Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363993 - EOFException parsing HEAD response in HttpTester
Summary: EOFException parsing HEAD response in HttpTester
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: other (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 7.5.x   Edit
Assignee: Jan Bartel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-16 22:35 EST by Ross A. Baker CLA
Modified: 2011-11-22 02:17 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross A. Baker CLA 2011-11-16 22:35:01 EST
Build Identifier: 

Using ServletTester, given the following response to a HEAD request:

----
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 22

----

Calling HttpTester.parse(response) results in an EOFException:

java.io.EOFException
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:309)
        at org.eclipse.jetty.http.HttpParser.parse(HttpParser.java:204)
        at org.eclipse.jetty.testing.HttpTester.parse(HttpTester.java:139)

The HttpTester does not know that this was a response to a HEAD call so it should not expect a body.  This worked through Jetty 7.5.1.  The breaking commit appears to be 12469af49929800e47d13dd71d5c46894f34f17a.  

The HttpParser has a flag for whether to expect a HEAD response, but HttpTester does not know whether it is a HEAD response or not.

Reproducible: Always

Steps to Reproduce:
    public void testParseHeadResponse() throws Exception {
        String response =
            "HTTP/1.1 200 OK\r\n"+
            "Content-Type: text/html\r\n"+
            "Content-Length: 22\r\n"+
            "\r\n";
        new HttpTester().parse(response);
    }
Comment 1 Jan Bartel CLA 2011-11-22 02:17:14 EST
Fixed for jetty-7.6.0.

added HttpTester.parse(String string, boolean isHeadResponse) and
HttpTester.parse(byte[] bytes, boolean isHeadResponse).