]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
renamed request_flags to RequestFlags, moved to own header, started implementing...
authorFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 10 Sep 2012 12:49:35 +0000 (14:49 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 10 Sep 2012 12:49:35 +0000 (14:49 +0200)
24 files changed:
src/HttpRequest.cc
src/HttpRequest.h
src/Makefile.am
src/RequestFlags.cc [new file with mode: 0644]
src/RequestFlags.h [new file with mode: 0644]
src/Store.h
src/acl/Asn.cc
src/client_side_reply.cc
src/client_side_reply.h
src/client_side_request.cc
src/http.cc
src/icmp/net_db.cc
src/mgr/ActionParams.h
src/mime.cc
src/neighbors.cc
src/store.cc
src/store_digest.cc
src/structs.h
src/tests/stub_store.cc
src/tests/testCoss.cc
src/tests/testNull.cc
src/tests/testRock.cc
src/tests/testUfs.cc
src/urn.cc

index 20a13379c711e6ff3dfc0631e53be51b3b0be8eb..e91c2240b36e5e2b2c20611fdcde3a497dc2690a 100644 (file)
@@ -420,27 +420,6 @@ HttpRequest::hdrCacheInit()
     range = header.getRange();
 }
 
-/* request_flags */
-bool
-request_flags::resetTCP() const
-{
-    return reset_tcp != 0;
-}
-
-void
-request_flags::setResetTCP()
-{
-    debugs(73, 9, "request_flags::setResetTCP");
-    reset_tcp = 1;
-}
-
-void
-request_flags::clearResetTCP()
-{
-    debugs(73, 9, "request_flags::clearResetTCP");
-    reset_tcp = 0;
-}
-
 #if ICAP_CLIENT
 Adaptation::Icap::History::Pointer
 HttpRequest::icapHistory() const
@@ -493,27 +472,6 @@ HttpRequest::multipartRangeRequest() const
     return (range && range->specs.count > 1);
 }
 
