1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

mod_proxy_connect/wstunnel: If both client and backend sides get readable

at the same time, don't lose errors occuring while forwarding on the first
side when none occurs next on the other side, and abort.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657636 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yann Ylavic
2015-02-05 17:36:23 +00:00
parent dd945fd961
commit c6f5f2f63f
3 changed files with 20 additions and 16 deletions

View File

@@ -6,6 +6,10 @@ Changes with Apache 2.5.0
calls r:wsupgrade() can cause a child process crash.
[Edward Lu <Chaosed0 gmail.com>]
*) mod_proxy_connect/wstunnel: If both client and backend sides get readable
at the same time, don't ignore errors while forwarding from the first side
if none occurs next on the other side. [Yann Ylavic]
*) mod_lua: After a r:wsupgrade(), mod_lua was not properly
responding to a websockets PING but instead invoking the specified
script. PR57524. [Edward Lu <Chaosed0 gmail.com>]

View File

@@ -414,8 +414,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
/* r->sent_bodyct = 1;*/
while (1) { /* Infinite loop until error (one side closes the connection) */
if ((rv = apr_pollset_poll(pollset, -1, &pollcnt, &signalled))
!= APR_SUCCESS) {
rv = apr_pollset_poll(pollset, -1, &pollcnt, &signalled);
if (rv != APR_SUCCESS) {
if (APR_STATUS_IS_EINTR(rv)) {
continue;
}
@@ -438,10 +438,10 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01025)
"sock was readable");
#endif
rv = proxy_connect_transfer(r, backconn, c, bb, "sock");
rv |= proxy_connect_transfer(r, backconn, c, bb, "sock");
}
else if (pollevent & APR_POLLERR) {
rv = APR_EPIPE;
rv |= APR_EPIPE;
backconn->aborted = 1;
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(01026)
"err on backconn");
@@ -454,17 +454,17 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01027)
"client was readable");
#endif
rv = proxy_connect_transfer(r, c, backconn, bb, "client");
rv |= proxy_connect_transfer(r, c, backconn, bb, "client");
}
else if (pollevent & APR_POLLERR) {
rv = APR_EPIPE;
rv |= APR_EPIPE;
c->aborted = 1;
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02827)
"err on client");
}
}
else {
rv = APR_EBADF;
rv |= APR_EBADF;
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(01028)
"unknown socket in pollset");
}

View File

@@ -55,8 +55,8 @@ static int proxy_wstunnel_pump(ws_baton_t *baton, apr_time_t timeout, int try_as
apr_bucket_brigade *bb = baton->bb;
while(1) {
if ((rv = apr_pollset_poll(pollset, timeout, &pollcnt, &signalled))
!= APR_SUCCESS) {
rv = apr_pollset_poll(pollset, timeout, &pollcnt, &signalled);
if (rv != APR_SUCCESS) {
if (APR_STATUS_IS_EINTR(rv)) {
continue;
}
@@ -86,16 +86,16 @@ static int proxy_wstunnel_pump(ws_baton_t *baton, apr_time_t timeout, int try_as
if (pollevent & (APR_POLLIN | APR_POLLHUP)) {
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02446)
"sock was readable");
rv = proxy_wstunnel_transfer(r, backconn, c, bb, "sock");
rv |= proxy_wstunnel_transfer(r, backconn, c, bb, "sock");
}
else if (pollevent & APR_POLLERR) {
rv = APR_EPIPE;
rv |= APR_EPIPE;
backconn->aborted = 1;
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02447)
"error on backconn");
}
else {
rv = APR_EGENERAL;
rv |= APR_EGENERAL;
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02605)
"unknown event on backconn %d", pollevent);
}
@@ -105,22 +105,22 @@ static int proxy_wstunnel_pump(ws_baton_t *baton, apr_time_t timeout, int try_as
if (pollevent & (APR_POLLIN | APR_POLLHUP)) {
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02448)
"client was readable");
rv = proxy_wstunnel_transfer(r, c, backconn, bb, "client");
rv |= proxy_wstunnel_transfer(r, c, backconn, bb, "client");
}
else if (pollevent & APR_POLLERR) {
rv = APR_EPIPE;
rv |= APR_EPIPE;
c->aborted = 1;
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, APLOGNO(02607)
"error on client conn");
}
else {
rv = APR_EGENERAL;
rv |= APR_EGENERAL;
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02606)
"unknown event on client conn %d", pollevent);
}
}
else {
rv = APR_EBADF;
rv |= APR_EBADF;
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02449)
"unknown socket in pollset");
}