mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
This patch eliminates the wasteful run-time conversion of method names from
strings to numbers in places where the methods are known at compile time. (Justin fixed the va_end() call to be correct.) Submitted by: Brian Pane <bpane@pacbell.net> Reviewed by: Justin Erenkrantz git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91078 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -490,3 +490,27 @@ AP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...)
|
||||
ap_method_list_add(r->allowed_methods, method);
|
||||
}
|
||||
}
|
||||
|
||||
AP_DECLARE(void) ap_allow_standard_methods(request_rec *r, int reset, ...)
|
||||
{
|
||||
int method;
|
||||
va_list methods;
|
||||
apr_int64_t mask;
|
||||
|
||||
/*
|
||||
* Get rid of any current settings if requested; not just the
|
||||
* well-known methods but any extensions as well.
|
||||
*/
|
||||
if (reset) {
|
||||
ap_clear_method_list(r->allowed_methods);
|
||||
}
|
||||
|
||||
mask = 0;
|
||||
va_start(methods, reset);
|
||||
while ((method = va_arg(methods, int)) != -1) {
|
||||
mask |= (AP_METHOD_BIT << method);
|
||||
}
|
||||
va_end(methods);
|
||||
|
||||
r->allowed_methods->method_mask |= mask;
|
||||
}
|
||||
|
Reference in New Issue
Block a user