]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Spread HttpHeader.h among .h monsters.
authorrousskov <>
Thu, 26 Feb 1998 13:30:01 +0000 (13:30 +0000)
committerrousskov <>
Thu, 26 Feb 1998 13:30:01 +0000 (13:30 +0000)
src/HttpHeader.cc
src/defines.h
src/enums.h
src/protos.h
src/structs.h
src/typedefs.h

index c84dd57761ecb68373ce62434a96cae585f108b7..74ebdf99b53806d8756f9cdb68532411e03c6e06 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: HttpHeader.cc,v 1.8 1998/02/25 16:35:08 rousskov Exp $
+ * $Id: HttpHeader.cc,v 1.9 1998/02/26 06:30:01 rousskov Exp $
  *
  * DEBUG: section 55    HTTP Header
  * AUTHOR: Alex Rousskov
@@ -30,7 +30,6 @@
 
 #include "squid.h"
 #include "MemPool.h"
-#include "HttpHeader.h"
 
 /*
    On naming conventions:
index 3b2aa2f16edaeeb7ae12e83d7d7b95329c7fb42f..2518fa7d813477e1958b9e3ddd121fc1ab9c3309 100644 (file)
 
 #define SKIP_BASIC_SZ ((size_t) 6)
 
-#if 0
-#define STAT_LOG_HIST_BINS 300
-#endif
-
 /* were to look for errors if config path fails */
 #define DEFAULT_SQUID_ERROR_DIR "/usr/local/squid/etc/errors"
index ddf3387e3f1968a1590b1e1e947f3167678ad012..c82e0c4584808fce5fd5eea85d4093ad47522bdf 100644 (file)
@@ -162,6 +162,49 @@ typedef enum {
     MGR_MAX
 } objcache_op;
 
