You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2003/04/23 22:42:51 UTC
cvs commit: httpd-apreq-2/t params.c
joes 2003/04/23 13:42:50
Modified: src apreq_params.c
t params.c
Log:
Let args parser tolerate missing '='-signs.
Revision Changes Path
1.14 +12 -4 httpd-apreq-2/src/apreq_params.c
Index: apreq_params.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq_params.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- apreq_params.c 23 Apr 2003 07:00:33 -0000 1.13
+++ apreq_params.c 23 Apr 2003 20:42:50 -0000 1.14
@@ -219,16 +219,24 @@
case '&':
case ';':
case 0:
- if (nlen > 0) {
- const apr_size_t vlen = data - start - nlen - 1;
+ if (data > start) {
+ apr_size_t vlen = 0;
+ if (nlen == 0)
+ nlen = data - start;
+ else
+ vlen = data - start - nlen - 1;
+
status = apreq_table_add(t, p2v(
apreq_decode_param( pool, start,
nlen, vlen )));
- if (*data == 0 || status != APR_SUCCESS)
+ if (status != APR_SUCCESS)
return status;
}
+ if (*data == 0)
+ return status;
+
nlen = 0;
start = data + 1;
status = APR_INCOMPLETE;
@@ -246,7 +254,7 @@
apreq_param_t *param;
apr_ssize_t size;
- if (nlen == 0 || word[nlen] != '=')
+ if (nlen == 0)
return NULL;
param = apr_palloc(pool, nlen + vlen + 1 + sizeof *param);
1.2 +6 -2 httpd-apreq-2/t/params.c
Index: params.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/params.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- params.c 21 Apr 2003 20:16:24 -0000 1.1
+++ params.c 23 Apr 2003 20:42:50 -0000 1.2
@@ -62,9 +62,9 @@
static void request_make(CuTest *tc)
{
- r = apreq_request(NULL,"a=1;quux=foo+bar&plus=%2B;okie=dokie");
-
+ r = apreq_request(NULL,"a=1;quux=foo+bar&plus=%2B;okie=dokie;novalue1;novalue2=");
CuAssertPtrNotNull(tc, r);
+ CuAssertIntEquals(tc,6, apreq_table_nelts(r->args));
}
static void request_args_get(CuTest *tc)
@@ -80,6 +80,10 @@
CuAssertStrEquals(tc,"+",val);
val = apreq_table_get(r->args,"okie");
CuAssertStrEquals(tc,"dokie",val);
+ val = apreq_table_get(r->args,"novalue1");
+ CuAssertStrEquals(tc,"",val);
+ val = apreq_table_get(r->args,"novalue2");
+ CuAssertStrEquals(tc,"",val);
}