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.c mod_proxy.h proxy_ftp.c proxy_http.c proxy_util.c
Date Tue, 10 Apr 2001 19:52:42 GMT
minfrin     01/04/10 12:52:42

  Modified:    module-2.0 mod_proxy.c mod_proxy.h proxy_ftp.c proxy_http.c
                        proxy_util.c
  Log:
  We now keep the entire conn_rec across downstream keepalives, not
  just the socket.
  Made the "keepalive mismatch" message more accurate.
  
  Revision  Changes    Path
  1.38      +2 -1      httpd-proxy/module-2.0/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/mod_proxy.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- mod_proxy.c	2001/04/10 12:06:49	1.37
  +++ mod_proxy.c	2001/04/10 19:52:38	1.38
  @@ -410,7 +410,8 @@
       ps->noproxies = ap_make_array(p, 10, sizeof(struct noproxy_entry));
       ps->dirconn = ap_make_array(p, 10, sizeof(struct dirconn_entry));
       ps->allowed_connect_ports = ap_make_array(p, 10, sizeof(int));
  -    ps->client_socket = NULL;
  +/*    ps->client_socket = NULL;*/
  +    ps->connection = NULL;
       ps->domain = NULL;
       ps->viaopt = via_off; /* initially backward compatible with 1.3.1 */
       ps->viaopt_set = 0; /* 0 means default */
  
  
  
  1.43      +2 -1      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.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- mod_proxy.h	2001/04/10 12:06:49	1.42
  +++ mod_proxy.h	2001/04/10 19:52:39	1.43
  @@ -170,7 +170,8 @@
       long id;
       const char *connectname;
       apr_port_t connectport;
  -    apr_socket_t *client_socket;
  +/*    apr_socket_t *client_socket;*/
  +    conn_rec *connection;
       const char *domain;		/* domain name to use in absence of a domain name in the request
*/
       int req;			/* true if proxy requests are enabled */
       char req_set;
  
  
  
  1.40      +11 -62    httpd-proxy/module-2.0/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/proxy_ftp.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- proxy_ftp.c	2001/04/10 00:13:56	1.39
  +++ proxy_ftp.c	2001/04/10 19:52:39	1.40
  @@ -488,7 +488,7 @@
   	 * because it has the lifetime of the connection.  The other allocations
   	 * are temporary and can be tossed away any time.
   	 */
  -	user = ap_getword_nulls (r->pool, &password, ':');
  +	user = ap_getword_nulls (r->connection->pool, &password, ':');
   	r->ap_auth_type = "Basic";
   	r->user = r->parsed_uri.user = user;
       }
  @@ -555,7 +555,6 @@
   #ifndef _OSD_POSIX /* BS2000 has this option "always on" */
   	ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
   		     "proxy: error setting reuseaddr option: setsockopt(SO_REUSEADDR)");
  -	apr_socket_close(sock);
   	return HTTP_INTERNAL_SERVER_ERROR;
   #endif /*_OSD_POSIX*/
       }
  @@ -599,7 +598,6 @@
   
   	/* handle a permanent error from the above loop */
   	if (failed) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_psprintf(r->pool,
   				 "Could not connect to remote machine: %s port %d",
   				 connectname, connectport));
  @@ -613,21 +611,20 @@
   	 * closed the socket */
   	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
   		     "proxy: an error occurred creating a new connection to %pI (%s)", connect_addr,
