Discussion:
mod_proxy and chunked requests
Mathias Herberts
2003-03-10 13:16:37 UTC
Permalink
Hi,

I am running Apache 1.3.27 as a reverse proxy using mod_rewrite and
mod_proxy. We recently encountered problems with PDA client browsers
using MIDP (J2ME Mobile Information Device Profile) which send their
requests using a chunked transfer encoding.

mod_proxy as shipped with Apache 1.3.27 does not allow chunked TE and
therefore refuses to reroute the requests to the origin server.

I looked in src/modules/proxy/mod_proxy.c and saw the following code:

static int proxy_handler(request_rec *r)
{

.....

if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)))
return rc;

.....
}

What impact would it have to replace REQUEST_CHUNKED_ERROR with
REQUEST_CHUNKED_DECHUNK? I do not master the mod_proxy source enough to
forecast any behaviour.

The chunked TE used by MIDP seems unavoidable, the only chance is there:

http://wireless.java.sun.com/midp/questions/chunking/

but it implies efforts on the client application side which servers
usually do not manage.

Any help appreciated,

Mathias.
--
-- Informatique du Credit Mutuel ---- Reseaux et Systemes Distribues
-- 32 rue Mirabeau -- Le Relecq-Kerhuon -- 29808 Brest Cedex 9, FRANCE
-- Tel +33298004653 - Fax +33298284005 - Mail ***@gicm.fr
-- Key Fingerprint: 8778 D2FD 3B4A 6B33 10AB F503 63D0 ADAE 9112 03E4
Graham Leggett
2003-03-10 11:58:53 UTC
Permalink
Post by Mathias Herberts
mod_proxy as shipped with Apache 1.3.27 does not allow chunked TE and
therefore refuses to reroute the requests to the origin server.
mod_proxy with Apache v1.3.27 is a full HTTP/1.1 proxy, so if it is not
accepting chunked encoding for any reason then it is a bug.

Can you give more details of exactly what is not working - is it a
chunked request that proxy is not handling correctly? (As opposed to a
chunked response).

Regards,
Graham
--
-----------------------------------------
***@sharp.fm "There's a moon
over Bourbon Street
tonight..."
Mathias Herberts
2003-03-10 14:20:23 UTC
Permalink
Post by Graham Leggett
Post by Mathias Herberts
mod_proxy as shipped with Apache 1.3.27 does not allow chunked TE and
therefore refuses to reroute the requests to the origin server.
mod_proxy with Apache v1.3.27 is a full HTTP/1.1 proxy, so if it is not
accepting chunked encoding for any reason then it is a bug.
Can you give more details of exactly what is not working - is it a
chunked request that proxy is not handling correctly? (As opposed to a
chunked response).
Indeed it is a chunked request that the proxy is rejecting with a 411
Content-Length required error message (and adding a Content-Length does
not help since it further rejects the request with a 400 BAD REQUEST error).

I foresee two solutions, one is to change the behavior to
REQUEST_CHUNKED_PASS and force the transmission of a Transfert-Encoding:
chunked header in ap_proxy_http_handler so that the origin server
receives the chunked request 'as-is' (the Transfert-Encoding header from
the request will not be sent as it is considered a hop-to-hop header,
see RFC 2616 13.5.1). The other option is to handle the dechunking of
the request, dealing with dynamic memory allocations to hold the request
yet of unknown length, then send a Content-Length header and the
dechunked request body to the origin server.

The first solution seems less error prone as no dynamic memory
allocation is to be done.

Regards,

Mathias.
--
-- Informatique du Credit Mutuel ---- Reseaux et Systemes Distribues
-- 32 rue Mirabeau -- Le Relecq-Kerhuon -- 29808 Brest Cedex 9, FRANCE
-- Tel +33298004653 - Fax +33298284005 - Mail ***@gicm.fr
-- Key Fingerprint: 8778 D2FD 3B4A 6B33 10AB F503 63D0 ADAE 9112 03E4
Loading...