tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject svn commit: r887093 - in /tomcat/trunk/modules/tomcat-lite: java/org/apache/tomcat/lite/http/ test/org/apache/tomcat/lite/http/
Date Fri, 04 Dec 2009 08:03:19 GMT
Author: costin
Date: Fri Dec  4 08:03:16 2009
New Revision: 887093

URL: http://svn.apache.org/viewvc?rev=887093&view=rev
Log:
Added the tests - but then tried few more changes and broke them again. Fix it back.

Modified:
    tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Http11Connection.java
    tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpConnector.java
    tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpChannelInMemoryTest.java
    tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpsTest.java

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Http11Connection.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Http11Connection.java?rev=887093&r1=887092&r2=887093&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Http11Connection.java
(original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Http11Connection.java
Fri Dec  4 08:03:16 2009
@@ -64,11 +64,12 @@
     
     public Http11Connection(HttpConnector httpConnector) {
         this.httpConnector = httpConnector;
-        debug = true; //httpConnector.debug;
+        if (httpConnector != null) {
+            debug = httpConnector.debugHttp;
+        }
     }
 
     public void beforeRequest() {
-        log.info("Before request");
         activeHttp = null;
         endSent = false;
         keepAlive = true;
@@ -269,8 +270,9 @@
     }
 
     void closeStreamOnEnd(String cause) {
-        if (debug) 
+        if (debug) {
             log.info("Not reusing connection because: " + cause);
+        }
         keepAlive = false;
     }
 
@@ -411,7 +413,7 @@
             } 
 
         } else {
-            receiveBodyState.noBody = http.getResponse().hasBody();
+            receiveBodyState.noBody = !http.getResponse().hasBody();
             
             updateKeepAlive(http.getResponse().getMimeHeaders(), false);
             
@@ -751,6 +753,12 @@
                 http.getRequest());
 
 
+        CBuffer method = http.getRequest().method();
+        if (method.equals("GET") || method.equals("HEAD")) {
+            // TODO: add the others
+            sendBodyState.noBody = true;
+        }
+        
         // 1.0: The presence of an entity body in a request is signaled by 
         // the inclusion of a Content-Length header field in the request 
         // message headers. HTTP/1.0 requests containing an entity body 
@@ -953,13 +961,14 @@
         // ( like 'upgrade')
 
         CBuffer value = headers.getHeader(CONNECTION);
-        String conHeader = (value == null) ? null : value.toString();
-        if (conHeader != null) {
-            if (CLOSE.equalsIgnoreCase(conHeader)) {
+        // TODO: split it by space
+        if (value != null) {
+            value.toLower();
+            if (value.indexOf(CLOSE) >= 0) {
                 // 1.1 ( but we accept it for 1.0 too )
                 closeStreamOnEnd("connection close");
             }
-            if (http10 && conHeader.indexOf(KEEPALIVE_S) < 0) {
+            if (http10 && value.indexOf(KEEPALIVE_S) < 0) {
                 // Keep-Alive required for http/1.0
                 closeStreamOnEnd("connection != keep alive");
             }
@@ -1362,6 +1371,7 @@
             chunked = false;
             remaining = 0; 
             contentLength = -1;
+            noBody = false;
         }
         public boolean isContentDelimited() {
             return chunked || contentLength >= 0;

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpConnector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpConnector.java?rev=887093&r1=887092&r2=887093&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpConnector.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpConnector.java Fri
Dec  4 08:03:16 2009
@@ -15,10 +15,8 @@
 import java.util.logging.Logger;
 
 import org.apache.tomcat.lite.http.HttpChannel.HttpService;
-import org.apache.tomcat.lite.http.SpdyConnection.SpdyConnectionManager;
 import org.apache.tomcat.lite.io.BBuffer;
 import org.apache.tomcat.lite.io.DumpChannel;
-import org.apache.tomcat.lite.io.BBucket;
 import org.apache.tomcat.lite.io.IOBuffer;
 import org.apache.tomcat.lite.io.IOChannel;
 import org.apache.tomcat.lite.io.IOConnector;
@@ -376,7 +374,6 @@
     private class AcceptorCallback implements IOConnector.ConnectedCallback {
         @Override
         public void handleConnected(IOChannel accepted) throws IOException {
-            System.err.println("ACCEPTED " + accepted);
             handleAccepted(accepted);
         }
     }

Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpChannelInMemoryTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpChannelInMemoryTest.java?rev=887093&r1=887092&r2=887093&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpChannelInMemoryTest.java
(original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpChannelInMemoryTest.java
Fri Dec  4 08:03:16 2009
@@ -198,7 +198,7 @@
         MultiMap headers = http.getRequest().getMimeHeaders();
         CBuffer cookie = headers.getHeader("Cookie");
         CBuffer conn = headers.getHeader("Connection");
-        assertEquals(conn.toString(), "Close");
+        assertEquals(conn.toString(), "close");
         assertEquals(cookie.toString(), "1234 456");
         
         assertEquals(http.conn.headRecvBuf.toString(), 

Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpsTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpsTest.java?rev=887093&r1=887092&r2=887093&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpsTest.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpsTest.java Fri Dec
 4 08:03:16 2009
@@ -120,6 +120,7 @@
         SslConnector sslCon = new SslConnector();
         httpClient = new HttpConnector(sslCon);
         HttpRequest client = httpClient.request("www.google.com", 443);
+        client.getHttpChannel().setIOTimeout(2000);
         client.setRequestURI("/accounts/ServiceLogin");
         client.send();
         



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message