2
0
Fork 0

[plugin_core] Return error 405 for methods other than GET or HEAD on static files

personal/stbuehler/wip
Thomas Porzelt 2010-04-04 17:07:24 +02:00
parent ad8570423a
commit 683e334599
1 changed files with 9 additions and 2 deletions

View File

@ -428,16 +428,23 @@ static liHandlerResult core_handle_static(liVRequest *vr, gpointer param, gpoint
UNUSED(param);
UNUSED(context);
if (li_vrequest_is_handled(vr))
return LI_HANDLER_GO_ON;
switch (vr->request.http_method) {
case LI_HTTP_METHOD_GET:
case LI_HTTP_METHOD_HEAD:
break;
default:
if (!li_vrequest_handle_direct(vr)) {
return LI_HANDLER_ERROR;
}
vr->response.http_status = 405;
li_http_header_overwrite(vr->response.headers, CONST_STR_LEN("Allow"), CONST_STR_LEN("GET, HEAD"));
return LI_HANDLER_GO_ON;
}
if (li_vrequest_is_handled(vr)) return LI_HANDLER_GO_ON;
if (vr->physical.path->len == 0) return LI_HANDLER_GO_ON;
if (exclude_arr) {