[Klone-users] Bugs response_set_field

Stefano Barbato barbato at koanlogic.com
Wed Apr 30 09:12:30 EDT 2008


Mickael,

please try the attached patch.

---[ Makefile ]---

KLONE_TARGET_PATCH_FILE += $(CURDIR)/kl1_set_status.patch

------------------

stefano


On 29/apr/08, at 16:22, Mickael Auger wrote:

> Hi,
>
> I want to use basic authentication (http://en.wikipedia.org/wiki/Basic_access_authentication 
> ).
>
> But "set field" in response is not compatible with the  
> "response_set_status" :
>
> 1) test.kl1
> ===========================================================
> <%
> int a,b,c,d,e;
> a=response_set_status(response, 401);
> // result would be => HTTP/1.0 401 Authorization Required
>
> b=response_set_field(response,"WWW-Authenticate", "Basic realm= 
> \"Identification\"");
> // result would be => WWW-Authenticate: Basic realm="Identification"
>
> c=response_set_field(response,"Cache-Control","no-cache");
> // result would be => Cache-Control: no-cache
>
> d=response_set_field(response,"Connection","close");
> // result would be => Connection: close
>
> e=response_enable_caching(response);
>
> //  
> io_printf 
> (out 
> ,"Authorization :'%s'\n",request_get_field(request,"Authorization"));
> %>
> ===========================================================
> The result value of a,b,c,d,e are OK (zero).
>
>
> 2) The web-browser request (tests also with telnet)
> ======================
> GET /test.kl1 HTTP/1.0
> ======================
>
>
> 3) Receive response
> ======================
> HTTP/1.0 401 Unauthorized
> Server: klone/2.1.0
> Date: Tue, 29 Apr 2008 13:46:02 GMT
> Cache-Control: no-cache, must-revalidate
> Expires: Mon, 1 Jan 1990 05:00:00 GMT
> Pragma: no-cache
>
>
> HTTP/1.0 401 Unauthorized
> Server: klone/2.1.0
> Date: Tue, 29 Apr 2008 13:46:02 GMT
> Cache-Control: no-cache, must-revalidate
> Expires: Mon, 1 Jan 1990 05:00:00 GMT
> Pragma: no-cache
>
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0// 
> EN"><html><head><title>401 Unauthorized</title></head>
> <body><h1>Unauthorized</h1><p>URL: /test.kl1</p><hr><address>KLone/ 
> 2.1.0 web server - www.koanlogic.com
> </address></body></html>
> ======================
>
> 4) Attended response
> ======================
> HTTP/1.0 401 Unauthorized
> Date: Tue, 29 Apr 2008 13:45:29 GMT
> WWW-Authenticate: Basic realm="Identification"
> Cache-Control: no-cache
> Connection: close
> ======================
>
> There are two problems:
> - the 'set_field' are not applied
> - the default error page overload the 'set_status' function (while a  
> 200 response of status do not disturb the use of 'set_field')
>
> The 401 response of status is "necessary" for the 'WWW-Authenticate'  
> header field.
>
>
> Thank you.
>
> -- 
> Mickaël AUGER
> mickael.auger at gmail.com  
> _______________________________________________
> Klone-users mailing list
> Klone-users at koanlogic.com
> http://koanlogic.com/cgi-bin/mailman/listinfo/klone-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kl1_set_status.patch
Type: application/octet-stream
Size: 1010 bytes
Desc: not available
Url : http://koanlogic.com/pipermail/klone-users/attachments/20080430/92ad2990/kl1_set_status.obj


More information about the klone-users mailing list