From: phk Date: Sat, 8 Jul 2006 19:54:10 +0000 (+0000) Subject: Move struct http into cache.h X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c8a4467a7719fbf6f0683284c0119876bce0111;p=varnish Move struct http into cache.h The original reasoning for having it private to cache_http.c was to avoid pollution with event.h related structures but since that pollution is happening other ways anyway, the cost is too high. Include pthread.h, sys/time.h, and event.h from cache.h git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@380 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 00642140..302ef08a 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -2,7 +2,10 @@ * $Id$ */ +#include +#include #include +#include #include "vcl_returns.h" @@ -15,7 +18,36 @@ struct sess; struct object; struct objhead; -#ifdef EV_TIMEOUT +/*-------------------------------------------------------------------- + * HTTP Request/Response/Header handling structure. + * RSN: struct worker and struct session will have one of these embedded. + */ + +typedef void http_callback_f(void *, int bad); + +struct http { + struct event ev; + http_callback_f *callback; + void *arg; + + char *s; /* start of buffer */ + char *e; /* end of buffer */ + char *v; /* valid bytes */ + char *t; /* start of trailing data */ + + + char *req; + char *url; + char *proto; + char *status; + char *response; + + char **hdr; + unsigned nhdr; +}; + +/*--------------------------------------------------------------------*/ + struct worker { struct event_base *eb; struct event e1, e2; @@ -23,9 +55,6 @@ struct worker { struct objhead *nobjhead; struct object *nobj; }; -#else -struct worker; -#endif #include "hash_slinger.h" @@ -169,8 +198,6 @@ void HSH_Deref(struct object *o); void HSH_Init(void); /* cache_http.c */ -typedef void http_callback_f(void *, int bad); -struct http; struct http *http_New(void); void http_Delete(struct http *hp); int http_GetHdr(struct http *hp, const char *hdr, char **ptr); @@ -187,7 +214,7 @@ enum http_build { Build_Pipe, Build_Pass, Build_Fetch, - Build_Reply, + Build_Reply }; void http_BuildSbuf(int fd, enum http_build mode, struct sbuf *sb, struct http *hp); diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index bbb64e1c..c88ec28f 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -23,29 +23,6 @@ static unsigned http_nhdr = 128; /*--------------------------------------------------------------------*/ -struct http { - struct event ev; - http_callback_f *callback; - void *arg; - - char *s; /* start of buffer */ - char *e; /* end of buffer */ - char *v; /* valid bytes */ - char *t; /* start of trailing data */ - - - char *req; - char *url; - char *proto; - char *status; - char *response; - - char **hdr; - unsigned nhdr; -}; - -/*--------------------------------------------------------------------*/ - struct http * http_New(void) {