Fixed the problems with sending/not sending headers so that the CONNECT

(SSL) method would work with upstream proxying!
This commit is contained in:
Robert James Kaes 2001-10-25 05:12:46 +00:00
parent 28b4477f48
commit 1bbf32f04c

View File

@ -1,4 +1,4 @@
/* $Id: reqs.c,v 1.33 2001-10-25 04:40:48 rjkaes Exp $ /* $Id: reqs.c,v 1.34 2001-10-25 05:12:46 rjkaes Exp $
* *
* This is where all the work in tinyproxy is actually done. Incoming * This is where all the work in tinyproxy is actually done. Incoming
* connections have a new thread created for them. The thread then * connections have a new thread created for them. The thread then
@ -491,13 +491,12 @@ static int process_client_headers(struct conn_s *connptr)
if (connptr->send_message) if (connptr->send_message)
continue; continue;
#if 0
/* /*
* Don't send any of the headers if we're in SSL mode. * Don't send any of the headers if we're in SSL mode and
* NOT using an upstream proxy.
*/ */
if (connptr->ssl) if (connptr->ssl && !connptr->upstream)
continue; continue;
#endif
/* /*
* Don't send certain headers. * Don't send certain headers.
@ -525,7 +524,7 @@ static int process_client_headers(struct conn_s *connptr)
} }
} }
if (!connptr->send_message && !connptr->ssl) { if (!connptr->send_message && (connptr->upstream || !connptr->ssl)) {
#ifdef XTINYPROXY_ENABLE #ifdef XTINYPROXY_ENABLE
if (config.my_domain if (config.my_domain
&& add_xtinyproxy_header(connptr) < 0) { && add_xtinyproxy_header(connptr) < 0) {
@ -651,9 +650,6 @@ static void relay_connection(struct conn_s *connptr)
if (FD_ISSET(connptr->server_fd, &rset) if (FD_ISSET(connptr->server_fd, &rset)
&& readbuff(connptr->server_fd, connptr->sbuffer) < 0) { && readbuff(connptr->server_fd, connptr->sbuffer) < 0) {
#if 0
shutdown(connptr->server_fd, SHUT_WR);
#endif
break; break;
} }
if (FD_ISSET(connptr->client_fd, &rset) if (FD_ISSET(connptr->client_fd, &rset)
@ -662,9 +658,6 @@ static void relay_connection(struct conn_s *connptr)
} }
if (FD_ISSET(connptr->server_fd, &wset) if (FD_ISSET(connptr->server_fd, &wset)
&& writebuff(connptr->server_fd, connptr->cbuffer) < 0) { && writebuff(connptr->server_fd, connptr->cbuffer) < 0) {
#if 0
shutdown(connptr->server_fd, SHUT_WR);
#endif
break; break;
} }
if (FD_ISSET(connptr->client_fd, &wset) if (FD_ISSET(connptr->client_fd, &wset)
@ -705,6 +698,7 @@ static void initialize_conn(struct conn_s *connptr)
connptr->simple_req = FALSE; connptr->simple_req = FALSE;
connptr->ssl = FALSE; connptr->ssl = FALSE;
connptr->upstream = FALSE;
update_stats(STAT_OPEN); update_stats(STAT_OPEN);
} }
@ -867,7 +861,8 @@ internal_proxy:
#ifdef UPSTREAM_SUPPORT #ifdef UPSTREAM_SUPPORT
if (config.upstream_name && config.upstream_port != -1) { if (config.upstream_name && config.upstream_port != -1) {
DEBUG1("Going to connect to the upstream."); connptr->upstream = TRUE;
if (connect_to_upstream(connptr, request) < 0) if (connect_to_upstream(connptr, request) < 0)
goto send_error; goto send_error;
} else { } else {
@ -904,8 +899,7 @@ send_error:
return; return;
} }
if (!connptr->ssl || config.upstream_name) { if (!connptr->ssl || connptr->upstream) {
DEBUG1("Processing the server's headers now.");
if (process_server_headers(connptr) < 0) { if (process_server_headers(connptr) < 0) {
update_stats(STAT_BADCONN); update_stats(STAT_BADCONN);
destroy_conn(connptr); destroy_conn(connptr);