From: rousskov <> Date: Thu, 26 Feb 1998 13:30:01 +0000 (+0000) Subject: Spread HttpHeader.h among .h monsters. X-Git-Tag: SQUID_3_0_PRE1~3980 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f0874195459281bad3f18a62f5b1eccf6adbdf7;p=thirdparty%2Fsquid.git Spread HttpHeader.h among .h monsters. --- diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index c84dd57761..74ebdf99b5 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -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: diff --git a/src/defines.h b/src/defines.h index 3b2aa2f16e..2518fa7d81 100644 --- a/src/defines.h +++ b/src/defines.h @@ -206,9 +206,5 @@ #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" diff --git a/src/enums.h b/src/enums.h index ddf3387e3f..c82e0c4584 100644 --- a/src/enums.h +++ b/src/enums.h @@ -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, diff --git a/src/protos.h b/src/protos.h index 448d352551..b13ac7158b 100644 --- a/src/protos.h +++ b/src/protos.h @@ -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); diff --git a/src/structs.h b/src/structs.h index 024c68b709..916f49831f 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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 */ - /* 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 { diff --git a/src/typedefs.h b/src/typedefs.h index 262d3b66e6..95eab48ad1 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -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;