summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2020-05-12 14:20:57 +0200
committerYann Ylavic <ylavic@apache.org>2020-05-12 14:20:57 +0200
commit1dc3c88d41a5362c6c0852b63ac85bc996ca157e (patch)
tree019c5c2fb190ee45929eec40bb846eadec849aba /include
parentap_log_pid(): Windown does not implement apr_file_perms_set(), not a failure. (diff)
downloadapache2-1dc3c88d41a5362c6c0852b63ac85bc996ca157e.tar.xz
apache2-1dc3c88d41a5362c6c0852b63ac85bc996ca157e.zip
mod_proxy_http: handle Upgrade requests and upgraded protocol forwarding.
If the request Upgrade header matches the worker upgrade= parameter and the backend switches the protocol, do the tunneling in mod_proxy_http. This allows to keep the protocol to HTTP until the backend really switches the protocol, and apply usual output filters. When configured to forward Upgrade mechanism, we want the backend to be able to announce its Upgrade protocol to the client (e.g. with 426 Upgrade Required response) and thus forward back the Upgrade header that matches the one(s) configured in the worker upgrade= parameter. modules/proxy/mod_proxy.h: modules/proxy/proxy_util.c: ap_proxy_worker_can_upgrade(): added helper to determine whether a proxy worker is configured to forward an Upgrade protocol. include/ap_mmn.h: Bump MMN minor for ap_proxy_worker_can_upgrade(). modules/proxy/mod_proxy.c: set_worker_param(): handle worker parameter upgrade=ANY as upgrade=* (should the "any" protocol scheme be something some day..). modules/proxy/mod_proxy_wstunnel.c: proxy_wstunnel_handler(): use ap_proxy_worker_can_upgrade() to match the Upgrade header. Axe handling of upgrade=NONE, it makes no sense to Upgrade a connection if the client did not ask for it, nor to configure mod_proxy_wstunnel to use a worker with upgrade=NONE by the way. modules/proxy/mod_proxy_http.c: proxy_http_req_t: add fields force10 (force HTTP/1.0) and upgrade (value of the Upgrade header sent by the client if it matches the configuration, NULL otherwise). proxy_http_handler(): use ap_proxy_worker_can_upgrade() to determine whether the request is electable for end to end protocol upgrading and set req->upgrade accordingly. terminate_headers(): handle Connection and Upgrade headers to send to the backend, according to req->force10 and req->upgrade set before. ap_proxy_http_prefetch(): use req->force10 and terminate_headers(). send_continue_body(): added helper to send the body retained for end to end 100-continue handling. ap_proxy_http_process_response(): use ap_proxy_worker_can_upgrade() to match the response Upgrade header and forward it back if it matches the configured one(s). That is for 101 Switching Protocol obviously but also any other status code which is not overidden, at the backend wish. If the protocol is switching, create a proxy tunnel and run it, using the minimal timeout from the client or backend connection. Github: closes #125 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1877646 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r--include/ap_mmn.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/ap_mmn.h b/include/ap_mmn.h
index 7e5a1f902b..8ac21c15f4 100644
--- a/include/ap_mmn.h
+++ b/include/ap_mmn.h
@@ -630,6 +630,7 @@
* ap_check_request_header()
* 20200420.0 (2.5.1-dev) Add flags to listen_rec in place of use_specific_errors
* 20200420.1 (2.5.1-dev) Add ap_filter_adopt_brigade()
+ * 20200420.2 (2.5.1-dev) Add ap_proxy_worker_can_upgrade()
*/
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
@@ -637,7 +638,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20200420
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a