joes 2003/04/24 14:19:12
Modified: src apreq_parsers.c
t parsers.c
Log:
Improve mfd parser test.
Revision Changes Path
1.21 +5 -3 httpd-apreq-2/src/apreq_parsers.c
Index: apreq_parsers.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq_parsers.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- apreq_parsers.c 24 Apr 2003 20:17:17 -0000 1.20
+++ apreq_parsers.c 24 Apr 2003 21:19:12 -0000 1.21
@@ -310,6 +310,10 @@
return APR_INCOMPLETE;
}
+
+/********************* header parsing utils ********************/
+
+
static apr_status_t split_header(apr_pool_t *pool, apreq_table_t *t,
apr_bucket_brigade *bb,
const apr_size_t nlen,
@@ -748,8 +752,6 @@
}
-static const char crlf[] = CRLF;
-
APREQ_DECLARE(apr_status_t) apreq_parse_multipart(apr_pool_t *pool,
apr_bucket_brigade *bb,
apreq_parser_t *parser)
@@ -813,7 +815,7 @@
case MFD_NEXTLINE:
{
apr_status_t s;
- s = split_on_bdry(pool, ctx->bb, bb, NULL, crlf);
+ s = split_on_bdry(pool, ctx->bb, bb, NULL, CRLF);
if (s != APR_SUCCESS)
return s;
1.2 +13 -1 httpd-apreq-2/t/parsers.c
Index: parsers.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/parsers.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- parsers.c 24 Apr 2003 20:17:17 -0000 1.1
+++ parsers.c 24 Apr 2003 21:19:12 -0000 1.2
@@ -109,6 +109,8 @@
static void parse_multipart(CuTest *tc)
{
const char *val;
+ apr_size_t dummy;
+ apreq_table_t *t;
apreq_request_t *r = apreq_request(APREQ_MFD_ENCTYPE
"; boundary=\"AaB03x\"" ,"");
apr_bucket_brigade *bb = apr_brigade_create(p,
@@ -132,8 +134,18 @@
val = apreq_table_get(r->body,"field1");
CuAssertStrEquals(tc, "Joe owes =80100.", val);
- val = apreq_table_get(r->body,"pics");
+ t = apreq_value_to_param(apreq_strtoval(val))->info;
+ val = apreq_table_get(t, "content-transfer-encoding");
+ CuAssertStrEquals(tc,"quoted-printable", val);
+
+ val = apreq_table_get(r->body, "pics");
CuAssertStrEquals(tc, "file1.txt", val);
+ t = apreq_value_to_param(apreq_strtoval(val))->info;
+ bb = apreq_value_to_param(apreq_strtoval(val))->bb;
+ apr_brigade_pflatten(bb, (char **)&val, &dummy, p);
+ CuAssertStrEquals(tc,"... contents of file1.txt ...", val);
+ val = apreq_table_get(t, "content-type");
+ CuAssertStrEquals(tc, "text/plain", val);
}