httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Hay <steve....@uk.radan.com>
Subject Re: [libapreq-2] Test failure on Win32
Date Wed, 17 Sep 2003 15:15:10 GMT
Joe Schaefer wrote:

>Randy Kobes <randy@theoryx5.uwinnipeg.ca> writes:
>
>  
>
>>On Wed, 17 Sep 2003, Steve Hay wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>I get the following test failure when running "nmake test" on Win32
>>>(Apache 2.0.47, Perl 5.8.1 @ 21233, mod_perl 2 CVS):
>>>
>>>All APREQ Tests:
>>>Cookie: ....
>>>Param: ...
>>>Parsers: .F
>>>
>>>9 tests run: 8 passed, 1 failed, 0 not implemented.
>>>
>>>      
>>>
>>[ .. ]
>>    
>>
>>>Looks like something didn't get null-terminated properly?
>>>      
>>>
>>I haven't had a chance yet to look at this with perl-5.8.1
>>on Win32 - I'll do that. Does anyone else see problems
>>with this on Unix 5.8.1?
>>    
>>
>                    ^^^^^
>
>The perl version shouldn't matter, should it?  The failing tests 
>are from the unit tests in t/, which are only apr/apreq dependent.
>My guess is that we're assuming apr_brigade_pflatten will null-
>terminate the resulting string.  Of course, it doesn't do that.
>
>See if this patch fixes it.
>
Yep, that's fixed it for me:

All APREQ Tests:
    Cookie:                   ....
    Param:                    ...
    Parsers:                  ..

9 tests run:  9 passed, 0 failed, 0 not implemented.

Thanks,
- Steve

>
>Index: t/parsers.c
>===================================================================
>RCS file: /home/cvs/httpd-apreq-2/t/parsers.c,v
>retrieving revision 1.5
>diff -u -r1.5 parsers.c
>--- t/parsers.c	27 Jun 2003 11:41:07 -0000	1.5
>+++ t/parsers.c	17 Sep 2003 14:52:55 -0000
>@@ -111,7 +111,7 @@
> static void parse_multipart(CuTest *tc)
> {
>     const char *val;
>-    apr_size_t dummy;
>+    apr_size_t len;
>     apr_table_t *t;
>     apr_status_t rv;
>     apreq_request_t *req = apreq_request(APREQ_MFD_ENCTYPE
>@@ -145,8 +145,9 @@
>     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);
>+    apr_brigade_pflatten(bb, (char **)&val, &len, p);
>+    CuAssertIntEquals(tc,strlen("... contents of file1.txt ..."), len);
>+    CuAssertStrNEquals(tc,"... contents of file1.txt ...", val, len);
>     val = apr_table_get(t, "content-type");
>     CuAssertStrEquals(tc, "text/plain", val);
> }
>



Mime
View raw message