Commit 24e7df37 authored by Eric Covener's avatar Eric Covener
Browse files

Backport r1669299 from trunk:

 
  *) mod_proxy_wstunnel: Avoid an empty response by failing with 502 (Bad
     Gateway) when no response is ever received from the backend.

Submitted By: jkaluza
Reviewde By: covener, ylavic, trawick




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1673902 13f79535-47bb-0310-9956-ffa450edef68
parent be3f791d
Loading
Loading
Loading
Loading
+4 −0
Changes for CHANGES: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -23,6 +23,10 @@ Changes with Apache 2.4.13
  *) mod_proxy: Add ap_connection_reusable() for checking if a connection
     is reusable as of this point in processing.  [Jeff Trawick]

  *) mod_proxy_wstunnel: Avoid an empty response by failing with 502 (Bad
     Gateway) when no response is ever received from the backend.
     [Jan Kaluza]

  *) core_filters: restore/disable TCP_NOPUSH option after non-blocking
     sendfile.  [Yann Ylavic]

+0 −6
Changes for STATUS: 0 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -105,12 +105,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) mod_proxy_wstunnel: Avoid an empty response by failing with 502 (Bad
     Gateway) when no response is ever received from the backend.
     trunk patch: http://svn.apache.org/r1669299
     2.4.x patch: http://people.apache.org/~covener/patches/httpd-2.4.x-wstunel-noreply.diff 
     +1 covener, ylavic, trawick

  *) mod_ssl: Fix possible crash when loading server certificate constraints.
     PR 57694.
     trunk patch: http://svn.apache.org/r1666297
+14 −4
Changes for modules/proxy/mod_proxy_wstunnel.c: 14 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ static int proxy_wstunnel_canon(request_rec *r, char *url)


static apr_status_t proxy_wstunnel_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o,
                                     apr_bucket_brigade *bb, char *name)
                                     apr_bucket_brigade *bb, char *name, int *sent)
{
    apr_status_t rv;
#ifdef DEBUGGING
@@ -116,6 +116,9 @@ static apr_status_t proxy_wstunnel_transfer(request_rec *r, conn_rec *c_i, conn_
                          "read %" APR_OFF_T_FMT
                          " bytes from %s", len, name);
#endif
            if (sent) {
                *sent = 1;
            }
            rv = ap_pass_brigade(c_o->output_filters, bb);
            if (rv == APR_SUCCESS) {
                ap_fflush(c_o->output_filters, bb);
@@ -167,7 +170,7 @@ static int proxy_wstunnel_request(apr_pool_t *p, request_rec *r,
    char *old_te_val = NULL;
    apr_bucket_brigade *bb = apr_brigade_create(p, c->bucket_alloc);
    apr_socket_t *client_socket = ap_get_conn_socket(c);
    int done = 0;
    int done = 0, replied = 0;

    header_brigade = apr_brigade_create(p, backconn->bucket_alloc);

@@ -246,7 +249,7 @@ static int proxy_wstunnel_request(apr_pool_t *p, request_rec *r,
                    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02446)
                                  "sock was readable");
                    done |= proxy_wstunnel_transfer(r, backconn, c, bb,
                                                    "sock") != APR_SUCCESS;
                                                    "sock", NULL) != APR_SUCCESS;
                }
                else if (pollevent & APR_POLLERR) {
                    ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02447)
@@ -266,7 +269,7 @@ static int proxy_wstunnel_request(apr_pool_t *p, request_rec *r,
                    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02448)
                                  "client was readable");
                    done |= proxy_wstunnel_transfer(r, c, backconn, bb,
                                                    "client") != APR_SUCCESS;
                                                    "client", &replied) != APR_SUCCESS;
                }
                else if (pollevent & APR_POLLERR) {
                    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02607)
@@ -292,6 +295,13 @@ static int proxy_wstunnel_request(apr_pool_t *p, request_rec *r,
    ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
                  "finished with poll() - cleaning up");

    if (!replied) {
        return HTTP_BAD_GATEWAY;
    }
    else {
        return OK;
    }

    return OK;
}