joes 2004/06/27 21:50:14
Modified: src apreq_params.c
t params.c
Log:
param_push needs to returna non-zero value to let apr_table_do to keep going.
This fixes a bug in apreq_params_as_string where only the first value was
represented in its output
Revision Changes Path
1.41 +1 -1 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.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- apreq_params.c 4 Jun 2004 22:02:11 -0000 1.40
+++ apreq_params.c 28 Jun 2004 04:50:14 -0000 1.41
@@ -134,7 +134,7 @@
apr_array_header_t *arr = data;
*(apreq_param_t **)apr_array_push(arr) =
apreq_value_to_param(apreq_strtoval(val));
- return 0;
+ return 1;
}
1.12 +10 -2 httpd-apreq-2/t/params.c
Index: params.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/params.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- params.c 15 Jun 2004 05:12:05 -0000 1.11
+++ params.c 28 Jun 2004 04:50:14 -0000 1.12
@@ -24,9 +24,9 @@
static void request_make(CuTest *tc)
{
- r =
apreq_request(NULL,"a=1;quux=foo+bar&plus=%2B;uplus=%U002b;okie=dokie;novalue1;novalue2=");
+ r =
apreq_request(NULL,"a=1;quux=foo+bar&a=2&plus=%2B;uplus=%U002b;okie=dokie;novalue1;novalue2=");
CuAssertPtrNotNull(tc, r);
- CuAssertIntEquals(tc,7, apr_table_elts(r->args)->nelts);
+ CuAssertIntEquals(tc,8, apr_table_elts(r->args)->nelts);
}
static void request_args_get(CuTest *tc)
@@ -53,6 +53,13 @@
}
+static void params_as(CuTest *tc)
+{
+ const char *val;
+ val = apreq_params_as_string(p,r,"a",APREQ_JOIN_AS_IS);
+ CuAssertStrEquals(tc,"1, 2", val);
+}
+
static void string_decoding_in_place(CuTest *tc)
{
char *s1 = apr_palloc(p,4096);
@@ -77,6 +84,7 @@
SUITE_ADD_TEST(suite, request_make);
SUITE_ADD_TEST(suite, request_args_get);
+ SUITE_ADD_TEST(suite, params_as);
SUITE_ADD_TEST(suite, string_decoding_in_place);
return suite;
}