Make 401 persistent. Not convinced this is right

This commit is contained in:
Ron Pedde 2003-12-09 05:49:00 +00:00
parent 0df8292d6f
commit e3b5c496bc

View File

@ -734,7 +734,11 @@ void *ws_dispatcher(void *arg) {
pwsc->threadno);
can_dispatch=0;
if(auth_handler) {
/* If an auth handler is registered, but it accepts a
* username and password of NULL, then don't bother
* authing.
*/
if((auth_handler) && (auth_handler(NULL,NULL)==0)) {
/* do the auth thing */
auth=ws_getarg(&pwsc->request_headers,"Authorization");
if(auth) {
@ -749,16 +753,19 @@ void *ws_dispatcher(void *arg) {
ws_addarg(&pwsc->response_headers,"Connection","close");
ws_addarg(&pwsc->response_headers,"WWW-Authenticate",
"Basic realm=\"webserver\"");
pwsc->close=1;
ws_returnerror(pwsc,401,"Unauthorized");
ws_close(pwsc);
return NULL;
pwsc->error=0;
}
} else {
can_dispatch=1;
}
if(can_dispatch) {
if(req_handler)
req_handler(pwsc);
else
ws_defaulthandler(pwsp,pwsc);
}
if(req_handler)
req_handler(pwsc);
else
ws_defaulthandler(pwsp,pwsc);
}
if((pwsc->close) || (pwsc->error) || (pwsp->stop)) {