]> git.ipfire.org Git - thirdparty/apache/httpd.git/commit
mod_proxy: improved and reentrant tunneling loop.
authorYann Ylavic <ylavic@apache.org>
Wed, 1 Jul 2020 16:35:48 +0000 (16:35 +0000)
committerYann Ylavic <ylavic@apache.org>
Wed, 1 Jul 2020 16:35:48 +0000 (16:35 +0000)
commit3d5ace0a30256c3fa49c8996ea6e4b0882d32b70
tree4bc1f4be8b6d651f34ab078e37948f73044d6b03
parent8d4133f1c1278282b31d04d461a8123dce5a765c
mod_proxy: improved and reentrant tunneling loop.

modules/proxy/mod_proxy.h:
    Rename AP_PROXY_TRANSFER_SHOULD_YIELD to AP_PROXY_TRANSFER_YIELD_PENDING
    and add AP_PROXY_TRANSFER_YIELD_MAX_READS.

modules/proxy/mod_proxy_http.c:
modules/proxy/mod_proxy_wstunnel.c:
    Removing of reqtimeout filter is now handled by ap_proxy_tunnel_create().

modules/proxy/proxy_util.c:
    ap_proxy_transfer_between_connections():
        Reorganize loop to break out early.
        When AP_PROXY_TRANSFER_YIELD_PENDING, if !ap_filter_should_yield() we
        still need to run and check ap_filter_output_pending() since it may
        release pending data.
        When AP_PROXY_TRANSFER_YIELD_MAX_READS, stop the loop after too much
        reads (PROXY_TRANSFER_MAX_READS = 10000) to release the thread and
        give the caller a chance to schedule the other direction.
        Don't return APR_INCOMPLETE when it comes from an incomplete body
        detected by ap_http_filter().

    ap_proxy_tunnel_create():
        Start with POLLOUT on both directions so that any pending output data
        is flushed first.

    ap_proxy_tunnel_run():
        Remove re-init/clear of the pollset for each call so that the function
        is reentrant.
        Handle POLLOUT before POLLIN so that we can read in the same pass once
        all buffered output data are flushed, using ap_filter_input_pending()
        to drain buffered input data.

This is preparatory patch for async websocket tunneling is mod_proxy_http.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879401 13f79535-47bb-0310-9956-ffa450edef68
modules/proxy/mod_proxy.h
modules/proxy/mod_proxy_http.c
modules/proxy/mod_proxy_wstunnel.c
modules/proxy/proxy_util.c