-void
-request_flags::destinationIPLookupCompleted()
-{
-    destinationIPLookedUp_ = true;
-}
-
-bool
-request_flags::destinationIPLookedUp() const
-{
-    return destinationIPLookedUp_;
-}
-
-request_flags
-request_flags::cloneAdaptationImmune() const
-{
-    // At the time of writing, all flags where either safe to copy after
-    // adaptation or were not set at the time of the adaptation. If there
-    // are flags that are different, they should be cleared in the clone.
-    return *this;
-}
-
 bool
 HttpRequest::bodyNibbled() const
 {
index f7a06a6c784714bdbae934a057741f7d35d43ad7..40005752a58e33b7ad851babd4283074f248f613 100644 (file)
@@ -37,6 +37,7 @@
 #include "HierarchyLogEntry.h"
 #include "HttpMsg.h"
 #include "HttpRequestMethod.h"
+#include "RequestFlags.h"
 
 #if USE_AUTH
 #include "auth/UserRequest.h"
@@ -162,7 +163,7 @@ public:
 
     char *canonical;
 
-    request_flags flags;
+    RequestFlags flags;
 
     HttpHdrRange *range;
 
index 1510f7e379e7f9158558c4aff216e773986ac871..21fe2588b68a36b9b2a881f6754c294c53f1f0d0 100644 (file)
@@ -397,6 +397,8 @@ squid_SOURCES = \
        HttpParser.h \
        HttpReply.cc \
        HttpReply.h \
+       RequestFlags.h \
+       RequestFlags.cc \
        HttpRequest.cc \
        HttpRequest.h \
        HttpRequestMethod.cc \
@@ -1142,8 +1144,8 @@ tests_testHttpReply_SOURCES=\
        HttpStatusLine.h \
        Mem.h \
        mem.cc \
-    RegexList.h \
-    RegexList.cc \
+       RegexList.h \
+       RegexList.cc \
        MemBuf.cc \
        MemBuf.h \
        mime_header.h \
@@ -1366,6 +1368,8 @@ tests_testCacheManager_SOURCES = \
        debug.cc \
        HttpParser.cc \
        HttpParser.h \
+       RequestFlags.h \
+       RequestFlags.cc \
        HttpRequest.cc \
        HttpRequestMethod.cc \
        Mem.h \
@@ -1386,7 +1390,7 @@ tests_testCacheManager_SOURCES = \
        YesNoNone.cc \
        RefreshPattern.h \
        CacheMgrPasswd.h \
-    CacheMgrPasswd.cc \
+       CacheMgrPasswd.cc \
        cache_cf.cc \
        CacheDigest.h \
        CacheDigest.cc \
@@ -1648,6 +1652,8 @@ tests_testDiskIO_SOURCES = \
        refresh.h \
        refresh.cc \
        RemovalPolicy.cc \
+       RequestFlags.h \
+       RequestFlags.cc \
        StatCounters.h \
        StatCounters.cc \
        StatHist.h \
@@ -1779,7 +1785,7 @@ tests_testEvent_SOURCES = \
        YesNoNone.cc \
        RefreshPattern.h \
        CacheMgrPasswd.h \
-    CacheMgrPasswd.cc \
+       CacheMgrPasswd.cc \
        cache_cf.cc \
        cache_manager.cc \
        carp.h \
@@ -1853,6 +1859,8 @@ tests_testEvent_SOURCES = \
        HttpParser.cc \
        HttpParser.h \
        HttpReply.cc \
+       RequestFlags.h \
+       RequestFlags.cc \
        HttpRequest.cc \
        HttpRequestMethod.cc \
        HttpStatusLine.cc \
@@ -2019,7 +2027,7 @@ tests_testEventLoop_SOURCES = \
        YesNoNone.cc \
        RefreshPattern.h \
        CacheMgrPasswd.h \
-    CacheMgrPasswd.cc \
+       CacheMgrPasswd.cc \
        cache_cf.cc \
        carp.h \
        carp.cc \
@@ -2092,6 +2100,8 @@ tests_testEventLoop_SOURCES = \
        HttpParser.cc \
        HttpParser.h \
        HttpReply.cc \
+       RequestFlags.h \
+       RequestFlags.cc \
        HttpRequest.cc \
        HttpRequestMethod.cc \
        HttpStatusLine.cc \
@@ -2254,7 +2264,7 @@ tests_test_http_range_SOURCES = \
        YesNoNone.cc \
        RefreshPattern.h \
        CacheMgrPasswd.h \
-    CacheMgrPasswd.cc \
+       CacheMgrPasswd.cc \
        cache_cf.cc \
        cache_manager.cc \
        CacheDigest.h \
@@ -2328,6 +2338,8 @@ tests_test_http_range_SOURCES = \
        HttpParser.cc \
        HttpParser.h \
        HttpReply.cc \
+       RequestFlags.h \
+       RequestFlags.cc \
        HttpRequest.cc \
        HttpRequestMethod.cc \
        HttpStatusLine.cc \
@@ -2522,6 +2534,8 @@ tests_testHttpRequest_SOURCES = \
        $(ACL_REGISTRATION_SOURCES) \
        HttpParser.cc \
        HttpParser.h \
+       RequestFlags.h \
+       RequestFlags.cc \
        HttpRequest.cc \
        HttpRequestMethod.cc \
        Mem.h \
@@ -2545,7 +2559,7 @@ tests_testHttpRequest_SOURCES = \
        YesNoNone.cc \
        RefreshPattern.h \
        CacheMgrPasswd.h \
-    CacheMgrPasswd.cc \
+       CacheMgrPasswd.cc \
        cache_cf.cc \
        debug.cc \
        CacheDigest.h \
@@ -2783,6 +2797,8 @@ tests_testStore_SOURCES= \
        HttpHeader.cc \
        HttpMsg.cc \
        HttpRequestMethod.cc \
+       RequestFlags.cc \
+       RequestFlags.h \
        int.h \
        int.cc \
        SquidList.h \
@@ -3003,6 +3019,8 @@ tests_testUfs_SOURCES = \
        HttpStatusLine.cc \
        int.h \
        int.cc \
+       RequestFlags.h \
+       RequestFlags.cc \
        SquidList.h \
        SquidList.cc \
        MemObject.cc \
@@ -3182,6 +3200,8 @@ tests_testRock_SOURCES = \
        Packer.cc \
        Parsing.cc \
        RemovalPolicy.cc \
+       RequestFlags.cc \
+       RequestFlags.h \
        StatCounters.h \
        StatCounters.cc \
        StatHist.h \
@@ -3606,7 +3626,7 @@ tests_testURL_SOURCES = \
        YesNoNone.cc \
        RefreshPattern.h \
        CacheMgrPasswd.h \
-    CacheMgrPasswd.cc \
+       CacheMgrPasswd.cc \
        cache_cf.cc \
        cache_manager.cc \
        CacheDigest.h \
@@ -3679,6 +3699,8 @@ tests_testURL_SOURCES = \
        HttpParser.cc \
        HttpParser.h \
        HttpReply.cc \
+       RequestFlags.h \
+       RequestFlags.cc \
        HttpRequest.cc \
        HttpRequestMethod.cc \
        HttpStatusLine.cc \
@@ -3760,8 +3782,8 @@ tests_testURL_SOURCES = \
        StoreMetaVary.cc \
        StoreSwapLogData.cc \
        String.cc \
-    StrList.h \
-    StrList.cc \
+       StrList.h \
+       StrList.cc \
        SwapDir.cc \
        MemStore.cc \
        tests/stub_debug.cc \
diff --git a/src/RequestFlags.cc b/src/RequestFlags.cc
new file mode 100644 (file)
index 0000000..e19df2e
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * DEBUG: section 73    HTTP Request
+ * AUTHOR: Duane Wessels
+ *
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "squid.h"
+#include "Debug.h"
+#include "RequestFlags.h"
+
+// TODO: move to .cci
+/* RequestFlags */
+bool
+RequestFlags::resetTCP() const
+{
+    return resetTCP_;
+}
+
+void
+RequestFlags::setResetTCP()
+{
+    debugs(73, 9, "request_flags::setResetTCP");
+    resetTCP_ = true;
+}
+
+void
+RequestFlags::clearResetTCP()
+{
+    debugs(73, 9, "request_flags::clearResetTCP");
+    resetTCP_ = false;
+}
+
+void
+RequestFlags::destinationIPLookupCompleted()
+{
+    destinationIPLookedUp_ = true;
+}
+
+bool
+RequestFlags::destinationIPLookedUp() const
+{
+    return destinationIPLookedUp_;
+}
+
+bool
+RequestFlags::isRanged() const
+{
+    return isRanged_;
+}
+
+void
+RequestFlags::setRanged()
+{
+    isRanged_ = true;
+}
+
+void
+RequestFlags::clearRanged()
+{
+    isRanged_ = false;
+}
+
+
+RequestFlags
+RequestFlags::cloneAdaptationImmune() const
+{
+    // At the time of writing, all flags where either safe to copy after
+    // adaptation or were not set at the time of the adaptation. If there
+    // are flags that are different, they should be cleared in the clone.
+    return *this;
+}
diff --git a/src/RequestFlags.h b/src/RequestFlags.h
new file mode 100644 (file)
index 0000000..738a728
--- /dev/null
@@ -0,0 +1,118 @@
+#ifndef SQUID_REQUESTFLAGS_H_
+#define SQUID_REQUESTFLAGS_H_
+/*
+ * DEBUG: section 73    HTTP Request
+ * AUTHOR: Duane Wessels
+ *
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+class RequestFlags {
+public:
+    RequestFlags():
+        nocache(0), ims(0), auth(0), cachable(0),
+        hierarchical(0), loopdetect(0), proxy_keepalive(0), proxying(0),
+        refresh(0), redirected(0), need_validation(0),
+        fail_on_validation_err(0), stale_if_hit(0), accelerated(0),
+        ignore_cc(0), intercepted(0), hostVerified(0), spoof_client_ip(0),
+        internal(0), internalclient(0), must_keepalive(0), pinned(0),
+        canRePin(0), chunked_reply(0), stream_error(0), sslPeek(0),
+        sslBumped(0), destinationIPLookedUp_(false), resetTCP_(false),
+        isRanged_(false) {
+#if USE_HTTP_VIOLATIONS
+        nocache_hack = 0;
+#endif
+#if FOLLOW_X_FORWARDED_FOR
+        done_follow_x_forwarded_for = 0;
+#endif /* FOLLOW_X_FORWARDED_FOR */
+    }
+
+    unsigned int nocache :1; ///< whether the response to this request may be READ from cache
+    unsigned int ims :1;
+    unsigned int auth :1;
+    unsigned int cachable :1; ///< whether the response to thie request may be stored in the cache
+    unsigned int hierarchical :1;
+    unsigned int loopdetect :1;
+    unsigned int proxy_keepalive :1;
+    unsigned int proxying :1; /* this should be killed, also in httpstateflags */
+    unsigned int refresh :1;
+    unsigned int redirected :1;
+    unsigned int need_validation :1;
+    unsigned int fail_on_validation_err :1; ///< whether we should fail if validation fails
+    unsigned int stale_if_hit :1; ///< reply is stale if it is a hit
+#if USE_HTTP_VIOLATIONS
+    /* for changing/ignoring no-cache requests */
+    /* TODO: remove the conditional definition, move ifdef to setter */
+    unsigned int nocache_hack :1;
+#endif
+    unsigned int accelerated :1;
+    unsigned int ignore_cc :1;
+    unsigned int intercepted :1; ///< intercepted request
+    unsigned int hostVerified :1; ///< whether the Host: header passed verification
+    unsigned int spoof_client_ip :1; /**< spoof client ip if possible */
+    unsigned int internal :1;
+    unsigned int internalclient :1;
+    unsigned int must_keepalive :1;
+    unsigned int connection_auth :1; /** Request wants connection oriented auth */
+    unsigned int connection_auth_disabled :1; /** Connection oriented auth can not be supported */
+    unsigned int connection_proxy_auth :1; /** Request wants connection oriented auth */
+    unsigned int pinned :1; /* Request sent on a pinned connection */
+    unsigned int canRePin :1; ///< OK to reopen a failed pinned connection
+    unsigned int auth_sent :1; /* Authentication forwarded */
+    unsigned int no_direct :1; /* Deny direct forwarding unless overriden by always_direct. Used in accelerator mode */
+    unsigned int chunked_reply :1; /**< Reply with chunked transfer encoding */
+    unsigned int stream_error :1; /**< Whether stream error has occured */
+    unsigned int sslPeek :1; ///< internal ssl-bump request to get server cert
+    unsigned int sslBumped :1; /**< ssl-bumped request*/
+
+#if FOLLOW_X_FORWARDED_FOR
+    /* TODO: move from conditional definition to conditional setting */
+    unsigned int done_follow_x_forwarded_for :1;
+#endif /* FOLLOW_X_FORWARDED_FOR */
+
+    // When adding new flags, please update cloneAdaptationImmune() as needed.
+    bool resetTCP() const;
+    void setResetTCP();
+    void clearResetTCP();
+    void destinationIPLookupCompleted();
+    bool destinationIPLookedUp() const;
+    // returns a partial copy of the flags that includes only those flags
+    // that are safe for a related (e.g., ICAP-adapted) request to inherit
+    RequestFlags cloneAdaptationImmune() const;
+
+    bool isRanged() const;
+    void setRanged();
+    void clearRanged();
+private:
+
+    bool destinationIPLookedUp_:1;
+    bool resetTCP_:1;                ///< request to reset the TCP stream
+    bool isRanged_ :1;
+};
+
+#endif /* SQUID_REQUESTFLAGS_H_ */
index 5fedd563bdb577162a243eb7ea019131181ac536..04c182d331f3f3e0b262c5f59377662d42bc54f4 100644 (file)
@@ -42,6 +42,7 @@
 #include "Range.h"
 #include "RefCount.h"
 #include "RemovalPolicy.h"
