On 10/18/2019 09:50 AM, [email protected] wrote:
> Author: ylavic
> Date: Fri Oct 18 07:50:59 2019
> New Revision: 1868576
> 
> URL: http://svn.apache.org/viewvc?rev=1868576&view=rev
> Log:
> mod_proxy_http: Fix 100-continue deadlock for spooled request bodies. PR 
> 63855.
> 
> Send "100 Continue", if needed, before fetching/blocking on the request body 
> in
> spool_reqbody_cl(), otherwise mod_proxy and the client can wait for each 
> other,
> leading to a request timeout (408).
> 
> While at it, make so that ap_send_interim_response() uses the default status
> line if none is set in r->status_line.
> 
> Modified:
>     httpd/httpd/trunk/CHANGES
>     httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
>     httpd/httpd/trunk/server/protocol.c
> 

> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=1868576&r1=1868575&r2=1868576&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Fri Oct 18 07:50:59 2019
> @@ -431,6 +431,21 @@ static int spool_reqbody_cl(proxy_http_r
>      apr_file_t *tmpfile = NULL;
>      apr_off_t limit;
>  
> +    /* Send "100 Continue" now if the client expects one, before
> +     * blocking on the body, otherwise we'd wait for each other.
> +     */
> +    if (req->expecting_100) {
> +        int saved_status = r->status;
> +
> +        r->expecting_100 = 1;
> +        r->status = HTTP_CONTINUE;
> +        ap_send_interim_response(r, 0);
> +        AP_DEBUG_ASSERT(!r->expecting_100);
> +
> +        r->status = saved_status;
> +        req->expecting_100 = 0;
> +    }

Why sending it directly and not just set r->expecting_100 = 1; and let the 
HTTP_INPUT filter do the job?

So

    /*
     * Tell the HTTP_INPUT filter that it should send a "100 continue" if the 
client
     * expects one, before blocking on the body, otherwise we'd wait for each 
other.
     */
    if (req->expecting_100) {
        r->expecting_100 = 1;
        req->expecting_100 = 0;
    }


Regards

RĂ¼diger


Reply via email to