Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP/2 push fails #10795

Closed
AdamBien opened this issue Jul 17, 2020 · 2 comments · Fixed by #10814
Closed

HTTP/2 push fails #10795

AdamBien opened this issue Jul 17, 2020 · 2 comments · Fixed by #10814
Labels
area/undertow kind/bug Something isn't working
Milestone

Comments

@AdamBien
Copy link
Contributor

HTTP/2 push causes a HTTP status 500.

Steps to reproduce the behavior:

@WebServlet("/push")
public class H2Servlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.newPushBuilder().path("/style.css").push();
        req.getRequestDispatcher("index.html").forward(req, resp);
    }
    
}
  1. Open the page in a browser.

Configuration

quarkus.http.ssl-port=443
quarkus.http.insecure-requests=redirect
quarkus.http.ssl.certificate.key-store-password=javaduke
quarkus.http.ssl.certificate.key-store-file=keystore.jks
quarkus.http.http2=true

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • openjdk version "11.0.7" and openjdk version "14.0.1"
  • Quarkus version or git rev: 1.6.0
  • Build tool: apache-maven-3.6.3

Additional context

io.netty.handler.codec.http2.Http2Exception: invalid header name [Referer]
at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:103)
at io.netty.handler.codec.http2.DefaultHttp2Headers$2.validateName(DefaultHttp2Headers.java:67)
at io.netty.handler.codec.http2.DefaultHttp2Headers$2.validateName(DefaultHttp2Headers.java:40)
at io.netty.handler.codec.DefaultHeaders.add(DefaultHeaders.java:295)
at io.vertx.core.http.impl.Http2ServerConnection.lambda$sendPush$1(Http2ServerConnection.java:174)
at io.vertx.core.http.impl.headers.VertxHttpHeaders.forEach(VertxHttpHeaders.java:250)
at io.vertx.core.http.impl.Http2ServerConnection.sendPush(Http2ServerConnection.java:174)
at io.vertx.core.http.impl.Http2ServerResponseImpl.push(Http2ServerResponseImpl.java:717)
at io.vertx.core.http.impl.Http2ServerResponseImpl.push(Http2ServerResponseImpl.java:707)
at io.undertow.vertx.VertxHttpExchange.pushResource(VertxHttpExchange.java:789)
at io.undertow.server.HttpServerExchange.pushResource(HttpServerExchange.java:1376)
at io.undertow.servlet.spec.PushBuilderImpl.push(PushBuilderImpl.java:204)
at airhacks.H2Servlet.doGet(H2Servlet.java:16)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:503)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:63)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:67)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:133)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:65)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:247)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:56)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:111)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:108)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$10$1.call(UndertowDeploymentRecorder.java:565)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:152)
at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:43)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$1.handleRequest(UndertowDeploymentRecorder.java:113)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:290)
at io.undertow.server.DefaultExchangeHandler.handle(DefaultExchangeHandler.java:18)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$6$1.run(UndertowDeploymentRecorder.java:396)
at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:231)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)

@AdamBien AdamBien added the kind/bug Something isn't working label Jul 17, 2020
@jaikiran
Copy link
Member

As per the RFC-7540 section 8.1.2[1], only lower case HTTP header names are allowed in the request. So it looks like the Undertow PushBuilderImpl needs to convert them to lower case before "pushing". The PushBuilderImpl is the one which adds this Referer header here[3]. Bit surprised this hasn't shown up before. Perhaps @stuartwdouglas would know more?

[1] https://tools.ietf.org/html/rfc7540#section-8.1.2
[2] https://github.com/undertow-io/undertow/blob/master/servlet/src/main/java/io/undertow/servlet/spec/PushBuilderImpl.java#L201
[3] https://github.com/undertow-io/undertow/blob/master/servlet/src/main/java/io/undertow/servlet/spec/PushBuilderImpl.java#L101

@stuartwdouglas
Copy link
Member

I don't think push is widely used, which is why this has not shown up before. It looks like Vert.x automatically handles this for normal headers, but not for server push.

quarkusio/quarkus-http#39

Should fix it.

gsmet added a commit to gsmet/quarkus that referenced this issue Jul 17, 2020
@gsmet gsmet added this to the 1.6.1.Final milestone Jul 20, 2020
gsmet added a commit to gsmet/quarkus that referenced this issue Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/undertow kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants