]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceLayout: ETag and TimeOrTag in their own headers
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 23 Jun 2011 08:31:56 +0000 (02:31 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 23 Jun 2011 08:31:56 +0000 (02:31 -0600)
12 files changed:
src/ETag.cc
src/ETag.h [new file with mode: 0644]
src/HttpHeader.cc
src/HttpHeader.h
src/Makefile.am
src/TimeOrTag.h [new file with mode: 0644]
src/client_side.cc
src/errorpage.cc
src/protos.h
src/store.cc
src/structs.h
src/typedefs.h

index c845c52068097e4c58d27229776550d1f4560d42..b2307b3fa29da2d58c0abe085d6066bf672ea990 100644 (file)
  *
  */
 
-#include "squid.h"
+#include "config.h"
+#include "ETag.h"
+
+#if HAVE_CSTRING
+#include <cstring>
+#endif
 
 /*
  * Note: ETag is not an http "field" like, for example HttpHdrRange. ETag is a
diff --git a/src/ETag.h b/src/ETag.h
new file mode 100644 (file)
index 0000000..0c3f1ae
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef _SQUID_ETAG_H
+#define _SQUID_ETAG_H
+
+/**
+ * ETag support is rudimantal; this struct is likely to change
+ * Note: "str" points to memory in HttpHeaderEntry (for now)
+ *       so ETags should be used as tmp variables only (for now)
+ */
+class ETag
+{
+public:
+    const char *str;            ///< quoted-string
+    int weak;                   ///< true if it is a weak validator
+};
+
+/* ETag */
+SQUIDCEXTERN int etagParseInit(ETag * etag, const char *str);
+/// whether etags are strong-equal
+SQUIDCEXTERN bool etagIsStrongEqual(const ETag &tag1, const ETag &tag2);
+/// whether etags are weak-equal
+SQUIDCEXTERN bool etagIsWeakEqual(const ETag &tag1, const ETag &tag2);
+
+#endif /* _SQUIDETAG_H */
index 10bd05bb854e9fbc10c5e4d66f06d1c39575f827..39cdc309434d4ebf87e2aef1c4380d934dc799d3 100644 (file)
@@ -42,6 +42,7 @@
 #include "mgr/Registration.h"
 #include "rfc1123.h"
 #include "Store.h"
+#include "TimeOrTag.h"
 
 /*
  * On naming conventions:
index 84fa95b12e8cccf6c5e5afeac84255753e9e7638..778b76fc1c7c49b62280d2f5f1b8f6e102623056 100644 (file)
@@ -177,14 +177,6 @@ typedef ssize_t HttpHeaderPos;
 /* use this and only this to initialize HttpHeaderPos */
 #define HttpHeaderInitPos (-1)
 
-/* these two are defined in  structs.h */
-
-/// \todo CLEANUP: Kill this.
-typedef struct _TimeOrTag TimeOrTag;
-
-/// \todo CLEANUP: Kill this.
-typedef struct _ETag ETag;
-
 class HttpHeaderEntry
 {
 
@@ -204,6 +196,9 @@ public:
 
 MEMPROXY_CLASS_INLINE(HttpHeaderEntry);
 
+class ETag;
+class TimeOrTag;
+
 class HttpHeader
 {
 
index c65d35ac6f87ead6c20f7a8d6e93ad17f2321cb3..6c152419ed4e42a1fdcfa81ebcdf65294f5bf238 100644 (file)
@@ -310,6 +310,7 @@ squid_SOURCES = \
        errorpage.cc \
        errorpage.h \
        ETag.cc \
+       ETag.h \
        event.cc \
        event.h \
        EventLoop.h \
@@ -469,6 +470,7 @@ squid_SOURCES = \
        SwapDir.cc \
        SwapDir.h \
        time.cc \
+       TimeOrTag.h \
        tools.cc \
        tunnel.cc \
        typedefs.h \
diff --git a/src/TimeOrTag.h b/src/TimeOrTag.h
new file mode 100644 (file)
index 0000000..b3449d9
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef _SQUID_TIMEORTAG_H
+#define _SQUID_TIMEORTAG_H
+
+#include "ETag.h"
+
+/**
+ * Some fields can hold either time or etag specs (e.g. If-Range)
+ */
+class TimeOrTag {
+public:
+    ETag tag;                   /* entity tag */
+    time_t time;
+    int valid;                  /* true if struct is usable */
+};
+
+#endif /* _SQUID_TIMEORTAG_H */
index 472ec928b28660d974732491b64989c5975e18ca..85d545befb88445082829d6532bb165e130fd86c 100644 (file)
 #include "ssl/certificate_db.h"
 #endif
 #include "Store.h"
+#include "TimeOrTag.h"
 
 #if HAVE_LIMITS
 #include <limits>
index 7a6d7a683f69504c37ed2d6e131e9426cbc93f87..095bd2781cf79f21f072e95ef436205b05c6e59f 100644 (file)
@@ -39,6 +39,7 @@
 #include "auth/UserRequest.h"
 #endif
 #include "SquidTime.h"
+#include "ssl/ErrorDetailManager.h"
 #include "Store.h"
 #include "html_quote.h"
 #include "HttpReply.h"
index c5a61794d550229df603b44bd51d220e78988af1..446018f7330b4a0a8919e4e3392c3ff1311b358c 100644 (file)
@@ -219,13 +219,6 @@ SQUIDCEXTERN int httpAnonHdrAllowed(http_hdr_type hdr_id);
 SQUIDCEXTERN int httpAnonHdrDenied(http_hdr_type hdr_id);
 SQUIDCEXTERN const char *httpMakeVaryMark(HttpRequest * request, HttpReply const * reply);
 
-/* ETag */
-SQUIDCEXTERN int etagParseInit(ETag * etag, const char *str);
-/// whether etags are strong-equal
-SQUIDCEXTERN bool etagIsStrongEqual(const ETag &tag1, const ETag &tag2);
-/// whether etags are weak-equal
-SQUIDCEXTERN bool etagIsWeakEqual(const ETag &tag1, const ETag &tag2);
-
 #include "HttpStatusCode.h"
 SQUIDCEXTERN const char *httpStatusString(http_status status);
 
index d574fecb9174d198e99103785005321a21fd7cb4..94e382e6633a0f754df8c14ee376d86a03e8dc81 100644 (file)
@@ -36,6 +36,7 @@
 #include "squid.h"
 #include "CacheManager.h"
 #include "comm/Connection.h"
+#include "ETag.h"
 #include "event.h"
 #include "fde.h"
 #include "Store.h"
index 38b978780f46fd5cac3f3f4fd03d6c5029a7d81c..c4b72debba3d13514bf28bc3d5a63b8909641cb3 100644 (file)
@@ -660,17 +660,6 @@ struct _dwrite_q {
     FREE *free_func;
 };
 
-
-/* ETag support is rudimantal;
- * this struct is likely to change
- * Note: "str" points to memory in HttpHeaderEntry (for now)
- *       so ETags should be used as tmp variables only (for now) */
-
-struct _ETag {
-    const char *str;           /* quoted-string */
-    int weak;                  /* true if it is a weak validator */
-};
-
 struct _fde_disk {
     DWCB *wrt_handle;
     void *wrt_handle_data;
@@ -723,14 +712,6 @@ public:
     String other;
 };
 
-/* some fields can hold either time or etag specs (e.g. If-Range) */
-
-struct _TimeOrTag {
-    ETag tag;                  /* entity tag */
-    time_t time;
-    int valid;                 /* true if struct is usable */
-};
-
 /* per field statistics */
 
 class HttpHeaderFieldStat
index 8ef0b2bed5068f36b54646c77eac248fa5795a0e..ce065c35a8dc0bc5ccf166ad5e04278f06301364 100644 (file)
@@ -60,14 +60,10 @@ typedef struct _dread_ctrl dread_ctrl;
 
 typedef struct _dwrite_q dwrite_q;
 
-typedef struct _ETag ETag;
-
 typedef struct _fileMap fileMap;
 
 typedef struct _HttpHeaderFieldAttrs HttpHeaderFieldAttrs;
 
-typedef struct _TimeOrTag TimeOrTag;
-
 typedef struct _HttpHeaderStat HttpHeaderStat;
 
 typedef struct _HttpBody HttpBody;