]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SSL proxy requests need full HTTP request headers. httpBuildRequest
authorwessels <>
Fri, 22 May 1998 04:01:07 +0000 (04:01 +0000)
committerwessels <>
Fri, 22 May 1998 04:01:07 +0000 (04:01 +0000)
junk must now be public instead of static to http.c

src/http.cc
src/protos.h
src/ssl.cc
src/tunnel.cc

index ac63dfbf5c772e85960c8c2be0d5a81928df139d..6553ebc4606377ae5e47f40d2aeaac95faada07b 100644 (file)
@@ -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,
index 821b634d70514bc9e44ce4cf731a52571e775ac3..8e363af05d6142308363e3e2fd5a8e0e31763bec 100644 (file)
@@ -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 */
index 7a863c45e72f01470a565d2400e9e8de76c7e8d2..51679b9cf30d91d0358a7f1ead1c7322c931cf85 100644 (file)
@@ -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,
index 724564a8662fe36a13e2c8a97afc1ea0eb159be6..750b3eb692a4f65c1972061d5fb5dacbfe4a18fc 100644 (file)
@@ -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,