Undertow从未为纯Servlet发送HTTP / 2预告片吗?

时间:2018-07-25 17:38:34

标签: wildfly undertow

我试图让一个非常简单的servlet发送HTTP / 2预告片作为响应。通过在Glassfish 5.0或Tomcat 9.0.10上运行我的servlet,我成功地做到了。我可以清楚地看到HTTP / 2客户端nghttp收到的预告片。

但是,当我尝试Undertow 2.0.10.Final(声称支持Servlet 4.0和HTTP / 2)时,该Servlet仅发送有效载荷,而从不发送预告片。我尝试了Spring Boot + Undertow以及独立的Wildfly,但没有一个发送预告片。

@WebServlet(urlPatterns = {"/hellotrailer"})
public class HelloTrailer extends HttpServlet {
  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    resp.setStatus(HttpServletResponse.SC_OK);
    resp.setContentType("text/plain");
    resp.setHeader("trailers", "hello");

    Map<String, String> trailers = new HashMap<>();
    trailers.put("hello", "world");
    resp.setTrailerFields(() -> trailers);
    resp.getWriter().write("payload");
  }
}

编辑:以下是通过Wildfly 13.0.0.Final--server-config=standalone-ee8.xml服务器或{{1}服务器向wildfly-14.0.0.Beta1服务器发送请求时客户端输出的详细信息}和弹簧靴。

Undertow 9.0.11

如您所见,仅标题和有效载荷被删除,没有尾部。如果将相同的请求发送到nghttp "https://127.0.0.1:8443/servlettest-1.0-SNAPSHOT/hellotrailer" -v -H ":method:GET" [ 0.003] Connected [WARNING] Certificate verification failed: Hostname mismatch The negotiated protocol: h2 [ 0.025] send SETTINGS frame <length=12, flags=0x00, stream_id=0> (niv=2) [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100] [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535] [ 0.025] send PRIORITY frame <length=5, flags=0x00, stream_id=3> (dep_stream_id=0, weight=201, exclusive=0) [ 0.025] send PRIORITY frame <length=5, flags=0x00, stream_id=5> (dep_stream_id=0, weight=101, exclusive=0) [ 0.025] send PRIORITY frame <length=5, flags=0x00, stream_id=7> (dep_stream_id=0, weight=1, exclusive=0) [ 0.025] send PRIORITY frame <length=5, flags=0x00, stream_id=9> (dep_stream_id=7, weight=1, exclusive=0) [ 0.025] send PRIORITY frame <length=5, flags=0x00, stream_id=11> (dep_stream_id=3, weight=1, exclusive=0) [ 0.025] send HEADERS frame <length=67, flags=0x25, stream_id=13> ; END_STREAM | END_HEADERS | PRIORITY (padlen=0, dep_stream_id=11, weight=16, exclusive=0) ; Open new stream :method: GET :path: /servlettest-1.0-SNAPSHOT/hellotrailer :scheme: https :authority: 127.0.0.1:8443 accept: */* accept-encoding: gzip, deflate user-agent: nghttp2/1.31.1 [ 0.026] recv SETTINGS frame <length=24, flags=0x00, stream_id=0> (niv=4) [SETTINGS_HEADER_TABLE_SIZE(0x01):4096] [SETTINGS_MAX_FRAME_SIZE(0x05):16384] [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535] [SETTINGS_MAX_HEADER_LIST_SIZE(0x06):1048576] [ 0.026] send SETTINGS frame <length=0, flags=0x01, stream_id=0> ; ACK (niv=0) [ 0.026] recv SETTINGS frame <length=0, flags=0x01, stream_id=0> ; ACK (niv=0) [ 0.061] recv (stream_id=13) :status: 200 [ 0.061] recv (stream_id=13) trailers: hello [ 0.061] recv (stream_id=13) content-type: text/plain;charset=ISO-8859-1 [ 0.061] recv (stream_id=13, sensitive) content-length: 7 [ 0.061] recv (stream_id=13, sensitive) date: Fri, 03 Aug 2018 22:56:33 GMT [ 0.061] recv HEADERS frame <length=70, flags=0x04, stream_id=13> ; END_HEADERS (padlen=0) ; First response header payload[ 0.061] recv DATA frame <length=7, flags=0x01, stream_id=13> ; END_STREAM [ 0.061] send GOAWAY frame <length=8, flags=0x00, stream_id=0> (last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[]) Glassfish 5.0Tomcat 9.0.10服务器,则可以观察到预告片:

Jetty 10.0-SNAPSHOT

更新:问题已解决

这已被确认为秘密问题https://issues.jboss.org/projects/UNDERTOW/issues/UNDERTOW-1389 并已在undertow v 2.0.12.Final中修复。

0 个答案:

没有答案