joes 2003/07/18 09:07:23
Modified: . CHANGES
src apreq.c
t params.c
Log:
Incorporate Graham Clark's apreq_decode patch + unit test.
Revision Changes Path
1.7 +8 -1 httpd-apreq-2/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-apreq-2/CHANGES,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CHANGES 17 Jul 2003 02:59:33 -0000 1.6
+++ CHANGES 18 Jul 2003 16:07:22 -0000 1.7
@@ -2,12 +2,19 @@
@section 2.0.0-dev Changes with libapreq-2.0.0-dev
+- July 18, 2003 - C bugfix: apreq_decode [Graham Clark]
+
+If the source and destination strings are represented by the same
+pointer - e.g. if called as apreq_unescape(s) - string s is modified
+incorrectly in general. Patch includes new unit test.
+
+
- July 16, 2003 - Perl API [joes]
Added $req->parse, $req->status, & "preparse" logic
to $req->param & $req->upload.
-- July 16 ,2003 - C API [joes]
+- July 16, 2003 - C API [joes]
Added "preparse" logic to apreq_params & apreq_uploads
to bring behavior in line with libapreq-1.x.
1.25 +1 -0 httpd-apreq-2/src/apreq.c
Index: apreq.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- apreq.c 30 Jun 2003 20:42:14 -0000 1.24
+++ apreq.c 18 Jul 2003 16:07:22 -0000 1.25
@@ -333,6 +333,7 @@
else if (*s == 0)
return s - (const char *)d;
}
+ d = (char *)s;
}
for (; s < end; ++d, ++s) {
1.6 +21 -0 httpd-apreq-2/t/params.c
Index: params.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/params.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- params.c 8 Jun 2003 18:37:56 -0000 1.5
+++ params.c 18 Jul 2003 16:07:22 -0000 1.6
@@ -92,6 +92,26 @@
}
+static void string_decoding_in_place(CuTest *tc)
+{
+ apreq_value_t *v;
+ char *s1 = malloc(4096);
+ char *s2 = malloc(4096);
+
+ strcpy(s1, "bend it like beckham");
+ strcpy(s2, "dandy %3Edons");
+
+ CuAssertStrEquals(tc,"bend it like beckham",s1);
+ apreq_unescape(s1);
+ CuAssertStrEquals(tc,"bend it like beckham",s1);
+ CuAssertStrEquals(tc,"dandy %3Edons",s2);
+ apreq_unescape(s2);
+ CuAssertStrEquals(tc,"dandy >dons",s2);
+
+ free(s2);
+ free(s1);
+}
+
CuSuite *testparam(void)
{
@@ -99,6 +119,7 @@
SUITE_ADD_TEST(suite, request_make);
SUITE_ADD_TEST(suite, request_args_get);
+ SUITE_ADD_TEST(suite, string_decoding_in_place);
return suite;
}