hgomez      01/03/22 01:58:29

  Modified:    src/share/org/apache/tomcat/modules/server
                        Http10Interceptor.java
  Log:
  Fix BUG #1006, by adding socket timeout
  Default is 300s (5mn) but you could configure it in server.xml
  timeout attribute (in second).
  
  Revision  Changes    Path
  1.16      +14 -0     
jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Http10Interceptor.java
  
  Index: Http10Interceptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Http10Interceptor.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Http10Interceptor.java    2001/03/02 04:49:25     1.15
  +++ Http10Interceptor.java    2001/03/22 09:58:28     1.16
  @@ -94,6 +94,8 @@
   public class Http10Interceptor extends PoolTcpConnector
       implements  TcpConnectionHandler
   {
  +     private int     timeout = 300000;       // 5 minutes as in Apache HTTPD server
  +
       public Http10Interceptor() {
        super();
       }
  @@ -105,6 +107,10 @@
       }
   
       // -------------------- Attributes --------------------
  +    public void setTimeout( int timeouts ) {
  +    timeout = timeouts * 1000;
  +    }
  +
       // -------------------- Handler implementation --------------------
       public void setServer( Object o ) {
        this.cm=(ContextManager)o;
  @@ -131,6 +137,7 @@
            resA=(HttpResponse)thData[1];
   
            socket=connection.getSocket();
  +             socket.setSoTimeout(timeout);
   
            reqA.setSocket( socket );
            resA.setSocket( socket );
  @@ -149,6 +156,13 @@
            log( "SocketException reading request, ignored", null,
                 Log.INFORMATION);
            log( "SocketException reading request:", e, Log.DEBUG);
  +     }
  +     catch (java.io.InterruptedIOException ioe) {
  +             // We have armed a timeout on read as does apache httpd server.
  +             // Just to avoid staying with inactive connection
  +             // BUG#1006
  +             ioe.printStackTrace();
  +             log( "Timeout reading request, aborting", ioe, Log.ERROR);
        }
        catch (java.io.IOException e) {
            // IOExceptions are normal 
  
  
  

Reply via email to