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,
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);
#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 {
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;