From 6b40ae2b48cbc65889d33f86709a7a5b9d0724b4 Mon Sep 17 00:00:00 2001 From: Greg Ames Date: Wed, 24 Apr 2002 14:31:28 +0000 Subject: [PATCH] default_handler: short circuit the method checks. Move the code to deal with unusual methods to the end of function to reduce i-cache clutter. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94781 13f79535-47bb-0310-9956-ffa450edef68 --- server/core.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/server/core.c b/server/core.c index a83044d2a5..41d3fae2aa 100644 --- a/server/core.c +++ b/server/core.c @@ -3167,18 +3167,8 @@ static int default_handler(request_rec *r) return errstatus; } - if (r->method_number == M_INVALID) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Invalid method in request %s", r->the_request); - return HTTP_NOT_IMPLEMENTED; - } - - if (r->method_number == M_OPTIONS) { - return ap_send_http_options(r); - } - if (r->method_number != M_GET && r->method_number != M_POST) { - return HTTP_METHOD_NOT_ALLOWED; + goto unusual_method; } if (r->finfo.filetype == 0) { @@ -3248,6 +3238,18 @@ static int default_handler(request_rec *r) APR_BRIGADE_INSERT_TAIL(bb, e); return ap_pass_brigade(r->output_filters, bb); + +unusual_method: + if (r->method_number == M_INVALID) { + ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, + "Invalid method in request %s", r->the_request); + return HTTP_NOT_IMPLEMENTED; + } + + if (r->method_number == M_OPTIONS) { + return ap_send_http_options(r); + } + return HTTP_METHOD_NOT_ALLOWED; } static int net_time_filter(ap_filter_t *f, apr_bucket_brigade *b, -- 2.50.1