Hi,<br><br>I want to use basic authentication (<a href="http://en.wikipedia.org/wiki/Basic_access_authentication">http://en.wikipedia.org/wiki/Basic_access_authentication</a>).<br><br>But &quot;set field&quot; in response is not compatible with the &quot;response_set_status&quot; :<br>
<br><b>1) test.kl1</b><br>===========================================================<br>&lt;%<br>int a,b,c,d,e;<br>a=response_set_status(response, 401);<br>// result would be =&gt; HTTP/1.0 401 Authorization Required<br>
<br>b=response_set_field(response,&quot;WWW-Authenticate&quot;, &quot;Basic realm=\&quot;Identification\&quot;&quot;);<br>// result would be =&gt; WWW-Authenticate: Basic realm=&quot;Identification&quot;<br><br>c=response_set_field(response,&quot;Cache-Control&quot;,&quot;no-cache&quot;);<br>
// result would be =&gt; Cache-Control: no-cache<br><br>d=response_set_field(response,&quot;Connection&quot;,&quot;close&quot;);<br>// result would be =&gt; Connection: close<br><br>e=response_enable_caching(response);<br>
<br>// io_printf(out,&quot;Authorization :&#39;%s&#39;\n&quot;,request_get_field(request,&quot;Authorization&quot;));<br>%&gt;<br>===========================================================<br>The result value of a,b,c,d,e are OK (zero).<br>
<br><br><b>2) The web-browser request</b> (tests also with telnet)<br>======================<br>GET /test.kl1 HTTP/1.0<br>======================<br><br><b><br>3) Receive response</b><br>======================<br>HTTP/1.0 401 Unauthorized<br>
Server: klone/2.1.0<br>Date: Tue, 29 Apr 2008 13:46:02 GMT<br>Cache-Control: no-cache, must-revalidate<br>Expires: Mon, 1 Jan 1990 05:00:00 GMT<br>Pragma: no-cache<br><br><br>HTTP/1.0 401 Unauthorized<br>Server: klone/2.1.0<br>
Date: Tue, 29 Apr 2008 13:46:02 GMT<br>Cache-Control: no-cache, must-revalidate<br>Expires: Mon, 1 Jan 1990 05:00:00 GMT<br>Pragma: no-cache<br><br>&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML 2.0//EN&quot;&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;401 Unauthorized&lt;/title&gt;&lt;/head&gt;<br>
&lt;body&gt;&lt;h1&gt;Unauthorized&lt;/h1&gt;&lt;p&gt;URL: /test.kl1&lt;/p&gt;&lt;hr&gt;&lt;address&gt;KLone/2.1.0 web server - <a href="http://www.koanlogic.com">www.koanlogic.com</a><br>&lt;/address&gt;&lt;/body&gt;&lt;/html&gt;<br>
======================<br><br><b>4) Attended response</b><br>======================<br>HTTP/1.0 401 Unauthorized<br>Date: Tue, 29 Apr 2008 13:45:29 GMT<br>WWW-Authenticate: Basic realm=&quot;Identification&quot;<br>Cache-Control: no-cache<br>
Connection: close<br>======================<br><br>There are two problems:<br>- the &#39;set_field&#39; are not applied<br>- the default error page overload the &#39;set_status&#39; function (while a 200 response of status do not disturb the use of &#39;set_field&#39;)<br>
<br>The 401 response of status is &quot;necessary&quot; for the &#39;WWW-Authenticate&#39; header field.<br><br><br>Thank you.<br clear="all"><br>-- <br>Mickaël AUGER<br><a href="mailto:mickael.auger@gmail.com">mickael.auger@gmail.com</a>