hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r233342 - /jakarta/httpclient/trunk/coyote-httpconnector/src/java/org/apache/http/coyote/impl/HttpConnectionProcessor.java
Date Thu, 18 Aug 2005 18:05:47 GMT
Author: olegk
Date: Thu Aug 18 11:05:43 2005
New Revision: 233342

URL: http://svn.apache.org/viewcvs?rev=233342&view=rev
Log:
Rethrow SocketExceptions thrown when receiving HTTP request line as ConnectionClosedException

Modified:
    jakarta/httpclient/trunk/coyote-httpconnector/src/java/org/apache/http/coyote/impl/HttpConnectionProcessor.java

Modified: jakarta/httpclient/trunk/coyote-httpconnector/src/java/org/apache/http/coyote/impl/HttpConnectionProcessor.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/coyote-httpconnector/src/java/org/apache/http/coyote/impl/HttpConnectionProcessor.java?rev=233342&r1=233341&r2=233342&view=diff
==============================================================================
--- jakarta/httpclient/trunk/coyote-httpconnector/src/java/org/apache/http/coyote/impl/HttpConnectionProcessor.java
(original)
+++ jakarta/httpclient/trunk/coyote-httpconnector/src/java/org/apache/http/coyote/impl/HttpConnectionProcessor.java
Thu Aug 18 11:05:43 2005
@@ -30,7 +30,9 @@
 package org.apache.http.coyote.impl;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.InetAddress;
+import java.net.SocketException;
 import java.net.SocketTimeoutException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -203,7 +205,14 @@
     private void receiveHttpRequest() throws IOException, HttpException {
         LOG.debug("Waiting for incoming HTTP request");
         this.coyotereq.getRequestProcessor().setStage(Constants.STAGE_NEW);
-    	this.httpreq = this.conn.receiveRequest(this.params);
+        try {
+            this.httpreq = this.conn.receiveRequest(this.params);
+        } catch (SocketException ex) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug(ex.getMessage());
+            }
+            throw new ConnectionClosedException("Client closed connection");
+        }
         this.coyotereq.setStartTime(System.currentTimeMillis());
         LOG.debug("HTTP request header received");
         this.coyotereq.getRequestProcessor().setStage(Constants.STAGE_PREPARE);
@@ -268,8 +277,11 @@
 
     private void closeInputBuffer() throws IOException {
     	if (this.in != null) {
-    		while (this.in.getContent().read(this.inbuffer) != -1) {
+            InputStream instream = this.in.getContent();
+    		while (instream.read(this.inbuffer) != -1) {
+                // Consume leftover content
     		}
+            instream.close();            
     	}
     }
     



Mime
View raw message