You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2001/08/11 06:04:13 UTC
cvs commit: httpd-2.0/server config.c core.c request.c
rbb 01/08/10 21:04:13
Modified: include http_protocol.h httpd.h
modules/aaa mod_access.c mod_auth.c mod_auth_db.c
mod_auth_dbm.c mod_auth_digest.c
modules/cache mod_file_cache.c
modules/dav/main mod_dav.c
modules/filters mod_include.c
modules/generators mod_asis.c mod_autoindex.c mod_cgi.c
mod_cgid.c mod_info.c mod_status.c
modules/http http_protocol.c
modules/mappers mod_actions.c
modules/test mod_autoindex.c mod_rndchunk.c
mod_test_util_uri.c
server config.c core.c request.c
Log:
Fix the new method code. We need to cast 1 to an apr_int64_t or it will
be treated as a 32-bit integer, and it will wrap after being shifted
32 times.
Submitted by: Cody Sherr <cs...@covalent.net> and
Ryan Morgan <rm...@covalent.net>
Revision Changes Path
1.62 +3 -2 httpd-2.0/include/http_protocol.h
Index: http_protocol.h
===================================================================
RCS file: /home/cvs/httpd-2.0/include/http_protocol.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- http_protocol.h 2001/08/02 04:25:19 1.61
+++ http_protocol.h 2001/08/11 04:04:11 1.62
@@ -246,7 +246,7 @@
* @param methname The name of the new method to register.
* @return Ab int value representing an offset into a bitmask.
*/
-AP_DECLARE(int) ap_method_register(apr_pool_t *p, char *methname);
+AP_DECLARE(int) ap_method_register(apr_pool_t *p, const char *methname);
/**
* Initialize the method_registry and allocate memory for it.
@@ -259,7 +259,8 @@
* This is a convenience macro to ease with checking a mask
* against a method name.
*/
-#define AP_METHOD_CHECK_ALLOWED(mask, methname) ((mask) & (1 << ap_method_number_of((methname))))
+#define AP_METHOD_CHECK_ALLOWED(mask, methname) \
+ ((mask) & (AP_METHOD_BIT << ap_method_number_of((methname))))
/**
* Create a new method list with the specified number of preallocated
1.158 +6 -0 httpd-2.0/include/httpd.h
Index: httpd.h
===================================================================
RCS file: /home/cvs/httpd-2.0/include/httpd.h,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -r1.157 -r1.158
--- httpd.h 2001/08/02 04:25:19 1.157
+++ httpd.h 2001/08/11 04:04:11 1.158
@@ -503,6 +503,12 @@
*/
#define METHODS 64
+/**
+ * The method mask bit to shift for anding with a bitmask.
+ */
+#define AP_METHOD_BIT (apr_int64_t)1
+
+
typedef struct ap_method_list_t ap_method_list_t;
/**
* Structure for handling HTTP methods. Methods known to the server are
1.34 +2 -2 httpd-2.0/modules/aaa/mod_access.c
Index: mod_access.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_access.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- mod_access.c 2001/08/02 04:25:19 1.33
+++ mod_access.c 2001/08/11 04:04:12 1.34
@@ -141,7 +141,7 @@
return "unknown order";
for (i = 0; i < METHODS; ++i)
- if (cmd->limited & (1 << i))
+ if (cmd->limited & (AP_METHOD_BIT << i))
d->order[i] = o;
return NULL;
@@ -239,7 +239,7 @@
{
allowdeny *ap = (allowdeny *) a->elts;
- apr_int64_t mmask = (1 << method);
+ apr_int64_t mmask = (AP_METHOD_BIT << method);
int i;
int gothost = 0;
const char *remotehost = NULL;
1.34 +1 -1 httpd-2.0/modules/aaa/mod_auth.c
Index: mod_auth.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- mod_auth.c 2001/02/25 00:51:30 1.33
+++ mod_auth.c 2001/08/11 04:04:12 1.34
@@ -268,7 +268,7 @@
for (x = 0; x < reqs_arr->nelts; x++) {
- if (!(reqs[x].method_mask & (1 << m)))
+ if (!(reqs[x].method_mask & (AP_METHOD_BIT << m)))
continue;
method_restricted = 1;
1.30 +1 -1 httpd-2.0/modules/aaa/mod_auth_db.c
Index: mod_auth_db.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth_db.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- mod_auth_db.c 2001/05/30 10:22:18 1.29
+++ mod_auth_db.c 2001/08/11 04:04:12 1.30
@@ -360,7 +360,7 @@
for (x = 0; x < reqs_arr->nelts; x++) {
- if (!(reqs[x].method_mask & (1 << m)))
+ if (!(reqs[x].method_mask & (AP_METHOD_BIT << m)))
continue;
t = reqs[x].requirement;
1.35 +1 -1 httpd-2.0/modules/aaa/mod_auth_dbm.c
Index: mod_auth_dbm.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth_dbm.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- mod_auth_dbm.c 2001/05/30 10:22:19 1.34
+++ mod_auth_dbm.c 2001/08/11 04:04:12 1.35
@@ -299,7 +299,7 @@
for (x = 0; x < reqs_arr->nelts; x++) {
- if (!(reqs[x].method_mask & (1 << m)))
+ if (!(reqs[x].method_mask & (AP_METHOD_BIT << m)))
continue;
t = reqs[x].requirement;
1.49 +1 -1 httpd-2.0/modules/aaa/mod_auth_digest.c
Index: mod_auth_digest.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth_digest.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- mod_auth_digest.c 2001/05/22 01:31:03 1.48
+++ mod_auth_digest.c 2001/08/11 04:04:12 1.49
@@ -1851,7 +1851,7 @@
for (x = 0; x < reqs_arr->nelts; x++) {
- if (!(reqs[x].method_mask & (1 << m)))
+ if (!(reqs[x].method_mask & (AP_METHOD_BIT << m)))
continue;
method_restricted = 1;
1.62 +1 -1 httpd-2.0/modules/cache/mod_file_cache.c
Index: mod_file_cache.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/cache/mod_file_cache.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- mod_file_cache.c 2001/08/02 00:17:45 1.61
+++ mod_file_cache.c 2001/08/11 04:04:12 1.62
@@ -387,7 +387,7 @@
}
/* note that we would handle GET on this resource */
- r->allowed |= (1 << M_GET);
+ r->allowed |= (AP_METHOD_BIT << M_GET);
/* This handler has no use for a request body (yet), but we still
* need to read and discard it if the client sent one.
1.59 +13 -13 httpd-2.0/modules/dav/main/mod_dav.c
Index: mod_dav.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/dav/main/mod_dav.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- mod_dav.c 2001/07/31 17:01:34 1.58
+++ mod_dav.c 2001/08/11 04:04:12 1.59
@@ -4466,28 +4466,28 @@
* These are the HTTP-defined methods that we handle directly.
*/
r->allowed = 0
- | (1 << M_GET)
- | (1 << M_PUT)
- | (1 << M_DELETE)
- | (1 << M_OPTIONS)
- | (1 << M_INVALID);
+ | (AP_METHOD_BIT << M_GET)
+ | (AP_METHOD_BIT << M_PUT)
+ | (AP_METHOD_BIT << M_DELETE)
+ | (AP_METHOD_BIT << M_OPTIONS)
+ | (AP_METHOD_BIT << M_INVALID);
/*
* These are the DAV methods we handle.
*/
r->allowed |= 0
- | (1 << M_COPY)
- | (1 << M_LOCK)
- | (1 << M_UNLOCK)
- | (1 << M_MKCOL)
- | (1 << M_MOVE)
- | (1 << M_PROPFIND)
- | (1 << M_PROPPATCH);
+ | (AP_METHOD_BIT << M_COPY)
+ | (AP_METHOD_BIT << M_LOCK)
+ | (AP_METHOD_BIT << M_UNLOCK)
+ | (AP_METHOD_BIT << M_MKCOL)
+ | (AP_METHOD_BIT << M_MOVE)
+ | (AP_METHOD_BIT << M_PROPFIND)
+ | (AP_METHOD_BIT << M_PROPPATCH);
/*
* These are methods that we don't handle directly, but let the
* server's default handler do for us as our agent.
*/
r->allowed |= 0
- | (1 << M_POST);
+ | (AP_METHOD_BIT << M_POST);
/* ### hrm. if we return HTTP_METHOD_NOT_ALLOWED, then an Allow header
* ### is sent; it will need the other allowed states; since the default
1.121 +1 -1 httpd-2.0/modules/filters/mod_include.c
Index: mod_include.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- mod_include.c 2001/08/07 08:02:42 1.120
+++ mod_include.c 2001/08/11 04:04:12 1.121
@@ -2680,7 +2680,7 @@
if (!(ap_allow_options(r) & OPT_INCLUDES)) {
return ap_pass_brigade(f->next, b);
}
- r->allowed |= (1 << M_GET);
+ r->allowed |= (AP_METHOD_BIT << M_GET);
if (r->method_number != M_GET) {
return ap_pass_brigade(f->next, b);
}
1.40 +1 -1 httpd-2.0/modules/generators/mod_asis.c
Index: mod_asis.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_asis.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- mod_asis.c 2001/07/27 19:58:15 1.39
+++ mod_asis.c 2001/08/11 04:04:12 1.40
@@ -79,7 +79,7 @@
if(strcmp(r->handler,ASIS_MAGIC_TYPE) && strcmp(r->handler,"send-as-is"))
return DECLINED;
- r->allowed |= (1 << M_GET);
+ r->allowed |= (AP_METHOD_BIT << M_GET);
if (r->method_number != M_GET)
return DECLINED;
if (r->finfo.filetype == 0) {
1.83 +1 -1 httpd-2.0/modules/generators/mod_autoindex.c
Index: mod_autoindex.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_autoindex.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- mod_autoindex.c 2001/08/07 15:15:53 1.82
+++ mod_autoindex.c 2001/08/11 04:04:12 1.83
@@ -1994,7 +1994,7 @@
d = (autoindex_config_rec *) ap_get_module_config(r->per_dir_config,
&autoindex_module);
- r->allowed |= (1 << M_GET);
+ r->allowed |= (AP_METHOD_BIT << M_GET);
if (r->method_number != M_GET) {
return DECLINED;
}
1.99 +2 -2 httpd-2.0/modules/generators/mod_cgi.c
Index: mod_cgi.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -r1.98 -r1.99
--- mod_cgi.c 2001/08/06 18:41:31 1.98
+++ mod_cgi.c 2001/08/11 04:04:12 1.99
@@ -586,8 +586,8 @@
if (r->method_number == M_OPTIONS) {
/* 99 out of 100 CGI scripts, this is all they support */
- r->allowed |= (1 << M_GET);
- r->allowed |= (1 << M_POST);
+ r->allowed |= (AP_METHOD_BIT << M_GET);
+ r->allowed |= (AP_METHOD_BIT << M_POST);
return DECLINED;
}
1.92 +2 -2 httpd-2.0/modules/generators/mod_cgid.c
Index: mod_cgid.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgid.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- mod_cgid.c 2001/08/09 15:10:58 1.91
+++ mod_cgid.c 2001/08/11 04:04:12 1.92
@@ -857,8 +857,8 @@
if (r->method_number == M_OPTIONS) {
/* 99 out of 100 cgid scripts, this is all they support */
- r->allowed |= (1 << M_GET);
- r->allowed |= (1 << M_POST);
+ r->allowed |= (AP_METHOD_BIT << M_GET);
+ r->allowed |= (AP_METHOD_BIT << M_POST);
return DECLINED;
}
1.40 +1 -1 httpd-2.0/modules/generators/mod_info.c
Index: mod_info.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_info.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- mod_info.c 2001/07/28 00:46:49 1.39
+++ mod_info.c 2001/08/11 04:04:12 1.40
@@ -373,7 +373,7 @@
if (strcmp(r->handler, "server-info"))
return DECLINED;
- r->allowed |= (1 << M_GET);
+ r->allowed |= (AP_METHOD_BIT << M_GET);
if (r->method_number != M_GET)
return DECLINED;
1.46 +1 -1 httpd-2.0/modules/generators/mod_status.c
Index: mod_status.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_status.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- mod_status.c 2001/07/31 06:22:32 1.45
+++ mod_status.c 2001/08/11 04:04:13 1.46
@@ -270,7 +270,7 @@
"Server status unavailable in inetd mode");
return HTTP_INTERNAL_SERVER_ERROR;
}
- r->allowed = (1 << M_GET);
+ r->allowed = (AP_METHOD_BIT << M_GET);
if (r->method_number != M_GET)
return DECLINED;
1.353 +19 -19 httpd-2.0/modules/http/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.352
retrieving revision 1.353
diff -u -r1.352 -r1.353
--- http_protocol.c 2001/08/10 18:35:08 1.352
+++ http_protocol.c 2001/08/11 04:04:13 1.353
@@ -328,7 +328,7 @@
apr_pool_cleanup_null);
}
-AP_DECLARE(int) ap_method_register(apr_pool_t *p, char *methname)
+AP_DECLARE(int) ap_method_register(apr_pool_t *p, const char *methname)
{
int *newmethnum;
@@ -985,23 +985,23 @@
mask = r->allowed_methods->method_mask;
list = apr_pstrcat(r->pool,
- (mask & (1 << M_GET)) ? ", GET, HEAD" : "",
- (mask & (1 << M_POST)) ? ", POST" : "",
- (mask & (1 << M_PUT)) ? ", PUT" : "",
- (mask & (1 << M_DELETE)) ? ", DELETE" : "",
- (mask & (1 << M_CONNECT)) ? ", CONNECT" : "",
- (mask & (1 << M_OPTIONS)) ? ", OPTIONS" : "",
- (mask & (1 << M_PATCH)) ? ", PATCH" : "",
- (mask & (1 << M_PROPFIND)) ? ", PROPFIND" : "",
- (mask & (1 << M_PROPPATCH)) ? ", PROPPATCH" : "",
- (mask & (1 << M_MKCOL)) ? ", MKCOL" : "",
- (mask & (1 << M_COPY)) ? ", COPY" : "",
- (mask & (1 << M_MOVE)) ? ", MOVE" : "",
- (mask & (1 << M_LOCK)) ? ", LOCK" : "",
- (mask & (1 << M_UNLOCK)) ? ", UNLOCK" : "",
+ (mask & (AP_METHOD_BIT << M_GET)) ? ", GET, HEAD" : "",
+ (mask & (AP_METHOD_BIT << M_POST)) ? ", POST" : "",
+ (mask & (AP_METHOD_BIT << M_PUT)) ? ", PUT" : "",
+ (mask & (AP_METHOD_BIT << M_DELETE)) ? ", DELETE" : "",
+ (mask & (AP_METHOD_BIT << M_CONNECT)) ? ", CONNECT" : "",
+ (mask & (AP_METHOD_BIT << M_OPTIONS)) ? ", OPTIONS" : "",
+ (mask & (AP_METHOD_BIT << M_PATCH)) ? ", PATCH" : "",
+ (mask & (AP_METHOD_BIT << M_PROPFIND)) ? ", PROPFIND" : "",
+ (mask & (AP_METHOD_BIT << M_PROPPATCH)) ? ", PROPPATCH" : "",
+ (mask & (AP_METHOD_BIT << M_MKCOL)) ? ", MKCOL" : "",
+ (mask & (AP_METHOD_BIT << M_COPY)) ? ", COPY" : "",
+ (mask & (AP_METHOD_BIT << M_MOVE)) ? ", MOVE" : "",
+ (mask & (AP_METHOD_BIT << M_LOCK)) ? ", LOCK" : "",
+ (mask & (AP_METHOD_BIT << M_UNLOCK)) ? ", UNLOCK" : "",
", TRACE",
NULL);
- if ((mask & (1 << M_INVALID))
+ if ((mask & (AP_METHOD_BIT << M_INVALID))
&& (r->allowed_methods->method_list != NULL)
&& (r->allowed_methods->method_list->nelts != 0)) {
int i;
@@ -2089,7 +2089,7 @@
*/
methnum = ap_method_number_of(method);
if (methnum != M_INVALID) {
- return !!(l->method_mask & (1 << methnum));
+ return !!(l->method_mask & (AP_METHOD_BIT << methnum));
}
/*
* Otherwise, see if the method name is in the array or string names
@@ -2121,7 +2121,7 @@
* bitmask.
*/
methnum = ap_method_number_of(method);
- l->method_mask |= (1 << methnum);
+ l->method_mask |= (AP_METHOD_BIT << methnum);
if (methnum != M_INVALID) {
return;
}
@@ -2154,7 +2154,7 @@
* by a module, use the bitmask.
*/
methnum = ap_method_number_of(method);
- l->method_mask |= ~(1 << methnum);
+ l->method_mask |= ~(AP_METHOD_BIT << methnum);
if (methnum != M_INVALID) {
return;
}
1.24 +1 -1 httpd-2.0/modules/mappers/mod_actions.c
Index: mod_actions.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_actions.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- mod_actions.c 2001/02/16 13:38:28 1.23
+++ mod_actions.c 2001/08/11 04:04:13 1.24
@@ -172,7 +172,7 @@
/* Set allowed stuff */
for (i = 0; i < METHODS; ++i) {
if (conf->scripted[i])
- r->allowed |= (1 << i);
+ r->allowed |= (AP_METHOD_BIT << i);
}
/* First, check for the method-handling scripts */
1.13 +1 -1 httpd-2.0/modules/test/mod_autoindex.c
Index: mod_autoindex.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/test/mod_autoindex.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- mod_autoindex.c 2001/07/25 21:34:15 1.12
+++ mod_autoindex.c 2001/08/11 04:04:13 1.13
@@ -1670,7 +1670,7 @@
d = (autoindex_config_rec *) ap_get_module_config(r->per_dir_config,
&autoindex_module);
- r->allowed |= (1 << M_GET);
+ r->allowed |= (AP_METHOD_BIT << M_GET);
if (r->method_number != M_GET) {
return DECLINED;
}
1.8 +1 -1 httpd-2.0/modules/test/mod_rndchunk.c
Index: mod_rndchunk.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/test/mod_rndchunk.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- mod_rndchunk.c 2001/02/28 15:24:08 1.7
+++ mod_rndchunk.c 2001/08/11 04:04:13 1.8
@@ -100,7 +100,7 @@
char buf[MAX_SEGMENT + 1];
unsigned int len;
- r->allowed |= (1 << M_GET);
+ r->allowed |= (AP_METHOD_BIT << M_GET);
if (r->method_number != M_GET)
return DECLINED;
1.12 +1 -1 httpd-2.0/modules/test/mod_test_util_uri.c
Index: mod_test_util_uri.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/test/mod_test_util_uri.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- mod_test_util_uri.c 2001/08/02 05:25:53 1.11
+++ mod_test_util_uri.c 2001/08/11 04:04:13 1.12
@@ -265,7 +265,7 @@
unsigned total_failures;
int i;
- r->allowed |= (1 << M_GET);
+ r->allowed |= (AP_METHOD_BIT << M_GET);
if (r->method_number != M_GET)
return DECLINED;
1.133 +1 -1 httpd-2.0/server/config.c
Index: config.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/config.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- config.c 2001/08/03 00:59:01 1.132
+++ config.c 2001/08/11 04:04:13 1.133
@@ -362,7 +362,7 @@
* added by a module and registered.
*/
if (methnum != M_INVALID) {
- return !!(cmd->limited & (1<<methnum));
+ return !!(cmd->limited & (AP_METHOD_BIT << methnum));
}
return 0; /* not found */
1.35 +1 -1 httpd-2.0/server/core.c
Index: core.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/core.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- core.c 2001/08/07 16:19:03 1.34
+++ core.c 2001/08/11 04:04:13 1.35
@@ -1490,7 +1490,7 @@
*/
methnum = ap_method_register(cmd->pool, method);
}
- limited |= (1 << methnum);
+ limited |= (AP_METHOD_BIT << methnum);
}
/* Killing two features with one function,
1.23 +1 -1 httpd-2.0/server/request.c
Index: request.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/request.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- request.c 2001/08/07 02:34:42 1.22
+++ request.c 2001/08/11 04:04:13 1.23
@@ -1280,7 +1280,7 @@
reqs = (require_line *) reqs_arr->elts;
for (i = 0; i < reqs_arr->nelts; ++i)
- if (reqs[i].method_mask & (1 << r->method_number))
+ if (reqs[i].method_mask & (AP_METHOD_BIT << r->method_number))
return 1;
return 0;