338807 Ignore content length in 1xx, 204, 304 responses

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2953 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-04-01 04:03:30 +00:00
parent 50541649ca
commit 35558971d9
3 changed files with 27 additions and 2 deletions

View File

@ -1,7 +1,8 @@
jetty-7.3.2-SNAPSHOT
jetty-7.4.0-SNAPSHOT
+ 324110 Added test harnesses for merging of QueryStrings.
+ 337685 Update websocket API in preparation for draft -07
+ 338627 HashSessionManager.getIdleSavePeriod returns milliseconds instead of seconds
+ 338807 Ignore content length in 1xx, 204, 304 responses
+ 338819 Externally control Deployment Manager application lifecycle
+ 339150 Validate client certificate when it is used for authentication
+ 339187 In the OSGi manifest of the jetty-all-server aggregate, mark javax.annotation as optional

View File

@ -514,7 +514,7 @@ public class HttpParser implements Parser
switch (ho)
{
case HttpHeaders.CONTENT_LENGTH_ORDINAL:
if (_contentLength != HttpTokens.CHUNKED_CONTENT)
if (_contentLength != HttpTokens.CHUNKED_CONTENT && _responseStatus!=304 && _responseStatus!=204 && (_responseStatus<100 || _responseStatus>=200))
{
try
{

View File

@ -453,6 +453,7 @@ public class HttpParserTest
assertTrue(headerCompleted);
assertTrue(messageCompleted);
}
@Test
public void testResponseParse4() throws Exception
{
@ -476,6 +477,29 @@ public class HttpParserTest
assertTrue(headerCompleted);
assertTrue(messageCompleted);
}
@Test
public void testResponse304WithContentLength() throws Exception
{
StringEndPoint io=new StringEndPoint();
io.setInput(
"HTTP/1.1 304 found\015\012"
+ "Content-Length: 10\015\012"
+ "\015\012");
ByteArrayBuffer buffer= new ByteArrayBuffer(4096);
SimpleBuffers buffers=new SimpleBuffers(buffer,null);
Handler handler = new Handler();
HttpParser parser= new HttpParser(buffers,io, handler);
parser.parse();
assertEquals("HTTP/1.1", f0);
assertEquals("304", f1);
assertEquals("found", f2);
assertEquals(null,_content);
assertTrue(headerCompleted);
assertTrue(messageCompleted);
}
private String _content;
private String f0;
private String f1;