]> granicus.if.org Git - apache/commitdiff
mod_proxy_wstunnel: Bypass the handler while the connection is not
authorYann Ylavic <ylavic@apache.org>
Sun, 19 Apr 2015 15:51:03 +0000 (15:51 +0000)
committerYann Ylavic <ylavic@apache.org>
Sun, 19 Apr 2015 15:51:03 +0000 (15:51 +0000)
upgraded to WebSocket, so that other modules can possibly take over
the leading HTTP requests.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1674632 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/log-message-tags/next-number
modules/proxy/mod_proxy_wstunnel.c

diff --git a/CHANGES b/CHANGES
index a94d77ca3e5c62ce923ecf7bc4b6b7a7b3444f5f..20715c13abb549466902e8d889c9a94f4de4a4bb 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) 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_proxy_scgi: ProxySCGIInternalRedirect now allows an alternate
      response header to be used by the application, for when the application
      or framework is unable to return Location in the internal-redirect
index d77de0555773a3363f91e4ac8664bfe85097be96..c914c6a5d92ac836303a6d856c07a835a3043945 100644 (file)
@@ -1 +1 @@
-2900
+2901
index 11bc02d99b47640a41a812970292c369b50c8ac9..f0816b261c2141e55d9c309068cc954f8966efbb 100644 (file)
@@ -466,6 +466,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;
@@ -485,6 +486,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);