Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-8946

Invalid response code for empty host value in request

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 7.1.0.DR12
    • Undertow
    • None

      In case of sending request with empty host field:

      GET /redirect-https-test/ HTTP/1.1 [ host: , Connection: ....])

      server return response 500 Internal Server Error instead 400 Bad Request which is against HTTP/1.1 spec RFC (5.4 Host section)

      Additional info

      There is different behavior which depends on require-host-http11 option

      When require-host-http11 options set as TRUE, it does works as expected:

      curl -I --header 'Host: ' http://127.0.0.1:8080
      HTTP/1.1 400 Bad Request
      Content-Length: 0
      Connection: close

      curl -I --header 'Host: ' http://127.0.0.1:8080/jbeap8946_dep/index.html
      HTTP/1.1 400 Bad Request
      Content-Length: 0
      Connection: close

      With require-host-http11 options set as FALSE:

      Simple url. Expected behavior.

      curl -I --header 'Host: ' http://127.0.0.1:8080/
      HTTP/1.1 200 OK
      Connection: keep-alive
      Last-Modified: Sat, 29 Jul 2017 08:38:24 GMT
      X-Powered-By: Undertow/1
      Server: JBoss-EAP/7
      Content-Length: 1517
      Content-Type: text/html
      Accept-Ranges: bytes
      Date: Mon, 14 Aug 2017 06:27:04 GMT

      But in case with redirect(HTTP is redirected to HTTPS)

      curl -I --header 'Host: ' http://127.0.0.1:8080/jbeap8946_dep/index.html
      HTTP/1.1 500 Internal Server Error
      Connection: keep-alive
      X-Powered-By: Undertow/1
      Server: JBoss-EAP/7
      Content-Length: 86
      Content-Type: text/html
      Date: Mon, 14 Aug 2017 06:26:42 GMT

      there is exception during parsing URI.

      08:26:42,202 ERROR [io.undertow.request] (default task-1) UT005001: An exception occurred processing the request: java.net.URISyntaxException: Expected hostname at index 8: https://:8443/jbeap8946_dep/index.html
      at java.net.URI$Parser.fail(URI.java:2848)
      at java.net.URI$Parser.failExpecting(URI.java:2854)
      at java.net.URI$Parser.parseHostname(URI.java:3390)
      at java.net.URI$Parser.parseServer(URI.java:3236)
      at java.net.URI$Parser.parseAuthority(URI.java:3155)
      at java.net.URI$Parser.parseHierarchical(URI.java:3097)
      at java.net.URI$Parser.parse(URI.java:3053)
      at java.net.URI.<init>(URI.java:673)
      at io.undertow.security.handlers.SinglePortConfidentialityHandler.getRedirectURI(SinglePortConfidentialityHandler.java:64)
      at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.getRedirectURI(ServletConfidentialityConstraintHandler.java:83)
      at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:49)
      at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
      at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
      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 org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
      at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
      at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
      at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1506)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1506)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1506)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1506)
      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
      at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
      at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
      at io.undertow.server.Connectors.executeRootHandler(Connectors.java:332)
      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:812)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)

              rhn-support-iweiss Ingo Weiss
              ktriscik@redhat.com Kamil Triscik (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: