[Klone-users] Bugs response_set_field
Mickael Auger
mickael.auger at gmail.com
Tue Apr 29 10:22:46 EDT 2008
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://koanlogic.com/pipermail/klone-users/attachments/20080429/98684bb6/attachment.htm
More information about the klone-users
mailing list