Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-5051

HTTP/1.1 400 No Host matches server name localhost

    XMLWordPrintable

Details

    Description

      Why would an http-client request fail with this 400 error when wget and firefox work fine?

      http-client output from WebConstraintsUnitTestCase.testGetAccess test:
      217 [main] DEBUG org.jboss.test.util.web.HttpUtils - Connecting to: http://getUser:getUserPass@localhost:8080/web-constraints/restricted/get-only
      221 [main] DEBUG org.jboss.test.util.web.HttpUtils - RequestURI: http://localhost:8080/web-constraints/restricted/get-only
      240 [main] DEBUG org.apache.commons.httpclient.HttpConnection - Open connection to localhost:8080
      244 [main] DEBUG httpclient.wire.header - >> "GET /web-constraints/restricted/get-only HTTP/1.1[\r][\n]"
      244 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - Adding Host request header
      259 [main] DEBUG httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
      260 [main] DEBUG httpclient.wire.header - >> "Host: localhost:8080[\r][\n]"
      261 [main] DEBUG httpclient.wire.header - >> "[\r][\n]"
      264 [main] DEBUG httpclient.wire.header - << "HTTP/1.1 400 No Host matches server name localhost[\r][\n]"
      266 [main] DEBUG httpclient.wire.header - << "Server: Apache-Coyote/1.1[\r][\n]"
      266 [main] DEBUG httpclient.wire.header - << "Transfer-Encoding: chunked[\r][\n]"
      266 [main] DEBUG httpclient.wire.header - << "Date: Wed, 05 Dec 2007 20:21:51 GMT[\r][\n]"
      266 [main] DEBUG httpclient.wire.header - << "Connection: close[\r][\n]"
      272 [main] DEBUG org.jboss.test.util.web.HttpUtils - responseCode=400, response=No Host matches server name localhost
      272 [main] WARN org.apache.commons.httpclient.HttpMethodBase - Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
      272 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - Buffering response body
      272 [main] DEBUG httpclient.wire.content - << "0"
      272 [main] DEBUG httpclient.wire.content - << "[\r]"
      272 [main] DEBUG httpclient.wire.content - << "[\n]"
      272 [main] DEBUG httpclient.wire.content - << "[\r]"
      272 [main] DEBUG httpclient.wire.content - << "[\n]"
      273 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - Should close connection in response to directive: close
      273 [main] DEBUG org.apache.commons.httpclient.HttpConnection - Releasing connection back to connection manager.
      273 [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - Default charset used: ISO-8859-1
      273 [main] DEBUG org.jboss.test.util.web.HttpUtils -

      wget output:
      [starksm@succubus testsuite]$ wget -S --http-user=getUser --http-passwd=getUserPass http://localhost:8080/web-constraints/restricted/get-only
      -12:26:36- http://localhost:8080/web-constraints/restricted/get-only
      => `get-only'
      Resolving localhost... 127.0.0.1
      Connecting to localhost|127.0.0.1|:8080... connected.
      HTTP request sent, awaiting response...
      HTTP/1.1 200 OK
      Server: Apache-Coyote/1.1
      Pragma: No-cache
      Cache-Control: no-cache
      Expires: Wed, 31 Dec 1969 16:00:00 PST
      X-Powered-By: Servlet 2.5; JBoss-5.0.0.Alpha (build: CVSTag=HEAD date=200606261952)/Tomcat-6.0
      Content-Length: 79
      Date: Wed, 05 Dec 2007 20:26:36 GMT
      Connection: keep-alive
      Length: 79

      100%[===================================>] 79 -.-K/s

      12:26:36 (6.28 MB/s) - `get-only' saved [79/79]

      Attachments

        Activity

          People

            starksm64 Scott Stark (Inactive)
            starksm64 Scott Stark (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: