Author: joes
Date: Tue Oct 11 17:15:09 2005
New Revision: 312983
URL: http://svn.apache.org/viewcvs?rev=312983&view=rev
Log:
Clean up end-of-file parsing for apreq_parse_multipart(),
conforming to rfc-2046 5.1.1.
Modified:
httpd/apreq/trunk/CHANGES
httpd/apreq/trunk/include/apreq_version.h
httpd/apreq/trunk/library/parser_multipart.c
httpd/apreq/trunk/library/t/parsers.c
Modified: httpd/apreq/trunk/CHANGES
URL:
http://svn.apache.org/viewcvs/httpd/apreq/trunk/CHANGES?rev=312983&r1=312982&r2=312983&view=diff
==============================================================================
--- httpd/apreq/trunk/CHANGES (original)
+++ httpd/apreq/trunk/CHANGES Tue Oct 11 17:15:09 2005
@@ -5,6 +5,10 @@
@section v2_07 Changes with libapreq2-2.07
+- C API [joes]
+ Clean up end-of-file parsing for apreq_parse_multipart(),
+ conforming to rfc-2046 ยง 5.1.1.
+
- Perl API [joes]
Move APR::Request::Param::Table and APR::Request::Cookie::Table
packages to APR::Request module.
Modified: httpd/apreq/trunk/include/apreq_version.h
URL:
http://svn.apache.org/viewcvs/httpd/apreq/trunk/include/apreq_version.h?rev=312983&r1=312982&r2=312983&view=diff
==============================================================================
--- httpd/apreq/trunk/include/apreq_version.h (original)
+++ httpd/apreq/trunk/include/apreq_version.h Tue Oct 11 17:15:09 2005
@@ -61,7 +61,7 @@
#define APREQ_MINOR_VERSION 5
/** patch level */
-#define APREQ_PATCH_VERSION 2
+#define APREQ_PATCH_VERSION 3
/**
* This symbol is defined for internal, "development" copies of libapreq.
Modified: httpd/apreq/trunk/library/parser_multipart.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/trunk/library/parser_multipart.c?rev=312983&r1=312982&r2=312983&view=diff
==============================================================================
--- httpd/apreq/trunk/library/parser_multipart.c (original)
+++ httpd/apreq/trunk/library/parser_multipart.c Tue Oct 11 17:15:09 2005
@@ -291,19 +291,26 @@
case MFD_NEXTLINE:
{
s = split_on_bdry(ctx->bb, ctx->in, NULL, CRLF);
+ if (s == APR_EOF) {
+ ctx->status = MFD_COMPLETE;
+ return APR_SUCCESS;
+ }
if (s != APR_SUCCESS) {
apreq_brigade_setaside(ctx->in, pool);
apreq_brigade_setaside(ctx->bb, pool);
return s;
}
if (!APR_BRIGADE_EMPTY(ctx->bb)) {
- /* ctx->bb probably contains "--", but we'll stop here
- * without bothering to check, and just
- * return any postamble text to caller.
- */
- APR_BRIGADE_CONCAT(bb, ctx->in);
- ctx->status = MFD_COMPLETE;
- return APR_SUCCESS;
+ char *line;
+ apr_size_t len;
+ apr_brigade_pflatten(ctx->bb, &line, &len, pool);
+
+ if (len >= 2 && strncmp(line, "--", 2) == 0) {
+ APR_BRIGADE_CONCAT(bb, ctx->in);
+ ctx->status = MFD_COMPLETE;
+ return APR_SUCCESS;
+ }
+ apr_brigade_cleanup(ctx->bb);
}
ctx->status = MFD_HEADER;
Modified: httpd/apreq/trunk/library/t/parsers.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/trunk/library/t/parsers.c?rev=312983&r1=312982&r2=312983&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/parsers.c (original)
+++ httpd/apreq/trunk/library/t/parsers.c Tue Oct 11 17:15:09 2005
@@ -99,12 +99,12 @@
"Content-Transfer-Encoding: binary" CRLF CRLF
"...contents of file2.gif..." CRLF
"--BbC04y--" CRLF
-"--AaB03x" CRLF
+"--AaB03x " CRLF
"content-disposition: form-data; name=\"field1\"" CRLF
"content-type: text/plain;charset=windows-1250" CRLF
"content-transfer-encoding: quoted-printable" CRLF CRLF
"Joe owes =80100." CRLF
-"--AaB03x--" CRLF;
+"--AaB03x--"; /* omit CRLF, which is ok per rfc 2046 */
#define URL_ENCTYPE "application/x-www-form-urlencoded"