From: wessels <> Date: Fri, 22 May 1998 04:01:07 +0000 (+0000) Subject: SSL proxy requests need full HTTP request headers. httpBuildRequest X-Git-Tag: SQUID_3_0_PRE1~3291 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e1e72f062233367f9c2b05339f197b697a364f59;p=thirdparty%2Fsquid.git SSL proxy requests need full HTTP request headers. httpBuildRequest junk must now be public instead of static to http.c --- diff --git a/src/http.cc b/src/http.cc index ac63dfbf5c..6553ebc460 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.272 1998/05/20 23:35:01 wessels Exp $ + * $Id: http.cc,v 1.273 1998/05/21 22:01:08 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -602,7 +602,7 @@ httpAppendRequestHeader(char *hdr, const char *line, size_t * sz, size_t max, in * used by httpBuildRequestPrefix() * note: calls httpHeaderInit(), the caller is responsible for Clean()-ing */ -static void +void httpBuildRequestHeader(request_t * request, request_t * orig_request, StoreEntry * entry, diff --git a/src/protos.h b/src/protos.h index 821b634d70..8e363af05d 100644 --- a/src/protos.h +++ b/src/protos.h @@ -238,6 +238,7 @@ extern size_t httpBuildRequestPrefix(request_t * request, extern void httpAnonInitModule(); extern int httpAnonHdrAllowed(http_hdr_type hdr_id); extern int httpAnonHdrDenied(http_hdr_type hdr_id); +extern void httpBuildRequestHeader(request_t *, request_t *, StoreEntry *, HttpHeader *, int, int); /* Http Status Line */ /* init/clean */ diff --git a/src/ssl.cc b/src/ssl.cc index 7a863c45e7..51679b9cf3 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -1,6 +1,6 @@ /* - * $Id: ssl.cc,v 1.77 1998/03/31 05:37:49 wessels Exp $ + * $Id: ssl.cc,v 1.78 1998/05/21 22:01:08 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -411,12 +411,28 @@ static void sslProxyConnected(int fd, void *data) { SslStateData *sslState = data; + MemBuf mb; + HttpHeader hdr_out; + Packer p; debug(26, 3) ("sslProxyConnected: FD %d sslState=%p\n", fd, sslState); - snprintf(sslState->client.buf, SQUID_TCP_SO_RCVBUF, - "CONNECT %s HTTP/1.0\r\n\r\n", sslState->url); - debug(26, 3) ("sslProxyConnected: Sending '%s'\n", sslState->client.buf); - sslState->client.len = strlen(sslState->client.buf); + memBufDefInit(&mb); + memBufPrintf(&mb, "CONNECT %s HTTP/1.0\r\n", sslState->url); + httpBuildRequestHeader(sslState->request, + sslState->request, + NULL, /* StoreEntry */ + &hdr_out, + sslState->client.fd, + 0); /* flags */ + packerToMemInit(&p, &mb); + httpHeaderPackInto(&hdr_out, &p); + httpHeaderClean(&hdr_out); + packerClean(&p); + memBufAppend(&mb, "\r\n", 2); + xstrncpy(sslState->client.buf, mb.buf, SQUID_TCP_SO_RCVBUF); + debug(26, 3) ("sslProxyConnected: Sending {%s}\n", sslState->client.buf); + sslState->client.len = mb.size; sslState->client.offset = 0; + memBufClean(&mb); commSetSelect(sslState->server.fd, COMM_SELECT_WRITE, sslWriteServer, diff --git a/src/tunnel.cc b/src/tunnel.cc index 724564a866..750b3eb692 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.77 1998/03/31 05:37:49 wessels Exp $ + * $Id: tunnel.cc,v 1.78 1998/05/21 22:01:08 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -411,12 +411,28 @@ static void sslProxyConnected(int fd, void *data) { SslStateData *sslState = data; + MemBuf mb; + HttpHeader hdr_out; + Packer p; debug(26, 3) ("sslProxyConnected: FD %d sslState=%p\n", fd, sslState); - snprintf(sslState->client.buf, SQUID_TCP_SO_RCVBUF, - "CONNECT %s HTTP/1.0\r\n\r\n", sslState->url); - debug(26, 3) ("sslProxyConnected: Sending '%s'\n", sslState->client.buf); - sslState->client.len = strlen(sslState->client.buf); + memBufDefInit(&mb); + memBufPrintf(&mb, "CONNECT %s HTTP/1.0\r\n", sslState->url); + httpBuildRequestHeader(sslState->request, + sslState->request, + NULL, /* StoreEntry */ + &hdr_out, + sslState->client.fd, + 0); /* flags */ + packerToMemInit(&p, &mb); + httpHeaderPackInto(&hdr_out, &p); + httpHeaderClean(&hdr_out); + packerClean(&p); + memBufAppend(&mb, "\r\n", 2); + xstrncpy(sslState->client.buf, mb.buf, SQUID_TCP_SO_RCVBUF); + debug(26, 3) ("sslProxyConnected: Sending {%s}\n", sslState->client.buf); + sslState->client.len = mb.size; sslState->client.offset = 0; + memBufClean(&mb); commSetSelect(sslState->server.fd, COMM_SELECT_WRITE, sslWriteServer,