billbarker    02/04/25 18:50:32

  Modified:    http11/src/java/org/apache/coyote/http11
                        Http11Processor.java Http11Protocol.java
  Log:
  Fix problem with soTimeout.
  
  The makes Coyote act like httpd with respect to soTimeout (which is what it was 
trying to do before, but only worked on HTTP/1.0 connectors).
  
  Revision  Changes    Path
  1.30      +25 -0     
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Http11Processor.java      18 Apr 2002 09:11:44 -0000      1.29
  +++ Http11Processor.java      26 Apr 2002 01:50:32 -0000      1.30
  @@ -232,6 +232,11 @@
        */
       protected String remoteHost = null;
   
  +    /**
  +     * Maximum timeout on uploads.
  +     */
  +    protected int timeout = 300000;   // 5 minutes as in Apache HTTPD server
  +
       // --------------------------------------------------------- Public Methods
   
   
  @@ -327,6 +332,18 @@
           this.socket = socket;
       }
   
  +    /**
  +     * Set the upload timeout.
  +     */
  +    public void setTimeout( int timeouts ) {
  +        timeout = timeouts * 1000;
  +    }
  +    /**
  +     * Get the upload timeout.
  +     */
  +    public int getTimeout() {
  +        return timeout;
  +    }
   
       /**
        * Process pipelined HTTP requests using the specified input and output
  @@ -354,10 +371,18 @@
           keepAlive = true;
   
           int keepAliveLeft = maxKeepAliveRequests;
  +        int soTimeout = socket.getSoTimeout();
  +        boolean keptAlive = false;
  +        socket.setSoTimeout(timeout);
   
           while (started && !error && keepAlive) {
               try {
  +                if( keptAlive && soTimeout > 0 ) {
  +                    socket.setSoTimeout(soTimeout);
  +                }
                   inputBuffer.parseRequestLine();
  +                keptAlive = false;
  +                socket.setSoTimeout(timeout);
                   inputBuffer.parseHeaders();
               } catch (IOException e) {
                   error = true;
  
  
  
  1.9       +0 -5      
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java
  
  Index: Http11Protocol.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Http11Protocol.java       17 Apr 2002 17:31:37 -0000      1.8
  +++ Http11Protocol.java       26 Apr 2002 01:50:32 -0000      1.9
  @@ -164,7 +164,6 @@
       protected String sslImplementationName=null;
   
       private int maxKeepAliveRequests=100; // as in Apache HTTPD server
  -    private int      timeout = 300000;       // 5 minutes as in Apache HTTPD server
       private String reportedname;
       private int socketCloseDelay=-1;
   
  @@ -289,9 +288,6 @@
        return (ServerSocketFactory)chC.newInstance();
       }
   
  -    public void setTimeout( int timeouts ) {
  -     timeout = timeouts * 1000;
  -    }
       public void setReportedname( String reportedName) {
        reportedname = reportedName;
       }
  @@ -338,7 +334,6 @@
                       ((ActionHook) processor).action(ActionCode.ACTION_START, null);
                   }
                   socket=connection.getSocket();
  -                socket.setSoTimeout(proto.timeout);
                   
                   InputStream in = socket.getInputStream();
                   OutputStream out = socket.getOutputStream();
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to