httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From orlikow...@apache.org
Subject cvs commit: httpd-proxy/module-2.0 proxy_http.c
Date Fri, 17 Aug 2001 01:38:16 GMT
orlikowski    01/08/16 18:38:16

  Modified:    module-2.0 proxy_http.c
  Log:
  Fix behavior in the event that a socket is closed.
  Submitted by: barbee@veribox.net
  Reviewed by: orlikowski@apache.org
  
  Revision  Changes    Path
  1.90      +16 -2     httpd-proxy/module-2.0/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/proxy_http.c,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- proxy_http.c	2001/08/15 18:36:05	1.89
  +++ proxy_http.c	2001/08/17 01:38:16	1.90
  @@ -309,6 +309,10 @@
       /* get a socket - either a keepalive one, or a new one */
       new = 1;
       if ((backend->connection) && (backend->connection->id == c->id))
{
  +        int buffer_len = 1;
  +        char test_buffer[buffer_len];
  +        apr_status_t socket_status;
  +        apr_int32_t current_timeout;
   
           /* use previous keepalive socket */
           *origin = backend->connection;
  @@ -318,8 +322,18 @@
           /* reset the connection filters */
           ap_proxy_reset_output_filters(*origin);
   
  -        /* XXX FIXME: If the socket has since closed, change new to 1 so
  -         * a new socket is opened */
  +        /* save timeout */
  +        apr_getsocketopt(p_conn->sock, APR_SO_TIMEOUT, &current_timeout);
  +        /* set no timeout */
  +        apr_setsocketopt(p_conn->sock, APR_SO_TIMEOUT, 0);
  +        socket_status = apr_recv(p_conn->sock, test_buffer, &buffer_len);
  +        /* put back old timeout */
  +        apr_setsocketopt(p_conn->sock, APR_SO_TIMEOUT, current_timeout);
  +        if ( APR_STATUS_IS_EOF(socket_status) ) {
  +            ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL,
  +                         "proxy: HTTP: previous connection is closed");
  +            new = 1;
  +        }
       }
       if (new) {
   
  
  
  

Mime
View raw message