1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +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:
Yann Ylavic
2019-11-05 16:41:14 +00:00
parent 3d3e03a63a
commit 124a26fb09
6 changed files with 368 additions and 184 deletions

View File

@@ -335,7 +335,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
/* r->sent_bodyct = 1; */
rv = ap_proxy_tunnel_create(&tunnel, r, backconn);
rv = ap_proxy_tunnel_create(&tunnel, r, backconn, "CONNECT");
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(10208)
"can't create tunnel for %pI (%s)",
@@ -345,6 +345,11 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
rc = ap_proxy_tunnel_run(tunnel);
if (ap_is_HTTP_ERROR(rc)) {
if (rc == HTTP_GATEWAY_TIME_OUT) {
/* ap_proxy_tunnel_run() didn't log this */
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10224)
"tunnel timed out");
}
/* Don't send an error page if we sent data already */
if (proxyport && !tunnel->replied) {
return rc;