httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject cvs commit: httpd-proxy/module-2.0 mod_proxy.h proxy_http.c
Date Wed, 11 Apr 2001 23:07:25 GMT
minfrin     01/04/11 16:07:25

  Modified:    .        CHANGES STATUS
               module-2.0 mod_proxy.h proxy_http.c
  Log:
  Fixed some thread-safety issues with the HTTP proxy in mod_proxy.
  
  Revision  Changes    Path
  1.21      +3 -0      httpd-proxy/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/CHANGES,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- CHANGES	2001/04/09 21:49:17	1.20
  +++ CHANGES	2001/04/11 23:07:16	1.21
  @@ -1,6 +1,9 @@
   
   mod_proxy changes for 2.0.15 current
   
  +  *) Fixed some thread-safety issues with the HTTP proxy in mod_proxy.
  +     [Graham Leggett <minfrin@sharp.fm>]
  +
     *) PASV FTP works now.
        [Graham Leggett <minfrin@sharp.fm>]
   
  
  
  
  1.13      +13 -14    httpd-proxy/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/STATUS,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- STATUS	2001/04/10 19:04:00	1.12
  +++ STATUS	2001/04/11 23:07:17	1.13
  @@ -1,5 +1,5 @@
   HTTPD PROXY STATUS:
  -Last modified at [$Date: 2001/04/10 19:04:00 $]
  +Last modified at [$Date: 2001/04/11 23:07:17 $]
   
   Release:
   
  @@ -29,18 +29,18 @@
   
   2.0
   
  -    * HTTP - currently almost works!
  -      About 10% of proxied connections break while downloading the entity
  -      body from the remote server with the following error logged somewhere
  -      in the filter stack:
  -
  -        [error] (9)Bad file descriptor: apr_bucket_read
  -
  -      These broken connections usually show up as broken graphics inside
  -      webpages.
  -      Someone who understands filters needs to take a look at this.
  +    * HTTP - currently almost almost works! (we are so close)
   
  +    At add times the fllowing error is finding it's way into the
  +    error log:
   
  +      [error] (32)Broken pipe: core_output_filter: writing data to the network
  +
  +    It happens after the body send is complete - it looks like we
  +    are trying to send data after the request, but the browser
  +    has closed the connection.
  +
  +
   RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP:
   
   1.3.x
  @@ -84,8 +84,7 @@
   
   2.0
   
  -    * finish conversion of proxy_connect.c and proxy_ftp.c
  -      (done - but currently still broken)
  +    * finish conversion of proxy_ftp.c
   
   2.0+
   
  @@ -99,7 +98,7 @@
   
   2.0
   
  -    * mod_proxy.html - updated for v2.0
  +    * none
   
   2.0+
   
  
  
  
  1.45      +6 -0      httpd-proxy/module-2.0/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/mod_proxy.h,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- mod_proxy.h	2001/04/10 20:44:15	1.44
  +++ mod_proxy.h	2001/04/11 23:07:20	1.45
  @@ -193,6 +193,12 @@
   };
   
   typedef struct {
  +    conn_rec *connection;
  +    char *hostname;
  +    apr_port_t port;
  +} proxy_conn_rec;
  +
  +typedef struct {
           float cache_completion; /* completion percentage */
           int content_length; /* length of the content */
   } proxy_completion;
  
  
  
  1.56      +29 -21    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.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- proxy_http.c	2001/04/10 21:31:10	1.55
  +++ proxy_http.c	2001/04/11 23:07:21	1.56
  @@ -206,6 +206,15 @@
       apr_bucket *e;
       apr_bucket_brigade *bb = apr_brigade_create(p);
   
  +    proxy_conn_rec *backend =
  +    (proxy_conn_rec *) ap_get_module_config(c->conn_config, &proxy_module);
  +    if (!backend) {
  +	backend = ap_pcalloc(c->pool, sizeof(proxy_conn_rec));
  +	backend->connection = NULL;
  +	backend->hostname = NULL;
  +	backend->port = 0;
  +	ap_set_module_config(c->conn_config, &proxy_module, backend);
  +    }
   
       /*
        * Step One: Determine Who To Connect To
  @@ -285,11 +294,11 @@
        * open, or whether it should be closed and a new socket created.
        */
       /* see memory note above */
  -    if (conf->connection) {
  -	if ((conf->id == c->id) &&
  -	    (conf->connectport == connectport) &&
  -	    (conf->connectname) &&
  -            (!apr_strnatcasecmp(conf->connectname,connectname))) {
  +    if (backend->connection) {
  +	if ((backend->connection->id == c->id) &&
  +	    (backend->port == connectport) &&
  +	    (backend->hostname) &&
  +            (!apr_strnatcasecmp(backend->hostname,connectname))) {
   	    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
   			 "proxy: keepalive address match (keep original socket)");
           }
  @@ -297,20 +306,20 @@
               ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
   			 "proxy: keepalive address mismatch / connection has"
   			 " changed (close old socket (%s/%s, %d/%d))", 
  -			 connectname, conf->connectname, 
  -			 connectport, conf->connectport);
  -            apr_socket_close(conf->connection->client_socket);
  -            conf->connection = NULL;
  +			 connectname, backend->hostname, 
  +			 connectport, backend->port);
  +            apr_socket_close(backend->connection->client_socket);
  +            backend->connection = NULL;
   	}
       }
   
       /* get a socket - either a keepalive one, or a new one */
       new = 1;
  -    if ((conf->id == c->id) && (conf->connection)) {
  +    if ((backend->connection) && (backend->connection->id == c->id))
{
   
   	/* use previous keepalive socket */
  -	sock = conf->connection->client_socket;
  -	origin = conf->connection;
  +	origin = backend->connection;
  +	sock = origin->client_socket;
   	new = 0;
   
   	/* reset the connection filters */
  @@ -322,7 +331,7 @@
       if (new) {
   
   	/* create a new socket */
  -	conf->connection = NULL;
  +	backend->connection = NULL;
   
   	/* see memory note above */
   	if ((apr_socket_create(&sock, APR_INET, SOCK_STREAM, c->pool)) != APR_SUCCESS)
{
  @@ -389,7 +398,7 @@
   	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
   		     "proxy: socket is connected");
   
  -	/* the socket is now open, create a new downstream connection */
  +	/* the socket is now open, create a new backend server connection */
   	origin = ap_new_connection(c->pool, r->server, sock, r->connection->id);
   	if (!origin) {
   	    /* the peer reset the connection already; ap_new_connection() 
  @@ -399,10 +408,9 @@
   	    apr_socket_close(sock);
   	    return HTTP_INTERNAL_SERVER_ERROR;
   	}
  -	conf->id = r->connection->id;
  -	conf->connectname = connectname;
  -	conf->connectport = connectport;
  -	conf->connection = origin;
  +	backend->connection = origin;
  +	backend->hostname = apr_pstrdup(c->pool, connectname);
  +	backend->port = connectport;
   
   	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
   		     "proxy: connection complete");
  @@ -581,7 +589,7 @@
   
       if (APR_SUCCESS != (rv = ap_proxy_string_read(origin, bb, buffer, sizeof(buffer))))
{
   	apr_socket_close(sock);
  -	conf->connection = NULL;
  +	backend->connection = NULL;
   	ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
   	     "proxy: error reading status line from remote server %s",
   	     connectname);
  @@ -602,7 +610,7 @@
           /* If not an HTTP/1 message or if the status line was > 8192 bytes */
   	else if ((buffer[5] != '1') || (len >= sizeof(buffer)-1)) {
   	    apr_socket_close(sock);
  -	    conf->connection = NULL;
  +	    backend->connection = NULL;
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   				 apr_pstrcat(p, "Corrupt status line returned by remote server: ", buffer, NULL));
   	}
  @@ -752,7 +760,7 @@
        */
       if (close || (r->proto_num < HTTP_VERSION(1,1))) {
           apr_socket_close(sock);
  -	conf->connection = NULL;
  +	backend->connection = NULL;
       }
   
       return OK;
  
  
  

Mime
View raw message