[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-commit] r2953 - in jetty/trunk: . jetty-http/src/main/java/org/eclipse/jetty/http jetty-http/src/test/java/org/eclipse/jetty/http

Author: gwilkins
Date: 2011-04-01 00:03:30 -0400 (Fri, 01 Apr 2011)
New Revision: 2953

Modified:
   jetty/trunk/VERSION.txt
   jetty/trunk/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java
   jetty/trunk/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java
Log:
338807 Ignore content length in 1xx, 204, 304 responses

Modified: jetty/trunk/VERSION.txt
===================================================================
--- jetty/trunk/VERSION.txt	2011-04-01 03:42:09 UTC (rev 2952)
+++ jetty/trunk/VERSION.txt	2011-04-01 04:03:30 UTC (rev 2953)
@@ -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

Modified: jetty/trunk/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java
===================================================================
--- jetty/trunk/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java	2011-04-01 03:42:09 UTC (rev 2952)
+++ jetty/trunk/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java	2011-04-01 04:03:30 UTC (rev 2953)
@@ -514,7 +514,7 @@
                                     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
                                                 {

Modified: jetty/trunk/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java
===================================================================
--- jetty/trunk/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java	2011-04-01 03:42:09 UTC (rev 2952)
+++ jetty/trunk/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java	2011-04-01 04:03:30 UTC (rev 2953)
@@ -453,6 +453,7 @@
         assertTrue(headerCompleted);
         assertTrue(messageCompleted);
     }
+    
     @Test
     public void testResponseParse4() throws Exception
     {
@@ -476,6 +477,29 @@
         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;