+#include "RequestFlags.h"
 #include "StoreIOBuffer.h"
 #include "StoreStats.h"
 
@@ -378,7 +379,8 @@ SQUIDCEXTERN StoreEntry *storeGetPublicByRequest(HttpRequest * request);
 SQUIDCEXTERN StoreEntry *storeGetPublicByRequestMethod(HttpRequest * request, const HttpRequestMethod& method);
 
 /// \ingroup StoreAPI
-SQUIDCEXTERN StoreEntry *storeCreateEntry(const char *, const char *, request_flags, const HttpRequestMethod&);
+class RequestFlags;
+extern StoreEntry *storeCreateEntry(const char *, const char *, const RequestFlags &, const HttpRequestMethod&);
 
 /// \ingroup StoreAPI
 SQUIDCEXTERN void storeInit(void);
index 6ed8056caefe4419953bb6c1aeb85dc5f629c9b2..c0b94d7d6511e69710a6a78f7d81883c206f9c01 100644 (file)
  */
 
 #include "squid.h"
-#include "mgr/Registration.h"
-#include "radix.h"
-#include "HttpRequest.h"
-#include "StoreClient.h"
-#include "Store.h"
 #include "acl/Acl.h"
 #include "acl/Asn.h"
 #include "acl/Checklist.h"
