2
0
Fork 0

Handle OPTIONS in vrequest by default, check method in other modules

personal/stbuehler/wip
Stefan Bühler 2009-09-15 21:30:25 +02:00
parent efa2d31ada
commit d6ff06347d
5 changed files with 40 additions and 4 deletions

View File

@ -326,9 +326,14 @@ static gboolean vrequest_do_handle_actions(liVRequest *vr) {
if (vr->state == LI_VRS_HANDLE_REQUEST_HEADERS) {
/* request not handled */
li_vrequest_handle_direct(vr);
vr->response.http_status = 404;
if (CORE_OPTION(LI_CORE_OPTION_DEBUG_REQUEST_HANDLING).boolean) {
VR_DEBUG(vr, "%s", "actions didn't handle request");
if (vr->request.http_method == LI_HTTP_METHOD_OPTIONS) {
vr->response.http_status = 200;
li_http_header_append(vr->response.headers, CONST_STR_LEN("Allow"), CONST_STR_LEN("OPTIONS, GET, HEAD, POST"));
} else {
vr->response.http_status = 404;
if (CORE_OPTION(LI_CORE_OPTION_DEBUG_REQUEST_HANDLING).boolean) {
VR_DEBUG(vr, "%s", "actions didn't handle request");
}
}
return TRUE;
}

View File

@ -263,6 +263,14 @@ static liHandlerResult debug_show_connections_cleanup(liVRequest *vr, gpointer p
}
static liHandlerResult debug_show_connections(liVRequest *vr, gpointer param, gpointer *context) {
switch (vr->request.http_method) {
case LI_HTTP_METHOD_GET:
case LI_HTTP_METHOD_HEAD:
break;
default:
return LI_HANDLER_GO_ON;
}
if (li_vrequest_handle_direct(vr)) {
liCollectInfo *ci;
mod_debug_job_t *j = g_slice_new0(mod_debug_job_t);

View File

@ -171,6 +171,14 @@ static liHandlerResult dirlist(liVRequest *vr, gpointer param, gpointer *context
UNUSED(context);
switch (vr->request.http_method) {
case LI_HTTP_METHOD_GET:
case LI_HTTP_METHOD_HEAD:
break;
default:
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;

View File

@ -62,9 +62,16 @@ static liAction* fortune_header(liServer *srv, liPlugin* p, liValue *val) {
static liHandlerResult fortune_page_handle(liVRequest *vr, gpointer param, gpointer *context) {
fortune_data *fd = param;
UNUSED(context);
switch (vr->request.http_method) {
case LI_HTTP_METHOD_GET:
case LI_HTTP_METHOD_HEAD:
break;
default:
return LI_HANDLER_GO_ON;
}
if (!li_vrequest_handle_direct(vr))
return LI_HANDLER_GO_ON;

View File

@ -653,6 +653,14 @@ static void status_collect_cb(gpointer cbdata, gpointer fdata, GPtrArray *result
static liHandlerResult status_info(liVRequest *vr, gpointer _param, gpointer *context) {
mod_status_param *param = _param;
switch (vr->request.http_method) {
case LI_HTTP_METHOD_GET:
case LI_HTTP_METHOD_HEAD:
break;
default:
return LI_HANDLER_GO_ON;
}
if (li_vrequest_handle_direct(vr)) {
gchar *val;
guint len;