I suggest you to set the timeout in HttpConnectionHandler :

        //      System.out.println("New Connection");
        try {
            // XXX - Add workarounds for the fact that the underlying
            // serverSocket.accept() call can now time out.  This whole
            // architecture needs some serious review.
            if (connection == null)
                return;
            //      System.out.print("1");
            socket=connection.getSocket();
            if (socket == null)
                return;

            socket.setSoTimeout(15000); // 15s Timeout - must be suffisant
for http 1.0 request

            //      System.out.print("2");
            InputStream in=socket.getInputStream();
            OutputStream out=socket.getOutputStream();


Apache server use 300s (5mn) which is fine for HTTP 1.1 keep-alive
connection. In http 1.0 connection 15s must be suffisant between accept()
and read. The browser must'nt spend more than 15 seconds between to packet
emission (even 1 byte packet).... IMHO. 

We must forward the question to Apache gurus. I'll contact Ryan Bloom
for more info ....


>-----Original Message-----
>From: GOMEZ Henri 
>Sent: Wednesday, March 21, 2001 12:19 AM
>To: '[EMAIL PROTECTED]'
>Subject: RE: cvs commit:
>jakarta-tomcat/src/share/org/apache/tomcat/service PoolTcpEndpoint.java
>
>
>You we're just too fast ;-)
>
>What happen to ajpx connector with that patch ?
>
>If ajp12 is a short life connection, ajp13 need permanent connection !
>The setTimeOut in that case will broke it ;(
>
>Si la fortune vient en dormant, ça n'empêche pas les 
>emmerdements de venir au réveil.
>-- Pierre Dac
>
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, March 20, 2001 11:21 PM
>>To: [EMAIL PROTECTED]
>>Subject: cvs commit: 
>jakarta-tomcat/src/share/org/apache/tomcat/service
>>PoolTcpEndpoint.java
>>
>>
>>marcsaeg    01/03/20 14:21:28
>>
>>  Modified:    src/share/org/apache/tomcat/service Tag: tomcat_32
>>                        PoolTcpEndpoint.java
>>  Log:
>>  Set the SO_TIMEOUT value on the accepted socket.  This 
>prevents a DOS
>>  attacked by clients opening connections and never sending any data.
>>  
>>  The default timeout was also increased from 1 second to 5 
>>minutes (which
>>  is the default value used by Apache httpd).
>>  
>>  PR:  1006
>>  Submitted by:       [EMAIL PROTECTED] (Tal Dayan)
>>  
>>  Revision  Changes    Path
>>  No                   revision
>>  
>>  
>>  No                   revision
>>  
>>  
>>  1.8.2.4   +9 -6      
>>jakarta-tomcat/src/share/org/apache/tomcat/service/Attic/PoolTc
>>pEndpoint.java
>>  
>>  Index: PoolTcpEndpoint.java
>>  ===================================================================
>>  RCS file: 
>>/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/At
>>tic/PoolTcpEndpoint.java,v
>>  retrieving revision 1.8.2.3
>>  retrieving revision 1.8.2.4
>>  diff -u -r1.8.2.3 -r1.8.2.4
>>  --- PoolTcpEndpoint.java    2000/11/17 23:19:55     1.8.2.3
>>  +++ PoolTcpEndpoint.java    2001/03/20 22:21:25     1.8.2.4
>>  @@ -1,7 +1,7 @@
>>   /*
>>  - * $Header: 
>>/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/At
>>tic/PoolTcpEndpoint.java,v 1.8.2.3 2000/11/17 23:19:55 craigmcc Exp $
>>  - * $Revision: 1.8.2.3 $
>>  - * $Date: 2000/11/17 23:19:55 $
>>  + * $Header: 
>>/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/At
>>tic/PoolTcpEndpoint.java,v 1.8.2.4 2001/03/20 22:21:25 marcsaeg Exp $
>>  + * $Revision: 1.8.2.4 $
>>  + * $Date: 2001/03/20 22:21:25 $
>>    *
>>    * 
>>====================================================================
>>    *
>>  @@ -98,7 +98,7 @@
>>       private static StringManager sm = 
>>StringManager.getManager("org.apache.tomcat.service");
>>   
>>       private static final int BACKLOG = 100;
>>  -    private static final int TIMEOUT = 1000;
>>  +    private static final int TIMEOUT = 300000;  // 5 minutes
>>   
>>       private boolean isPool = true;
>>   
>>  @@ -290,8 +290,11 @@
>>                                  accepted = null;
>>                              }
>>                              }
>>  -                   if( factory != null && accepted != null)
>>  -                       factory.initSocket( accepted );
>>  +
>>  +                    if(accepted != null)
>>  +                        accepted.setSoTimeout(timeout);
>>  +            if( factory != null && accepted != null)
>>  +                factory.initSocket( accepted );
>>                      }
>>                  }
>>          
>>  
>>  
>>  
>>
>

Reply via email to