|
12 | 12 |
|
13 | 13 | import io.vertx.core.Future; |
14 | 14 | import io.vertx.core.Promise; |
15 | | -import io.vertx.core.http.HttpClient; |
16 | | -import io.vertx.core.http.HttpClientRequest; |
17 | | -import io.vertx.core.http.HttpClientResponse; |
18 | | -import io.vertx.core.http.HttpHeaders; |
19 | | -import io.vertx.core.http.HttpMethod; |
20 | | -import io.vertx.core.http.HttpServerRequest; |
21 | | -import io.vertx.core.http.HttpServerResponse; |
22 | | -import io.vertx.core.http.HttpVersion; |
23 | | -import io.vertx.core.http.RequestOptions; |
| 15 | +import io.vertx.core.http.*; |
24 | 16 | import io.vertx.core.net.NetSocket; |
25 | | -import io.vertx.core.net.SocketAddress; |
26 | | -import io.vertx.httpproxy.HttpProxy; |
27 | | -import io.vertx.httpproxy.ProxyContext; |
28 | | -import io.vertx.httpproxy.ProxyInterceptor; |
29 | | -import io.vertx.httpproxy.ProxyOptions; |
30 | | -import io.vertx.httpproxy.ProxyRequest; |
31 | | -import io.vertx.httpproxy.ProxyResponse; |
| 17 | +import io.vertx.httpproxy.*; |
32 | 18 | import io.vertx.httpproxy.cache.CacheOptions; |
33 | 19 | import io.vertx.httpproxy.spi.cache.Cache; |
34 | 20 |
|
35 | | -import java.util.ArrayList; |
36 | | -import java.util.HashMap; |
37 | | -import java.util.List; |
38 | | -import java.util.ListIterator; |
39 | | -import java.util.Map; |
| 21 | +import java.util.*; |
40 | 22 | import java.util.function.BiFunction; |
41 | | -import java.util.function.Function; |
42 | 23 |
|
43 | 24 | public class ReverseProxy implements HttpProxy { |
44 | 25 |
|
@@ -82,10 +63,7 @@ public void handle(HttpServerRequest request) { |
82 | 63 | } |
83 | 64 |
|
84 | 65 | // WebSocket upgrade tunneling |
85 | | - if (supportWebSocket && |
86 | | - request.version() == HttpVersion.HTTP_1_1 && |
87 | | - request.method() == HttpMethod.GET && |
88 | | - request.headers().contains(HttpHeaders.CONNECTION, HttpHeaders.UPGRADE, true)) { |
| 66 | + if (supportWebSocket && io.vertx.core.http.impl.HttpUtils.canUpgradeToWebSocket(request)) { |
89 | 67 | handleWebSocketUpgrade(proxyRequest); |
90 | 68 | return; |
91 | 69 | } |
|
0 commit comments