connectname);
  -	apr_socket_close(sock);
   	return HTTP_INTERNAL_SERVER_ERROR;
       }
  -    conf->id = r->connection->id;
  -    /* allocate this out of the connection pool - the check on r->connection->id
makes
  -     * sure that this string does not live past the connection lifetime */
  -    conf->connectname = apr_pstrdup(r->connection->pool, connectname);
  -    conf->connectport = connectport;
   
       /* if a keepalive connection is floating around, close it first! */
       /* we might support ftp keepalives later, but not now... */
  -    if (conf->client_socket) {
  -	apr_socket_close(conf->client_socket);
  -	conf->client_socket = NULL;
  +    if ((conf->id == r->connection->id) && conf->connection) {
  +	apr_socket_close(conf->connection->client_socket);
  +	conf->connection = NULL;
       }
  +    conf->id = r->connection->id;
  +    /* allocate this out of the connection pool - the check on r->connection->id
makes
  +     * sure that this string does not get accessed past the connection lifetime */
  +    conf->connectname = apr_pstrdup(r->connection->pool, connectname);
  +    conf->connectport = connectport;
   
       ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
   		 "proxy: connection complete");
  @@ -652,7 +649,6 @@
       ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
   		 "proxy: FTP: initial connect returned status %d", i);
       if (i == -1) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY, "Error reading from remote server");
       }
   #if 0
  @@ -668,12 +664,10 @@
   	 *     Retry-After  = "Retry-After" ":" ( HTTP-date | delta-seconds )
   	 */
   	ap_table_add(r->headers_out, "Retry-After", apr_psprintf(p, "%u", 60*wait_mins);
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_SERVICE_UNAVAILABLE, buffer);
       }
   #endif
       if (i != 220) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer);
       }
   
  @@ -703,21 +697,17 @@
       ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
                    "proxy: FTP: returned status %d", i);
       if (i == -1) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY, "Error reading from remote server");
       }
       if (i == 530) {
  -	apr_socket_close(sock);
   	return ftp_unauthorized (r, 1);	/* log it: user name guessing attempt? */
       }
       if (i != 230 && i != 331) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer);
       }
   
       if (i == 331) {		/* send password */
   	if (password == NULL) {
  -	    apr_socket_close(sock);
   	    return ftp_unauthorized (r, 0);
   	}
   	buf = apr_pstrcat(p, "PASS ", password, CRLF, NULL);
  @@ -741,22 +731,18 @@
           ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
                        "proxy: FTP: returned status %d [%s]", i, buffer);
   	if (i == -1) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   				 "Error reading from remote server");
   	}
   	if (i == 332) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_UNAUTHORIZED,
   				 apr_pstrcat(p, "Need account for login: ", buffer, NULL));
   	}
   	/* @@@ questionable -- we might as well return a 403 Forbidden here */
   	if (i == 530) {
  -	    apr_socket_close(sock);
   	    return ftp_unauthorized (r, 1); /* log it: passwd guessing attempt? */
   	}
   	if (i != 230 && i != 202) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer);
   	}
       }
  @@ -793,16 +779,13 @@
           ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
                        "proxy: FTP: returned status %d", i);
   	if (i == -1) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   				 "Error reading from remote server");
   	}
   	if (i == 550) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_NOT_FOUND, buffer);
   	}
   	if (i != 250) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer);
   	}
   
  @@ -837,12 +820,10 @@
       ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
   		 "proxy: FTP: returned status %d", i);
       if (i == -1) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   			     "Error reading from remote server");
       }
       if (i != 200 && i != 504) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer);
       }
       /* Allow not implemented */
  @@ -879,12 +860,10 @@
       ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
   		 "proxy: FTP: returned status %d", i);
       if (i == -1) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   			     "Error reading from remote server");
       }
       if (i != 227 && i != 502) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer);
       }
       else if (i == 227) {
  @@ -918,7 +897,6 @@
   	    if ((rv = apr_socket_create(&remote_sock, APR_INET, SOCK_STREAM, r->pool))
!= APR_SUCCESS) {
   		ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
   			     "proxy: error creating PASV socket");
  -		apr_socket_close(sock);
   		return HTTP_INTERNAL_SERVER_ERROR;
   	    }
   
  @@ -934,8 +912,6 @@
   	    apr_sockaddr_info_get(&pasv_addr, apr_psprintf(p, "%d.%d.%d.%d", h3, h2, h1, h0),
APR_INET, pasvport, 0, p);
   	    rv = apr_connect(remote_sock, pasv_addr);
               if (rv != APR_SUCCESS) {
  -		apr_socket_close(sock);
  -		apr_socket_close(remote_sock);
   		ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
   			     "proxy: FTP: PASV error creating socket");
   		return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_psprintf(r->pool,
  @@ -960,10 +936,9 @@
   	if ((apr_socket_create(&local_sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS)
{
   	    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
   			 "proxy: FTP: error creating local socket");
  -	    apr_socket_close(sock);
   	    return HTTP_INTERNAL_SERVER_ERROR;
   	}
  -        apr_socket_addr_get(&local_addr, APR_LOCAL, sock);
  +        apr_socket_addr_get(&local_addr, APR_LOCAL, local_sock);
           apr_sockaddr_port_get(&local_port, local_addr);
           apr_sockaddr_ip_get(&local_ip, local_addr);
   
  @@ -971,8 +946,6 @@
   #ifndef _OSD_POSIX /* BS2000 has this option "always on" */
   	    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
   			 "proxy: FTP: error setting reuseaddr option");
  -	    apr_socket_close(local_sock);
  -	    apr_socket_close(sock);
   	    return HTTP_INTERNAL_SERVER_ERROR;
   #endif /*_OSD_POSIX*/
   	}
  @@ -981,18 +954,12 @@
   				  local_port, 0, r->pool) != APR_SUCCESS) {
               ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                             "proxy: FTP: error creating local socket address");
  -	    apr_socket_close(sock);
               return HTTP_INTERNAL_SERVER_ERROR;
           }
   
   	if (apr_bind(local_sock, local_addr) != APR_SUCCESS) {
  -	    char buff[22];
  -
  -	    apr_snprintf(buff, sizeof(buff), "%s:%d", local_ip, local_port);
   	    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  -			 "proxy: FTP: error binding to ftp data socket %s", buff);
  -	    apr_socket_close(remote_sock);
  -	    apr_socket_close(sock);
  +			 "proxy: FTP: error binding to ftp data socket %s:%d", local_ip, local_port);
   	    return HTTP_INTERNAL_SERVER_ERROR;
   	}
   
  @@ -1053,16 +1020,13 @@
                   ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
                                "proxy: FTP: returned status %d", i);
   		if (i == -1) {
  -		    apr_socket_close(sock);
   		    return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   					 "Error reading from remote server");
   		}
   		if (i == 550) {
  -		    apr_socket_close(sock);
   		    return ap_proxyerror(r, HTTP_NOT_FOUND, buffer);
   		}
   		if (i != 250) {
  -		    apr_socket_close(sock);
   		    return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer);
   		}
   		path = "";
  @@ -1099,12 +1063,10 @@
   	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
   				 "proxy: FTP: PWD returned status %d", i);
       if (i == -1 || i == 421) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   			     "Error reading from remote server");
       }
       if (i == 550) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_NOT_FOUND, buffer);
       }
       if (i == 257) {
  @@ -1151,7 +1113,6 @@
       ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
                    "proxy: FTP: returned status %d", rc);
       if (rc == -1) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   			     "Error reading from remote server");
       }
  @@ -1179,16 +1140,13 @@
   	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
   				 "proxy: FTP: returned status %d", rc);
   	if (rc == -1) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   			     "Error reading from remote server");
   	}
   	if (rc == 550) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_NOT_FOUND, buffer);
   	}
   	if (rc != 250) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer);
   	}
   
  @@ -1212,12 +1170,10 @@
   	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
   				 "proxy: FTP: PWD returned status %d", i);
   	if (i == -1 || i == 421) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   			     "Error reading from remote server");
   	}
   	if (i == 550) {
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_NOT_FOUND, buffer);
   	}
   	if (i == 257) {
  @@ -1238,12 +1194,10 @@
   	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
   				 "proxy: FTP: returned status %d", rc);
   	if (rc == -1)
  -	    apr_socket_close(sock);
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   			     "Error reading from remote server");
       }
       if (rc != 125 && rc != 150 && rc != 226 && rc != 250) {
  -	apr_socket_close(sock);
   	return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer);
       }
   
  @@ -1291,7 +1245,6 @@
               default:
                   ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                                 "proxy: FTP: failed to accept data connection");
  -                apr_socket_close(local_sock);
                   return HTTP_BAD_GATEWAY;
               }
           }
  @@ -1304,8 +1257,6 @@
   	 * closed the socket */
   	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
   		     "proxy: FTP: an error occurred creating the transfer connection");
  -	apr_socket_close(remote_sock);
  -	apr_socket_close(local_sock);
   	return HTTP_INTERNAL_SERVER_ERROR;
       }
   
  @@ -1313,7 +1264,6 @@
       ap_proxy_pre_http_connection(remote, NULL);
   
   /* XXX temporary end here while testing */
  -/*apr_socket_close(sock);*/
   /*return HTTP_NOT_IMPLEMENTED;*/
   
       /*
  @@ -1404,6 +1354,5 @@
                    "proxy: FTP: QUIT: status %d", i);
   
       apr_brigade_destroy(bb);
  -    apr_socket_close(sock);
       return OK;
   }
  
  
  
  1.52      +45 -37    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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- proxy_http.c	2001/04/10 09:30:12	1.51
  +++ proxy_http.c	2001/04/10 19:52:39	1.52
  @@ -201,7 +201,7 @@
        * connection ID of the current upstream connection is the same as that
        * of the connection when the socket was opened.
        */
  -    apr_pool_t *p = r->pool;
  +    apr_pool_t *p = r->connection->pool;
       conn_rec *c = r->connection;
       apr_bucket *e;
       apr_bucket_brigade *bb = apr_brigade_create(p);
  @@ -227,17 +227,19 @@
   
       /* do a DNS lookup for the destination host */
       /* see memory note above */
  -    err = apr_sockaddr_info_get(&uri_addr, uri.hostname, APR_UNSPEC, uri.port, 0, c->pool);
  +    err = apr_sockaddr_info_get(&uri_addr, apr_pstrdup(c->pool, uri.hostname), APR_UNSPEC,
uri.port, 0, c->pool);
   
  +    /* allocate these out of the connection pool - the check on r->connection->id
makes
  +     * sure that this string does not get accessed past the connection lifetime */
       /* are we connecting directly, or via a proxy? */
       if (proxyname) {
  -	connectname = proxyname;
  +	connectname = apr_pstrdup(c->pool,proxyname);
   	connectport = proxyport;
   	/* see memory note above */
  -        err = apr_sockaddr_info_get(&connect_addr, proxyname, APR_UNSPEC, proxyport,
0, c->pool);
  +        err = apr_sockaddr_info_get(&connect_addr, connectname, APR_UNSPEC, connectport,
0, c->pool);
       }
       else {
  -	connectname = uri.hostname;
  +	connectname = apr_pstrdup(c->pool, uri.hostname);
   	connectport = uri.port;
   	connect_addr = uri_addr;
   	url = apr_pstrcat(p, uri.path, uri.query ? "?" : "",
  @@ -283,7 +285,7 @@
        * open, or whether it should be closed and a new socket created.
        */
       /* see memory note above */
  -    if (conf->client_socket) {
  +    if (conf->connection) {
   	if ((conf->id == c->id) &&
   	    (conf->connectport == connectport) &&
   	    (conf->connectname) &&
  @@ -293,18 +295,22 @@
           }
   	else {
               ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
  -			 "proxy: keepalive address mismatch (close old socket (%s/%s, %d/%d))", connectname,
conf->connectname, connectport, conf->connectport);
  -            apr_socket_close(conf->client_socket);
  -            conf->client_socket = NULL;
  +			 "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;
   	}
       }
   
       /* get a socket - either a keepalive one, or a new one */
       new = 1;
  -    if ((conf->id == c->id) && (conf->client_socket)) {
  +    if ((conf->id == c->id) && (conf->connection)) {
   
   	/* use previous keepalive socket */
  -	sock = conf->client_socket;
  +	sock = conf->connection->client_socket;
  +	origin = conf->connection;
   	new = 0;
   
   	/* XXX FIXME: If the socket has since closed, change new to 1 so
  @@ -313,7 +319,7 @@
       if (new) {
   
   	/* create a new socket */
  -	conf->client_socket = NULL;
  +	conf->connection = NULL;
   
   	/* see memory note above */
   	if ((apr_socket_create(&sock, APR_INET, SOCK_STREAM, c->pool)) != APR_SUCCESS)
{
  @@ -355,7 +361,8 @@
   	    /* if an error occurred, loop round and try again */
               if (err != APR_SUCCESS) {
   		ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server,
  -			     "proxy: attempt to connect to %pI (%s) failed", connect_addr, connectname);
  +			     "proxy: attempt to connect to %pI (%s) failed", 
  +			     connect_addr, connectname);
   		connect_addr = connect_addr->next;
   		continue;
               }
  @@ -375,30 +382,32 @@
   		return HTTP_BAD_GATEWAY;
   	    }
   	}
  -    }
   
  -    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
  -		 "proxy: socket is connected");
  +	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 */
  +	origin = ap_new_connection(c->pool, r->server, sock, r->connection->id);
  +	if (!origin) {
  +	    /* the peer reset the connection already; ap_new_connection() 
  +	     * closed the socket */
  +	    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
  +			 "proxy: an error occurred creating a new connection to %pI (%s)", connect_addr, connectname);
  +	    apr_socket_close(sock);
  +	    return HTTP_INTERNAL_SERVER_ERROR;
  +	}
  +	conf->id = r->connection->id;
  +	conf->connectname = connectname;
  +	conf->connectport = connectport;
  +	conf->connection = origin;
   
  -    /* the socket is now open, create a new downstream connection */
  -    origin = ap_new_connection(p, r->server, sock, r->connection->id);
  -    if (!origin) {
  -	/* the peer reset the connection already; ap_new_connection() 
  -	 * closed the socket */
   	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
  -		     "proxy: an error occurred creating a new connection to %pI (%s)", connect_addr,
connectname);
  -	apr_socket_close(sock);
  -	return HTTP_INTERNAL_SERVER_ERROR;
  -    }
  -    conf->id = r->connection->id;
  -    /* allocate this out of the config pool */
  -    conf->connectname = apr_pstrdup(r->server->process->pconf, connectname);
  -    conf->connectport = connectport;
  -    conf->client_socket = sock;
  +		     "proxy: connection complete");
   
  -    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
  -		 "proxy: connection complete");
  +	/* set up the connection filters */
  +	ap_proxy_pre_http_connection(origin, NULL);
   
  +    }
   
   
       /*
  @@ -407,8 +416,6 @@
        * Send the HTTP/1.1 request to the remote server
        */
   
  -    /* set up the connection filters */
  -    ap_proxy_pre_http_connection(origin, NULL);
   
       /* strip connection listed hop-by-hop headers from the request */
       /* even though in theory a connection: close coming from the client
  @@ -573,7 +580,7 @@
   
       if (APR_SUCCESS != (rv = ap_proxy_string_read(origin, bb, buffer, sizeof(buffer))))
{
   	apr_socket_close(sock);
  -	conf->client_socket = NULL;
  +	conf->connection = NULL;
   	ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
   	     "proxy: error reading status line from remote server %s",
   	     connectname);
  @@ -594,7 +601,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->client_socket = NULL;
  +	    conf->connection = NULL;
   	    return ap_proxyerror(r, HTTP_BAD_GATEWAY,
   				 apr_pstrcat(p, "Corrupt status line returned by remote server: ", buffer, NULL));
   	}
  @@ -663,6 +670,7 @@
       /* munge the Location and URI response headers according to ProxyPassReverse */
       {
   	const char *buf;
  +/* XXX FIXME: this isn't working */
           if ((buf = apr_table_get(r->headers_out, "Location")) != NULL)
   	    apr_table_set(r->headers_out, "Location", ap_proxy_location_reverse_map(r, buf));
           if ((buf = apr_table_get(r->headers_out, "Content-Location")) != NULL)
  @@ -743,7 +751,7 @@
        */
       if (close || (r->proto_num < HTTP_VERSION(1,1))) {
           apr_socket_close(sock);
  -	conf->client_socket = NULL;
  +	conf->connection = NULL;
       }
   
       return OK;
  
  
  
  1.51      +7 -7      httpd-proxy/module-2.0/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/proxy_util.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- proxy_util.c	2001/04/10 00:13:56	1.50
  +++ proxy_util.c	2001/04/10 19:52:40	1.51
  @@ -369,11 +369,11 @@
       rp->pool            = c->pool;
       rp->status          = HTTP_OK;
   
  -    rp->headers_in      = apr_table_make(r->pool, 50);
  -    rp->subprocess_env  = apr_table_make(r->pool, 50);
  -    rp->headers_out     = apr_table_make(r->pool, 12);
  -    rp->err_headers_out = apr_table_make(r->pool, 5);
  -    rp->notes           = apr_table_make(r->pool, 5);
  +    rp->headers_in      = apr_table_make(c->pool, 50);
  +    rp->subprocess_env  = apr_table_make(c->pool, 50);
  +    rp->headers_out     = apr_table_make(c->pool, 12);
  +    rp->err_headers_out = apr_table_make(c->pool, 5);
  +    rp->notes           = apr_table_make(c->pool, 5);
   
       rp->server = r->server;
       rp->request_time = r->request_time;
  @@ -381,9 +381,9 @@
       rp->output_filters  = c->output_filters;
       rp->input_filters   = c->input_filters;
   
  -    rp->request_config  = ap_create_request_config(rp->pool);
  +    rp->request_config  = ap_create_request_config(c->pool);
       req_cfg = apr_pcalloc(rp->pool, sizeof(core_request_config));
  -    req_cfg->bb = apr_brigade_create(rp->pool);
  +    req_cfg->bb = apr_brigade_create(c->pool);
       ap_set_module_config(rp->request_config, &core_module, req_cfg);
   
       return rp;
  
  
  

Mime
View raw message