--- mod_proxy_http.c.orig 2005-11-08 11:05:34.000000000 +0000 +++ mod_proxy_http.c.orig 2005-11-08 12:25:57.000000000 +0000 @@ -802,27 +802,36 @@ /* We have headers, let's figure out our request body... */ input_brigade = apr_brigade_create(p, bucket_alloc); - /* sub-requests never use keepalives, and mustn't pass request bodies. - * Because the new logic looks at input_brigade, we will self-terminate - * input_brigade and jump past all of the request body logic... - * Reading anything with ap_get_brigade is likely to consume the - * main request's body or read beyond EOS - which would be unplesant. - */ if (r->main) { + /* sub-requests never use keepalives */ /* XXX: Why DON'T sub-requests use keepalives? */ p_conn->close++; - if (old_cl_val) { - old_cl_val = NULL; - apr_table_unset(r->headers_in, "Content-Length"); - } - if (old_te_val) { - old_te_val = NULL; - apr_table_unset(r->headers_in, "Transfer-Encoding"); + + /* Most sub-requests will be GETs (from SSIs). These do + * not have request bodies, but may have a C-L or T-E header + * taken from the main request. These need to be removed. + * Because the new logic looks at input_brigade, we will self-terminate + * input_brigade and jump past all of the request body logic... + * Reading anything with ap_get_brigade is likely to consume the + * main request's body or read beyond EOS - which would be unplesant. + * If another module generates POST sub-requests, it should + * take care to provide a request body via the input filter, and + * set an appropriate C-L or T-E. + */ + if (r->method_number != M_POST) { + if (old_cl_val) { + old_cl_val = NULL; + apr_table_unset(r->headers_in, "Content-Length"); + } + if (old_te_val) { + old_te_val = NULL; + apr_table_unset(r->headers_in, "Transfer-Encoding"); + } + rb_method = RB_STREAM_CL; + e = apr_bucket_eos_create(input_brigade->bucket_alloc); + APR_BRIGADE_INSERT_TAIL(input_brigade, e); + goto skip_body; } - rb_method = RB_STREAM_CL; - e = apr_bucket_eos_create(input_brigade->bucket_alloc); - APR_BRIGADE_INSERT_TAIL(input_brigade, e); - goto skip_body; } /* WE only understand chunked. Other modules might inject