From: Jules G. <jul...@us...> - 2002-04-14 21:12:30
|
User: jules_gosnell Date: 02/04/14 14:12:29 Modified: jetty/src/main/org/mortbay/http HttpConnection.java Log: Greg's fix for "Frequently Hanging On Http Requests" Revision Changes Path 1.9 +7 -10 contrib/jetty/src/main/org/mortbay/http/HttpConnection.java Index: HttpConnection.java =================================================================== RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/mortbay/http/HttpConnection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- HttpConnection.java 10 Apr 2002 19:32:32 -0000 1.8 +++ HttpConnection.java 14 Apr 2002 21:12:29 -0000 1.9 @@ -1,6 +1,6 @@ // ======================================================================== // Copyright (c) 1999 Mort Bay Consulting (Australia) Pty. Ltd. -// $Id: HttpConnection.java,v 1.8 2002/04/10 19:32:32 jules_gosnell Exp $ +// $Id: HttpConnection.java,v 1.9 2002/04/14 21:12:29 jules_gosnell Exp $ // ======================================================================== package org.mortbay.http; @@ -35,7 +35,7 @@ * * @see HttpListener * @see HttpServer - * @version $Id: HttpConnection.java,v 1.8 2002/04/10 19:32:32 jules_gosnell Exp $ + * @version $Id: HttpConnection.java,v 1.9 2002/04/14 21:12:29 jules_gosnell Exp $ * @author Greg Wilkins (gregw) */ public class HttpConnection @@ -941,9 +941,7 @@ { try{ // Read remaining input - while(_inputStream.available()>0 && - (_inputStream.skip(4096)>0 || - _inputStream.read()>=0)); + while(_inputStream.skip(4096)>0 || _inputStream.read()>=0); } catch(IOException e) { @@ -974,20 +972,19 @@ } catch(IOException e) {exception(e);} } - else + else if (_response!=null) // There was a request { // half hearted attempt to eat any remaining input try{ - while(_inputStream.available()>0 && - (_inputStream.skip(4096)>0 ||_inputStream.read()>=0)); + if (_inputStream.getContentLength()>0) + while(_inputStream.skip(4096)>0 ||_inputStream.read()>=0); _inputStream.resetStream(); } catch(IOException e){Code.ignore(e);} // commit non persistent try{ - if (_response!=null) - _response.commit(); + _response.commit(); _outputStream.flush(); bytes_written=_outputStream.getBytesWritten(); _outputStream.close(); |