From: robertc <> Date: Fri, 25 Oct 2002 13:36:31 +0000 (+0000) Subject: encapsulate tcp_reset flag X-Git-Tag: SQUID_3_0_PRE1~562 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e429f97594efcc940a86a39cdee900f2aa65b679;p=thirdparty%2Fsquid.git encapsulate tcp_reset flag --- diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index 395ca96a66..6bdd9b3fd7 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.cc,v 1.31 2002/10/13 20:34:57 robertc Exp $ + * $Id: HttpRequest.cc,v 1.32 2002/10/25 07:36:31 robertc Exp $ * * DEBUG: section 73 HTTP Request * AUTHOR: Duane Wessels @@ -159,3 +159,24 @@ httpRequestHdrAllowed(const HttpHeaderEntry * e, String * strConn) return 0; return 1; } + +/* request_flags */ +bool +request_flags::resetTCP() const +{ + return reset_tcp != 0; +} + +void +request_flags::setResetTCP() +{ + debug (73, 9) ("request_flags::setResetTCP\n"); + reset_tcp = 1; +} + +void +request_flags::clearResetTCP() +{ + debug(73, 9) ("request_flags::clearResetTCP\n"); + reset_tcp = 0; +} diff --git a/src/asn.cc b/src/asn.cc index 8e77507121..8f89f7853c 100644 --- a/src/asn.cc +++ b/src/asn.cc @@ -1,6 +1,6 @@ /* - * $Id: asn.cc,v 1.85 2002/10/14 10:44:30 adrian Exp $ + * $Id: asn.cc,v 1.86 2002/10/25 07:36:32 robertc Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -202,7 +202,7 @@ asnCacheStart(int as) assert(NULL != req); asState->request = requestLink(req); if ((e = storeGetPublic(asres, METHOD_GET)) == NULL) { - e = storeCreateEntry(asres, asres, null_request_flags, METHOD_GET); + e = storeCreateEntry(asres, asres, request_flags(), METHOD_GET); asState->sc = storeClientListAdd(e, asState); fwdStart(-1, e, asState->request); } else { diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index a45089054f..94714304c8 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.19 2002/10/15 13:12:00 robertc Exp $ + * $Id: client_side_reply.cc,v 1.20 2002/10/25 07:36:32 robertc Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -158,7 +158,7 @@ clientSetReplyToError(void *data, context->http->al.http.code = errstate->httpStatus; context->http->entry = - clientCreateStoreEntry(context, method, null_request_flags); + clientCreateStoreEntry(context, method, request_flags()); if (auth_user_request) { errstate->auth_user_request = auth_user_request; authenticateAuthUserRequestLock(errstate->auth_user_request); @@ -233,7 +233,7 @@ clientReplyContext::restoreState(clientHttpRequest * http) void startError(clientReplyContext * context, clientHttpRequest * http, ErrorState * err) { - http->entry = clientCreateStoreEntry(context, http->request->method, null_request_flags); + http->entry = clientCreateStoreEntry(context, http->request->method, request_flags()); triggerStoreReadWithClientParameters(context, http); errorAppendEntry(http->entry, err); } @@ -680,7 +680,7 @@ clientCacheHit(void *data, StoreIOBuffer result) clientRemoveStoreReference(context, &context->sc, &http->entry); http->entry = e = clientCreateStoreEntry(context, http->request->method, - null_request_flags); + request_flags()); /* * Copy timestamp from the original entry so the 304 * reply has a meaningful Age: header. @@ -750,7 +750,7 @@ clientProcessMiss(clientReplyContext * context) clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, &http->conn->peer.sin_addr, http->request); http->entry = - clientCreateStoreEntry(context, r->method, null_request_flags); + clientCreateStoreEntry(context, r->method, request_flags()); errorAppendEntry(http->entry, err); triggerStoreReadWithClientParameters(context, http); return; @@ -945,7 +945,7 @@ clientReplyContext::purgeDoPurgeHead(_StoreEntry *newEntry) */ http->entry = clientCreateStoreEntry(this, http->request->method, - null_request_flags); + request_flags()); triggerStoreReadWithClientParameters(this, http); httpReplyReset(r = http->entry->mem_obj->reply); httpBuildVersion(&version, 1, 0); @@ -964,7 +964,7 @@ clientTraceReply(clientStreamNode * node, clientReplyContext * context) assert(context->http->request->max_forwards == 0); context->http->entry = clientCreateStoreEntry(context, context->http->request->method, - null_request_flags); + request_flags()); tempBuffer.offset = next->readBuffer.offset + context->headers_sz; tempBuffer.length = next->readBuffer.length; tempBuffer.data = next->readBuffer.data; @@ -1575,7 +1575,7 @@ clientSendMoreData(void *data, StoreIOBuffer result) fd, storeUrl(entry), (long int) http->out.offset); /* update size of the request */ context->reqsize = size; - if (http->request->flags.reset_tcp) { + if (http->request->flags.resetTCP()) { /* yuck. FIXME: move to client_side.c */ if (fd != -1) comm_reset_close(fd); diff --git a/src/errorpage.cc b/src/errorpage.cc index 788108f0eb..5b5423935e 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.179 2002/10/21 14:00:02 adrian Exp $ + * $Id: errorpage.cc,v 1.180 2002/10/25 07:36:32 robertc Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -312,7 +312,7 @@ errorAppendEntry(StoreEntry * entry, ErrorState * err) if (err->page_id == TCP_RESET) { if (err->request) { debug(4, 2) ("RSTing this reply\n"); - err->request->flags.reset_tcp = 1; + err->request->flags.setResetTCP(); } } storeLockObject(entry); diff --git a/src/globals.h b/src/globals.h index 4347517a11..1b8f7d9ca2 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.113 2002/10/21 14:00:02 adrian Exp $ + * $Id: globals.h,v 1.114 2002/10/25 07:36:32 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -145,7 +145,6 @@ extern const char *MultipartMsgBoundaryStr; /* "Unique-Squid-Separator" */ #if HTTP_VIOLATIONS extern int refresh_nocache_hack; /* 0 */ #endif -extern request_flags null_request_flags; extern int store_open_disk_fd; /* 0 */ extern const char *SwapDirType[]; extern authscheme_entry_t *authscheme_list; /* NULL */ diff --git a/src/mime.cc b/src/mime.cc index f4d11fa8aa..a27c3b020f 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -1,6 +1,6 @@ /* - * $Id: mime.cc,v 1.106 2002/10/14 11:51:07 adrian Exp $ + * $Id: mime.cc,v 1.107 2002/10/25 07:36:32 robertc Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -481,7 +481,6 @@ MimeIcon::created (StoreEntry *newEntry) file_close(fd); return; } - flags = null_request_flags; flags.cachable = 1; StoreEntry *e = storeCreateEntry(url, url, diff --git a/src/neighbors.cc b/src/neighbors.cc index dfa81dbbf1..893a1d1f1a 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.307 2002/10/15 08:03:29 robertc Exp $ + * $Id: neighbors.cc,v 1.308 2002/10/25 07:36:32 robertc Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -1178,7 +1178,7 @@ peerCountMcastPeersStart(void *data) assert(p->type == PEER_MULTICAST); p->mcast.flags.count_event_pending = 0; snprintf(url, MAX_URL, "http://%s/", inet_ntoa(p->in_addr.sin_addr)); - fake = storeCreateEntry(url, url, null_request_flags, METHOD_GET); + fake = storeCreateEntry(url, url, request_flags(), METHOD_GET); psstate = cbdataAlloc(ps_state); psstate->request = requestLink(urlParse(METHOD_GET, url)); psstate->entry = fake; diff --git a/src/net_db.cc b/src/net_db.cc index 2ece29fbc0..cf8914c7ab 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.165 2002/10/25 04:06:39 robertc Exp $ + * $Id: net_db.cc,v 1.166 2002/10/25 07:36:32 robertc Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -1092,7 +1092,7 @@ netdbExchangeStart(void *data) assert(NULL != ex->r); httpBuildVersion(&ex->r->http_ver, 1, 0); ex->connstate = STATE_HEADER; - ex->e = storeCreateEntry(uri, uri, null_request_flags, METHOD_GET); + ex->e = storeCreateEntry(uri, uri, request_flags(), METHOD_GET); ex->buf_sz = NETDB_REQBUF_SZ; assert(NULL != ex->e); ex->sc = storeClientListAdd(ex->e, ex); diff --git a/src/store_digest.cc b/src/store_digest.cc index ea2b1d39c3..bc3a25e3b7 100644 --- a/src/store_digest.cc +++ b/src/store_digest.cc @@ -1,6 +1,6 @@ /* - * $Id: store_digest.cc,v 1.53 2002/10/15 08:03:30 robertc Exp $ + * $Id: store_digest.cc,v 1.54 2002/10/25 07:36:32 robertc Exp $ * * DEBUG: section 71 Store Digest Manager * AUTHOR: Alex Rousskov @@ -350,7 +350,6 @@ storeDigestRewriteStart(void *datanotused) debug(71, 2) ("storeDigestRewrite: start rewrite #%d\n", sd_state.rewrite_count + 1); /* make new store entry */ url = internalLocalUri("/squid-internal-periodic/", StoreDigestFileName); - flags = null_request_flags; flags.cachable = 1; e = storeCreateEntry(url, url, flags, METHOD_GET); assert(e); diff --git a/src/structs.h b/src/structs.h index 65c4e1bde2..ea3347a23d 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.436 2002/10/21 14:00:03 adrian Exp $ + * $Id: structs.h,v 1.437 2002/10/25 07:37:00 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1412,7 +1412,17 @@ struct _SwapDir { void *fsdata; }; -struct _request_flags { +/* To hard to pull this into another file just yet. + * SO, we stop globals.c seeing it + */ +#ifdef __cplusplus +struct request_flags { + request_flags():range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),accelerated(0),internal(0),internalclient(0),body_sent(0) + { +#if HTTP_VIOLATIONS + nocache_hack = 1; +#endif + } unsigned int range:1; unsigned int nocache:1; unsigned int ims:1; @@ -1432,6 +1442,10 @@ struct _request_flags { unsigned int internal:1; unsigned int internalclient:1; unsigned int body_sent:1; + bool resetTCP() const; + void setResetTCP(); + void clearResetTCP(); +private: unsigned int reset_tcp:1; }; @@ -1490,7 +1504,7 @@ struct _request_t { time_t lastmod; /* Used on refreshes */ const char *vary_headers; /* Used when varying entities are detected. Changes how the store key is calculated */ }; - +#endif struct _cachemgr_passwd { char *passwd; wordlist *actions; diff --git a/src/typedefs.h b/src/typedefs.h index 1a7db8d594..9f8e7ea006 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.141 2002/10/21 14:00:03 adrian Exp $ + * $Id: typedefs.h,v 1.142 2002/10/25 07:36:32 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -135,7 +135,6 @@ typedef struct _store_client store_client; typedef struct _MemObject MemObject; typedef struct _StoreEntry StoreEntry; typedef struct _SwapDir SwapDir; -typedef struct _request_flags request_flags; typedef struct _helper_flags helper_flags; typedef struct _helper_stateful_flags helper_stateful_flags; typedef struct _http_state_flags http_state_flags; diff --git a/src/url.cc b/src/url.cc index a6c431b2df..de5766cde6 100644 --- a/src/url.cc +++ b/src/url.cc @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.138 2002/10/13 20:35:06 robertc Exp $ + * $Id: url.cc,v 1.139 2002/10/25 07:36:32 robertc Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -150,7 +150,6 @@ urlInitialize(void) { debug(23, 5) ("urlInitialize: Initializing...\n"); assert(sizeof(ProtocolStr) == (PROTO_MAX + 1) * sizeof(char *)); - memset(&null_request_flags, '\0', sizeof(null_request_flags)); /* * These test that our matchDomainName() function works the * way we expect it to. diff --git a/src/urn.cc b/src/urn.cc index 75b6174166..02e4acb116 100644 --- a/src/urn.cc +++ b/src/urn.cc @@ -1,6 +1,6 @@ /* - * $Id: urn.cc,v 1.78 2002/10/14 11:59:33 adrian Exp $ + * $Id: urn.cc,v 1.79 2002/10/25 07:36:32 robertc Exp $ * * DEBUG: section 52 URN Parsing * AUTHOR: Kostas Anagnostakis @@ -219,7 +219,7 @@ UrnState::created(_StoreEntry *newEntry) { urlres_e = newEntry; if (urlres_e->isNull()) { - urlres_e = storeCreateEntry(urlres, urlres, null_request_flags, METHOD_GET); + urlres_e = storeCreateEntry(urlres, urlres, request_flags(), METHOD_GET); sc = storeClientListAdd(urlres_e, this); fwdStart(-1, urlres_e, urlres_r); } else {