+/* recognized or "known" header fields; @?@ add more! */
+typedef enum {
+    HDR_ACCEPT,
+    HDR_AGE,
+    HDR_CACHE_CONTROL,
+    HDR_CONNECTION,
+    HDR_CONTENT_ENCODING,
+    HDR_CONTENT_LENGTH,
+    HDR_CONTENT_MD5,
+    HDR_CONTENT_TYPE,
+    HDR_DATE,
+    HDR_ETAG,
+    HDR_EXPIRES,
+    HDR_HOST,
+    HDR_IMS,
+    HDR_LAST_MODIFIED,
+    HDR_LOCATION,
+    HDR_MAX_FORWARDS,
+    HDR_PROXY_AUTHENTICATE,
+    HDR_PUBLIC,
+    HDR_RETRY_AFTER,
+    HDR_SET_COOKIE,
+    HDR_UPGRADE,
+    HDR_WARNING,
+    HDR_WWW_AUTHENTICATE,
+    HDR_PROXY_KEEPALIVE,
+    HDR_OTHER,
+    HDR_ENUM_END
+} http_hdr_type;
+
+/* server cache-control */
+typedef enum {
+    SCC_PUBLIC,
+    SCC_PRIVATE,
+    SCC_NO_CACHE,
+    SCC_NO_STORE,
+    SCC_NO_TRANSFORM,
+    SCC_MUST_REVALIDATE,
+    SCC_PROXY_REVALIDATE,
+    SCC_MAX_AGE,
+    SCC_ENUM_END
+} http_scc_type;
+
 typedef enum {
     HIER_NONE,
     DIRECT,
index 448d35255183acd08ed08c8a0d6441991d1ba16a..b13ac7158b966015195ca9a70f8b4e8089d26a76 100644 (file)
@@ -206,9 +206,6 @@ extern int httpCachable(method_t);
 extern void httpStart(request_t *, StoreEntry *, peer *);
 extern void httpParseReplyHeaders(const char *, http_reply *);
 extern void httpProcessReplyHeader(HttpStateData *, const char *, int);
-#if 0
-extern void httpReplyHeaderStats(StoreEntry *);
-#endif
 extern size_t httpBuildRequestHeader(request_t * request,
     request_t * orig_request,
     StoreEntry * entry,
@@ -219,16 +216,35 @@ extern size_t httpBuildRequestHeader(request_t * request,
     int flags);
 extern int httpAnonAllowed(const char *line);
 extern int httpAnonDenied(const char *line);
-#if 0
-extern char *httpReplyHeader(double ver,
-    http_status status,
-    char *ctype,
-    int clen,
-    time_t lmt,
-    time_t expires);
-#endif
 extern void httpInit(void);
 
+/* Http Header */
+extern void httpHeaderInitModule();
+/* create/init/clean/destroy */
+extern HttpHeader *httpHeaderCreate();
+extern void httpHeaderInit(HttpHeader *hdr);
+extern void httpHeaderClean(HttpHeader *hdr);
+extern void httpHeaderDestroy(HttpHeader *hdr);
+/* clone */
+HttpHeader *httpHeaderClone(HttpHeader *hdr);
+/* parse/pack */
+extern int httpHeaderParse(HttpHeader *hdr, const char *header_start, const char *header_end);
+extern void httpHeaderPackInto(const HttpHeader *hdr, Packer *p);
+/* field manipulation */
+extern int httpHeaderHas(const HttpHeader *hdr, http_hdr_type type);
+extern void httpHeaderDel(HttpHeader *hdr, http_hdr_type id);
+extern void httpHeaderSetInt(HttpHeader *hdr, http_hdr_type type, int number);
+extern void httpHeaderSetTime(HttpHeader *hdr, http_hdr_type type, time_t time);
+extern void httpHeaderSetStr(HttpHeader *hdr, http_hdr_type type, const char *str);
+extern void httpHeaderSetAuth(HttpHeader *hdr, const char *authScheme, const char *realm);
+extern void httpHeaderAddExt(HttpHeader *hdr, const char *name, const char* value);
+extern const char *httpHeaderGetStr(const HttpHeader *hdr, http_hdr_type id);
+extern time_t httpHeaderGetTime(const HttpHeader *hdr, http_hdr_type id);
+extern HttpScc *httpHeaderGetScc(const HttpHeader *hdr);
+extern field_store httpHeaderGet(const HttpHeader *hdr, http_hdr_type id);
+int httpHeaderDelFields(HttpHeader *hdr, const char *name);
+/* store report about current header usage and other stats */
+extern void httpHeaderStoreReport(StoreEntry *e);
 
 extern void icmpOpen(void);
 extern void icmpClose(void);
index 024c68b7091c9b7a89c743fa12dbd99a6aa23c7a..916f49831f3b1744214ce76968fb520fc12e5657 100644 (file)
@@ -446,28 +446,36 @@ struct _hash_table {
 
 #include "MemBuf.h"
 #include "Packer.h"
-#include "HttpReply.h"
 
-#if 0                          /* tmp moved to HttpReply.h */
-#define Const const
-struct _http_reply {
-    double version;
-    int code;
-    int content_length;
-    int hdr_sz;                        /* includes _stored_ status-line, headers, and <CRLF> */
-    /* Note: fields below may not match info stored on disk */
-    Const int cache_control;
-    Const int misc_headers;
-    Const time_t date;
-    Const time_t expires;
-    Const time_t last_modified;
-    Const char content_type[HTTP_REPLY_FIELD_SZ];
-#if 0                          /* unused 512 bytes? */
-    Const char user_agent[HTTP_REPLY_FIELD_SZ << 2];
-#endif
+/* server cache control */
+struct _HttpScc {
+    int mask;
+    time_t max_age;
 };
 
-#endif
+/* a storage for an entry of one of possible types (for lower level routines) */
+union _field_store {
+    int v_int;
+    time_t v_time;
+    char *v_pchar;
+    const char *v_pcchar;
+    HttpScc *v_pscc;
+    HttpHeaderExtField *v_pefield;
+};
+
+struct _HttpHeader {
+    /* public, read only */
+    int emask;           /* bits set for present entries */
+
+    /* protected, do not use these, use interface functions instead */
+    int capacity;        /* max #entries before we have to grow */
+    int ucount;          /* #entries used, including holes */
+    HttpHeaderEntry *entries;
+};
+
+
+#include "HttpReply.h"
+
 
 
 struct _HttpStateData {
index 262d3b66e685c199a68b2c472812f1346a53c8c5..95eab48ad128b5234bb4e2fd867482b34501fba8 100644 (file)
@@ -46,6 +46,11 @@ typedef struct _hash_table hash_table;
 typedef struct _http_reply http_reply;
 #else
 typedef struct _HttpReply http_reply;
+typedef struct _HttpHeader HttpHeader;
+typedef struct _HttpScc HttpScc;
+typedef struct _HttpHeaderExtField HttpHeaderExtField;
+typedef struct _HttpHeaderEntry HttpHeaderEntry;
+typedef union _field_store field_store;
 #endif
 typedef struct _HttpStateData HttpStateData;
 typedef struct _icpUdpData icpUdpData;