You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2022/08/17 12:57:40 UTC
svn commit: r1903489 - /httpd/apreq/trunk/library/t/parsers.c
Author: jorton
Date: Wed Aug 17 12:57:40 2022
New Revision: 1903489
URL: http://svn.apache.org/viewvc?rev=1903489&view=rev
Log:
* library/t/parsers.c: Remove the test case for invalid input (name="")
which is now rejected by the parser with an error.
Modified:
httpd/apreq/trunk/library/t/parsers.c
Modified: httpd/apreq/trunk/library/t/parsers.c
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/library/t/parsers.c?rev=1903489&r1=1903488&r2=1903489&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/parsers.c (original)
+++ httpd/apreq/trunk/library/t/parsers.c Wed Aug 17 12:57:40 2022
@@ -39,13 +39,20 @@ static char form_data[] =
"content-disposition: form-data; name=\"pics\"; filename=\"file1.txt\"" CRLF
"Content-Type: text/plain" CRLF CRLF
"... contents of file1.txt ..." CRLF CRLF
-"--AaB03x" CRLF
+"--AaB03x--" CRLF;
+
+/* This (invalid) case used to segfault the parser before r164254 so should
+ be tested separately to form_data:
+
+static char form_data_fail[] =
"content-disposition: form-data; name=\"\"" CRLF
"content-type: text/plain;" CRLF " charset=windows-1250" CRLF
"content-transfer-encoding: quoted-printable" CRLF CRLF
"Joe owes =80100." CRLF
"--AaB03x--" CRLF;
+*/
+
static char xml_data[] =
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"
"<methodCall>"
@@ -228,7 +235,7 @@ static void parse_multipart(dAT, void *c
AT_int_eq(rv, (j < strlen(form_data)) ? APR_INCOMPLETE : APR_SUCCESS);
rv = apreq_parser_run(parser, body, tail);
AT_int_eq(rv, APR_SUCCESS);
- AT_int_eq(apr_table_elts(body)->nelts, 3);
+ AT_int_eq(apr_table_elts(body)->nelts, 2);
val = apr_table_get(body,"field1");
AT_str_eq(val, "Joe owes =80100.");
@@ -246,14 +253,6 @@ static void parse_multipart(dAT, void *c
val = apr_table_get(t, "content-type");
AT_str_eq(val, "text/plain");
- val = apr_table_get(body, "");
- AT_str_eq(val, "Joe owes =80100.");
- t = apreq_value_to_param(val)->info;
- val = apr_table_get(t, "content-type");
- AT_int_eq(apreq_header_attribute(val, "charset", 7, &val, &len),
- APR_SUCCESS);
- AT_str_eq(val, "windows-1250");
-
apr_brigade_cleanup(vb);
apr_brigade_cleanup(bb);
}