httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ron Avriel" <ravr...@hotmail.com>
Subject Bad request returned for chunked HTTP post
Date Thu, 23 Dec 2004 17:48:31 GMT
Hi,

It seems there’s a bug in apreq that causes all HTTP post requests sent with 
chunked transfer encoding to return with HTTP 400 bad request.

I'm using httpd-2.0.52 and libapreq2-2.04-dev. In my apache module I parse a 
POST request using apreq. POST requests sent with content-length are parsed 
OK, but when I POST using chunked transfer encoding I get HTTP 400 bad 
request.

The problem can be easily reproduced by using the code from the sample 
mod_apreq_request_test.c and using curl as shown below:

C:\Util\cURL>curl -D - -d "param1=a&param2=b" -H "Transfer-Encoding: 
chunked" http://localhost:8888/mq HTTP/1.1 400 Bad Request
Date: Thu, 23 Dec 2004 17:34:35 GMT
Server: Apache/2.0.52 (Win32) DAV/2
Content-Length: 38
Connection: close
Content-Type: text/plain; charset=ISO-8859-1

ARGS:
BODY:
        param1 => a
        param2 => b


Note that HTTP 400 is returned, even though the module parsed the parameters 
OK and returned OK. As far as I can tell, curl is sending a valid request.


The same tests WITHOUT chunked encoding returns 200 OK:

C:\Util\cURL>curl -D - -d "param1=a&param2=b" http://localhost:8888/mq 
HTTP/1.1 200 OK
Date: Thu, 23 Dec 2004 17:37:22 GMT
Server: Apache/2.0.52 (Win32) DAV/2
Content-Length: 38
Content-Type: text/plain; charset=ISO-8859-1

ARGS:
BODY:
        param1 => a
        param2 => b

I traced down the problem to:

apreq_filter(0x008bf778, 0x008bfc30, 1, 0, 0) line 558
ap_get_brigade(0x008bf778, 0x008bfc30, 1, 0, 0) line 475 + 32 bytes
ap_rgetline_core(0x00f3fc04, 8192, 0x00f3fbfc, 0x008bdd58, 0, 0x008bfc30) 
line 215 + 27 bytes
ap_get_mime_headers_core(0x008bdd58, 0x008bfc30) line 688 + 36 bytes
ap_get_mime_headers(0x008bdd58) line 836
ap_http_filter(0x008bed58, 0x008bf920, 0, 0, 8192) line 1559
ap_get_brigade(0x008bed58, 0x008bf920, 0, 0, 8192) line 475 + 32 bytes
net_time_filter(0x008be9d0, 0x008bf920, 0, 0, 8192) line 3668
ap_get_brigade(0x008be9d0, 0x008bf920, 0, 0, 8192) line 475 + 32 bytes
apreq_filter(0x008bf778, 0x008bf920, 0, 0, 8192) line 578 + 35 bytes
ap_get_brigade(0x008bf778, 0x008bf920, 0, 0, 8192) line 475 + 32 bytes
apreq_request_test_handler(0x008bdd58) line 235 + 33 bytes
...

At mod_apreq.c:558 APR_ENOTIMPL is returned because mode is AP_MODE_GETLINE. 
This causes r->status = HTTP_BAD_REQUEST; in protocol.c:1843 which 
eventually is returned to client.

Any help will be greatly appreciated.
Ron

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Mime
View raw message