-#include "acl/SourceAsn.h"
 #include "acl/DestinationAsn.h"
 #include "acl/DestinationIp.h"
+#include "acl/SourceAsn.h"
 #include "cache_cf.h"
+#include "forward.h"
 #include "HttpReply.h"
+#include "HttpRequest.h"
 #include "ipcache.h"
-#include "forward.h"
+#include "mgr/Registration.h"
+#include "radix.h"
+#include "RequestFlags.h"
 #include "SquidConfig.h"
+#include "Store.h"
+#include "StoreClient.h"
 #include "StoreClient.h"
 #include "wordlist.h"
 
@@ -248,7 +249,7 @@ asnCacheStart(int as)
     asState->request = HTTPMSGLOCK(req);
 
     if ((e = storeGetPublic(asres, METHOD_GET)) == NULL) {
-        e = storeCreateEntry(asres, asres, request_flags(), METHOD_GET);
+        e = storeCreateEntry(asres, asres, RequestFlags(), METHOD_GET);
         asState->sc = storeClientListAdd(e, asState);
         FwdState::fwdStart(Comm::ConnectionPointer(), e, asState->request);
     } else {
index 323a40af150a557b5855d8585ecf9ea6f5d7d20b..4cafe42717c2ed4cbff3056fe470e83dac3f2c3a 100644 (file)
@@ -54,6 +54,7 @@
 #include "mime_header.h"
 #include "neighbors.h"
 #include "refresh.h"
+#include "RequestFlags.h"
 #include "SquidConfig.h"
 #include "SquidTime.h"
 #include "Store.h"
@@ -132,7 +133,7 @@ void clientReplyContext::setReplyToError(const HttpRequestMethod& method, ErrorS
 
     http->al->http.code = errstate->httpStatus;
 
-    createStoreEntry(method, request_flags());
+    createStoreEntry(method, RequestFlags());
     assert(errstate->callback_data == NULL);
     errorAppendEntry(http->storeEntry(), errstate);
     /* Now the caller reads to get this */
@@ -226,7 +227,7 @@ clientReplyContext::restoreState()
 void
 clientReplyContext::startError(ErrorState * err)
 {
-    createStoreEntry(http->request->method, request_flags());
+    createStoreEntry(http->request->method, RequestFlags());
     triggerInitialStoreRead();
     errorAppendEntry(http->storeEntry(), err);
 }
@@ -656,7 +657,7 @@ clientReplyContext::processMiss()
     if (r->flags.loopdetect) {
         http->al->http.code = HTTP_FORBIDDEN;
         err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, http->getConn()->clientConnection->remote, http->request);
-        createStoreEntry(r->method, request_flags());
+        createStoreEntry(r->method, RequestFlags());
         errorAppendEntry(http->storeEntry(), err);
         triggerInitialStoreRead();
         return;
@@ -994,7 +995,7 @@ clientReplyContext::purgeDoPurgeHead(StoreEntry *newEntry)
     /* FIXME: This doesn't need to go through the store. Simply
      * push down the client chain
      */
-    createStoreEntry(http->request->method, request_flags());
+    createStoreEntry(http->request->method, RequestFlags());
 
     triggerInitialStoreRead();
 
@@ -1009,7 +1010,7 @@ clientReplyContext::traceReply(clientStreamNode * node)
 {
     clientStreamNode *nextNode = (clientStreamNode *)node->node.next->data;
     StoreIOBuffer localTempBuffer;
-    createStoreEntry(http->request->method, request_flags());
+    createStoreEntry(http->request->method, RequestFlags());
     localTempBuffer.offset = nextNode->readBuffer.offset + headers_sz;
     localTempBuffer.length = nextNode->readBuffer.length;
     localTempBuffer.data = nextNode->readBuffer.data;
@@ -1895,7 +1896,7 @@ clientReplyContext::sendNotModified()
     HttpReply *const temprep = e->getReply()->make304();
     http->logType = LOG_TCP_IMS_HIT;
     removeClientStoreReference(&sc, http);
-    createStoreEntry(http->request->method, request_flags());
+    createStoreEntry(http->request->method, RequestFlags());
     e = http->storeEntry();
     // Copy timestamp from the original entry so the 304
     // reply has a meaningful Age: header.
@@ -2157,7 +2158,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
 /* Using this breaks the client layering just a little!
  */
 void
-clientReplyContext::createStoreEntry(const HttpRequestMethod& m, request_flags reqFlags)
+clientReplyContext::createStoreEntry(const HttpRequestMethod& m, RequestFlags reqFlags)
 {
     assert(http != NULL);
     /*
index a0639940014b22b4a773f1b704ed4e9d53fcc75c..155b814d3ea438fa3ccd5be54fda6cfe7a311665 100644 (file)
 #ifndef SQUID_CLIENTSIDEREPLY_H
 #define SQUID_CLIENTSIDEREPLY_H
 
-#include "RefCount.h"
-#include "HttpHeader.h"
+#include "client_side_request.h"
 #include "clientStream.h"
+#include "HttpHeader.h"
+#include "RefCount.h"
+#include "RequestFlags.h"
 #include "StoreClient.h"
-#include "client_side_request.h"
 
 class ErrorState;
 #include "ip/forward.h"
@@ -82,7 +83,7 @@ public:
 #endif
     /// creates a store entry for the reply and appends err to it
     void setReplyToError(const HttpRequestMethod& method, ErrorState *err);
-    void createStoreEntry(const HttpRequestMethod& m, request_flags flags);
+    void createStoreEntry(const HttpRequestMethod& m, RequestFlags flags);
     void removeStoreReference(store_client ** scp, StoreEntry ** ep);
     void removeClientStoreReference(store_client **scp, ClientHttpRequest *http);
     void startError(ErrorState * err);
index 8bce891ae14a68a3f3893b1d68f4c2260d86b6d7..7731e9d3136ab84306b8fc75e85451c66f0e6adf 100644 (file)
@@ -1106,7 +1106,7 @@ clientInterpretRequestHeaders(ClientHttpRequest * http)
             request->range = req_hdr->getRange();
 
         if (request->range) {
-            request->flags.range = 1;
+            request->flags.setRanged();
             clientStreamNode *node = (clientStreamNode *)http->client_stream.tail->data;
             /* XXX: This is suboptimal. We should give the stream the range set,
              * and thereby let the top of the stream set the offset when the
index 73ffa217dae9c8638ea504ee6637a5b6bd84ca84..6d0ed19a776e3139185b32e53ee598fe62dbba75 100644 (file)
@@ -1652,7 +1652,7 @@ HttpStateData::httpBuildRequestHeader(HttpRequest * request,
         /* pretend it's not a range request */
         delete request->range;
         request->range = NULL;
-        request->flags.range = 0;
+        request->flags.clearRanged();
     }
 
     /* append Via */
index f0b0c3b30a9868d96b95a318b7d2435b893f1a18..8d199d154298db2159b408a3a0d2b2985e304d32 100644 (file)
@@ -1335,7 +1335,7 @@ netdbExchangeStart(void *data)
     assert(NULL != ex->r);
     ex->r->http_ver = HttpVersion(1,1);
     ex->connstate = STATE_HEADER;
-    ex->e = storeCreateEntry(uri, uri, request_flags(), METHOD_GET);
+    ex->e = storeCreateEntry(uri, uri, RequestFlags(), METHOD_GET);
     ex->buf_sz = NETDB_REQBUF_SZ;
     assert(NULL != ex->e);
     ex->sc = storeClientListAdd(ex->e, ex);
index 095d134315211ce5777ed7bd94fd4976710b8363..75ab674e51a769fd0ce1518c4c4efd7bb17dff75 100644 (file)
@@ -9,6 +9,7 @@
 #include "HttpRequestMethod.h"
 #include "ipc/forward.h"
 #include "mgr/QueryParams.h"
+#include "RequestFlags.h"
 
 namespace Mgr
 {
@@ -26,7 +27,7 @@ public:
     /* details of the client HTTP request that caused the action */
     String httpUri; ///< HTTP request URI
     _method_t httpMethod; ///< HTTP request method
-    request_flags httpFlags; ///< HTTP request flags
+    RequestFlags httpFlags; ///< HTTP request flags
     String httpOrigin;       ///< HTTP Origin: header (if any)
 
     /* action parameters extracted from the client HTTP request */
index 0d49ba7f58fe186edff392c64ed9d91240dfe06f..2d14023fd2d2caaf4e564fe2f83f6f7fc9d85444 100644 (file)
@@ -43,6 +43,7 @@
 #include "MemBuf.h"
 #include "mime.h"
 #include "MemObject.h"
+#include "RequestFlags.h"
 #include "SquidConfig.h"
 #include "Store.h"
 #include "StoreClient.h"
@@ -431,7 +432,7 @@ MimeIcon::created (StoreEntry *newEntry)
 
     int n;
 
-    request_flags flags;
+    RequestFlags flags;
 
     struct stat sb;
 
index 0ef005c88cde1159f3ede79d8e98308b5705d880..3677cf435380f88303d9f47f1e64a982148a0ea8 100644 (file)
@@ -54,6 +54,7 @@
 #include "neighbors.h"
 #include "PeerDigest.h"
 #include "PeerSelectState.h"
+#include "RequestFlags.h"
 #include "SquidConfig.h"
 #include "SquidMath.h"
 #include "SquidTime.h"
@@ -1375,7 +1376,7 @@ peerCountMcastPeersStart(void *data)
     snprintf(url, MAX_URL, "http://");
     p->in_addr.ToURL(url+7, MAX_URL -8 );
     strcat(url, "/");
-    fake = storeCreateEntry(url, url, request_flags(), METHOD_GET);
+    fake = storeCreateEntry(url, url, RequestFlags(), METHOD_GET);
     HttpRequest *req = HttpRequest::CreateFromUrl(url);
     psstate = new ps_state;
     psstate->request = HTTPMSGLOCK(req);
index 2e2213f808ae6462267fd33a815d982e887957e4..941c2c005488417dd1b51c44fe021df8ea2da2af 100644 (file)
@@ -48,6 +48,7 @@
 #include "mgr/StoreIoAction.h"
 #include "profiler/Profiler.h"
 #include "repl_modules.h"
+#include "RequestFlags.h"
 #include "SquidConfig.h"
 #include "SquidTime.h"
 #include "Stack.h"
@@ -817,7 +818,7 @@ StoreEntry::setPublicKey()
 }
 
 StoreEntry *
-storeCreateEntry(const char *url, const char *log_url, request_flags flags, const HttpRequestMethod& method)
+storeCreateEntry(const char *url, const char *log_url, const RequestFlags &flags, const HttpRequestMethod& method)
 {
     StoreEntry *e = NULL;
     MemObject *mem = NULL;
@@ -1966,7 +1967,7 @@ StoreEntry::hasIfNoneMatchEtag(const HttpRequest &request) const
 {
     const String reqETags = request.header.getList(HDR_IF_NONE_MATCH);
     // weak comparison is allowed only for HEAD or full-body GET requests
-    const bool allowWeakMatch = !request.flags.range &&
+    const bool allowWeakMatch = !request.flags.isRanged() &&
                                 (request.method == METHOD_GET || request.method == METHOD_HEAD);
     return hasOneOfEtags(reqETags, allowWeakMatch);
 }
index 784fbbe2b1ddf953be3df64e97ecfdbb2f532807..b1133c83acb464140c81f0092845533f73a4497e 100644 (file)
@@ -377,7 +377,7 @@ storeDigestRebuildStep(void *datanotused)
 static void
 storeDigestRewriteStart(void *datanotused)
 {
-    request_flags flags;
+    RequestFlags flags;
     char *url;
     StoreEntry *e;
 
index af8a4b7b4e07897bb4589702b1f76a931ca31f4f..a47763582eac316e7af4010b9f98e36ba23ffa91 100644 (file)
@@ -235,75 +235,6 @@ public:
     Http, Ftp, Gopher;
 };
 
-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),fail_on_validation_err(0),stale_if_hit(0),accelerated(0),ignore_cc(0),intercepted(0),hostVerified(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),pinned(0),canRePin(0),chunked_reply(0),stream_error(0),sslPeek(0),sslBumped(0),destinationIPLookedUp_(0) {
-#if USE_HTTP_VIOLATIONS
-        nocache_hack = 0;
-#endif
-#if FOLLOW_X_FORWARDED_FOR
-        done_follow_x_forwarded_for = 0;
-#endif /* FOLLOW_X_FORWARDED_FOR */
-    }
-
-    unsigned int range:1;
-    unsigned int nocache:1;            ///< whether the response to this request may be READ from cache
-    unsigned int ims:1;
-    unsigned int auth:1;
-    unsigned int cachable:1;           ///< whether the response to thie request may be stored in the cache
-    unsigned int hierarchical:1;
-    unsigned int loopdetect:1;
-    unsigned int proxy_keepalive:1;
-unsigned int proxying:
-    1; /* this should be killed, also in httpstateflags */
-    unsigned int refresh:1;
-    unsigned int redirected:1;
-    unsigned int need_validation:1;
-    unsigned int fail_on_validation_err:1; ///< whether we should fail if validation fails
-    unsigned int stale_if_hit:1; ///< reply is stale if it is a hit
-#if USE_HTTP_VIOLATIONS
-    unsigned int nocache_hack:1;       /* for changing/ignoring no-cache requests */
-#endif
-    unsigned int accelerated:1;
-    unsigned int ignore_cc:1;
-    unsigned int intercepted:1;        ///< intercepted request
-    unsigned int hostVerified:1;       ///< whether the Host: header passed verification
-    unsigned int spoof_client_ip:1;  /**< spoof client ip if possible */
-    unsigned int internal:1;
-    unsigned int internalclient:1;
-    unsigned int must_keepalive:1;
-    unsigned int connection_auth:1; /** Request wants connection oriented auth */
-    unsigned int connection_auth_disabled:1; /** Connection oriented auth can not be supported */
-    unsigned int connection_proxy_auth:1; /** Request wants connection oriented auth */
-    unsigned int pinned:1;      /* Request sent on a pinned connection */
-    unsigned int canRePin:1; ///< OK to reopen a failed pinned connection
-    unsigned int auth_sent:1;   /* Authentication forwarded */
-    unsigned int no_direct:1;  /* Deny direct forwarding unless overriden by always_direct. Used in accelerator mode */
-    unsigned int chunked_reply:1; /**< Reply with chunked transfer encoding */
-    unsigned int stream_error:1; /**< Whether stream error has occured */
-    unsigned int sslPeek:1; ///< internal ssl-bump request to get server cert
-    unsigned int sslBumped:1; /**< ssl-bumped request*/
-
-    // When adding new flags, please update cloneAdaptationImmune() as needed.
-
-    bool resetTCP() const;
-    void setResetTCP();
-    void clearResetTCP();
-    void destinationIPLookupCompleted();
-    bool destinationIPLookedUp() const;
-
-    // returns a partial copy of the flags that includes only those flags
-    // that are safe for a related (e.g., ICAP-adapted) request to inherit
-    request_flags cloneAdaptationImmune() const;
-
-#if FOLLOW_X_FORWARDED_FOR
-    unsigned int done_follow_x_forwarded_for;
-#endif /* FOLLOW_X_FORWARDED_FOR */
-private:
-
-    unsigned int reset_tcp:1;
-    unsigned int destinationIPLookedUp_:1;
-};
-
 #if USE_SSL
 struct _sslproxy_cert_sign {
     int alg;
index 136debf5d88eb300f19818f1ac7b64a341af6b35..bcc1f6a761045f258e3b621872676f07a718d00c 100644 (file)
@@ -1,4 +1,5 @@
 #include "squid.h"
+#include "RequestFlags.h"
 
 #define STUB_API "store.cc"
 #include "tests/STUB.h"
@@ -115,7 +116,7 @@ void storeEntryReplaceObject(StoreEntry *, HttpReply *) STUB
 SQUIDCEXTERN StoreEntry *storeGetPublic(const char *uri, const HttpRequestMethod& method) STUB_RETVAL(NULL)
 SQUIDCEXTERN StoreEntry *storeGetPublicByRequest(HttpRequest * request) STUB_RETVAL(NULL)
 SQUIDCEXTERN StoreEntry *storeGetPublicByRequestMethod(HttpRequest * request, const HttpRequestMethod& method) STUB_RETVAL(NULL)
-SQUIDCEXTERN StoreEntry *storeCreateEntry(const char *, const char *, request_flags, const HttpRequestMethod&) STUB_RETVAL(NULL)
+extern StoreEntry *storeCreateEntry(const char *, const char *, const RequestFlags &, const HttpRequestMethod&) STUB_RETVAL(NULL)
 SQUIDCEXTERN void storeInit(void) STUB
 SQUIDCEXTERN void storeConfigure(void) STUB
 SQUIDCEXTERN void storeFreeMemory(void) STUB
index ba48d2ee1060b0c804b77916e46a5b058c2bd72c..d2cabb711f34157c3e6619e175fd71eb3248823e 100644 (file)
@@ -9,6 +9,7 @@
 #include "MemObject.h"
 #include "HttpHeader.h"
 #include "HttpReply.h"
+#include "RequestFlags.h"
 #include "StoreFileSystem.h"
 #include "testStoreSupport.h"
 #include "SquidConfig.h"
@@ -188,7 +189,7 @@ testCoss::testCossSearch()
     /* add an entry */
     {
         /* Create "vary" base object */
-        request_flags flags;
+        RequestFlags flags;
         flags.cachable = 1;
         StoreEntry *pe = storeCreateEntry("dummy url", "dummy log url", flags, METHOD_GET);
         HttpReply *rep = (HttpReply *) pe->getReply(); // bypass const
index eb9cba8af69de437cab2558332cc9da327102baa..0e2bcf59d82eff7d25619f35855983699c1796b3 100644 (file)
@@ -9,6 +9,7 @@
 #include "MemObject.h"
 #include "HttpHeader.h"
 #include "HttpReply.h"
+#include "RequestFlags.h"
 #include "SquidConfig.h"
 #include "StoreFileSystem.h"
 #include "testStoreSupport.h"
@@ -159,7 +160,7 @@ testNull::testNullSearch()
     /* add an entry */
     {
         /* Create "vary" base object */
-        request_flags flags;
+        RequestFlags flags;
         flags.cachable = 1;
         StoreEntry *pe = storeCreateEntry("dummy url", "dummy log url", flags, METHOD_GET);
         /* We are allowed to do this typecast */
index de5167dd2ba9a50fc581b74bca08cc465f99b711..9ba566665749b35b286c81cd932f917d22dba2cd 100644 (file)
@@ -8,6 +8,7 @@
 #include "HttpReply.h"
 #include "Mem.h"
 #include "MemObject.h"
+#include "RequestFlags.h"
 #include "SquidConfig.h"
 #include "Store.h"
 #include "StoreFileSystem.h"
@@ -163,7 +164,7 @@ testRock::storeInit()
 StoreEntry *
 testRock::createEntry(const int i)
 {
-    request_flags flags;
+    RequestFlags flags;
     flags.cachable = 1;
     char url[64];
     snprintf(url, sizeof(url), "dummy url %i", i);
index 87a99767f782dc19006c5025c4ccb8f6f83e06df..1213414642fa884af162115a93f985a45daa2e73 100644 (file)
@@ -8,6 +8,7 @@
 #include "HttpReply.h"
 #include "Mem.h"
 #include "MemObject.h"
+#include "RequestFlags.h"
 #include "SquidConfig.h"
 #include "Store.h"
 #include "SwapDir.h"
@@ -140,7 +141,7 @@ testUfs::testUfsSearch()
     /* add an entry */
     {
         /* Create "vary" base object */
-        request_flags flags;
+        RequestFlags flags;
         flags.cachable = 1;
         StoreEntry *pe = storeCreateEntry("dummy url", "dummy log url", flags, METHOD_GET);
         HttpReply *rep = (HttpReply *) pe->getReply(); // bypass const
index ab64ff7df3ee8b22b6b8c56dc5ed1b99a51f8fea..c5c5964042e30359e470d60c6fecfba94f097411 100644 (file)
@@ -40,6 +40,7 @@
 #include "icmp/net_db.h"
 #include "MemBuf.h"
 #include "mime_header.h"
+#include "RequestFlags.h"
 #include "SquidTime.h"
 #include "Store.h"
 #include "StoreClient.h"
@@ -256,7 +257,7 @@ UrnState::created(StoreEntry *newEntry)
     urlres_e = newEntry;
 
     if (urlres_e->isNull()) {
-        urlres_e = storeCreateEntry(urlres, urlres, request_flags(), METHOD_GET);
+        urlres_e = storeCreateEntry(urlres, urlres, RequestFlags(), METHOD_GET);
         sc = storeClientListAdd(urlres_e, this);
         FwdState::fwdStart(Comm::ConnectionPointer(), urlres_e, urlres_r);
     } else {