r483 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Tue Jul 18 11:02:56 CEST 2006
Author: phk
Date: 2006-07-18 11:02:56 +0200 (Tue, 18 Jul 2006)
New Revision: 483
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_acceptor.c
trunk/varnish-cache/bin/varnishd/cache_center.c
trunk/varnish-cache/bin/varnishd/cache_hash.c
trunk/varnish-cache/bin/varnishd/cache_http.c
trunk/varnish-cache/bin/varnishd/cache_vrt.c
Log:
Retire the http_GetReq(), http_GetURL() and http_GetProto() accessor
functions now that struct http is out of the closet.
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2006-07-18 08:52:07 UTC (rev 482)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2006-07-18 09:02:56 UTC (rev 483)
@@ -45,8 +45,8 @@
char *s; /* start of buffer */
char *t; /* start of trailing data */
+ char *v; /* end of valid bytes */
char *e; /* end of buffer */
- char *v; /* valid bytes */
char *req;
char *url;
@@ -267,12 +267,9 @@
void http_Init(struct http *ht, void *space);
int http_GetHdr(struct http *hp, const char *hdr, char **ptr);
int http_GetHdrField(struct http *hp, const char *hdr, const char *field, char **ptr);
-int http_GetReq(struct http *hp, char **b);
-int http_GetProto(struct http *hp, char **b);
int http_GetStatus(struct http *hp);
int http_HdrIs(struct http *hp, const char *hdr, const char *val);
int http_GetTail(struct http *hp, unsigned len, char **b, char **e);
-int http_GetURL(struct http *hp, char **b);
void http_RecvHead(struct http *hp, int fd, struct event_base *eb, http_callback_f *func, void *arg);
int http_DissectRequest(struct http *sp, int fd);
int http_DissectResponse(struct http *sp, int fd);
Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-07-18 08:52:07 UTC (rev 482)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-07-18 09:02:56 UTC (rev 483)
@@ -79,7 +79,6 @@
{
struct storage *st;
unsigned u = 0;
- char *r;
uint64_t bytes = 0;
@@ -93,14 +92,14 @@
sp->obj->age + sp->t_req - sp->obj->entered);
sbuf_printf(w->sb, "Via: 1.1 varnish\r\n");
sbuf_printf(w->sb, "X-Varnish: xid %u\r\n", sp->obj->xid);
- if (http_GetProto(sp->http, &r) && strcmp(r, "HTTP/1.1"))
+ if (strcmp(sp->http->proto, "HTTP/1.1"))
sbuf_printf(w->sb, "Connection: close\r\n");
sbuf_printf(w->sb, "\r\n");
sbuf_finish(w->sb);
vca_write(sp, sbuf_data(w->sb), sbuf_len(w->sb));
bytes += sbuf_len(w->sb);
- assert(http_GetReq(sp->http, &r));
- if (!strcmp(r, "GET")) {
+ /* XXX: conditional request handling */
+ if (!strcmp(sp->http->req, "GET")) {
TAILQ_FOREACH(st, &sp->obj->store, list) {
u += st->len;
if (st->stevedore->send == NULL) {
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-07-18 08:52:07 UTC (rev 482)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-07-18 09:02:56 UTC (rev 483)
@@ -85,8 +85,7 @@
if (http_GetHdr(sp->http, "Connection", &b) &&
!strcmp(b, "close")) {
vca_close_session(sp, "Connection header");
- } else if (http_GetProto(sp->http, &b) &&
- strcmp(b, "HTTP/1.1")) {
+ } else if (strcmp(sp->http->proto, "HTTP/1.1")) {
vca_close_session(sp, "not HTTP/1.1");
}
VCL_Rel(sp->vcl);
Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-07-18 08:52:07 UTC (rev 482)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-07-18 09:02:56 UTC (rev 483)
@@ -46,7 +46,7 @@
struct http *h;
struct objhead *oh;
struct object *o;
- char *b, *c;
+ char *c;
assert(hash != NULL);
w = sp->wrk;
@@ -70,16 +70,15 @@
VSL_stats->n_object++;
}
- assert(http_GetURL(h, &b));
if (!http_GetHdr(h, "Host", &c))
- c = b;
+ c = h->url;
if (sp->obj != NULL) {
o = sp->obj;
oh = o->objhead;
AZ(pthread_mutex_lock(&oh->mtx));
goto were_back;
}
- oh = hash->lookup(b, c, w->nobjhead);
+ oh = hash->lookup(h->url, c, w->nobjhead);
if (oh == w->nobjhead)
w->nobjhead = NULL;
AZ(pthread_mutex_lock(&oh->mtx));
@@ -98,7 +97,7 @@
/* ignore */
} else if (o->ttl == 0) {
/* Object banned but not reaped yet */
- } else if (BAN_CheckObject(o, b)) {
+ } else if (BAN_CheckObject(o, h->url)) {
o->ttl = 0;
VSL(SLT_ExpBan, 0, "%u was banned", o->xid);
EXP_TTLchange(o);
Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c 2006-07-18 08:52:07 UTC (rev 482)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c 2006-07-18 09:02:56 UTC (rev 483)
@@ -100,33 +100,6 @@
}
int
-http_GetReq(struct http *hp, char **b)
-{
- if (hp->req == NULL)
- return (0);
- *b = hp->req;
- return (1);
-}
-
-int
-http_GetURL(struct http *hp, char **b)
-{
- if (hp->url == NULL)
- return (0);
- *b = hp->url;
- return (1);
-}
-
-int
-http_GetProto(struct http *hp, char **b)
-{
- if (hp->proto == NULL)
- return (0);
- *b = hp->proto;
- return (1);
-}
-
-int
http_GetTail(struct http *hp, unsigned len, char **b, char **e)
{
Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-07-18 08:52:07 UTC (rev 482)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-07-18 09:02:56 UTC (rev 483)
@@ -54,12 +54,10 @@
char *
VRT_GetReq(struct sess *sp)
{
- char *p;
assert(sp != NULL);
assert(sp->http != NULL);
- assert(http_GetReq(sp->http, &p));
- return (p);
+ return (sp->http->req);
}
/*--------------------------------------------------------------------*/
More information about the varnish-commit
mailing list