From: Jeff Trawick Date: Fri, 7 Jan 2005 19:37:33 +0000 (+0000) Subject: watch out for "Content-Length: 0" more carefully; it has X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c4882b844e5a9b6a6e9c95c85b35b0acf5d5443f;p=thirdparty%2Fapache%2Fhttpd.git watch out for "Content-Length: 0" more carefully; it has to be handled a certain way git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/proxy-reqbody@124562 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index 4bfb93fa497..bb13b037e37 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -626,6 +626,7 @@ static apr_status_t send_request_body(apr_pool_t *p, { enum {RB_INIT, RB_STREAM_CL, RB_STREAM_CHUNKED, RB_SPOOL_CL} rb_method = RB_INIT; const char *old_cl_val, *te_val; + int cl_zero; /* client sent "Content-Length: 0", which we forward on to server */ apr_status_t status; /* send CL or use chunked encoding? @@ -656,17 +657,22 @@ static apr_status_t send_request_body(apr_pool_t *p, * . proxy-sendunchangedcl * use C-L from client and spool the request body */ - if (!force10 && apr_table_get(r->subprocess_env, "proxy-sendchunks")) { + old_cl_val = apr_table_get(r->headers_in, "Content-Length"); + cl_zero = old_cl_val && !strcmp(old_cl_val, "0"); + + if (!force10 + && !cl_zero + && apr_table_get(r->subprocess_env, "proxy-sendchunks")) { rb_method = RB_STREAM_CHUNKED; } - else if (apr_table_get(r->subprocess_env, "proxy-sendcl")) { + else if (!cl_zero + && apr_table_get(r->subprocess_env, "proxy-sendcl")) { rb_method = RB_SPOOL_CL; } else { - old_cl_val = apr_table_get(r->headers_in, "Content-Length"); if (old_cl_val && (r->input_filters == r->proto_input_filters - || !strcmp(old_cl_val, "0") + || cl_zero || apr_table_get(r->subprocess_env, "proxy-sendunchangedcl"))) { rb_method = RB_STREAM_CL; } @@ -887,8 +893,7 @@ apr_status_t ap_proxy_http_request(apr_pool_t *p, request_rec *r, || !apr_strnatcasecmp(headers_in[counter].key, "Transfer-Encoding") || !apr_strnatcasecmp(headers_in[counter].key, "Upgrade") - /* We have no way of knowing whether this Content-Length will - * be accurate, so we must not include it. + /* We'll add appropriate Content-Length later, if appropriate. */ || !apr_strnatcasecmp(headers_in[counter].key, "Content-Length") /* XXX: @@@ FIXME: "Proxy-Authorization" should *only* be