]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
encapsulate tcp_reset flag
authorrobertc <>
Fri, 25 Oct 2002 13:36:31 +0000 (13:36 +0000)
committerrobertc <>
Fri, 25 Oct 2002 13:36:31 +0000 (13:36 +0000)
13 files changed:
src/HttpRequest.cc
src/asn.cc
src/client_side_reply.cc
src/errorpage.cc
src/globals.h
src/mime.cc
src/neighbors.cc
src/net_db.cc
src/store_digest.cc
src/structs.h
src/typedefs.h
src/url.cc
src/urn.cc

index 395ca96a661d39a8afd4c254cee5461d1895442d..6bdd9b3fd74ad54f384a027e0df75697448c792c 100644 (file)
@@ -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;
+}
index 8e77507121968bfb76b404802f2ec0e569a14a06..8f89f7853c2121ae0c95db75a47330fbef19e3ca 100644 (file)
@@ -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 {
index a45089054fb2be9b9cbcf4c97dcacc47cad0f4c6..94714304c8697fb8e69e5ca833dfb63e35b8360b 100644 (file)
@@ -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);
index 788108f0eb36827085cbc24cf1b50f87d35dcf5f..5b5423935e78962e649ba18a75ef1b97f19afe85 100644 (file)
@@ -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);
index 4347517a11465c521036b03827774b5cb2368ed8..1b8f7d9ca27a94e7fc041bc9d827bb60c58d287f 100644 (file)
@@ -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 */
index f4d11fa8aaddbfa805a463a106bbc5a1d1042b57..a27c3b020f9233ebce62653403c32694549b6941 100644 (file)
@@ -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,
index dfa81dbbf17caae0673d1036965c25643bbf882f..893a1d1f1a7934eb9c3d9c6881d0a74544756a2d 100644 (file)
@@ -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;
index 2ece29fbc018fdd66bd2a9df9ae501ac5a4d187f..cf8914c7abf5da4de536022bf7c01e87ff1e603c 100644 (file)
@@ -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);
index ea2b1d39c3b75485734afb4371e1c5409743f1cf..bc3a25e3b7113215ef2ebe728094839562c2ee9a 100644 (file)
@@ -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);
index 65c4e1bde21b5d4d832471231f8d93ed54efdd61..ea3347a23d20b44a62f9e5669c3abe6a9b9b89b3 100644 (file)
@@ -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;
index 1a7db8d594676ac3b17c502c75b0b79df4097d20..9f8e7ea006d8a48c7288581302bdf46400530d35 100644 (file)
@@ -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;
index a6c431b2df78b15e09b000e44e6567f4e89cf1ce..de5766cde6b580f8987b735bc15e27952a7f5434 100644 (file)
@@ -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.
index 75b617416685ab5d7d209e6636d8d33277a9aed5..02e4acb1169c1b78508be24d5ce6142c99c928d1 100644 (file)
@@ -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 {