Commit 72baa9f1 authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

  An impossible-to-hit edge case today; we described the request
  as chunked - and if chunked always send the body termination "0"
  chunk header.

  Roy's requested change that we always send a body we could read
  in full as a C-L request ensures this code wasn't triggered; some
  change in the future could again reveal this edge case.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@230718 13f79535-47bb-0310-9956-ffa450edef68
parent 45702b6b
Loading
Loading
Loading
Loading
+11 −10
Changes for modules/proxy/mod_proxy_http.c: 11 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -254,6 +254,7 @@ static apr_status_t stream_reqbody_chunked(apr_pool_t *p,
            bb = input_brigade;
        }
        
        /* The request is flushed below this loop with chunk EOS header */
        status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 0);
        if (status != APR_SUCCESS) {
            return status;
@@ -285,14 +286,16 @@ static apr_status_t stream_reqbody_chunked(apr_pool_t *p,
            AP_DEBUG_ASSERT(APR_BUCKET_IS_EOS(e));
            apr_bucket_delete(e);
        }
        bb = input_brigade;
    }

    e = apr_bucket_immortal_create(ASCII_ZERO ASCII_CRLF
                                   /* <trailers> */
                                   ASCII_CRLF,
                                   5, bucket_alloc);
        APR_BRIGADE_INSERT_TAIL(input_brigade, e);
        bb = input_brigade;
    }
    APR_BRIGADE_INSERT_TAIL(bb, e);

    /* Now we have headers-only, or the chunk EOS mark; flush it */
    status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 1);
    return status;
}
@@ -365,7 +368,8 @@ static apr_status_t stream_reqbody_cl(apr_pool_t *p,
            bb = input_brigade;
        }
        
        status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 0);
        /* Once we hit EOS, we are ready to flush. */
        status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, seen_eos);
        if (status != APR_SUCCESS) {
            return status;
        }
@@ -392,16 +396,12 @@ static apr_status_t stream_reqbody_cl(apr_pool_t *p,

    if (header_brigade) {
        /* we never sent the header brigade since there was no request
         * body; send it now
         * body; send it now with the flush flag
         */
        terminate_headers(bucket_alloc, header_brigade);
        bb = header_brigade;
    }
    else {
        /* need to flush any pending data */
        bb = input_brigade; /* empty now; pass_brigade() will add flush */
    }
        status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 1);
    }
    return status;
}

@@ -531,6 +531,7 @@ static apr_status_t spool_reqbody_cl(apr_pool_t *p,
        }
        APR_BRIGADE_INSERT_TAIL(header_brigade, e);
    }
    /* This is all a single brigade, pass with flush flagged */
    status = pass_brigade(bucket_alloc, r, p_conn, origin, header_brigade, 1);
    return status;
}