Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public ParseState handleByte(byte b, HttpHeaderParser parser)
if(b == LF) {
// TODO: this is lax, is LFLF an OK terminator?
// that's all folks!
parser.headerFinished();
parser.parseFinished();
return parser.endState;
}
Expand Down
19 changes: 19 additions & 0 deletions src/test/java/org/archive/format/http/HttpResponseParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,23 @@ public void testParse() throws IOException {

}

public void testParseWithLf() throws IOException {

HttpResponseParser parser = new HttpResponseParser();
String message = "200 OK\nContent-Type: text/plain\n\nHi there";
try {
HttpResponse response =
parser.parse(new ByteArrayInputStream(message.getBytes(IAUtils.UTF8)));
assertNotNull(response);
HttpHeaders headers = response.getHeaders();
assertNotNull(headers);
assertEquals(1,headers.size());

} catch (HttpParseException e) {
e.printStackTrace();
fail();
}

}

}