mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
mod_proxy: Improve tunneling loop.
Support half closed connections and pending data draining (for protocols like rsync). PR 61616. When reading on one side goes faster than writing on the other side, the output filters chain may start buffering data and finally block, which will break bidirectional tunneling for some protocols. To avoid this, proxy_tunnel_run() now stops polling/reading until pending data are drained, and recovers appropriately. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1869420 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -37,10 +37,17 @@ static void proxy_wstunnel_callback(void *b);
|
||||
static int proxy_wstunnel_pump(ws_baton_t *baton, int async)
|
||||
{
|
||||
int status = ap_proxy_tunnel_run(baton->tunnel);
|
||||
if (async && status == HTTP_GATEWAY_TIME_OUT) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, baton->r,
|
||||
APLOGNO(02542) "Attempting to go async");
|
||||
status = SUSPENDED;
|
||||
if (status == HTTP_GATEWAY_TIME_OUT) {
|
||||
if (!async) {
|
||||
/* ap_proxy_tunnel_run() didn't log this */
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, baton->r, APLOGNO(10225)
|
||||
"Tunnel timed out");
|
||||
}
|
||||
else {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, baton->r, APLOGNO(02542)
|
||||
"Attempting to go async");
|
||||
status = SUSPENDED;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@@ -234,7 +241,7 @@ static int proxy_wstunnel_request(apr_pool_t *p, request_rec *r,
|
||||
|
||||
ap_remove_input_filter_byhandle(c->input_filters, "reqtimeout");
|
||||
|
||||
rv = ap_proxy_tunnel_create(&tunnel, r, conn->connection);
|
||||
rv = ap_proxy_tunnel_create(&tunnel, r, conn->connection, scheme);
|
||||
if (rv != APR_SUCCESS) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(02543)
|
||||
"error creating websocket tunnel");
|
||||
|
Reference in New Issue
Block a user