什么是 Http2 中的 GoAway 框架以及它如何链接到重定向?
What is a GoAway Frame in Http2 and how is it linked to Redirects?
我知道 HTTP/2 Client provided by Java 9 并且在使用以下代码试用孵化器模块时:
// Request builder
URI uri = new URI("http://www.whosebug.com/"); // using www.google.com gives me some payload with no exception
HttpRequest request = HttpRequest.newBuilder().uri(uri).GET().build();
// Client
HttpClient httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.ALWAYS).build();
System.out.println(httpClient.version());
// Response builder
HttpResponse response = httpClient.send(request, HttpResponse.BodyHandler.asString());
System.out.println("statusCode = " + response.statusCode()); // 200 for google.com
我收到了这个作为输出:
Exception in thread "main" java.io.IOException: /192.168.0.2:60726: GOAWAY received
at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleGoAway(Http2Connection.java:613)
at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleConnectionFrame(Http2Connection.java:531)
at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.processFrame(Http2Connection.java:466)
at jdk.incubator.httpclient/jdk.incubator.http.internal.frame.FramesDecoder.decode(FramesDecoder.java:114)
at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection$FramesController.processReceivedData(Http2Connection.java:152)
at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.asyncReceive(Http2Connection.java:425)
at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.upperRead(AsyncSSLDelegate.java:557)
at jdk.incubator.httpclient/jdk.incubator.http.internal.common.Queue.put(Queue.java:73)
at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.asyncReceive(AsyncSSLDelegate.java:503)
at jdk.incubator.httpclient/jdk.incubator.http.PlainHttpConnection.asyncRead(PlainHttpConnection.java:300)
at jdk.incubator.httpclient/jdk.incubator.http.PlainHttpConnection$ReadEvent.handle(PlainHttpConnection.java:395)
at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.handleEvent(HttpClientImpl.java:438)
at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:408)
向下移动堆栈跟踪,我发现 GOAWAY
被列为
的一种类型
jdk.incubator.http.internal.frame.Http2Frame
但是内部 class 没有太多的文档来找到这个类型到底代表什么。我也尝试在 JEP 的链接上搜索相同内容,但找不到。
Q.什么是GoAway框架?何时以及如何使用它?
Q. 为什么如果我更改我的代码以使用客户端而不遵循重定向尝试 GET "whosebug.com" 我做没有得到相同的异常?
HttpClient httpClient = HttpClient.newBuilder().build();
中的设置
The GOAWAY frame (type=0x7) is used to initiate graceful shutdown of
a connection by a server.
很可能该帧是由服务器在重定向后的第二个连接上发送的。
whosebug.com 处的所有 URL 都接受 http/2 连接吗?当查看我的 HTTP/2-SPDY 浏览器插件的指示器时,情况似乎并非如此。
从 HTTP/1.1 重定向到 HTTP/2 通过 TLS 错误地包括升级 header。此问题已提交
我知道 HTTP/2 Client provided by Java 9 并且在使用以下代码试用孵化器模块时:
// Request builder
URI uri = new URI("http://www.whosebug.com/"); // using www.google.com gives me some payload with no exception
HttpRequest request = HttpRequest.newBuilder().uri(uri).GET().build();
// Client
HttpClient httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.ALWAYS).build();
System.out.println(httpClient.version());
// Response builder
HttpResponse response = httpClient.send(request, HttpResponse.BodyHandler.asString());
System.out.println("statusCode = " + response.statusCode()); // 200 for google.com
我收到了这个作为输出:
Exception in thread "main" java.io.IOException: /192.168.0.2:60726: GOAWAY received at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleGoAway(Http2Connection.java:613) at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleConnectionFrame(Http2Connection.java:531) at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.processFrame(Http2Connection.java:466) at jdk.incubator.httpclient/jdk.incubator.http.internal.frame.FramesDecoder.decode(FramesDecoder.java:114) at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection$FramesController.processReceivedData(Http2Connection.java:152) at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.asyncReceive(Http2Connection.java:425) at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.upperRead(AsyncSSLDelegate.java:557) at jdk.incubator.httpclient/jdk.incubator.http.internal.common.Queue.put(Queue.java:73) at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.asyncReceive(AsyncSSLDelegate.java:503) at jdk.incubator.httpclient/jdk.incubator.http.PlainHttpConnection.asyncRead(PlainHttpConnection.java:300) at jdk.incubator.httpclient/jdk.incubator.http.PlainHttpConnection$ReadEvent.handle(PlainHttpConnection.java:395) at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.handleEvent(HttpClientImpl.java:438) at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:408)
向下移动堆栈跟踪,我发现 GOAWAY
被列为
jdk.incubator.http.internal.frame.Http2Frame
但是内部 class 没有太多的文档来找到这个类型到底代表什么。我也尝试在 JEP 的链接上搜索相同内容,但找不到。
Q.什么是GoAway框架?何时以及如何使用它?
Q. 为什么如果我更改我的代码以使用客户端而不遵循重定向尝试 GET "whosebug.com" 我做没有得到相同的异常?
HttpClient httpClient = HttpClient.newBuilder().build();
The GOAWAY frame (type=0x7) is used to initiate graceful shutdown of a connection by a server.
很可能该帧是由服务器在重定向后的第二个连接上发送的。
whosebug.com 处的所有 URL 都接受 http/2 连接吗?当查看我的 HTTP/2-SPDY 浏览器插件的指示器时,情况似乎并非如此。
从 HTTP/1.1 重定向到 HTTP/2 通过 TLS 错误地包括升级 header。此问题已提交