From: wessels <> Date: Tue, 26 Nov 1996 01:47:15 +0000 (+0000) Subject: Added 'passthrough_proxy' support X-Git-Tag: SQUID_3_0_PRE1~5402 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6e3b09b6f488686c78ebf460f104a2bff6509dd;p=thirdparty%2Fsquid.git Added 'passthrough_proxy' support --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 0b6c4742f4..75ceb4a564 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $Id: cache_cf.cc,v 1.143 1996/11/24 02:37:33 wessels Exp $ + * $Id: cache_cf.cc,v 1.144 1996/11/25 18:47:15 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -256,6 +256,7 @@ static void parseMinutesLine _PARAMS((int *)); static void ip_acl_destroy _PARAMS((ip_acl **)); static void parseCachemgrPasswd _PARAMS((void)); static void parsePathname _PARAMS((char **)); +static void parseProxyLine _PARAMS((edge **)); static void self_destruct(void) @@ -954,20 +955,25 @@ parseVizHackLine(void) } static void -parseSslProxyLine(void) +parseProxyLine(edge **E) { char *token; char *t; + edge *e; token = strtok(NULL, w_space); if (token == NULL) self_destruct(); - safe_free(Config.sslProxy.host); - Config.sslProxy.port = 0; + if (*E) { + edgeDestroy(*E); + *E = NULL; + } + e = xcalloc (1, sizeof(edge)); if ((t = strchr(token, ':'))) { *t++ = '\0'; - Config.sslProxy.port = atoi(t); + e->http_port = atoi(t); } - Config.sslProxy.host = xstrdup(token); + e->host = xstrdup(token); + *E = e; } static void @@ -1310,7 +1316,9 @@ parseConfigFile(const char *file_name) parseAnnounceToLine(); else if (!strcmp(token, "ssl_proxy")) - parseSslProxyLine(); + parseProxyLine(&Config.sslProxy); + else if (!strcmp(token, "passthrough_proxy")) + parseProxyLine(&Config.passProxy); else if (!strcmp(token, "err_html_text")) parseErrHtmlLine(); @@ -1446,7 +1454,8 @@ configFreeMemory(void) safe_free(Config.Announce.host); safe_free(Config.Announce.file); safe_free(Config.errHtmlText); - safe_free(Config.sslProxy.host); + edgeDestroy(Config.sslProxy); + edgeDestroy(Config.passProxy); wordlistDestroy(&Config.cache_dirs); wordlistDestroy(&Config.hierarchy_stoplist); wordlistDestroy(&Config.local_domain_list); @@ -1544,8 +1553,6 @@ configSetFactoryDefaults(void) Config.Addrs.udp_outgoing.s_addr = DefaultUdpOutgoingAddr; Config.Addrs.udp_incoming.s_addr = DefaultUdpIncomingAddr; Config.Addrs.client_netmask.s_addr = DefaultClientNetmask; - Config.sslProxy.port = DefaultSslProxyPort; - Config.sslProxy.host = safe_xstrdup(DefaultSslProxyHost); Config.ipcache.size = DefaultIpcacheSize; Config.ipcache.low = DefaultIpcacheLow; Config.ipcache.high = DefaultIpcacheHigh; diff --git a/src/neighbors.cc b/src/neighbors.cc index 7501e4f65d..7412f4b834 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,5 +1,5 @@ /* - * $Id: neighbors.cc,v 1.87 1996/11/18 02:25:45 wessels Exp $ + * $Id: neighbors.cc,v 1.88 1996/11/25 18:47:17 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -143,6 +143,7 @@ const char *hier_strings[] = "SOURCE_FASTEST", "SIBLING_UDP_HIT_OBJ", "PARENT_UDP_HIT_OBJ", + "PASSTHROUGH_PARENT", "INVALID CODE" }; @@ -314,8 +315,7 @@ neighborsDestroy(void) for (e = friends.edges_head; e; e = next) { next = e->next; - safe_free(e->host); - safe_free(e); + edgeDestroy(e); friends.n--; } memset(&friends, '\0', sizeof(friends)); @@ -878,3 +878,12 @@ parseNeighborType(const char *s) debug(15, 0, "WARNING: Unknown neighbor type: %s\n", s); return EDGE_SIBLING; } + +void +edgeDestroy(edge *e) +{ + if (e == NULL) + return; + safe_free(e->host); + safe_free(e); +} diff --git a/src/ssl.cc b/src/ssl.cc index c679cf9358..5b265b4bb4 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -1,6 +1,6 @@ /* - * $Id: ssl.cc,v 1.27 1996/11/22 08:38:20 wessels Exp $ + * $Id: ssl.cc,v 1.28 1996/11/25 18:47:19 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -381,7 +381,7 @@ sslConnectDone(int fd, int status, void *data) } if (opt_no_ipcache) ipcacheInvalidate(sslState->host); - if (Config.sslProxy.host == sslState->host) + if (Config.sslProxy && Config.sslProxy->host == sslState->host) sslProxyConnected(sslState->server.fd, sslState); else sslConnected(sslState->server.fd, sslState); @@ -441,7 +441,7 @@ sslStart(int fd, const char *url, request_t * request, char *mime_hdr, int *size sslClientClosed, (void *) sslState); - if (Config.sslProxy.host) { + if (Config.sslProxy) { ipcache_nbgethostbyname(request->host, sslState->server.fd, sslSelectForwarding, @@ -508,9 +508,9 @@ sslSelectForwarding(int fd, const ipcache_addrs * ia, void *data) sslState->host = request->host; sslState->port = request->port; } else { - sslState->host = Config.sslProxy.host; - if ((sslState->port = Config.sslProxy.port) == 0) { - if ((e = neighborFindByName(Config.sslProxy.host))) + sslState->host = Config.sslProxy->host; + if ((sslState->port = Config.sslProxy->http_port) == 0) { + if ((e = neighborFindByName(Config.sslProxy->host))) sslState->port = e->http_port; else sslState->port = CACHE_HTTP_PORT; diff --git a/src/tunnel.cc b/src/tunnel.cc index 1d925844d4..9e9ef8090f 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.27 1996/11/22 08:38:20 wessels Exp $ + * $Id: tunnel.cc,v 1.28 1996/11/25 18:47:19 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -381,7 +381,7 @@ sslConnectDone(int fd, int status, void *data) } if (opt_no_ipcache) ipcacheInvalidate(sslState->host); - if (Config.sslProxy.host == sslState->host) + if (Config.sslProxy && Config.sslProxy->host == sslState->host) sslProxyConnected(sslState->server.fd, sslState); else sslConnected(sslState->server.fd, sslState); @@ -441,7 +441,7 @@ sslStart(int fd, const char *url, request_t * request, char *mime_hdr, int *size sslClientClosed, (void *) sslState); - if (Config.sslProxy.host) { + if (Config.sslProxy) { ipcache_nbgethostbyname(request->host, sslState->server.fd, sslSelectForwarding, @@ -508,9 +508,9 @@ sslSelectForwarding(int fd, const ipcache_addrs * ia, void *data) sslState->host = request->host; sslState->port = request->port; } else { - sslState->host = Config.sslProxy.host; - if ((sslState->port = Config.sslProxy.port) == 0) { - if ((e = neighborFindByName(Config.sslProxy.host))) + sslState->host = Config.sslProxy->host; + if ((sslState->port = Config.sslProxy->http_port) == 0) { + if ((e = neighborFindByName(Config.sslProxy->host))) sslState->port = e->http_port; else sslState->port = CACHE_HTTP_PORT;