--------------------- PatchSet 4624 Date: 2002/08/11 09:51:14 Author: rbcollins Branch: esi Tag: (none) Log: add custom header capability to clientBeginRequest Members: src/ESI.c:1.1.2.2->1.1.2.3 src/HttpHeader.c:1.15.2.1->1.15.2.2 src/client_side_request.c:1.1.2.2->1.1.2.3 src/enums.h:1.37->1.37.2.1 src/protos.h:1.59.2.2->1.59.2.3 Index: squid/src/ESI.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/ESI.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid/src/ESI.c 9 Aug 2002 11:56:01 -0000 1.1.2.2 +++ squid/src/ESI.c 11 Aug 2002 09:51:14 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: ESI.c,v 1.1.2.2 2002/08/09 11:56:01 rbcollins Exp $ + * $Id: ESI.c,v 1.1.2.3 2002/08/11 09:51:14 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -92,8 +92,15 @@ debug(86, 0) ("clientSendMoreData: Will be checking for ESI content here - %d sub requests remaining\n", context->remaining_esi_requests); /* Kick off a request */ - if (context->remaining_esi_requests-- && clientBeginRequest(METHOD_GET, "http://192.168.0.2/ESI_fragment_1.txt", esiBufferRecipient, NULL)) { - debug (86,0 ) ("starting new ESI subrequest failed\n"); + { + HttpHeader tempheaders; + httpHeaderInit (&tempheaders, hoRequest); + httpHeaderPutStr (&tempheaders, HDR_SURROGATE_CAPABILITY, "Surrogate/1.0"); + + if (context->remaining_esi_requests-- && clientBeginRequest(METHOD_GET, "http://192.168.0.2/ESI_fragment_1.txt", esiBufferRecipient, NULL, &tempheaders)) { + debug (86,0 ) ("starting new ESI subrequest failed\n"); + } + httpHeaderClean (&tempheaders); } /* EOF / Read error / aborted entry */ Index: squid/src/HttpHeader.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHeader.c,v retrieving revision 1.15.2.1 retrieving revision 1.15.2.2 diff -u -r1.15.2.1 -r1.15.2.2 --- squid/src/HttpHeader.c 11 Aug 2002 07:52:58 -0000 1.15.2.1 +++ squid/src/HttpHeader.c 11 Aug 2002 09:51:14 -0000 1.15.2.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.c,v 1.15.2.1 2002/08/11 07:52:58 rbcollins Exp $ + * $Id: HttpHeader.c,v 1.15.2.2 2002/08/11 09:51:14 rbcollins Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -129,6 +129,8 @@ #if X_ACCELERATOR_VARY {"X-Accelerator-Vary", HDR_X_ACCELERATOR_VARY, ftStr}, #endif + {"Surrogate-Capability", HDR_SURROGATE_CAPABILITY, ftStr}, + {"Surrogate-Control", HDR_SURROGATE_CONTROL, ftStr}, {"Other:", HDR_OTHER, ftStr} /* ':' will not allow matches */ }; static HttpHeaderFieldInfo *Headers = NULL; @@ -162,6 +164,8 @@ #if X_ACCELERATOR_VARY HDR_X_ACCELERATOR_VARY, #endif + HDR_SURROGATE_CAPABILITY, + HDR_SURROGATE_CONTROL, HDR_X_FORWARDED_FOR }; @@ -198,7 +202,8 @@ #if X_ACCELERATOR_VARY HDR_X_ACCELERATOR_VARY, #endif - HDR_X_SQUID_ERROR + HDR_X_SQUID_ERROR, + HDR_SURROGATE_CONTROL }; static HttpHeaderMask RequestHeadersMask; /* set run-time using RequestHeaders */ @@ -208,7 +213,7 @@ HDR_IF_MATCH, HDR_IF_MODIFIED_SINCE, HDR_IF_NONE_MATCH, HDR_IF_RANGE, HDR_MAX_FORWARDS, HDR_PROXY_CONNECTION, HDR_PROXY_AUTHORIZATION, HDR_RANGE, HDR_REFERER, HDR_REQUEST_RANGE, - HDR_USER_AGENT, HDR_X_FORWARDED_FOR + HDR_USER_AGENT, HDR_X_FORWARDED_FOR, HDR_SURROGATE_CAPABILITY }; /* header accounting */ Index: squid/src/client_side_request.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client_side_request.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid/src/client_side_request.c 9 Aug 2002 12:18:53 -0000 1.1.2.2 +++ squid/src/client_side_request.c 11 Aug 2002 09:51:14 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.c,v 1.1.2.2 2002/08/09 12:18:53 rbcollins Exp $ + * $Id: client_side_request.c,v 1.1.2.3 2002/08/11 09:51:14 rbcollins Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originall Duane Wessels in client_side.c) @@ -59,7 +59,7 @@ /* Create a request and kick it off */ int /* returns nonzero on failure */ -clientBeginRequest (method_t method, char const *url, CSR *streamfunc, void *streamdata /* TODO pass a HTTP Header collection */) +clientBeginRequest (method_t method, char const *url, CSR *streamfunc, void *streamdata, HttpHeader const *header) { size_t url_sz; http_version_t http_ver = {1,0}; @@ -88,6 +88,12 @@ debug(85, 5) ("Invalid URL: %s\n", http->uri); return -1; } + /* now update the headers in request with our supplied headers. + * urLParse should return a blank header set, but we use Update to be sure + * of correctness. + */ + if (header) + httpHeaderUpdate(&request->header, header, NULL); http->log_uri = xstrdup(urlCanonicalClean(request)); /* http struct now ready */ Index: squid/src/enums.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/enums.h,v retrieving revision 1.37 retrieving revision 1.37.2.1 diff -u -r1.37 -r1.37.2.1 --- squid/src/enums.h 21 Jul 2002 21:48:03 -0000 1.37 +++ squid/src/enums.h 11 Aug 2002 09:51:14 -0000 1.37.2.1 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.37 2002/07/21 21:48:03 squidadm Exp $ + * $Id: enums.h,v 1.37.2.1 2002/08/11 09:51:14 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -246,6 +246,8 @@ #if X_ACCELERATOR_VARY HDR_X_ACCELERATOR_VARY, #endif + HDR_SURROGATE_CAPABILITY, + HDR_SURROGATE_CONTROL, HDR_OTHER, HDR_ENUM_END } http_hdr_type; Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.59.2.2 retrieving revision 1.59.2.3 diff -u -r1.59.2.2 -r1.59.2.3 --- squid/src/protos.h 9 Aug 2002 12:18:53 -0000 1.59.2.2 +++ squid/src/protos.h 11 Aug 2002 09:51:14 -0000 1.59.2.3 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.59.2.2 2002/08/09 12:18:53 rbcollins Exp $ + * $Id: protos.h,v 1.59.2.3 2002/08/11 09:51:14 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -149,7 +149,7 @@ extern int clientDetermineActionAfterWrite(int fd, clientHttpRequest const *http, StoreEntry *entry, size_t size); extern STCB clientSendMoreData; extern ErrorState *clientBuildError (err_type, http_status, char const *, struct in_addr *, request_t *); -extern int clientBeginRequest (method_t, char const *, CSR *, void *); +extern int clientBeginRequest (method_t, char const *, CSR *, void *, HttpHeader const *); /* client_side_reply.c - client side reply related routines (pure logic, no comms) */ extern int clientCheckTransferDone(clientHttpRequest const *);