joes 2002/06/19 22:10:07
Modified: c apache_request.c
Log:
Graham Barr's my_urlword: allows "&;" token to vary between words.
Revision Changes Path
1.21 +14 -24 httpd-apreq/c/apache_request.c
Index: apache_request.c
===================================================================
RCS file: /home/cvs/httpd-apreq/c/apache_request.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- apache_request.c 18 Feb 2002 16:48:27 -0000 1.20
+++ apache_request.c 20 Jun 2002 05:10:07 -0000 1.21
@@ -218,36 +218,26 @@
static char *my_urlword(pool *p, const char **line)
{
- int i;
+ char *res = NULL;
+ const char *pos = *line;
+ char ch;
- for (i = 0; urlword_dlm[i]; i++) {
- int stop = urlword_dlm[i];
- char *pos = strchr(*line, stop);
- char *res;
-
- if (!pos) {
- if (!urlword_dlm[i+1]) {
- int len = strlen(*line);
- res = ap_pstrndup(p, *line, len);
- *line += len;
- return res;
- }
- continue;
- }
-
- res = ap_pstrndup(p, *line, pos - *line);
-
- while (*pos == stop) {
- ++pos;
- }
+ while ( (ch = *pos) != '\0' && ch != ';' && ch != '&') {
+ ++pos;
+ }
- *line = pos;
+ res = ap_pstrndup(p, *line, pos - *line);
- return res;
+ while (ch == ';' || ch == '&') {
+ ++pos;
+ ch = *pos;
}
- return NULL;
+ *line = pos;
+
+ return res;
}
+
static void split_to_parms(ApacheRequest *req, const char *data)
{