]> granicus.if.org Git - apache/commitdiff
Merge r1674632 from trunk:
authorJim Jagielski <jim@apache.org>
Sun, 19 Apr 2015 18:06:05 +0000 (18:06 +0000)
committerJim Jagielski <jim@apache.org>
Sun, 19 Apr 2015 18:06:05 +0000 (18:06 +0000)
mod_proxy_wstunnel: Bypass the handler while the connection is not
upgraded to WebSocket, so that other modules can possibly take over
the leading HTTP requests.

Submitted by: ylavic
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1674661 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/proxy/mod_proxy_wstunnel.c

diff --git a/CHANGES b/CHANGES
index c76eb5e2bbcb9113baac64b5a6ea1c46feb70849..17410ffb3e197c2ab0a1760a88291de0747fc839 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,10 @@ Changes with Apache 2.4.13
      calls r:wsupgrade() can cause a child process crash. 
      [Edward Lu <Chaosed0 gmail.com>]
 
+  *) mod_proxy_wstunnel: Bypass the handler while the connection is not
+     upgraded to WebSocket, so that other modules can possibly take over
+     the leading HTTP requests.  [Yann Ylavic]
+
   *) mod_http: Fix incorrect If-Match handling. PR 57358
      [Kunihiko Sakamoto <ksakamoto google.com>]
 
diff --git a/STATUS b/STATUS
index 716790f6f5ce98615ae9a8323a3dbcc8d4b7053d..09e013b038dd28ee441c4b7bbf5f0f4cb567aefb 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -105,12 +105,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) mod_proxy_wstunnel: Bypass the handler while the connection is not
-     upgraded to WebSocket, so that other modules can possibly take over
-     the leading HTTP requests.
-     trunk patch: http://svn.apache.org/r1674632
-     2.4.x patch: trunk works (modulo CHANGES, docs/log-message-tags)
-     +1: ylavic, covener, jim
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index fb72041bdf4d93d65ada816f28e7e64d617b3f20..7c283b8e02250025bae21d225abe2fc1461877f2 100644 (file)
@@ -315,6 +315,7 @@ static int proxy_wstunnel_handler(request_rec *r, proxy_worker *worker,
     int status;
     char server_portstr[32];
     proxy_conn_rec *backend = NULL;
+    const char *upgrade;
     char *scheme;
     int retry;
     conn_rec *c = r->connection;
@@ -334,6 +335,13 @@ static int proxy_wstunnel_handler(request_rec *r, proxy_worker *worker,
         return DECLINED;
     }
 
+    upgrade = apr_table_get(r->headers_in, "Upgrade");
+    if (!upgrade || strcasecmp(upgrade, "WebSocket") != 0) {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02900)
+                      "declining URL %s  (not WebSocket)", url);
+        return DECLINED;
+    }
+
     uri = apr_palloc(p, sizeof(*uri));
     ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02451) "serving URL %s", url);