You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joe Orton <jo...@orton.demon.co.uk> on 2000/08/11 17:27:41 UTC
Re: cvs commit: apache-2.0/src/main http_request.c
On Fri, Aug 11, 2000 at 02:41:13PM -0000, coar@locus.apache.org wrote:
... in ap_allow_methods():
> + /*
> + * Don't add it to the array if it's already listed.
> + */
> + xmethods = (char **) r->allowed_xmethods->elts;
> + for (i = 0; i < r->allowed_xmethods->nelts; ++i) {
> + if (strcmp(method, xmethods[i]) == 0) {
> + return;
> + }
> }
Won't that skip the rest of the methods that were passed, if a single
one has already been added? How about:
Index: http_request.c
===================================================================
RCS file: /home/joe/lib/cvsroot/apache2/src/main/http_request.c,v
retrieving revision 1.41
diff -u -p -r1.41 http_request.c
--- http_request.c 2000/08/11 14:41:13 1.41
+++ http_request.c 2000/08/11 15:07:19
@@ -1462,7 +1462,7 @@ API_EXPORT(void) ap_allow_methods(reques
* additional check of this array if it *is* invalid.
*/
if (mnum == M_INVALID) {
- int i;
+ int i, found = 0;
char **xmethods;
if (r->allowed_xmethods == NULL) {
@@ -1475,11 +1475,14 @@ API_EXPORT(void) ap_allow_methods(reques
xmethods = (char **) r->allowed_xmethods->elts;
for (i = 0; i < r->allowed_xmethods->nelts; ++i) {
if (strcmp(method, xmethods[i]) == 0) {
- return;
+ found = 1;
+ break;
}
}
- xmethod = (const char **) apr_push_array(r->allowed_xmethods);
- *xmethod = method;
+ if (!found) {
+ xmethod = (const char **) apr_push_array(r->allowed_xmethods);
+ *xmethod = method;
+ }
}
}
}
Re: cvs commit: apache-2.0/src/main http_request.c
Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Joe Orton wrote:
>
> Won't that skip the rest of the methods that were passed, if a single
> one has already been added?
Hork! True enough. Fixed, thanks!
--
#ken P-)}
Ken Coar <http://Golux.Com/coar/>
Apache Software Foundation <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed" <http://ApacheUnleashed.Com/>