From phk at projects.linpro.no Tue Aug 1 09:39:53 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 11:39:53 +0200 (CEST) Subject: r583 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20060801093953.4C6CF1EC3EB@projects.linpro.no> Author: phk Date: 2006-08-01 11:39:52 +0200 (Tue, 01 Aug 2006) New Revision: 583 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_fetch.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_pool.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/bin/varnishd/rfc2616.c trunk/varnish-cache/include/shmlog_tags.h Log: Record timestamp when we have received completed HTTP request header, and define this as the "start of request timestamp". Define "end of request timestamp" as when we are ready to transmit HTTP header back. SHMlog the start and difference between start and stop with ReqServTime tag. Keep track of idle sessions using CLOCK_MONOTONIC to avoid trouble here should our clock get stepped. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-07-31 22:21:02 UTC (rev 582) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-01 09:39:52 UTC (rev 583) @@ -243,8 +243,8 @@ const char *doclose; struct http *http; - time_t t_req; - time_t t_resp; + struct timespec t_req; + struct timespec t_idle; enum step step; unsigned handling; Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-07-31 22:21:02 UTC (rev 582) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-01 09:39:52 UTC (rev 583) @@ -41,15 +41,15 @@ vca_tick(int a, short b, void *c) { struct sess *sp, *sp2; - time_t t; + struct timespec t; (void)a; (void)b; (void)c; AZ(evtimer_add(&tick_e, &tick_rate)); - (void)time(&t); + clock_gettime(CLOCK_MONOTONIC, &t); TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { - if (sp->t_resp + 30 < t) { + if (sp->t_idle.tv_sec + 30 < t.tv_sec) { TAILQ_REMOVE(&sesshead, sp, list); vca_close_session(sp, "timeout"); vca_return_session(sp); @@ -88,7 +88,7 @@ (void)arg; i = read(fd, &sp, sizeof sp); assert(i == sizeof sp); - sp->t_resp = time(NULL); + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); TAILQ_INSERT_TAIL(&sesshead, sp, list); http_RecvHead(sp->http, sp->fd, evb, vca_callback, sp); } @@ -132,7 +132,7 @@ TCP_name(addr, l, sp->addr, sizeof sp->addr, sp->port, sizeof sp->port); VSL(SLT_SessionOpen, sp->fd, "%s %s", sp->addr, sp->port); - (void)time(&sp->t_resp); + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); TAILQ_INSERT_TAIL(&sesshead, sp, list); http_RecvHead(sp->http, sp->fd, evb, vca_callback, sp); } Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-07-31 22:21:02 UTC (rev 582) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-01 09:39:52 UTC (rev 583) @@ -291,7 +291,6 @@ sp->backend->hostname); } - sp->t_req = time(NULL); WRK_Reset(w, &vc->fd); http_Write(w, vc->http, 0); i = WRK_Flush(w); @@ -303,8 +302,10 @@ */ http_RecvHead(vc->http, vc->fd, w->eb, NULL, NULL); (void)event_base_loop(w->eb, 0); - sp->t_resp = time(NULL); assert(http_DissectResponse(vc->http, vc->fd) == 0); sp->vbc = vc; + + sp->obj->entered = time(NULL); + return (0); } Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-07-31 22:21:02 UTC (rev 582) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-01 09:39:52 UTC (rev 583) @@ -108,7 +108,7 @@ /* ignore */ } else if (o->ttl == 0) { /* Object banned but not reaped yet */ - } else if (o->ttl < sp->t_req) { + } else if (o->ttl < sp->t_req.tv_sec) { /* Object expired */ } else if (BAN_CheckObject(o, url)) { o->ttl = 0; Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-07-31 22:21:02 UTC (rev 582) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-01 09:39:52 UTC (rev 583) @@ -189,7 +189,7 @@ struct worker *w; pthread_t tp; - sp->t_req = time(NULL); + clock_gettime(CLOCK_REALTIME, &sp->t_req); sp->workreq.sess = sp; Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-07-31 22:21:02 UTC (rev 582) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-01 09:39:52 UTC (rev 583) @@ -33,7 +33,7 @@ sbuf_clear(sb); sbuf_printf(sb, "HTTP/1.1 %03d %s\r\n", error, msg); - TIM_format(sp->t_req, buf); + TIM_format(sp->t_req.tv_sec, buf); sbuf_printf(sb, "Date: %s\r\n", buf); sbuf_cat(sb, "Server: Varnish\r\n" @@ -106,7 +106,7 @@ if (sp->obj->last_modified > 0 && http_GetHdr(sp->http, H_If_Modified_Since, &p)) { ims = TIM_parse(p); - if (ims > sp->t_req) /* [RFC2616 14.25] */ + if (ims > sp->t_req.tv_sec) /* [RFC2616 14.25] */ return (0); if (ims > sp->obj->last_modified) { VSL(SLT_Debug, sp->fd, @@ -128,7 +128,15 @@ { struct storage *st; unsigned u = 0; + double dt; + struct timespec t_resp; + clock_gettime(CLOCK_REALTIME, &t_resp); + dt = (t_resp.tv_sec - sp->t_req.tv_sec); + dt += (t_resp.tv_nsec - sp->t_req.tv_nsec) * 1e-9; + VSL(SLT_ReqServTime, sp->fd, "%ld.%09ld %.9f", + (long)sp->t_req.tv_sec, (long)sp->t_req.tv_nsec, dt); + if (sp->obj->response == 200 && sp->http->conds && res_do_conds(sp)) return; @@ -144,7 +152,7 @@ else http_PrintfHeader(sp->fd, sp->http, "X-Varnish: %u", sp->xid); http_PrintfHeader(sp->fd, sp->http, "Age: %u", - sp->obj->age + sp->t_req - sp->obj->entered); + sp->obj->age + sp->t_req.tv_sec - sp->obj->entered); http_SetHeader(sp->fd, sp->http, "Via: 1.1 varnish"); if (sp->doclose != NULL) http_SetHeader(sp->fd, sp->http, "Connection: close"); Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-07-31 22:21:02 UTC (rev 582) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-01 09:39:52 UTC (rev 583) @@ -119,7 +119,16 @@ VBACKEND(const char *, host, hostname) VBACKEND(const char *, port, portname) -/*--------------------------------------------------------------------*/ +/*-------------------------------------------------------------------- + * XXX: Working relative to t_req is maybe not the right thing, we could + * XXX: have spent a long time talking to the backend since then. + * XXX: It might make sense to cache a timestamp as "current time" + * XXX: before vcl_recv (== t_req) and vcl_fetch. + * XXX: On the other hand, that might lead to inconsistent behaviour + * XXX: where an object expires while we are running VCL code, and + * XXX: and that may not be a good idea either. + * XXX: See also related t_req use in cache_hash.c + */ void VRT_l_obj_ttl(struct sess *sp, double a) @@ -130,7 +139,7 @@ VSL(SLT_TTL, sp->fd, "%u VCL %.0f %u", sp->obj->xid, a, sp->t_req); if (a < 0) a = 0; - sp->obj->ttl = sp->t_req + (int)a; + sp->obj->ttl = sp->t_req.tv_sec + (int)a; if (sp->obj->heap_idx != 0) EXP_TTLchange(sp->obj); } @@ -140,7 +149,7 @@ { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* XXX */ - return (sp->obj->ttl - sp->t_req); + return (sp->obj->ttl - sp->t_req.tv_sec); } /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/rfc2616.c =================================================================== --- trunk/varnish-cache/bin/varnishd/rfc2616.c 2006-07-31 22:21:02 UTC (rev 582) +++ trunk/varnish-cache/bin/varnishd/rfc2616.c 2006-08-01 09:39:52 UTC (rev 583) @@ -71,15 +71,13 @@ #endif static time_t -RFC2616_Ttl(struct sess *sp, struct http *hp, time_t t_req, time_t t_resp, struct object *obj) +RFC2616_Ttl(struct sess *sp, struct http *hp, struct object *obj) { int retirement_age; unsigned u1, u2; time_t h_date, h_expires, ttd; char *p; - (void)t_resp; /* XXX */ - retirement_age = INT_MAX; u1 = u2 = 0; @@ -102,10 +100,11 @@ if (http_GetHdr(hp, H_Expires, &p)) h_expires = TIM_parse(p); - if (h_date < t_req && h_expires > t_req) { + if (h_date < obj->entered && h_expires > obj->entered) { ttd = h_expires; - if (retirement_age != INT_MAX && t_req + retirement_age < ttd) - ttd = t_req + retirement_age; + if (retirement_age != INT_MAX && + obj->entered + retirement_age < ttd) + ttd = obj->entered + retirement_age; } else { if (h_date != 0 && h_expires != 0) { if (h_date < h_expires && @@ -115,13 +114,13 @@ if (retirement_age == INT_MAX) retirement_age = heritage.default_ttl; - ttd = t_req + retirement_age; + ttd = obj->entered + retirement_age; } /* calculated TTL, Our time, Date, Expires, max-age, age */ VSL(SLT_TTL, sp->fd, "%u RFC %d %d %d %d %d %d", sp->xid, - (int)(ttd - t_req), (int)t_req, (int)h_date, (int)h_expires, - (int)u1, (int)u2); + (int)(ttd - obj->entered), (int)obj->entered, (int)h_date, + (int)h_expires, (int)u1, (int)u2); return (ttd); } @@ -155,8 +154,7 @@ break; } - sp->obj->ttl = RFC2616_Ttl(sp, hp, sp->t_req, sp->t_resp, sp->obj); - sp->obj->entered = sp->t_req; + sp->obj->ttl = RFC2616_Ttl(sp, hp, sp->obj); if (sp->obj->ttl == 0) { sp->obj->cacheable = 0; } Modified: trunk/varnish-cache/include/shmlog_tags.h =================================================================== --- trunk/varnish-cache/include/shmlog_tags.h 2006-07-31 22:21:02 UTC (rev 582) +++ trunk/varnish-cache/include/shmlog_tags.h 2006-08-01 09:39:52 UTC (rev 583) @@ -13,6 +13,7 @@ SLTM(CLI) SLTM(StatAddr) SLTM(StatSess) +SLTM(ReqServTime) SLTM(SessionOpen) SLTM(SessionReuse) SLTM(SessionClose) From phk at phk.freebsd.dk Tue Aug 1 10:25:37 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Tue, 01 Aug 2006 10:25:37 +0000 Subject: r583 - in trunk/varnish-cache: bin/varnishd include In-Reply-To: Your message of "Tue, 01 Aug 2006 11:39:53 +0200." <20060801093953.4C6CF1EC3EB@projects.linpro.no> Message-ID: <92605.1154427937@critter.freebsd.dk> In message <20060801093953.4C6CF1EC3EB at projects.linpro.no>, phk at projects.linpro .no writes: >SHMlog the start and difference between start and stop with ReqServTime >tag. I just ran a very quick live-test to see the distrbution of our service time. For both hits and misses we have a "hockey-stick" figure with a small percentage of the transactions accounting for a large part of the average. The tables below show the numbers for the the entire dataset and for the 99, 95, 90 and 75% fastest of the dataset. Notice how rapidly the Max value falls off. Since some of the hits may actually have been waiting on a busy object while another session filled it from the backend, I think it is fair to say that a "un-encumbered" hit takes less than 100 usec and typically less than 50usec to process. Poul-Henning ===> hit N Min Max Median Avg Stddev 100% 5196 24.865e-06 0.002863344 44.98e-06 54.471059e-06 46.992297e-06 99% 5144 24.865e-06 0.000150585 44.98e-06 52.087417e-06 16.672175e-06 95% 4936 24.865e-06 86.886e-06 44.701e-06 49.620993e-06 11.263975e-06 90% 4676 24.865e-06 77.387e-06 44.421e-06 47.891206e-06 8.7613014e-06 75% 3897 24.865e-06 51.406e-06 43.862e-06 44.476003e-06 2.5034017e-06 ===> fetch N Min Max Median Avg Stddev 100% 701 0.002255418 13.741159 0.010918089 0.21945862 0.87530516 99% 693 0.002255418 2.5146695 0.010593451 0.14724379 0.3537625 95% 665 0.002255418 1.0104925 0.009807282 0.086928877 0.18072753 90% 630 0.002255418 0.50737959 0.009042904 0.052588283 0.10405137 75% 525 0.002255418 0.089049749 0.006494698 0.013066963 0.015961684 -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From phk at projects.linpro.no Tue Aug 1 12:04:56 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 14:04:56 +0200 (CEST) Subject: r584 - trunk/varnish-cache/bin/varnishd Message-ID: <20060801120456.F3D1E1EC486@projects.linpro.no> Author: phk Date: 2006-08-01 14:04:56 +0200 (Tue, 01 Aug 2006) New Revision: 584 Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c Log: Experiment: don't use req's workspace to build object http header. Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-01 09:39:52 UTC (rev 583) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-01 12:04:56 UTC (rev 584) @@ -17,6 +17,7 @@ #include "shmlog.h" #include "libvarnish.h" #include "cache.h" +#include "heritage.h" /* * Chunked encoding is a hack. We prefer to have a single chunk or a @@ -211,6 +212,7 @@ struct vbe_conn *vc; char *b; int body = 1; /* XXX */ + struct http *hp; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); @@ -222,16 +224,21 @@ if (http_GetHdr(vc->http, H_Last_Modified, &b)) sp->obj->last_modified = TIM_parse(b); + hp = &sp->obj->http; + hp->s = malloc(heritage.mem_workspace); + assert(hp->s != NULL); + hp->e = hp->s + heritage.mem_workspace; + hp->v = hp->s; /* * We borrow the sessions workspace and http header for building the * headers to store in the object, then copy them over there. * The actual headers to reply with are built later on over in * cache_response.c */ - http_ClrHeader(sp->http); - sp->http->logtag = HTTP_Obj; - http_CopyResp(sp->fd, sp->http, vc->http); - http_FilterHeader(sp->fd, sp->http, vc->http, HTTPH_A_INS); + http_ClrHeader(hp); + hp->logtag = HTTP_Obj; + http_CopyResp(sp->fd, hp, vc->http); + http_FilterHeader(sp->fd, hp, vc->http, HTTPH_A_INS); if (body) { if (http_GetHdr(vc->http, H_Content_Length, &b)) @@ -240,11 +247,10 @@ cls = fetch_chunked(sp, vc->fd, vc->http); else cls = fetch_eof(sp, vc->fd, vc->http); - http_PrintfHeader(sp->fd, sp->http, + http_PrintfHeader(sp->fd, hp, "Content-Length: %u", sp->obj->len); } else cls = 0; - http_CopyHttp(&sp->obj->http, sp->http); if (http_GetHdr(vc->http, H_Connection, &b) && !strcasecmp(b, "close")) cls = 1; From phk at projects.linpro.no Tue Aug 1 12:38:26 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 14:38:26 +0200 (CEST) Subject: r585 - trunk/varnish-cache/bin/varnishd Message-ID: <20060801123826.4797F1EC3B6@projects.linpro.no> Author: phk Date: 2006-08-01 14:38:26 +0200 (Tue, 01 Aug 2006) New Revision: 585 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_fetch.c Log: This is getting too longhaired: Give backend connections another http header which we can use to build the object headers in. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-01 12:04:56 UTC (rev 584) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-01 12:38:26 UTC (rev 585) @@ -133,6 +133,8 @@ struct event ev; int inuse; struct http *http; + struct http *http2; + struct http http_mem[2]; }; /* Storage -----------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-01 12:04:56 UTC (rev 584) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-01 12:38:26 UTC (rev 585) @@ -43,7 +43,6 @@ unsigned magic; #define VBC_MEM_MAGIC 0x2fd7af01 struct vbe_conn vbc; - struct http http; }; /* A backend IP */ @@ -72,17 +71,24 @@ vbe_new_conn(void) { struct vbc_mem *vbcm; + struct vbe_conn *vbc; + unsigned char *p; - vbcm = calloc(sizeof *vbcm + heritage.mem_workspace, 1); + vbcm = calloc(sizeof *vbcm + heritage.mem_workspace * 2, 1); if (vbcm == NULL) return (NULL); vbcm->magic = VBC_MEM_MAGIC; VSL_stats->n_vbe_conn++; - vbcm->vbc.magic = VBE_CONN_MAGIC; - vbcm->vbc.vbcm = vbcm; - vbcm->vbc.http = &vbcm->http; - http_Setup(&vbcm->http, (void *)(vbcm + 1), heritage.mem_workspace); - return (&vbcm->vbc); + vbc = &vbcm->vbc; + vbc->magic = VBE_CONN_MAGIC; + vbc->vbcm = vbcm; + vbc->http = &vbc->http_mem[0]; + vbc->http2 = &vbc->http_mem[1]; + p = (void *)(vbcm + 1); + http_Setup(vbc->http, p, heritage.mem_workspace); + p += heritage.mem_workspace; + http_Setup(vbc->http2, p, heritage.mem_workspace); + return (vbc); } static void Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-01 12:04:56 UTC (rev 584) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-01 12:38:26 UTC (rev 585) @@ -224,17 +224,7 @@ if (http_GetHdr(vc->http, H_Last_Modified, &b)) sp->obj->last_modified = TIM_parse(b); - hp = &sp->obj->http; - hp->s = malloc(heritage.mem_workspace); - assert(hp->s != NULL); - hp->e = hp->s + heritage.mem_workspace; - hp->v = hp->s; - /* - * We borrow the sessions workspace and http header for building the - * headers to store in the object, then copy them over there. - * The actual headers to reply with are built later on over in - * cache_response.c - */ + hp = vc->http2; http_ClrHeader(hp); hp->logtag = HTTP_Obj; http_CopyResp(sp->fd, hp, vc->http); @@ -252,6 +242,8 @@ } else cls = 0; + http_CopyHttp(&sp->obj->http, hp); + if (http_GetHdr(vc->http, H_Connection, &b) && !strcasecmp(b, "close")) cls = 1; From phk at projects.linpro.no Tue Aug 1 14:53:30 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 16:53:30 +0200 (CEST) Subject: r586 - trunk/varnish-cache/bin/varnishd Message-ID: <20060801145330.079001EC48C@projects.linpro.no> Author: phk Date: 2006-08-01 16:53:29 +0200 (Tue, 01 Aug 2006) New Revision: 586 Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c trunk/varnish-cache/bin/varnishd/storage_file.c Log: Add miniobj checks om SMF and STORAGE Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-01 12:38:26 UTC (rev 585) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-01 14:53:29 UTC (rev 586) @@ -17,7 +17,6 @@ #include "shmlog.h" #include "libvarnish.h" #include "cache.h" -#include "heritage.h" /* * Chunked encoding is a hack. We prefer to have a single chunk or a Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-01 12:38:26 UTC (rev 585) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-01 14:53:29 UTC (rev 586) @@ -35,6 +35,8 @@ /*--------------------------------------------------------------------*/ struct smf { + unsigned magic; +#define SMF_MAGIC 0x0927a8a0 struct storage s; struct smf_sc *sc; @@ -284,9 +286,11 @@ { struct smf *sp, *sp2; - TAILQ_FOREACH(sp, &sc->free, status) + TAILQ_FOREACH(sp, &sc->free, status) { + CHECK_OBJ_NOTNULL(sp, SMF_MAGIC); if (sp->size >= bytes) break; + } if (sp == NULL) return (sp); @@ -325,6 +329,7 @@ struct smf *sp2; struct smf_sc *sc = sp->sc; + CHECK_OBJ_NOTNULL(sp, SMF_MAGIC); TAILQ_REMOVE(&sc->used, sp, status); sp->alloc = 0; @@ -376,6 +381,7 @@ struct smf_sc *sc = sp->sc; assert(bytes > 0); + CHECK_OBJ_NOTNULL(sp, SMF_MAGIC); sp2 = malloc(sizeof *sp2); assert(sp2 != NULL); VSL_stats->n_smf++; @@ -401,6 +407,8 @@ sp = calloc(sizeof *sp, 1); assert(sp != NULL); + sp->magic = SMF_MAGIC; + sp->s.magic = STORAGE_MAGIC; VSL_stats->n_smf++; sp->sc = sc; @@ -498,6 +506,7 @@ size &= ~(sc->pagesize - 1); AZ(pthread_mutex_lock(&sc->mtx)); smf = alloc_smf(sc, size); + CHECK_OBJ_NOTNULL(smf, SMF_MAGIC); AZ(pthread_mutex_unlock(&sc->mtx)); assert(smf != NULL); assert(smf->size == size); @@ -506,6 +515,7 @@ smf->s.ptr = smf->ptr; smf->s.len = 0; smf->s.stevedore = st; + CHECK_OBJ_NOTNULL(&smf->s, STORAGE_MAGIC); return (&smf->s); } @@ -517,13 +527,14 @@ struct smf *smf; struct smf_sc *sc; + CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC); if (size == 0) { /* XXX: this should not happen */ return; } assert(size <= s->space); assert(size > 0); /* XXX: seen */ - smf = (struct smf *)(s->priv); + CAST_OBJ_NOTNULL(smf, s->priv, SMF_MAGIC); assert(size <= smf->size); sc = smf->sc; size += (sc->pagesize - 1); @@ -545,7 +556,8 @@ struct smf *smf; struct smf_sc *sc; - smf = (struct smf *)(s->priv); + CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC); + CAST_OBJ_NOTNULL(smf, s->priv, SMF_MAGIC); sc = smf->sc; AZ(pthread_mutex_lock(&sc->mtx)); free_smf(smf); @@ -562,8 +574,9 @@ off_t sent; struct sf_hdtr sfh; - smf = st->priv; - + CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); + CAST_OBJ_NOTNULL(smf, st->priv, SMF_MAGIC); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); memset(&sfh, 0, sizeof sfh); sfh.headers = sp->wrk->iov; sfh.hdr_cnt = sp->wrk->niov; @@ -571,6 +584,12 @@ sp->fd, smf->offset, st->len, &sfh, &sent, 0); + + /* Check again after potentially long sleep */ + CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); + CHECK_OBJ_NOTNULL(smf, SMF_MAGIC); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (sent == st->len + sp->wrk->liov) return; vca_close_session(sp, "remote closed"); From phk at projects.linpro.no Tue Aug 1 15:08:36 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 17:08:36 +0200 (CEST) Subject: r587 - trunk/varnish-cache/bin/varnishd Message-ID: <20060801150836.844FB1EC48A@projects.linpro.no> Author: phk Date: 2006-08-01 17:08:36 +0200 (Tue, 01 Aug 2006) New Revision: 587 Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c Log: Fixx off by one error. Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-01 14:53:29 UTC (rev 586) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-01 15:08:36 UTC (rev 587) @@ -176,7 +176,8 @@ CAST_OBJ_NOTNULL(he, oh->hashpriv, HCL_ENTRY_MAGIC); mtx = he->mtx; AZ(pthread_mutex_lock(&hcl_mutex[mtx])); - if (--he->refcnt >= 0) { + assert(he->refcnt > 0); + if (--he->refcnt > 0) { AZ(pthread_mutex_unlock(&hcl_mutex[mtx])); return (1); } From phk at projects.linpro.no Tue Aug 1 15:08:55 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 17:08:55 +0200 (CEST) Subject: r588 - trunk/varnish-cache/bin/varnishd Message-ID: <20060801150855.19F131EC48E@projects.linpro.no> Author: phk Date: 2006-08-01 17:08:54 +0200 (Tue, 01 Aug 2006) New Revision: 588 Modified: trunk/varnish-cache/bin/varnishd/storage_file.c Log: Make 32bit limitation work better. Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-01 15:08:36 UTC (rev 587) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-01 15:08:54 UTC (rev 588) @@ -161,7 +161,7 @@ exit (2); } - if (expl < 0 && sizeof(void *) == 4 && l > (1ULL << 31)) { + if (expl < 3 && sizeof(void *) == 4 && l > (1ULL << 31)) { fprintf(stderr, "NB: Limiting size to 2GB on 32 bit architecture to" " prevent running out of\naddress space." From phk at projects.linpro.no Tue Aug 1 15:09:20 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 17:09:20 +0200 (CEST) Subject: r589 - trunk/varnish-cache/bin/varnishd Message-ID: <20060801150920.686271EC48C@projects.linpro.no> Author: phk Date: 2006-08-01 17:09:20 +0200 (Tue, 01 Aug 2006) New Revision: 589 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c trunk/varnish-cache/bin/varnishd/cache_vrt_re.c Log: Flinting. Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-01 15:08:54 UTC (rev 588) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-01 15:09:20 UTC (rev 589) @@ -136,7 +136,8 @@ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* XXX */ - VSL(SLT_TTL, sp->fd, "%u VCL %.0f %u", sp->obj->xid, a, sp->t_req); + VSL(SLT_TTL, sp->fd, "%u VCL %.0f %u", + sp->obj->xid, a, sp->t_req.tv_sec); if (a < 0) a = 0; sp->obj->ttl = sp->t_req.tv_sec + (int)a; Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c 2006-08-01 15:08:54 UTC (rev 588) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c 2006-08-01 15:09:20 UTC (rev 589) @@ -13,7 +13,6 @@ #include "shmlog.h" #include "vrt.h" -#include "vrt_obj.h" #include "vcl.h" #include "cache.h" #include Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_re.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2006-08-01 15:08:54 UTC (rev 588) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2006-08-01 15:09:20 UTC (rev 589) @@ -12,7 +12,6 @@ #include "shmlog.h" #include "vrt.h" -#include "vrt_obj.h" #include "sbuf.h" #include "vcl.h" #include "cache.h" @@ -55,7 +54,7 @@ int VRT_re_test(struct sbuf *sb, const char *re) { - int i, j; + int i; regex_t t; char buf[BUFSIZ]; @@ -65,7 +64,7 @@ regfree(&t); return (0); } - j = regerror(i, &t, buf, sizeof buf); + (void)regerror(i, &t, buf, sizeof buf); sbuf_printf(sb, "Regexp compilation error:\n\n%s\n\n", buf); regfree(&t); return (1); From phk at projects.linpro.no Tue Aug 1 16:26:11 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 18:26:11 +0200 (CEST) Subject: r590 - trunk/varnish-cache/bin/varnishd Message-ID: <20060801162611.169091EC490@projects.linpro.no> Author: phk Date: 2006-08-01 18:26:10 +0200 (Tue, 01 Aug 2006) New Revision: 590 Modified: trunk/varnish-cache/bin/varnishd/cache_response.c Log: more miniobj checks Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-01 15:09:20 UTC (rev 589) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-01 16:26:10 UTC (rev 590) @@ -131,6 +131,7 @@ double dt; struct timespec t_resp; + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); clock_gettime(CLOCK_REALTIME, &t_resp); dt = (t_resp.tv_sec - sp->t_req.tv_sec); dt += (t_resp.tv_nsec - sp->t_req.tv_nsec) * 1e-9; @@ -158,10 +159,13 @@ http_SetHeader(sp->fd, sp->http, "Connection: close"); WRK_Reset(sp->wrk, &sp->fd); sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); /* XXX: conditional request handling */ if (sp->wantbody) { TAILQ_FOREACH(st, &sp->obj->store, list) { + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); assert(st->stevedore != NULL); u += st->len; sp->wrk->acct.bodybytes += st->len; @@ -169,6 +173,8 @@ WRK_Write(sp->wrk, st->ptr, st->len); } else { st->stevedore->send(st, sp); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); sp->wrk->niov = 0; sp->wrk->liov = 0; } From phk at projects.linpro.no Tue Aug 1 16:42:37 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 18:42:37 +0200 (CEST) Subject: r591 - trunk/varnish-cache/bin/varnishd Message-ID: <20060801164237.A10CB1EC492@projects.linpro.no> Author: phk Date: 2006-08-01 18:42:37 +0200 (Tue, 01 Aug 2006) New Revision: 591 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_http.c trunk/varnish-cache/bin/varnishd/flint.lnt Log: More miniobj checks Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-01 16:26:10 UTC (rev 590) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-01 16:42:37 UTC (rev 591) @@ -49,6 +49,7 @@ AZ(evtimer_add(&tick_e, &tick_rate)); clock_gettime(CLOCK_MONOTONIC, &t); TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); if (sp->t_idle.tv_sec + 30 < t.tv_sec) { TAILQ_REMOVE(&sesshead, sp, list); vca_close_session(sp, "timeout"); @@ -60,8 +61,9 @@ static void vca_callback(void *arg, int bad) { - struct sess *sp = arg; + struct sess *sp; + CAST_OBJ_NOTNULL(sp, arg, SESS_MAGIC); TAILQ_REMOVE(&sesshead, sp, list); if (bad) { if (bad == 1) Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-01 16:26:10 UTC (rev 590) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-01 16:42:37 UTC (rev 591) @@ -446,12 +446,13 @@ static void http_read_f(int fd, short event, void *arg) { - struct http *hp = arg; + struct http *hp; unsigned l; int i, ret = 0; (void)event; + CAST_OBJ_NOTNULL(hp, arg, HTTP_MAGIC); l = (hp->e - hp->s) / 2; if (l < hp->v - hp->s) l = 0; Modified: trunk/varnish-cache/bin/varnishd/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-01 16:26:10 UTC (rev 590) +++ trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-01 16:42:37 UTC (rev 591) @@ -1,4 +1,4 @@ --passes=3 +-passes=12 // Fix strchr() semtics, it can only return NULL if arg2 != 0 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) From phk at projects.linpro.no Tue Aug 1 17:54:34 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 19:54:34 +0200 (CEST) Subject: r592 - trunk/varnish-cache/bin/varnishd Message-ID: <20060801175434.DC1FA1EC493@projects.linpro.no> Author: phk Date: 2006-08-01 19:54:34 +0200 (Tue, 01 Aug 2006) New Revision: 592 Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c Log: More miniobj checks Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-01 16:42:37 UTC (rev 591) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-01 17:54:34 UTC (rev 592) @@ -293,6 +293,9 @@ i = WRK_Flush(w); assert(i == 0); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); + CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* * XXX: It might be cheaper to avoid the event_engine and simply * XXX: read(2) the header @@ -300,6 +303,9 @@ http_RecvHead(vc->http, vc->fd, w->eb, NULL, NULL); (void)event_base_loop(w->eb, 0); assert(http_DissectResponse(vc->http, vc->fd) == 0); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); + CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); sp->vbc = vc; sp->obj->entered = time(NULL); From phk at projects.linpro.no Tue Aug 1 19:48:36 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 1 Aug 2006 21:48:36 +0200 (CEST) Subject: r593 - trunk/varnish-cache/bin/varnishd Message-ID: <20060801194836.911651EC486@projects.linpro.no> Author: phk Date: 2006-08-01 21:48:36 +0200 (Tue, 01 Aug 2006) New Revision: 593 Modified: trunk/varnish-cache/bin/varnishd/cache_http.c Log: More miniobj checks Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-01 17:54:34 UTC (rev 592) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-01 19:48:36 UTC (rev 593) @@ -500,7 +500,7 @@ { unsigned l; - assert(hp != NULL); + CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); assert(hp->v <= hp->e); assert(hp->t <= hp->v); if (0) @@ -537,6 +537,8 @@ { unsigned u, l; + CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); + CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); l = 0; for (u = 0; u < fm->nhd; u++) { if (fm->hd[u].b == NULL) @@ -656,6 +658,8 @@ { unsigned u; + CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); + CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); to->nhd = HTTP_HDR_FIRST; for (u = HTTP_HDR_FIRST; u < fm->nhd; u++) { #define HTTPH(a, b, c, d, e, f, g) \ From phk at projects.linpro.no Wed Aug 2 04:57:58 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 06:57:58 +0200 (CEST) Subject: r594 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802045758.9F6C31EC49A@projects.linpro.no> Author: phk Date: 2006-08-02 06:57:58 +0200 (Wed, 02 Aug 2006) New Revision: 594 Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/hash_classic.c Log: More miniobj paranoia Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-01 19:48:36 UTC (rev 593) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-02 04:57:58 UTC (rev 594) @@ -162,8 +162,11 @@ { struct objhead *oh; + CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); oh = o->objhead; + CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); AZ(pthread_mutex_lock(&oh->mtx)); + assert(o->refcnt > 0); o->refcnt++; AZ(pthread_mutex_unlock(&oh->mtx)); } @@ -175,10 +178,13 @@ struct storage *st, *stn; unsigned r; + CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); oh = o->objhead; + CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); /* drop ref on object */ AZ(pthread_mutex_lock(&oh->mtx)); + assert(o->refcnt > 0); r = --o->refcnt; if (!r) TAILQ_REMOVE(&oh->objects, o, list); @@ -193,6 +199,7 @@ } TAILQ_FOREACH_SAFE(st, &o->store, list, stn) { + CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); TAILQ_REMOVE(&o->store, st, list); st->stevedore->free(st); } Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-01 19:48:36 UTC (rev 593) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-02 04:57:58 UTC (rev 594) @@ -174,9 +174,11 @@ CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); CAST_OBJ_NOTNULL(he, oh->hashpriv, HCL_ENTRY_MAGIC); + assert(he->refcnt > 0); + assert(he->mtx < hcl_nmtx); + assert(he->hash < hcl_nhash); mtx = he->mtx; AZ(pthread_mutex_lock(&hcl_mutex[mtx])); - assert(he->refcnt > 0); if (--he->refcnt > 0) { AZ(pthread_mutex_unlock(&hcl_mutex[mtx])); return (1); From phk at projects.linpro.no Wed Aug 2 07:07:56 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 09:07:56 +0200 (CEST) Subject: r595 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802070756.CC17B1EC43C@projects.linpro.no> Author: phk Date: 2006-08-02 09:07:56 +0200 (Wed, 02 Aug 2006) New Revision: 595 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_fetch.c trunk/varnish-cache/bin/varnishd/cache_http.c trunk/varnish-cache/bin/varnishd/cache_pass.c Log: I have nothing but circumstantial evidence that libevent is involved in the current stack corruption I see, but we might as well avoid using it where we can: Don't engage the eventengine when we talk to the backend, just call read(2) directly. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 04:57:58 UTC (rev 594) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 07:07:56 UTC (rev 595) @@ -347,7 +347,8 @@ 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_Read(struct http *hp, int fd, void *b, unsigned len); -void http_RecvHead(struct http *hp, int fd, struct event_base *eb, http_callback_f *func, void *arg); +void http_RecvHeadEv(struct http *hp, int fd, struct event_base *eb, http_callback_f *func, void *arg); +int http_RecvHead(struct http *hp, int fd); 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-08-02 04:57:58 UTC (rev 594) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-02 07:07:56 UTC (rev 595) @@ -92,7 +92,7 @@ assert(i == sizeof sp); clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); TAILQ_INSERT_TAIL(&sesshead, sp, list); - http_RecvHead(sp->http, sp->fd, evb, vca_callback, sp); + http_RecvHeadEv(sp->http, sp->fd, evb, vca_callback, sp); } static void @@ -136,7 +136,7 @@ VSL(SLT_SessionOpen, sp->fd, "%s %s", sp->addr, sp->port); clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); TAILQ_INSERT_TAIL(&sesshead, sp, list); - http_RecvHead(sp->http, sp->fd, evb, vca_callback, sp); + http_RecvHeadEv(sp->http, sp->fd, evb, vca_callback, sp); } static void * Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-02 04:57:58 UTC (rev 594) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-02 07:07:56 UTC (rev 595) @@ -296,12 +296,9 @@ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); - /* - * XXX: It might be cheaper to avoid the event_engine and simply - * XXX: read(2) the header - */ - http_RecvHead(vc->http, vc->fd, w->eb, NULL, NULL); - (void)event_base_loop(w->eb, 0); + + i = http_RecvHead(vc->http, vc->fd); + assert(i == 0); assert(http_DissectResponse(vc->http, vc->fd) == 0); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-02 04:57:58 UTC (rev 594) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-02 07:07:56 UTC (rev 595) @@ -440,19 +440,36 @@ return (1); } - /*--------------------------------------------------------------------*/ static void -http_read_f(int fd, short event, void *arg) +http_preprecv(struct http *hp) { - struct http *hp; unsigned l; - int i, ret = 0; - (void)event; + CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); + assert(hp->v <= hp->e); + assert(hp->t <= hp->v); + if (hp->t > hp->s && hp->t < hp->v) { + l = hp->v - hp->t; + memmove(hp->s, hp->t, l); + hp->v = hp->s + l; + hp->t = hp->s; + *hp->v = '\0'; + } else { + hp->v = hp->s; + hp->t = hp->s; + } +} - CAST_OBJ_NOTNULL(hp, arg, HTTP_MAGIC); +/*--------------------------------------------------------------------*/ + +static int +http_read_hdr(int fd, struct http *hp) +{ + unsigned l; + int i; + l = (hp->e - hp->s) / 2; if (l < hp->v - hp->s) l = 0; @@ -462,72 +479,87 @@ VSL(SLT_HttpError, fd, "Received too much"); VSLR(SLT_HttpGarbage, fd, hp->s, hp->v); hp->t = NULL; - ret = 1; - } else { - errno = 0; - i = read(fd, hp->v, l - 1); - if (i > 0) { - hp->v += i; - *hp->v = '\0'; - if (!http_header_complete(hp)) - return; - } else { - if (hp->v != hp->s) { - VSL(SLT_HttpError, fd, - "Received (only) %d bytes, errno %d", - hp->v - hp->s, errno); - VSLR(SLT_Debug, fd, hp->s, hp->v); - } else if (errno == 0) - VSL(SLT_HttpError, fd, "Received nothing"); - else - VSL(SLT_HttpError, fd, - "Received errno %d", errno); - hp->t = NULL; - ret = 2; - } + return (1); } + errno = 0; + i = read(fd, hp->v, l - 1); + if (i > 0) { + hp->v += i; + *hp->v = '\0'; + if (http_header_complete(hp)) + return(0); + return (-1); + } - assert(hp->t != NULL || ret != 0); + if (hp->v != hp->s) { + VSL(SLT_HttpError, fd, + "Received (only) %d bytes, errno %d", + hp->v - hp->s, errno); + VSLR(SLT_Debug, fd, hp->s, hp->v); + } else if (errno == 0) + VSL(SLT_HttpError, fd, "Received nothing"); + else + VSL(SLT_HttpError, fd, + "Received errno %d", errno); + hp->t = NULL; + return(2); +} + +/*--------------------------------------------------------------------*/ + +static void +http_read_f(int fd, short event, void *arg) +{ + struct http *hp; + int i; + + (void)event; + + CAST_OBJ_NOTNULL(hp, arg, HTTP_MAGIC); + i = http_read_hdr(fd, hp); + if (i < 0) + return; + event_del(&hp->ev); if (hp->callback != NULL) - hp->callback(hp->arg, ret); + hp->callback(hp->arg, i); } -/*--------------------------------------------------------------------*/ void -http_RecvHead(struct http *hp, int fd, struct event_base *eb, http_callback_f *func, void *arg) +http_RecvHeadEv(struct http *hp, int fd, struct event_base *eb, http_callback_f *func, void *arg) { - unsigned l; CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); - assert(hp->v <= hp->e); - assert(hp->t <= hp->v); - if (0) - VSL(SLT_Debug, fd, "Recv t %u v %u", - hp->t - hp->s, hp->v - hp->s); - if (hp->t > hp->s && hp->t < hp->v) { - l = hp->v - hp->t; - memmove(hp->s, hp->t, l); - hp->v = hp->s + l; - hp->t = hp->s; - *hp->v = '\0'; - if (http_header_complete(hp)) { - assert(func != NULL); - func(arg, 0); - return; - } - } else { - hp->v = hp->s; - hp->t = hp->s; + assert(func != NULL); + http_preprecv(hp); + if (hp->v != hp->s && http_header_complete(hp)) { + func(arg, 0); + return; } hp->callback = func; hp->arg = arg; event_set(&hp->ev, fd, EV_READ | EV_PERSIST, http_read_f, hp); AZ(event_base_set(eb, &hp->ev)); AZ(event_add(&hp->ev, NULL)); /* XXX: timeout */ + return; } +/*--------------------------------------------------------------------*/ + +int +http_RecvHead(struct http *hp, int fd) +{ + int i; + + CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); + http_preprecv(hp); + do + i = http_read_hdr(fd, hp); + while (i == -1); + return (i); +} + /*-------------------------------------------------------------------- * Copy HTTP headers into malloc'ed space. */ Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-02 04:57:58 UTC (rev 594) +++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-02 07:07:56 UTC (rev 595) @@ -205,12 +205,8 @@ /* XXX: copy any contents */ - /* - * XXX: It might be cheaper to avoid the event_engine and simply - * XXX: read(2) the header - */ - http_RecvHead(vc->http, vc->fd, w->eb, NULL, NULL); - (void)event_base_loop(w->eb, 0); + i = http_RecvHead(vc->http, vc->fd); + assert(i == 0); http_DissectResponse(vc->http, vc->fd); sp->vbc = vc; From phk at projects.linpro.no Wed Aug 2 07:23:46 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 09:23:46 +0200 (CEST) Subject: r596 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802072346.4E5E61EC498@projects.linpro.no> Author: phk Date: 2006-08-02 09:23:45 +0200 (Wed, 02 Aug 2006) New Revision: 596 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_pipe.c trunk/varnish-cache/bin/varnishd/cache_pool.c Log: Convert pipe to use poll(2) on the two filedescriptors it cares about and eliminate the per-workerthread event engine entirely. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 07:07:56 UTC (rev 595) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 07:23:45 UTC (rev 596) @@ -95,7 +95,6 @@ struct worker { unsigned magic; #define WORKER_MAGIC 0x6391adcf - struct event_base *eb; struct objhead *nobjhead; struct object *nobj; Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-02 07:07:56 UTC (rev 595) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-02 07:23:45 UTC (rev 596) @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -20,26 +21,22 @@ }; static void -rdf(int fd, short event, void *arg) +rdf(struct pollfd *fds, int idx) { int i, j; - struct edir *ep; char buf[BUFSIZ]; - (void)event; - - ep = arg; - i = read(fd, buf, sizeof buf); + i = read(fds[idx].fd, buf, sizeof buf); if (i <= 0) { - shutdown(fd, SHUT_RD); - shutdown(ep->fd, SHUT_WR); - AZ(event_del(&ep->ev)); + shutdown(fds[idx].fd, SHUT_RD); + shutdown(fds[1-idx].fd, SHUT_WR); + fds[idx].events = 0; } else { - j = write(ep->fd, buf, i); + j = write(fds[1-idx].fd, buf, i); if (i != j) { - shutdown(fd, SHUT_WR); - shutdown(ep->fd, SHUT_RD); - AZ(event_del(&ep->ev)); + shutdown(fds[idx].fd, SHUT_WR); + shutdown(fds[1-idx].fd, SHUT_RD); + fds[1-idx].events = 0; } } } @@ -48,9 +45,10 @@ PipeSession(struct sess *sp) { struct vbe_conn *vc; - struct edir e1, e2; char *b, *e; struct worker *w; + struct pollfd fds[2]; + int i; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); @@ -75,15 +73,22 @@ return; } - e1.fd = vc->fd; - e2.fd = sp->fd; - event_set(&e1.ev, sp->fd, EV_READ | EV_PERSIST, rdf, &e1); - AZ(event_base_set(w->eb, &e1.ev)); - event_set(&e2.ev, vc->fd, EV_READ | EV_PERSIST, rdf, &e2); - AZ(event_base_set(w->eb, &e2.ev)); - AZ(event_add(&e1.ev, NULL)); - AZ(event_add(&e2.ev, NULL)); - (void)event_base_loop(w->eb, 0); + memset(fds, 0, sizeof fds); + fds[0].fd = vc->fd; + fds[0].events = POLLIN | POLLERR; + fds[1].fd = sp->fd; + fds[1].events = POLLIN | POLLERR; + + while (fds[0].events || fds[1].events) { + fds[0].revents = 0; + fds[1].revents = 0; + i = poll(fds, 2, INFTIM); + assert(i > 0); + if (fds[0].revents) + rdf(fds, 0); + if (fds[1].revents) + rdf(fds, 1); + } vca_close_session(sp, "pipe"); VBE_ClosedFd(vc); } Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-02 07:07:56 UTC (rev 595) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-02 07:23:45 UTC (rev 596) @@ -137,9 +137,6 @@ AZ(pthread_cond_init(&w->cv, NULL)); - w->eb = event_init(); - assert(w->eb != NULL); - AZ(pthread_mutex_lock(&wrk_mtx)); w->nbr = VSL_stats->n_wrk; if (priv == NULL) { @@ -170,7 +167,6 @@ TAILQ_REMOVE(&wrk_head, w, list); AZ(pthread_mutex_unlock(&wrk_mtx)); VSL(SLT_WorkThread, 0, "%u suicide", w->nbr); - event_base_free(w->eb); AZ(pthread_cond_destroy(&w->cv)); return (NULL); } From phk at projects.linpro.no Wed Aug 2 09:34:40 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 11:34:40 +0200 (CEST) Subject: r597 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802093440.993241EC49B@projects.linpro.no> Author: phk Date: 2006-08-02 11:34:40 +0200 (Wed, 02 Aug 2006) New Revision: 597 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_http.c Log: Bite the bullet and write an alternate acceptor which uses kqueue directly instead of libevent. Degeneralize the header reading code in cache_http.c which seems to be cleaner anyway. An #ifdef at the top of cache_acceptor.c selects which implementation you want: libevent or kqueue. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 07:23:45 UTC (rev 596) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 09:34:40 UTC (rev 597) @@ -46,8 +46,6 @@ * RSN: struct worker and struct session will have one of these embedded. */ -typedef void http_callback_f(void *, int bad); - struct http_hdr { char *b; char *e; @@ -56,9 +54,6 @@ struct http { unsigned magic; #define HTTP_MAGIC 0x6428b5c9 - struct event ev; - http_callback_f *callback; - void *arg; char *s; /* (S)tart of buffer */ char *t; /* start of (T)railing data */ @@ -230,6 +225,7 @@ int id; unsigned xid; + struct event ev; struct worker *wrk; unsigned sockaddrlen; @@ -346,7 +342,9 @@ 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_Read(struct http *hp, int fd, void *b, unsigned len); -void http_RecvHeadEv(struct http *hp, int fd, struct event_base *eb, http_callback_f *func, void *arg); +void http_RecvPrep(struct http *hp); +int http_RecvPrepAgain(struct http *hp); +int http_RecvSome(int fd, struct http *hp); int http_RecvHead(struct http *hp, int fd); 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-08-02 07:23:45 UTC (rev 596) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-02 09:34:40 UTC (rev 597) @@ -6,6 +6,9 @@ * write the session pointer to a pipe which the event engine monitors. */ +#define ACCEPTOR_USE_KQUEUE +#undef ACCEPTOR_USE_LIBEVENT + #include #include #include @@ -16,14 +19,73 @@ #include #include -#include - #include "config.h" #include "libvarnish.h" #include "heritage.h" #include "shmlog.h" #include "cache.h" +static pthread_t vca_thread; +static unsigned xids; + +static struct sess * +vca_accept_sess(int fd) +{ + socklen_t l; + struct sockaddr addr[2]; /* XXX: IPv6 hack */ + struct sess *sp; + int i; + struct linger linger; + + VSL_stats->client_conn++; + + l = sizeof addr; + i = accept(fd, addr, &l); + if (i < 0) { + VSL(SLT_Debug, fd, "Accept failed errno=%d", errno); + /* XXX: stats ? */ + return (NULL); + } + sp = SES_New(addr, l); + assert(sp != NULL); /* XXX handle */ + + sp->fd = i; + sp->id = i; + +#ifdef SO_NOSIGPIPE /* XXX Linux */ + i = 1; + AZ(setsockopt(sp->fd, SOL_SOCKET, SO_NOSIGPIPE, &i, sizeof i)); +#endif +#ifdef SO_LINGER /* XXX Linux*/ + linger.l_onoff = 0; + linger.l_linger = 0; + AZ(setsockopt(sp->fd, SOL_SOCKET, SO_LINGER, &linger, sizeof linger)); +#endif + + TCP_name(addr, l, sp->addr, sizeof sp->addr, sp->port, sizeof sp->port); + VSL(SLT_SessionOpen, sp->fd, "%s %s", sp->addr, sp->port); + return (sp); +} + +static void +vca_handover(struct sess *sp, int bad) +{ + + if (bad) { + vca_close_session(sp, + bad == 1 ? "overflow" : "no request"); + vca_return_session(sp); + return; + } + sp->step = STP_RECV; + VSL_stats->client_req++; + sp->xid = xids++; + VSL(SLT_XID, sp->fd, "%u", sp->xid); + WRK_QueueSession(sp); +} + +#ifdef ACCEPTOR_USE_LIBEVENT + static struct event_base *evb; static struct event pipe_e; static int pipes[2]; @@ -31,12 +93,11 @@ static struct event tick_e; static struct timeval tick_rate; -static pthread_t vca_thread; -static unsigned xids; - static struct event accept_e[2 * HERITAGE_NSOCKS]; static TAILQ_HEAD(,sess) sesshead = TAILQ_HEAD_INITIALIZER(sesshead); +/*--------------------------------------------------------------------*/ + static void vca_tick(int a, short b, void *c) { @@ -59,28 +120,36 @@ } static void -vca_callback(void *arg, int bad) +vca_rcvhd_f(int fd, short event, void *arg) { struct sess *sp; + int i; + (void)event; + CAST_OBJ_NOTNULL(sp, arg, SESS_MAGIC); + i = http_RecvSome(fd, sp->http); + if (i < 0) + return; + + event_del(&sp->ev); TAILQ_REMOVE(&sesshead, sp, list); - if (bad) { - if (bad == 1) - vca_close_session(sp, "overflow"); - else - vca_close_session(sp, "no request"); - vca_return_session(sp); - return; - } - sp->step = STP_RECV; - VSL_stats->client_req++; - sp->xid = xids++; - VSL(SLT_XID, sp->fd, "%u", sp->xid); - WRK_QueueSession(sp); + vca_handover(sp, i); } static void +vca_rcvhdev(struct sess *sp) +{ + + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); + TAILQ_INSERT_TAIL(&sesshead, sp, list); + event_set(&sp->ev, sp->fd, EV_READ | EV_PERSIST, vca_rcvhd_f, sp); + AZ(event_base_set(evb, &sp->ev)); + AZ(event_add(&sp->ev, NULL)); /* XXX: timeout */ +} + +static void pipe_f(int fd, short event, void *arg) { struct sess *sp; @@ -90,53 +159,27 @@ (void)arg; i = read(fd, &sp, sizeof sp); assert(i == sizeof sp); - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - TAILQ_INSERT_TAIL(&sesshead, sp, list); - http_RecvHeadEv(sp->http, sp->fd, evb, vca_callback, sp); + if (http_RecvPrepAgain(sp->http)) { + vca_handover(sp, 0); + return; + } + vca_rcvhdev(sp); } static void accept_f(int fd, short event, void *arg) { - socklen_t l; - struct sockaddr addr[2]; /* XXX: IPv6 hack */ struct sess *sp; - int i; - struct linger linger; (void)event; (void)arg; - VSL_stats->client_conn++; - - l = sizeof addr; - i = accept(fd, addr, &l); - if (i < 0) { - VSL(SLT_Debug, fd, "Accept failed errno=%d", errno); - /* XXX: stats ? */ + sp = vca_accept_sess(fd); + if (sp == NULL) return; - } - sp = SES_New(addr, l); - assert(sp != NULL); /* XXX handle */ - sp->fd = i; - sp->id = i; - -#ifdef SO_NOSIGPIPE /* XXX Linux */ - i = 1; - AZ(setsockopt(sp->fd, SOL_SOCKET, SO_NOSIGPIPE, &i, sizeof i)); -#endif -#ifdef SO_LINGER /* XXX Linux*/ - linger.l_onoff = 0; - linger.l_linger = 0; - AZ(setsockopt(sp->fd, SOL_SOCKET, SO_LINGER, &linger, sizeof linger)); -#endif - - TCP_name(addr, l, sp->addr, sizeof sp->addr, sp->port, sizeof sp->port); - VSL(SLT_SessionOpen, sp->fd, "%s %s", sp->addr, sp->port); - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - TAILQ_INSERT_TAIL(&sesshead, sp, list); - http_RecvHeadEv(sp->http, sp->fd, evb, vca_callback, sp); + http_RecvPrep(sp->http); + vca_rcvhdev(sp); } static void * @@ -147,6 +190,8 @@ (void)arg; + tick_rate.tv_sec = 1; + tick_rate.tv_usec = 0; AZ(pipe(pipes)); evb = event_init(); assert(evb != NULL); @@ -187,37 +232,153 @@ /*--------------------------------------------------------------------*/ void -vca_close_session(struct sess *sp, const char *why) +vca_return_session(struct sess *sp) { - VSL(SLT_SessionClose, sp->fd, why); - if (sp->fd >= 0) - AZ(close(sp->fd)); - sp->fd = -1; + if (sp->fd < 0) { + SES_Delete(sp); + return; + } + VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); + assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); } +#endif /* ACCEPTOR_USE_LIBEVENT */ + +#ifdef ACCEPTOR_USE_KQUEUE +#include + +static int kq = -1; + +static void +vca_kq_sess(struct sess *sp, int arm) +{ + struct kevent ke[2]; + + assert(arm == EV_ADD || arm == EV_DELETE); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + memset(ke, 0, sizeof ke); + EV_SET(&ke[0], sp->fd, EVFILT_READ, arm, 0, 0, sp); + EV_SET(&ke[1], sp->fd, EVFILT_TIMER, arm , 0, 5000, sp); + AZ(kevent(kq, ke, 2, NULL, 0, NULL)); +} + +static void +accept_f(int fd) +{ + struct sess *sp; + + sp = vca_accept_sess(fd); + if (sp == NULL) + return; + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); + http_RecvPrep(sp->http); + vca_kq_sess(sp, EV_ADD); +} + +static void * +vca_main(void *arg) +{ + unsigned u; + struct kevent ke; + int i; + struct sess *sp; + + (void)arg; + + kq = kqueue(); + assert(kq >= 0); + + + for (u = 0; u < HERITAGE_NSOCKS; u++) { + if (heritage.sock_local[u] >= 0) { + memset(&ke, 0, sizeof ke); + EV_SET(&ke, heritage.sock_local[u], + EVFILT_READ, EV_ADD, 0, 0, accept_f); + AZ(kevent(kq, &ke, 1, NULL, 0, NULL)); + } + if (heritage.sock_remote[u] >= 0) { + memset(&ke, 0, sizeof ke); + EV_SET(&ke, heritage.sock_remote[u], + EVFILT_READ, EV_ADD, 0, 0, accept_f); + AZ(kevent(kq, &ke, 1, NULL, 0, NULL)); + } + } + + while (1) { + i = kevent(kq, NULL, 0, &ke, 1, NULL); + assert(i == 1); +#if 0 + printf("i = %d\n", i); + printf("ke.ident = %ju\n", (uintmax_t)ke.ident); + printf("ke.filter = %u\n", ke.filter); + printf("ke.flags = %u\n", ke.flags); + printf("ke.fflags = %u\n", ke.fflags); + printf("ke.data = %jd\n", (intmax_t)ke.data); + printf("ke.udata = %p\n", ke.udata); +#endif + if (ke.udata == accept_f) { + accept_f(ke.ident); + continue; + } + CAST_OBJ_NOTNULL(sp, ke.udata, SESS_MAGIC); + if (ke.filter == EVFILT_READ) { + i = http_RecvSome(sp->fd, sp->http); + if (i == -1) + continue; + vca_kq_sess(sp, EV_DELETE); + vca_handover(sp, i); + continue; + } + if (ke.filter == EVFILT_TIMER) { + vca_kq_sess(sp, EV_DELETE); + vca_close_session(sp, "timeout"); + vca_return_session(sp); + continue; + } + INCOMPL(); + } + + INCOMPL(); +} + /*--------------------------------------------------------------------*/ void vca_return_session(struct sess *sp) { - if (sp->fd >= 0) { - VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); - assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); - } else { + if (sp->fd < 0) { SES_Delete(sp); + return; } + VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); + if (http_RecvPrepAgain(sp->http)) + vca_handover(sp, 0); + else + vca_kq_sess(sp, EV_ADD); } +#endif /* ACCEPTOR_USE_KQUEUE */ + /*--------------------------------------------------------------------*/ void +vca_close_session(struct sess *sp, const char *why) +{ + + VSL(SLT_SessionClose, sp->fd, why); + if (sp->fd >= 0) + AZ(close(sp->fd)); + sp->fd = -1; +} + +/*--------------------------------------------------------------------*/ + +void VCA_Init(void) { - tick_rate.tv_sec = 1; - tick_rate.tv_usec = 0; AZ(pthread_create(&vca_thread, NULL, vca_main, NULL)); srandomdev(); xids = random(); Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-02 07:23:45 UTC (rev 596) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-02 09:34:40 UTC (rev 597) @@ -436,14 +436,15 @@ if (++p > hp->v) return (0); hp->t = p; + assert(hp->t > hp->s); assert(hp->t <= hp->v); return (1); } /*--------------------------------------------------------------------*/ -static void -http_preprecv(struct http *hp) +void +http_RecvPrep(struct http *hp) { unsigned l; @@ -462,10 +463,19 @@ } } +int +http_RecvPrepAgain(struct http *hp) +{ + http_RecvPrep(hp); + if (hp->v == hp->s) + return (0); + return (http_header_complete(hp)); +} + /*--------------------------------------------------------------------*/ -static int -http_read_hdr(int fd, struct http *hp) +int +http_RecvSome(int fd, struct http *hp) { unsigned l; int i; @@ -507,55 +517,15 @@ /*--------------------------------------------------------------------*/ -static void -http_read_f(int fd, short event, void *arg) -{ - struct http *hp; - int i; - - (void)event; - - CAST_OBJ_NOTNULL(hp, arg, HTTP_MAGIC); - i = http_read_hdr(fd, hp); - if (i < 0) - return; - - event_del(&hp->ev); - if (hp->callback != NULL) - hp->callback(hp->arg, i); -} - - -void -http_RecvHeadEv(struct http *hp, int fd, struct event_base *eb, http_callback_f *func, void *arg) -{ - - CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); - assert(func != NULL); - http_preprecv(hp); - if (hp->v != hp->s && http_header_complete(hp)) { - func(arg, 0); - return; - } - hp->callback = func; - hp->arg = arg; - event_set(&hp->ev, fd, EV_READ | EV_PERSIST, http_read_f, hp); - AZ(event_base_set(eb, &hp->ev)); - AZ(event_add(&hp->ev, NULL)); /* XXX: timeout */ - return; -} - -/*--------------------------------------------------------------------*/ - int http_RecvHead(struct http *hp, int fd) { int i; CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); - http_preprecv(hp); + http_RecvPrep(hp); do - i = http_read_hdr(fd, hp); + i = http_RecvSome(fd, hp); while (i == -1); return (i); } From phk at projects.linpro.no Wed Aug 2 10:40:22 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 12:40:22 +0200 (CEST) Subject: r598 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802104022.48E653BC017@projects.linpro.no> Author: phk Date: 2006-08-02 12:40:22 +0200 (Wed, 02 Aug 2006) New Revision: 598 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Replace libevent based acceptor with poll(2) based acceptor. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 09:34:40 UTC (rev 597) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 10:40:22 UTC (rev 598) @@ -225,7 +225,6 @@ int id; unsigned xid; - struct event ev; struct worker *wrk; unsigned sockaddrlen; Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-02 09:34:40 UTC (rev 597) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-02 10:40:22 UTC (rev 598) @@ -6,8 +6,8 @@ * write the session pointer to a pipe which the event engine monitors. */ -#define ACCEPTOR_USE_KQUEUE -#undef ACCEPTOR_USE_LIBEVENT +#define ACCEPTOR_USE_POLL +#undef ACCEPTOR_USE_KQUEUE #include #include @@ -84,59 +84,62 @@ WRK_QueueSession(sp); } -#ifdef ACCEPTOR_USE_LIBEVENT +/*====================================================================*/ +#ifdef ACCEPTOR_USE_POLL -static struct event_base *evb; -static struct event pipe_e; +#include + +static struct pollfd *pollfd; +static unsigned npoll; + static int pipes[2]; -static struct event tick_e; -static struct timeval tick_rate; - -static struct event accept_e[2 * HERITAGE_NSOCKS]; static TAILQ_HEAD(,sess) sesshead = TAILQ_HEAD_INITIALIZER(sesshead); /*--------------------------------------------------------------------*/ static void -vca_tick(int a, short b, void *c) +vca_pollspace(int fd) { - struct sess *sp, *sp2; - struct timespec t; + struct pollfd *p; + unsigned u, v; - (void)a; - (void)b; - (void)c; - AZ(evtimer_add(&tick_e, &tick_rate)); - clock_gettime(CLOCK_MONOTONIC, &t); - TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (sp->t_idle.tv_sec + 30 < t.tv_sec) { - TAILQ_REMOVE(&sesshead, sp, list); - vca_close_session(sp, "timeout"); - vca_return_session(sp); - } - } + if (fd < npoll) + return; + if (npoll == 0) + npoll = 16; + for (u = npoll; fd >= u; ) + u += u; + VSL(SLT_Debug, 0, "Acceptor Pollspace %u", u); + p = realloc(pollfd, u * sizeof *p); + assert(p != NULL); + memset(p + npoll, 0, (u - npoll) * sizeof *p); + for (v = npoll ; v <= u; v++) + p->fd = -1; + pollfd = p; + npoll = u; } +/*--------------------------------------------------------------------*/ + static void -vca_rcvhd_f(int fd, short event, void *arg) +vca_poll(int fd) { - struct sess *sp; - int i; + vca_pollspace(fd); + pollfd[fd].fd = fd; + pollfd[fd].events = POLLIN; +} - (void)event; +static void +vca_unpoll(int fd) +{ + vca_pollspace(fd); + pollfd[fd].fd = -1; + pollfd[fd].events = 0; +} - CAST_OBJ_NOTNULL(sp, arg, SESS_MAGIC); - i = http_RecvSome(fd, sp->http); - if (i < 0) - return; +/*--------------------------------------------------------------------*/ - event_del(&sp->ev); - TAILQ_REMOVE(&sesshead, sp, list); - vca_handover(sp, i); -} - static void vca_rcvhdev(struct sess *sp) { @@ -144,36 +147,14 @@ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); TAILQ_INSERT_TAIL(&sesshead, sp, list); - event_set(&sp->ev, sp->fd, EV_READ | EV_PERSIST, vca_rcvhd_f, sp); - AZ(event_base_set(evb, &sp->ev)); - AZ(event_add(&sp->ev, NULL)); /* XXX: timeout */ + vca_poll(sp->fd); } static void -pipe_f(int fd, short event, void *arg) +accept_f(int fd) { struct sess *sp; - int i; - (void)event; - (void)arg; - i = read(fd, &sp, sizeof sp); - assert(i == sizeof sp); - if (http_RecvPrepAgain(sp->http)) { - vca_handover(sp, 0); - return; - } - vca_rcvhdev(sp); -} - -static void -accept_f(int fd, short event, void *arg) -{ - struct sess *sp; - - (void)event; - (void)arg; - sp = vca_accept_sess(fd); if (sp == NULL) return; @@ -185,47 +166,73 @@ static void * vca_main(void *arg) { - unsigned u; - struct event *ep; + unsigned u, v; + struct sess *sp, *sp2; + struct timespec t; + int i; (void)arg; - tick_rate.tv_sec = 1; - tick_rate.tv_usec = 0; AZ(pipe(pipes)); - evb = event_init(); - assert(evb != NULL); + vca_poll(pipes[0]); - event_set(&pipe_e, pipes[0], EV_READ | EV_PERSIST, pipe_f, NULL); - AZ(event_base_set(evb, &pipe_e)); - AZ(event_add(&pipe_e, NULL)); + for (u = 0; u < HERITAGE_NSOCKS; u++) { + if (heritage.sock_local[u] >= 0) + vca_poll(heritage.sock_local[u]); + if (heritage.sock_remote[u] >= 0) + vca_poll(heritage.sock_local[u]); + } - evtimer_set(&tick_e, vca_tick, NULL); - AZ(event_base_set(evb, &tick_e)); - - AZ(evtimer_add(&tick_e, &tick_rate)); + while (1) { + v = poll(pollfd, npoll, 5000); + if (v && pollfd[pipes[0]].revents) { + v--; + i = read(pipes[0], &sp, sizeof sp); + assert(i == sizeof sp); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (http_RecvPrepAgain(sp->http)) + vca_handover(sp, 0); + else + vca_rcvhdev(sp); + } + for (u = 0; v && u < HERITAGE_NSOCKS; u++) { + if (heritage.sock_local[u] >= 0 && + pollfd[heritage.sock_local[u]].revents) { + accept_f(heritage.sock_local[u]); + v--; + } + if (heritage.sock_remote[u] >= 0 && + pollfd[heritage.sock_remote[u]].revents) { + accept_f(heritage.sock_local[u]); + v--; + } + } + clock_gettime(CLOCK_MONOTONIC, &t); + TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (pollfd[sp->fd].revents) { + v--; + i = http_RecvSome(sp->fd, sp->http); + if (i < 0) + continue; - ep = accept_e; - for (u = 0; u < HERITAGE_NSOCKS; u++) { - if (heritage.sock_local[u] >= 0) { - event_set(ep, heritage.sock_local[u], - EV_READ | EV_PERSIST, - accept_f, NULL); - AZ(event_base_set(evb, ep)); - AZ(event_add(ep, NULL)); - ep++; + vca_unpoll(sp->fd); + TAILQ_REMOVE(&sesshead, sp, list); + vca_handover(sp, i); + continue; + } + if (sp->t_idle.tv_sec + 5 < t.tv_sec) { + TAILQ_REMOVE(&sesshead, sp, list); + vca_unpoll(sp->fd); + vca_close_session(sp, "timeout"); + vca_return_session(sp); + continue; + } + if (v == 0) + break; } - if (heritage.sock_remote[u] >= 0) { - event_set(ep, heritage.sock_remote[u], - EV_READ | EV_PERSIST, - accept_f, NULL); - AZ(event_base_set(evb, ep)); - AZ(event_add(ep, NULL)); - ep++; - } } - AZ(event_base_loop(evb, 0)); INCOMPL(); } @@ -243,8 +250,8 @@ assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); } -#endif /* ACCEPTOR_USE_LIBEVENT */ - +#endif /* ACCEPTOR_USE_POLL */ +/*====================================================================*/ #ifdef ACCEPTOR_USE_KQUEUE #include @@ -360,6 +367,7 @@ } #endif /* ACCEPTOR_USE_KQUEUE */ +/*====================================================================*/ /*--------------------------------------------------------------------*/ From phk at projects.linpro.no Wed Aug 2 10:53:50 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 12:53:50 +0200 (CEST) Subject: r599 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802105350.122A51EC39A@projects.linpro.no> Author: phk Date: 2006-08-02 12:53:49 +0200 (Wed, 02 Aug 2006) New Revision: 599 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_backend.c Log: Simplify backend connection memory management. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 10:40:22 UTC (rev 598) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 10:53:49 UTC (rev 599) @@ -121,7 +121,6 @@ unsigned magic; #define VBE_CONN_MAGIC 0x0c5e6592 TAILQ_ENTRY(vbe_conn) list; - struct vbc_mem *vbcm; struct vbe *vbe; int fd; struct event ev; Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-02 10:40:22 UTC (rev 598) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-02 10:53:49 UTC (rev 599) @@ -39,12 +39,6 @@ #include "shmlog.h" #include "cache.h" -struct vbc_mem { - unsigned magic; -#define VBC_MEM_MAGIC 0x2fd7af01 - struct vbe_conn vbc; -}; - /* A backend IP */ struct vbe { @@ -70,21 +64,17 @@ static struct vbe_conn * vbe_new_conn(void) { - struct vbc_mem *vbcm; struct vbe_conn *vbc; unsigned char *p; - vbcm = calloc(sizeof *vbcm + heritage.mem_workspace * 2, 1); - if (vbcm == NULL) + vbc = calloc(sizeof *vbc + heritage.mem_workspace * 2, 1); + if (vbc == NULL) return (NULL); - vbcm->magic = VBC_MEM_MAGIC; VSL_stats->n_vbe_conn++; - vbc = &vbcm->vbc; vbc->magic = VBE_CONN_MAGIC; - vbc->vbcm = vbcm; vbc->http = &vbc->http_mem[0]; vbc->http2 = &vbc->http_mem[1]; - p = (void *)(vbcm + 1); + p = (void *)(vbc + 1); http_Setup(vbc->http, p, heritage.mem_workspace); p += heritage.mem_workspace; http_Setup(vbc->http2, p, heritage.mem_workspace); @@ -96,9 +86,8 @@ { CHECK_OBJ_NOTNULL(vb, VBE_CONN_MAGIC); - CHECK_OBJ_NOTNULL(vb->vbcm, VBC_MEM_MAGIC); VSL_stats->n_vbe_conn--; - free(vb->vbcm); + free(vb); } /*--------------------------------------------------------------------*/ From phk at projects.linpro.no Wed Aug 2 11:17:53 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 13:17:53 +0200 (CEST) Subject: r600 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802111753.B65C93BC017@projects.linpro.no> Author: phk Date: 2006-08-02 13:17:53 +0200 (Wed, 02 Aug 2006) New Revision: 600 Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c Log: Remove unused struct. Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-02 10:53:49 UTC (rev 599) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-02 11:17:53 UTC (rev 600) @@ -15,11 +15,6 @@ #include "shmlog.h" #include "cache.h" -struct edir { - int fd; - struct event ev; -}; - static void rdf(struct pollfd *fds, int idx) { From phk at projects.linpro.no Wed Aug 2 11:18:11 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 13:18:11 +0200 (CEST) Subject: r601 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802111811.2204E1EC4A6@projects.linpro.no> Author: phk Date: 2006-08-02 13:18:11 +0200 (Wed, 02 Aug 2006) New Revision: 601 Modified: trunk/varnish-cache/bin/varnishd/cache_http.c Log: Add include Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-02 11:17:53 UTC (rev 600) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-02 11:18:11 UTC (rev 601) @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include From phk at projects.linpro.no Wed Aug 2 11:58:55 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 13:58:55 +0200 (CEST) Subject: r602 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802115855.106441EC49E@projects.linpro.no> Author: phk Date: 2006-08-02 13:58:54 +0200 (Wed, 02 Aug 2006) New Revision: 602 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_fetch.c trunk/varnish-cache/bin/varnishd/cache_main.c trunk/varnish-cache/bin/varnishd/cache_vrt.c Log: Remove the libevent from the backend pool manager. Simplify the logic here while we're at it. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 11:18:11 UTC (rev 601) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 11:58:54 UTC (rev 602) @@ -8,7 +8,6 @@ #include #include "queue.h" -#include "event.h" #include "sbuf.h" #include "vcl_returns.h" @@ -121,10 +120,8 @@ unsigned magic; #define VBE_CONN_MAGIC 0x0c5e6592 TAILQ_ENTRY(vbe_conn) list; - struct vbe *vbe; + struct backend *backend; int fd; - struct event ev; - int inuse; struct http *http; struct http *http2; struct http http_mem[2]; @@ -263,22 +260,22 @@ struct backend { unsigned magic; #define BACKEND_MAGIC 0x64c4c7c6 - const char *vcl_name; - const char *hostname; - const char *portname; - unsigned ip; + const char *vcl_name; + const char *hostname; + const char *portname; + unsigned ip; - struct addrinfo *addr; - struct addrinfo *last_addr; + struct addrinfo *addr; + struct addrinfo *last_addr; + + TAILQ_HEAD(,vbe_conn) connlist; #if 0 - double responsetime; - double timeout; - double bandwidth; - int down; + double responsetime; + double timeout; + double bandwidth; + int down; #endif - /* internal stuff */ - struct vbe *vbe; }; /* Prototypes etc ----------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-02 11:18:11 UTC (rev 601) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-02 11:58:54 UTC (rev 602) @@ -3,23 +3,9 @@ * * Manage backend connections. * - * For each backend ip number we maintain a shadow backend structure so - * that backend connections can be reused across VCL changes. - * - * For each IP we maintain a list of busy and free backend connections, - * and free connections are monitored to detect if the backend closes - * the connection. - * - * We recycle backend connections in most recently used order to minimize - * the number of open connections to any one backend. - * - * XXX: - * I'm not happy about recycling always going through the monitor thread - * but not doing so is slightly more tricky: A connection might be reused - * several times before the monitor thread got around to it, and it would - * have to double check if it had already armed the event for that connection. - * Hopefully this is nowhere close to a performance issue, but if it is, - * it can be optimized at the expense of more complex code. + * XXX: When we switch VCL we can have vbe_conn's dangling from + * XXX: the backends no longer used. When the VCL's refcount + * XXX: drops to zero we should zap them. */ #include @@ -31,6 +17,7 @@ #include #include #include +#include #include #include @@ -41,24 +28,10 @@ /* A backend IP */ -struct vbe { - unsigned magic; -#define VBE_MAGIC 0x079648f0 - unsigned ip; - TAILQ_ENTRY(vbe) list; - TAILQ_HEAD(,vbe_conn) fconn; - TAILQ_HEAD(,vbe_conn) bconn; - unsigned nconn; -}; +static TAILQ_HEAD(,vbe_conn) vbe_head = TAILQ_HEAD_INITIALIZER(vbe_head); -static TAILQ_HEAD(,vbe) vbe_head = TAILQ_HEAD_INITIALIZER(vbe_head); - static pthread_mutex_t vbemtx; -static pthread_t vbe_thread; -static struct event_base *vbe_evb; -static int vbe_pipe[2]; - /*--------------------------------------------------------------------*/ static struct vbe_conn * @@ -74,6 +47,7 @@ vbc->magic = VBE_CONN_MAGIC; vbc->http = &vbc->http_mem[0]; vbc->http2 = &vbc->http_mem[1]; + vbc->fd = -1; p = (void *)(vbc + 1); http_Setup(vbc->http, p, heritage.mem_workspace); p += heritage.mem_workspace; @@ -81,15 +55,6 @@ return (vbc); } -static void -vbe_delete_conn(struct vbe_conn *vb) -{ - - CHECK_OBJ_NOTNULL(vb, VBE_CONN_MAGIC); - VSL_stats->n_vbe_conn--; - free(vb); -} - /*--------------------------------------------------------------------*/ static void @@ -197,92 +162,11 @@ TCP_myname(s, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1); TCP_name(ai->ai_addr, ai->ai_addrlen, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2); - VSL(SLT_BackendOpen, s, "%s %s %s %s", abuf1, pbuf1, abuf2, pbuf2); + VSL(SLT_BackendOpen, s, "%s %s %s %s %s", + bp->vcl_name, abuf1, pbuf1, abuf2, pbuf2); return (s); } -/*-------------------------------------------------------------------- - * When backend connections have been used, they are passed to us through - * the vbe_pipe. If fd == -1 it has been closed and will be reclaimed, - * otherwise arm an event to monitor if the backend closes and recycle. - */ - -static void -vbe_rdp(int fd, short event, void *arg) -{ - struct vbe_conn *vc; - int i; - - (void)event; - (void)arg; - i = read(fd, &vc, sizeof vc); - assert(i == sizeof vc); - AZ(pthread_mutex_lock(&vbemtx)); - TAILQ_REMOVE(&vc->vbe->bconn, vc, list); - if (vc->fd < 0) { - vc->vbe->nconn--; - vbe_delete_conn(vc); - } else { - vc->inuse = 0; - AZ(event_add(&vc->ev, NULL)); - TAILQ_INSERT_HEAD(&vc->vbe->fconn, vc, list); - } - AZ(pthread_mutex_unlock(&vbemtx)); -} - -/*-------------------------------------------------------------------- - * A backend connection became ready. This can happen if it was reused - * in which case we unarm the event and get out of the way, or if the - * backend closed the connection in which case we clean up. - */ - -static void -vbe_rdf(int fd, short event, void *arg) -{ - struct vbe_conn *vc; - int j; - - (void)fd; - (void)event; - vc = arg; - AZ(pthread_mutex_lock(&vbemtx)); - if (vc->inuse) { - AZ(event_del(&vc->ev)); - AZ(pthread_mutex_unlock(&vbemtx)); - return; - } - AZ(ioctl(vc->fd, FIONREAD, &j)); - VSL(SLT_BackendClose, vc->fd, "Remote (%d chars)", j); - TAILQ_REMOVE(&vc->vbe->fconn, vc, list); - AZ(pthread_mutex_unlock(&vbemtx)); - AZ(event_del(&vc->ev)); - AZ(close(vc->fd)); - vbe_delete_conn(vc); -} - -/* Backend monitoring thread -----------------------------------------*/ - -static void * -vbe_main(void *priv) -{ - struct event pev; - - (void)priv; - vbe_evb = event_init(); - assert(vbe_evb != NULL); - - AZ(pipe(vbe_pipe)); - - memset(&pev, 0, sizeof pev); - event_set(&pev, vbe_pipe[0], EV_READ | EV_PERSIST, vbe_rdp, NULL); - AZ(event_base_set(vbe_evb, &pev)); - AZ(event_add(&pev, NULL)); - - AZ(event_base_loop(vbe_evb, 0)); - - INCOMPL(); -} - /* Get a backend connection ------------------------------------------ * * First locate the backend shadow, if necessary by creating one. @@ -293,62 +177,73 @@ struct vbe_conn * VBE_GetFd(struct backend *bp, unsigned xid) { - struct vbe *vp; - struct vbe_conn *vc; + struct vbe_conn *vc, *vc2; + struct pollfd pfd; CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); - AZ(pthread_mutex_lock(&vbemtx)); - vp = bp->vbe; - if (vp == NULL) { - TAILQ_FOREACH(vp, &vbe_head, list) - if (vp->ip == bp->ip) - break; - } - if (vp == NULL) { - vp = calloc(sizeof *vp, 1); - assert(vp != NULL); - vp->magic = VBE_MAGIC; - TAILQ_INIT(&vp->fconn); - TAILQ_INIT(&vp->bconn); - vp->ip = bp->ip; - bp->vbe = vp; - TAILQ_INSERT_TAIL(&vbe_head, vp, list); - } else - CHECK_OBJ(vp, VBE_MAGIC); - /* XXX: check nconn vs backend->maxcon */ - vc = TAILQ_FIRST(&vp->fconn); - if (vc != NULL) { - vc->inuse = 1; - TAILQ_REMOVE(&vp->fconn, vc, list); - TAILQ_INSERT_TAIL(&vp->bconn, vc, list); - AZ(pthread_mutex_unlock(&vbemtx)); - } else { - vc = vbe_new_conn(); - if (vc == NULL) { - AZ(pthread_mutex_unlock(&vbemtx)); - return (NULL); + while (1) { + /* + * Try all connections on this backend until we find one + * that works. If that fails, grab a free connection + * (if any) while we have the lock anyway. + */ + vc2 = NULL; + AZ(pthread_mutex_lock(&vbemtx)); + vc = TAILQ_FIRST(&bp->connlist); + if (vc != NULL) { + assert(vc->fd >= 0); + TAILQ_REMOVE(&bp->connlist, vc, list); + } else { + vc2 = TAILQ_FIRST(&vbe_head); + if (vc2 != NULL) + TAILQ_REMOVE(&vbe_head, vc2, list); } - vp->nconn++; - vc->vbe = vp; - vc->fd = -1; - vc->inuse = 1; - TAILQ_INSERT_TAIL(&vp->bconn, vc, list); AZ(pthread_mutex_unlock(&vbemtx)); + if (vc == NULL) + break; + + /* Test the connection for remote close before we use it */ + pfd.fd = vc->fd; + pfd.events = POLLIN; + pfd.revents = 0; + if (!poll(&pfd, 1, 0)) + break; + VBE_ClosedFd(vc); + } + + if (vc == NULL) { + if (vc2 == NULL) + vc = vbe_new_conn(); + else + vc = vc2; + assert(vc != NULL); + assert(vc->fd == -1); + assert(vc->backend == NULL); + } + + /* If not connected yet, do so */ + if (vc->fd < 0) { + assert(vc->backend == NULL); vc->fd = vbe_connect(bp); + AZ(pthread_mutex_lock(&vbemtx)); if (vc->fd < 0) { - AZ(pthread_mutex_lock(&vbemtx)); - TAILQ_REMOVE(&vc->vbe->bconn, vc, list); - vp->nconn--; - AZ(pthread_mutex_unlock(&vbemtx)); - vbe_delete_conn(vc); - return (NULL); + vc->backend = NULL; + TAILQ_INSERT_HEAD(&vbe_head, vc, list); + vc = NULL; + } else { + vc->backend = bp; } + AZ(pthread_mutex_unlock(&vbemtx)); + } else { + assert(vc->fd >= 0); + assert(vc->backend == bp); + } + if (vc != NULL ) { + assert(vc->fd >= 0); VSL_stats->backend_conn++; - event_set(&vc->ev, vc->fd, - EV_READ | EV_PERSIST, vbe_rdf, vc); - AZ(event_base_set(vbe_evb, &vc->ev)); + VSL(SLT_BackendXID, vc->fd, "%u", xid); + assert(vc->backend != NULL); } - VSL(SLT_BackendXID, vc->fd, "%u", xid); return (vc); } @@ -357,14 +252,17 @@ void VBE_ClosedFd(struct vbe_conn *vc) { - int i; + CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); assert(vc->fd >= 0); - VSL(SLT_BackendClose, vc->fd, ""); + assert(vc->backend != NULL); + VSL(SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name); AZ(close(vc->fd)); vc->fd = -1; - i = write(vbe_pipe[1], &vc, sizeof vc); - assert(i == sizeof vc); + vc->backend = NULL; + AZ(pthread_mutex_lock(&vbemtx)); + TAILQ_INSERT_HEAD(&vbe_head, vc, list); + AZ(pthread_mutex_unlock(&vbemtx)); } /* Recycle a connection ----------------------------------------------*/ @@ -372,12 +270,15 @@ void VBE_RecycleFd(struct vbe_conn *vc) { - int i; + CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); + assert(vc->fd >= 0); + assert(vc->backend != NULL); VSL_stats->backend_recycle++; - VSL(SLT_BackendReuse, vc->fd, ""); - i = write(vbe_pipe[1], &vc, sizeof vc); - assert(i == sizeof vc); + VSL(SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name); + AZ(pthread_mutex_lock(&vbemtx)); + TAILQ_INSERT_HEAD(&vc->backend->connlist, vc, list); + AZ(pthread_mutex_unlock(&vbemtx)); } /*--------------------------------------------------------------------*/ @@ -387,5 +288,4 @@ { AZ(pthread_mutex_init(&vbemtx, NULL)); - AZ(pthread_create(&vbe_thread, NULL, vbe_main, NULL)); } Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-02 11:18:11 UTC (rev 601) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-02 11:58:54 UTC (rev 602) @@ -219,6 +219,7 @@ assert(sp->obj->busy != 0); vc = sp->vbc; + sp->vbc = NULL; if (http_GetHdr(vc->http, H_Last_Modified, &b)) sp->obj->last_modified = TIM_parse(b); @@ -303,6 +304,7 @@ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); + assert(sp->vbc == NULL); sp->vbc = vc; sp->obj->entered = time(NULL); Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-02 11:18:11 UTC (rev 601) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-02 11:58:54 UTC (rev 602) @@ -14,6 +14,7 @@ #include "heritage.h" #include "shmlog.h" #include "cache.h" +#include "event.h" #include "cli_event.h" static struct event ev_keepalive; Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-02 11:18:11 UTC (rev 601) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-02 11:58:54 UTC (rev 602) @@ -83,6 +83,7 @@ cp->backend[i] = calloc(sizeof *cp->backend[i], 1); assert(cp->backend[i] != NULL); cp->backend[i]->magic = BACKEND_MAGIC; + TAILQ_INIT(&cp->backend[i]->connlist); } } From phk at projects.linpro.no Wed Aug 2 12:05:19 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 14:05:19 +0200 (CEST) Subject: r603 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802120519.4DCC81EC4A8@projects.linpro.no> Author: phk Date: 2006-08-02 14:05:19 +0200 (Wed, 02 Aug 2006) New Revision: 603 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Typo: Also monitor remote sockets with the poll based acceptor. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-02 11:58:54 UTC (rev 602) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-02 12:05:19 UTC (rev 603) @@ -180,7 +180,7 @@ if (heritage.sock_local[u] >= 0) vca_poll(heritage.sock_local[u]); if (heritage.sock_remote[u] >= 0) - vca_poll(heritage.sock_local[u]); + vca_poll(heritage.sock_remote[u]); } while (1) { @@ -203,7 +203,7 @@ } if (heritage.sock_remote[u] >= 0 && pollfd[heritage.sock_remote[u]].revents) { - accept_f(heritage.sock_local[u]); + accept_f(heritage.sock_remote[u]); v--; } } From phk at projects.linpro.no Wed Aug 2 13:28:14 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 15:28:14 +0200 (CEST) Subject: r604 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802132814.CA4EF1EC4A8@projects.linpro.no> Author: phk Date: 2006-08-02 15:28:14 +0200 (Wed, 02 Aug 2006) New Revision: 604 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: Don my plumbers outfit and twist a lot of pipes into shape: When -d(ebug) is specified we fork before calling daemon. The parent process becomes a miniature cat(1) program which connects stdin/stdout with the management process stdin/stdout. It also knows that SIGINT should be passed on to the management process in order to make it DTRT. Any other cause of death for this "debugger" process will (once I teach the CLI about it) not affect the running varnish and therefore it will be possible to start varnish in debugging mode, tweak things a bit and CTRL-D and leave it running in the properly daemon(3)'ed background. The reason for this rather complicated bit of pipework is that we can not call daemon(3) once we have started any threads (only the calling thread survives) and we would loose our parent relationship to the cache process also. Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-02 12:05:19 UTC (rev 603) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-02 13:28:14 UTC (rev 604) @@ -226,29 +226,31 @@ if (i < 0) errx(1, "Could not fork child"); if (i == 0) { - /* XXX: close fds */ - /* XXX: (re)set signals */ - /* Redirect stdin/out/err */ - close(0); + AZ(close(0)); i = open("/dev/null", O_RDONLY); assert(i == 0); - close(child_fds[0]); - dup2(child_fds[1], 1); - dup2(child_fds[1], 2); - close(child_fds[1]); + assert(dup2(child_fds[1], 1) == 1); + assert(dup2(child_fds[1], 2) == 2); + AZ(close(child_fds[0])); + AZ(close(child_fds[1])); + AZ(close(heritage.fds[0])); + AZ(close(heritage.fds[3])); + child_main(); exit (1); } + child_pid = i; printf("start child pid %d\n", i); - /* - * We do not close the unused ends of the pipes here to avoid - * doing SIGPIPE handling. - */ + AZ(close(child_fds[1])); + + AZ(close(heritage.fds[1])); + AZ(close(heritage.fds[2])); + child_std = bufferevent_new(child_fds[0], std_rdcb, std_wrcb, std_excb, NULL); assert(child_std != NULL); Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-02 12:05:19 UTC (rev 603) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-02 13:28:14 UTC (rev 604) @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -18,8 +19,8 @@ #include -#include -#include +#include "event.h" +#include "sbuf.h" #include #include @@ -328,30 +329,7 @@ { NULL } }; -static void -testme(void) -{ - struct event e_sigchld; - struct cli *cli; - int i; - mgt_eb = event_init(); - assert(mgt_eb != NULL); - - cli = cli_setup(mgt_eb, 0, 1, 1, cli_proto); - - signal_set(&e_sigchld, SIGCHLD, mgt_sigchld, NULL); - AZ(event_base_set(mgt_eb, &e_sigchld)); - AZ(signal_add(&e_sigchld, NULL)); - - mgt_child_start(); - - i = event_base_loop(mgt_eb, 0); - if (i != 0) - printf("event_dispatch() = %d\n", i); - -} - /*--------------------------------------------------------------------*/ static int @@ -515,18 +493,107 @@ heritage.wthread_timeout = uc; } +/*-------------------------------------------------------------------- + * When -d is specified we fork a third process which will relay + * keystrokes between the terminal and the CLI. This allows us to + * detach from the process and have it daemonize properly (ie: it already + * did that long time ago). + * Doing the simple thing and calling daemon(3) when the user asks for + * it does not work, daemon(3) forks and all the threads are lost. + */ + +static pid_t d_child; + +#include + +static void +DebugSigPass(int sig) +{ + int i; + + i = kill(d_child, sig); + printf("sig %d i %d pid %d\n", sig, i, d_child); +} + +static void +DebugStunt(void) +{ + int pipes[2][2]; + struct pollfd pfd[2]; + char buf[BUFSIZ]; + int i, j, k; + char *p; + + AZ(pipe(pipes[0])); + AZ(pipe(pipes[1])); + d_child = fork(); + if (!d_child) { + assert(dup2(pipes[0][0], 0) >= 0); + assert(dup2(pipes[1][1], 1) >= 0); + assert(dup2(pipes[1][1], 2) >= 0); + AZ(close(pipes[0][0])); + AZ(close(pipes[0][1])); + AZ(close(pipes[1][0])); + AZ(close(pipes[1][1])); + return; + } + AZ(close(pipes[0][0])); + assert(dup2(pipes[0][1], 3) >= 0); + pipes[0][0] = 0; + pipes[0][1] = 3; + + assert(dup2(pipes[1][0], 4) >= 0); + AZ(close(pipes[1][1])); + pipes[1][0] = 4; + pipes[1][1] = 1; + + for (i = 5; i < 100; i++) + close(i); + + pfd[0].fd = pipes[0][0]; + pfd[0].events = POLLIN; + pfd[1].fd = pipes[1][0]; + pfd[1].events = POLLIN; + + signal(SIGINT, DebugSigPass); + i = read(pipes[1][0], buf, sizeof buf - 1); + buf[i] = '\0'; + d_child = strtoul(buf, &p, 0); + assert(p != NULL); + printf("New Pid %d\n", d_child); + i = strlen(p); + j = write(pipes[1][1], p, i); + assert(j == i); + + while (1) { + i = poll(pfd, 2, INFTIM); + for (k = 0; k < 2; k++) { + if (pfd[k].revents) { + j = read(pipes[k][0], buf, sizeof buf); + if (j == 0) + exit (0); + if (j > 0) { + i = write(pipes[k][1], buf, j); + if (i != j) + err(1, "i = %d j = %d\n", i, j); + } + } + } + } +} + + /*--------------------------------------------------------------------*/ /* for development purposes */ #include -#include int main(int argc, char *argv[]) { int o; const char *portnumber = "8080"; - unsigned dflag = 1; /* XXX: debug=on for now */ + unsigned dflag = 0; const char *bflag = NULL; const char *fflag = NULL; const char *sflag = "file"; @@ -613,7 +680,34 @@ VSL_MgtInit(SHMLOG_FILENAME, 8*1024*1024); - testme(); + if (dflag) + DebugStunt(); + daemon(0, dflag); + if (dflag) + printf("%d\n%d\n%d\n", getpid(), getsid(0), getpgrp()); + { + struct event e_sigchld; + struct cli *cli; + int i; + + mgt_eb = event_init(); + assert(mgt_eb != NULL); + + if (dflag) + cli = cli_setup(mgt_eb, 0, 1, 1, cli_proto); + + signal_set(&e_sigchld, SIGCHLD, mgt_sigchld, NULL); + AZ(event_base_set(mgt_eb, &e_sigchld)); + AZ(signal_add(&e_sigchld, NULL)); + + mgt_child_start(); + + i = event_base_loop(mgt_eb, 0); + if (i != 0) + printf("event_dispatch() = %d\n", i); + + } + exit(0); } From phk at projects.linpro.no Wed Aug 2 15:55:06 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 17:55:06 +0200 (CEST) Subject: r605 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802155506.747343BC017@projects.linpro.no> Author: phk Date: 2006-08-02 17:55:06 +0200 (Wed, 02 Aug 2006) New Revision: 605 Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c Log: Remember to clear sp->vbc Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-02 13:28:14 UTC (rev 604) +++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-02 15:55:06 UTC (rev 605) @@ -147,6 +147,7 @@ vc = sp->vbc; assert(vc != NULL); + sp->vbc = NULL; http_ClrHeader(sp->http); http_CopyResp(sp->fd, sp->http, vc->http); @@ -209,5 +210,6 @@ assert(i == 0); http_DissectResponse(vc->http, vc->fd); + assert(sp->vbc == NULL); sp->vbc = vc; } From phk at projects.linpro.no Wed Aug 2 17:27:33 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 19:27:33 +0200 (CEST) Subject: r606 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802172733.55B861EC4B1@projects.linpro.no> Author: phk Date: 2006-08-02 19:27:33 +0200 (Wed, 02 Aug 2006) New Revision: 606 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: More asserts, sp->vbc this time. Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-02 15:55:06 UTC (rev 605) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-02 17:27:33 UTC (rev 606) @@ -84,6 +84,7 @@ { assert(sp->obj == NULL); + assert(sp->vbc == NULL); if (sp->fd >= 0 && sp->doclose != NULL) vca_close_session(sp, sp->doclose); VCL_Rel(sp->vcl); @@ -163,6 +164,7 @@ cnt_fetch(struct sess *sp) { + assert(sp->vbc != NULL); RFC2616_cache_policy(sp, sp->vbc->http); VCL_fetch_method(sp); @@ -188,7 +190,9 @@ } if (sp->handling == VCL_RET_INSERT) { sp->obj->cacheable = 1; + assert(sp->vbc != NULL); FetchBody(sp); + assert(sp->vbc == NULL); HSH_Ref(sp->obj); /* get another, STP_DELIVER will deref */ HSH_Unbusy(sp->obj); sp->wrk->acct.fetch++; @@ -400,8 +404,10 @@ if (sp->handling == VCL_RET_LOOKUP) INCOMPL(); if (sp->handling == VCL_RET_FETCH) { + assert(sp->vbc == NULL); FetchHeaders(sp); sp->step = STP_FETCH; + assert(sp->vbc != NULL); return (0); } INCOMPL(); @@ -426,7 +432,9 @@ cnt_pass(struct sess *sp) { + assert(sp->vbc == NULL); PassSession(sp); + assert(sp->vbc != NULL); sp->step = STP_PASSBODY; return (0); } @@ -451,7 +459,9 @@ { sp->wrk->acct.pass++; + assert(sp->vbc != NULL); PassBody(sp); + assert(sp->vbc == NULL); sp->step = STP_DONE; return (0); } @@ -518,6 +528,7 @@ sp->vcl = VCL_Get(); assert(sp->obj == NULL); + assert(sp->vbc == NULL); sp->wrk->acct.req++; done = http_DissectRequest(sp->http, sp->fd); From phk at projects.linpro.no Wed Aug 2 17:45:03 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 19:45:03 +0200 (CEST) Subject: r607 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802174503.118EA1EC4B6@projects.linpro.no> Author: phk Date: 2006-08-02 19:45:02 +0200 (Wed, 02 Aug 2006) New Revision: 607 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: Enter pass mode through the front door. Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-02 17:27:33 UTC (rev 606) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-02 17:45:02 UTC (rev 607) @@ -261,7 +261,6 @@ if (sp->handling == VCL_RET_PASS) { HSH_Deref(sp->obj); sp->obj = NULL; - PassSession(sp); sp->step = STP_PASS; return (0); } @@ -396,9 +395,8 @@ sp->obj->cacheable = 0; HSH_Unbusy(sp->obj); HSH_Deref(sp->obj); - sp->obj = 0; - PassSession(sp); - sp->step = STP_PASSBODY; + sp->obj = NULL; + sp->step = STP_PASS; return (0); } if (sp->handling == VCL_RET_LOOKUP) From phk at projects.linpro.no Wed Aug 2 18:12:42 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 20:12:42 +0200 (CEST) Subject: r608 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802181242.38E111EC4B9@projects.linpro.no> Author: phk Date: 2006-08-02 20:12:42 +0200 (Wed, 02 Aug 2006) New Revision: 608 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: Tell daemon(3) to not chdir in debugging mode so we can find our core dumps. Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-02 17:45:02 UTC (rev 607) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-02 18:12:42 UTC (rev 608) @@ -682,7 +682,7 @@ if (dflag) DebugStunt(); - daemon(0, dflag); + daemon(dflag, dflag); if (dflag) printf("%d\n%d\n%d\n", getpid(), getsid(0), getpgrp()); From phk at projects.linpro.no Wed Aug 2 18:17:49 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 20:17:49 +0200 (CEST) Subject: r609 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802181749.A581F1EC4BA@projects.linpro.no> Author: phk Date: 2006-08-02 20:17:49 +0200 (Wed, 02 Aug 2006) New Revision: 609 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Allow ENOENT on removing kqueue events, a close will have drained them already. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-02 18:12:42 UTC (rev 608) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-02 18:17:49 UTC (rev 609) @@ -261,13 +261,18 @@ vca_kq_sess(struct sess *sp, int arm) { struct kevent ke[2]; + int i; assert(arm == EV_ADD || arm == EV_DELETE); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); memset(ke, 0, sizeof ke); EV_SET(&ke[0], sp->fd, EVFILT_READ, arm, 0, 0, sp); EV_SET(&ke[1], sp->fd, EVFILT_TIMER, arm , 0, 5000, sp); - AZ(kevent(kq, ke, 2, NULL, 0, NULL)); + i = kevent(kq, ke, 2, NULL, 0, NULL); + if (arm == EV_ADD) + assert(i == 0); + else + assert(i == 0 || errno == ENOENT); } static void From phk at projects.linpro.no Wed Aug 2 19:12:01 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 21:12:01 +0200 (CEST) Subject: r610 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802191201.88F6D1EC4BD@projects.linpro.no> Author: phk Date: 2006-08-02 21:12:01 +0200 (Wed, 02 Aug 2006) New Revision: 610 Modified: trunk/varnish-cache/bin/varnishd/cache_session.c Log: log StatAddr with fd=0 to avoid out-of-order confusion Modified: trunk/varnish-cache/bin/varnishd/cache_session.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-02 18:17:49 UTC (rev 609) +++ trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-02 19:12:01 UTC (rev 610) @@ -146,7 +146,7 @@ AZ(pthread_mutex_lock(&ses_mtx)); ses_sum_acct(b, a); - VSL(SLT_StatAddr, sp->id, "%s 0 %d %ju %ju %ju %ju %ju %ju %ju", + VSL(SLT_StatAddr, 0, "%s 0 %d %ju %ju %ju %ju %ju %ju %ju", sp->srcaddr->addr, time(NULL) - b->first, b->sess, b->req, b->pipe, b->pass, b->fetch, b->hdrbytes, b->bodybytes); From phk at projects.linpro.no Wed Aug 2 20:54:40 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 22:54:40 +0200 (CEST) Subject: r611 - trunk/varnish-cache/lib/libvarnish Message-ID: <20060802205440.D60D51EC4A2@projects.linpro.no> Author: phk Date: 2006-08-02 22:54:40 +0200 (Wed, 02 Aug 2006) New Revision: 611 Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c Log: Fix a bug when deleting items in the binheap Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/binary_heap.c 2006-08-02 19:12:01 UTC (rev 610) +++ trunk/varnish-cache/lib/libvarnish/binary_heap.c 2006-08-02 20:54:40 UTC (rev 611) @@ -108,10 +108,10 @@ assert(bh->magic == BINHEAP_MAGIC); while (1) { - v1 = CHILD(u, 1); + v1 = CHILD(u, 0); + v2 = CHILD(u, 1); if (v1 >= bh->next) return; - v2 = CHILD(u, 2); if (v2 >= bh->next) { if (!bh->cmp(bh->priv, bh->array[u], bh->array[v1])) binhead_swap(bh, u, v1); @@ -183,6 +183,7 @@ return; bh->array[idx] = bh->array[bh->next]; binheap_update(bh, idx); + idx = binheap_trickleup(bh, idx); binheap_trickledown(bh, idx); /* XXX: free part of array ? */ } @@ -193,6 +194,8 @@ #include +#if 0 + static int cmp(void *priv, void *a, void *b) { @@ -219,7 +222,7 @@ fprintf(f, "size=\"7,10\"\n"); fprintf(f, "ptr [label=\"%s\"]\n", what); fprintf(f, "ptr -> node_%u\n", ptr); - for (u = 0; u < bh->next; u++) { + for (u = 1; u < bh->next; u++) { up = bh->array[u]; fprintf(f, "node_%u [label=\"%u\"];\n", u, *up); if (u > 0) @@ -236,10 +239,6 @@ struct binheap *bh; unsigned l[N], u, *up, lu; - srandomdev(); - u = random(); - printf("Seed %u\n", u); - srandom(u); system("echo %! > /tmp/_.ps"); bh = binheap_new(NULL, cmp, update); for (u = 0; u < N; u++) { @@ -265,4 +264,87 @@ return (0); } +#else + +struct foo { + unsigned idx; + unsigned key; +}; + +#define M 1311191 +#define N 131 + +struct foo ff[N]; + + +static int +cmp(void *priv, void *a, void *b) +{ + struct foo *fa, *fb; + + fa = a; + fb = b; + return (fa->key < fb->key); +} + +void +update(void *priv, void *a, unsigned u) +{ + struct foo *fa; + + fa = a; + fa->idx = u; +} + +void +chk(struct binheap *bh) +{ + unsigned u, v, nb = 0; + struct foo *fa, *fb; + + for (u = 2; u < bh->next; u++) { + v = PARENT(u); + fa = bh->array[u]; + fb = bh->array[v]; + assert(fa->key > fb->key); + continue; + printf("[%2u/%2u] %10u > [%2u/%2u] %10u %s\n", + u, fa - ff, fa->key, + v, fb - ff, fb->key, + fa->key > fb->key ? "OK" : "BAD"); + if (fa->key <= fb->key) + nb++; + } + if (nb) + exit(0); +} + +int +main(int argc, char **argv) +{ + struct binheap *bh; + unsigned u, v; + +#if 0 + srandomdev(); + u = random(); + printf("Seed %u\n", u); + srandom(u); #endif + bh = binheap_new(NULL, cmp, update); + for (u = 0; u < M; u++) { + v = random() % N; + if (ff[v].idx > 0) { + printf("Delete [%u] %'u\n", v, ff[v].key); + binheap_delete(bh, ff[v].idx); + } else { + ff[v].key = random(); + printf("Insert [%u] %'u\n", v, ff[v].key); + binheap_insert(bh, &ff[v]); + } + chk(bh); + } + return (0); +} +#endif +#endif From phk at projects.linpro.no Wed Aug 2 20:59:46 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 2 Aug 2006 22:59:46 +0200 (CEST) Subject: r612 - trunk/varnish-cache/bin/varnishd Message-ID: <20060802205946.E4C611EC4C1@projects.linpro.no> Author: phk Date: 2006-08-02 22:59:46 +0200 (Wed, 02 Aug 2006) New Revision: 612 Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c Log: Add an assert, just in case. Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-08-02 20:54:40 UTC (rev 611) +++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-08-02 20:59:46 UTC (rev 612) @@ -123,6 +123,12 @@ continue; } binheap_delete(exp_heap, o->heap_idx); +{ + struct object *o2; + o2 = binheap_root(exp_heap); + if (o2 != NULL) + assert(o2->ttl >= o->ttl); +} AZ(pthread_mutex_unlock(&exp_mtx)); VSL(SLT_ExpPick, 0, "%u", o->xid); From andersb at projects.linpro.no Wed Aug 2 22:33:31 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Thu, 3 Aug 2006 00:33:31 +0200 (CEST) Subject: r613 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060802223331.ED5361EC4C5@projects.linpro.no> Author: andersb Date: 2006-08-03 00:33:31 +0200 (Thu, 03 Aug 2006) New Revision: 613 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Starting to get the structure right (I think). Thx for the NULL on each string Poul-Hennning :) Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-02 20:59:46 UTC (rev 612) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-02 22:33:31 UTC (rev 613) @@ -28,19 +28,38 @@ /* Ordering-----------------------------------------------------------*/ +/* Adding a struct to hold the data for the logline + * + */ + +struct logline { + char df_h[4 * (3 + 1)]; // Datafield for %h (IP adress) + // // int y; + // // unsigned char *df_l; // Datafield for %l + // // unsigned char *df_u; // Datafield for %u + // // unsigned char *df_t; // Datafield for %t + // // unsigned char *df_r; // Datafield for %r + // // unsigned char *df_s; // Datafield for %s + // // unsigned char *df_b; // Datafield for %b + // // unsigned char *df_R; // Datafield for %{Referer}i + unsigned char *df_U; // Datafield for %{User-agent}i +}; + /* We make a array of pointers to sbuf's. Sbuf is a string buffer. -* The buffer can be made/extended/cleared etc. through a API. -* The array is 65536 long because we will use sessionid as key. -* -*/ + * * The buffer can be made/extended/cleared etc. through a API. + * * The array is 65536 long because we will use sessionid as key. + * * + * */ -static struct sbuf *ob[65536]; +static struct sbuf *ob[65536]; +static struct logline ll[65536]; /* * Clean order is called once in a while. It clears all the sessions that * where never finished (SLT_SessionClose). Because the data is not complete * we disregard the data. +* */ static void @@ -52,16 +71,6 @@ if (ob[u] == NULL) continue; sbuf_finish(ob[u]); - - /* XXX delete this code? Probably, since we write data to disk/screen - * as soon as we have all the data we need anyway. If we are here - * we don't have all the data, hence we don't bother to write out. - * - * - * if (sbuf_len(ob[u])) - * printf("%s\n", sbuf_data(ob[u])); - */ - sbuf_clear(ob[u]); } } @@ -69,25 +78,13 @@ static void extended_log_format(unsigned char *p, char *w_opt) { - unsigned u, v; - int i,j,k; - unsigned char *ans; + unsigned u; + int i,j; + unsigned char *tmpPtr; // Declare the int's that are used to determin if we have all data. int ll_h = 0; // %h - int ll_l = 0; // %l - int ll_u = 0; // %u - int ll_t = 0; // %t - int ll_r = 0; // %r - int ll_s = 0; // %s - int ll_b = 0; // %b - int ll_R = 0; // %{Referer}i int ll_U = 0; // %{User-agent}i // Declare the data where we store the differnt parts - char df_h[4 * (3 + 1)]; // Datafield for %h (IP adress) - char df_l; - char df_u[65536]; - char df_U[65536]; - if (w_opt != NULL){ // printf(" Has w_opt\n"); @@ -100,74 +97,43 @@ ob[u] = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); assert(ob[u] != NULL); } - v = 0; switch (p[0]) { case SLT_SessionOpen: - - // Finding the IP adress when data is: "XXX.XXX.XXX.XXX somenumber" - ans = strchr(p + 4, ' '); - j = ans - (p + 4); // length - //printf("Ip address: '%*.*s'\n", j, j, p + 4); - memcpy(df_h, p + 4, j); - df_h[j] = '\0'; - //printf("Ip address: %s\n", df_h); - ll_h = 1; + tmpPtr = strchr(p + 4, ' '); + j = strlen(p + 4) - strlen(tmpPtr); // length of IP + strncpy(ll[u].df_h, p + 4, j); + ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. break; case SLT_RxHeader: - + if (p[1] >= 11 && !strncasecmp((void *)&p[4], "user-agent:",11)){ - // Could actually check for ll_h = 1 also in line above. - // If it is equal 1 we know a new client is in, hence a new User-Agent. - - memcpy(df_U, p + 4, p[1]); - df_U[p[1]] = '\0'; - //printf("Ip address: %s\n", df_U); - /*sbuf_bcat(ob[u], p + 4, p[1]); - sbuf_cat(ob[u], "\n"); - sbuf_finish(ob[u]); - printf("%s", sbuf_data(ob[u])); - sbuf_clear(ob[u]); - */ + ll[u].df_U = strdup(p + 4); } + break; + + case SLT_StatAddr: + + break; case SLT_SessionClose: + printf("Closing session [%d]: %s %s\n",u, ll[u].df_h, ll[u].df_U); break; default: - v = 1; break; } - if (ll_h && ll_U) { + if (0) { - /* XXX Need to write some code to make the logline - sbuf_printf(ob[u], "%02x %3d %4d %-12s", - p[0], p[1], u, VSL_tags[p[0]]); - if (p[1] > 0) { - sbuf_cat(ob[u], " <"); - sbuf_bcat(ob[u], p + 4, p[1]); - sbuf_cat(ob[u], ">"); - } - sbuf_cat(ob[u], "\n"); - */ } - /* XXX Do I need this? When is u == 0? I can't seem to see - * it used before this place. - if (u == 0) { - sbuf_finish(ob[u]); - printf("%s", sbuf_data(ob[u])); - sbuf_clear(ob[u]); - return; - } - */ } @@ -186,11 +152,8 @@ int i, c; unsigned u, v; unsigned char *p; - //int o_flag = 0; - //int l_flag = 0; char *w_opt = NULL; FILE *wfile = NULL; - // int h_opt = 0; struct VSL_data *vd; vd = VSL_New(); @@ -229,43 +192,20 @@ break; if (i == 0) { if (w_opt == NULL) { - if (++v == 100) + if (++v == 100){ clean_order(); - fflush(stdout); - } else if (++v == 100) { - - /* Not sure if needed. - * - *fflush(wfile); - */ - - printf("\n Inside the ++v==100 and w_opt is set.\n"); + fflush(stdout); } + } usleep(50000); continue; } v = 0; - /* XXX probably wanna throw this out. Not sure when needed. - if (wfile != NULL) { - i = fwrite(p, 4 + p[1], 1, wfile); - if (i != 1) - perror(w_opt); - u++; - if (!(u % 1000)) { - printf("%u\r", u); - fflush(stdout); - } - continue; - } - */ - extended_log_format(p, w_opt); - - - //printf("\n"); } clean_order(); return (0); } + From andersb at projects.linpro.no Wed Aug 2 22:53:56 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Thu, 3 Aug 2006 00:53:56 +0200 (CEST) Subject: r614 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060802225356.833961EC4C5@projects.linpro.no> Author: andersb Date: 2006-08-03 00:53:56 +0200 (Thu, 03 Aug 2006) New Revision: 614 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Added SessionReuse so I now write a logline for SessionClose and SessionReuse. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-02 22:33:31 UTC (rev 613) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-02 22:53:56 UTC (rev 614) @@ -106,6 +106,7 @@ j = strlen(p + 4) - strlen(tmpPtr); // length of IP strncpy(ll[u].df_h, p + 4, j); ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. + printf("New session [%d]: %s \n",u, ll[u].df_h); break; @@ -117,19 +118,19 @@ break; - case SLT_StatAddr: + case SLT_SessionClose: + printf("Session close [%d]: %s %s\n",u, ll[u].df_h, ll[u].df_U); + break; + case SLT_SessionReuse: + printf("Session reuse [%d]: %s %s\n",u, ll[u].df_h, ll[u].df_U); break; - - case SLT_SessionClose: - printf("Closing session [%d]: %s %s\n",u, ll[u].df_h, ll[u].df_U); - break; + default: + break; } - - if (0) { } From phk at projects.linpro.no Thu Aug 3 06:45:58 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 3 Aug 2006 08:45:58 +0200 (CEST) Subject: r615 - trunk/varnish-cache/bin/varnishd Message-ID: <20060803064558.E2EC21EC4D1@projects.linpro.no> Author: phk Date: 2006-08-03 08:45:58 +0200 (Thu, 03 Aug 2006) New Revision: 615 Added: trunk/varnish-cache/bin/varnishd/cache_cli.c Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_main.c trunk/varnish-cache/bin/varnishd/cli_event.h Log: Rework the cache process CLI handling: We are only accepting CLI from the pipes in heritage, so simply run a loop reading those, dispatching lines as we see them. Export CLI_cmds[] so that the management process can see it, we might as well take advantage of the shared binary where we can. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-02 22:53:56 UTC (rev 614) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-03 06:45:58 UTC (rev 615) @@ -18,6 +18,7 @@ cache_backend.c \ cache_ban.c \ cache_center.c \ + cache_cli.c \ cache_expire.c \ cache_fetch.c \ cache_hash.c \ Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-02 22:53:56 UTC (rev 614) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-03 06:45:58 UTC (rev 615) @@ -301,6 +301,9 @@ /* cache_center.c [CNT] */ void CNT_Session(struct sess *sp); +/* cache_cli.c [CLI] */ +void CLI_Init(void); + /* cache_expiry.c */ void EXP_Insert(struct object *o); void EXP_Init(void); Added: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-02 22:53:56 UTC (rev 614) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-03 06:45:58 UTC (rev 615) @@ -0,0 +1,130 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "event.h" /* XXX only as long as it takes */ + +#include "libvarnish.h" +#include "shmlog.h" +#include "cli.h" +#include "cli_priv.h" +#include "cli_event.h" +#include "cache.h" +#include "sbuf.h" +#include "heritage.h" + +/*--------------------------------------------------------------------*/ + +static void +cli_func_ping(struct cli *cli, char **av, void *priv) +{ + time_t t; + + (void)priv; +#if 0 + arm_keepalive(); +#endif + if (av[2] != NULL) { + /* XXX: check clock skew is pointless here */ + } + t = time(NULL); + cli_out(cli, "PONG %ld", t); +} + +/*--------------------------------------------------------------------*/ + +struct cli_proto CLI_cmds[] = { + { CLI_PING, cli_func_ping }, +#if 0 + { CLI_URL_QUERY, cli_func_url_query }, +#endif + { CLI_URL_PURGE, cli_func_url_purge }, + { CLI_CONFIG_LOAD, cli_func_config_load }, + { CLI_CONFIG_LIST, cli_func_config_list }, + { CLI_CONFIG_UNLOAD, cli_func_config_unload }, + { CLI_CONFIG_USE, cli_func_config_use }, + { NULL } +}; + +static int +cli_writes(const char *s, const char *r, const char *t) +{ + int i, l; + struct iovec iov[3]; + + iov[0].iov_base = (void*)(uintptr_t)s; + iov[1].iov_base = (void*)(uintptr_t)r; + iov[2].iov_base = (void*)(uintptr_t)t; + for (l = i = 0; i < 3; i++) { + iov[i].iov_len = strlen(iov[i].iov_base); + l += iov[i].iov_len; + } + i = writev(heritage.fds[1], iov, 3); + VSL(SLT_CLI, 0, "Wr %d %s %s", i != l, s, r); + return (i != l); +} + +void +CLI_Init(void) +{ + struct pollfd pfd[1]; + char *buf, *p; + unsigned nbuf, lbuf; + struct cli *cli, clis; + int i; + char res[30]; + + cli = &clis; + memset(cli, 0, sizeof *cli); + + cli->sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(cli->sb != NULL); + lbuf = 4096; + buf = malloc(lbuf); + assert(buf != NULL); + nbuf = 0; + while (1) { + pfd[0].fd = heritage.fds[2]; + pfd[0].events = POLLIN; + i = poll(pfd, 1, 5000); + if (i == 0) + continue; + if (nbuf == lbuf) { + lbuf += lbuf; + buf = realloc(buf, lbuf); + assert(buf != NULL); + } + i = read(heritage.fds[2], buf + nbuf, lbuf - nbuf); + if (i <= 0) { + VSL(SLT_Error, 0, "CLI read %d (errno=%d)", i, errno); + return; + } + nbuf += i; + p = strchr(buf, '\n'); + if (p == NULL) + continue; + *p = '\0'; + VSL(SLT_CLI, 0, "Rd %s", buf); + sbuf_clear(cli->sb); + cli_dispatch(cli, CLI_cmds, buf); + sbuf_finish(cli->sb); + sprintf(res, "%d ", cli->result); + if (cli_writes(res, sbuf_data(cli->sb), "\n")) { + VSL(SLT_Error, 0, "CLI write failed (errno=%d)", errno); + return; + } + i = ++p - buf; + assert(i <= nbuf); + if (i < nbuf) + memcpy(buf, p, nbuf - i); + nbuf -= i; + } +} Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-02 22:53:56 UTC (rev 614) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-03 06:45:58 UTC (rev 615) @@ -7,84 +7,14 @@ #include #include -#include -#include - #include "libvarnish.h" #include "heritage.h" #include "shmlog.h" #include "cache.h" #include "event.h" -#include "cli_event.h" -static struct event ev_keepalive; - struct stevedore *stevedore; -/*--------------------------------------------------------------------*/ - -static void -timer_keepalive(int a, short b, void *c) -{ - - printf("%s(%d, %d, %p)\n", (const char *)__func__, a, (int)b, c); - printf("Heeellloooo ? Ohh bother...\n"); - exit (1); -} - -static void -arm_keepalive(void) -{ - struct timeval tv; - - tv.tv_sec = 30; - tv.tv_usec = 0; - - AZ(evtimer_del(&ev_keepalive)); - AZ(evtimer_add(&ev_keepalive, &tv)); -} - -/*--------------------------------------------------------------------*/ - -static void -cli_func_url_query(struct cli *cli, char **av, void *priv) -{ - - (void)priv; - cli_out(cli, "url <%s>", av[2]); - cli_result(cli, CLIS_UNIMPL); -} - -/*--------------------------------------------------------------------*/ - -static void -cli_func_ping(struct cli *cli, char **av, void *priv) -{ - time_t t; - - (void)priv; - VSL(SLT_CLI, 0, av[1]); - arm_keepalive(); - if (av[2] != NULL) { - /* XXX: check clock skew is pointless here */ - } - t = time(NULL); - cli_out(cli, "PONG %ld\n", t); -} - -/*--------------------------------------------------------------------*/ - -static struct cli_proto cli_proto[] = { - { CLI_URL_QUERY, cli_func_url_query }, - { CLI_URL_PURGE, cli_func_url_purge }, - { CLI_CONFIG_LOAD, cli_func_config_load }, - { CLI_CONFIG_LIST, cli_func_config_list }, - { CLI_CONFIG_UNLOAD, cli_func_config_unload }, - { CLI_CONFIG_USE, cli_func_config_use }, - { CLI_PING, cli_func_ping }, - { NULL } -}; - /*-------------------------------------------------------------------- * XXX: Think more about which order we start things */ @@ -92,9 +22,6 @@ void child_main(void) { - struct event_base *eb; - struct cli *cli; - int i; /* XXX: SO_NOSIGPIPE does not work reliably :-( */ signal(SIGPIPE, SIG_IGN); @@ -118,25 +45,15 @@ HSH_Init(); BAN_Init(); - eb = event_init(); - assert(eb != NULL); - stevedore = heritage.stevedore; if (stevedore->open != NULL) stevedore->open(stevedore); - cli = cli_setup(eb, heritage.fds[2], heritage.fds[1], 0, cli_proto); - - evtimer_set(&ev_keepalive, timer_keepalive, NULL); - AZ(event_base_set(eb, &ev_keepalive)); - arm_keepalive(); - printf("Ready\n"); VSL_stats->start_time = time(NULL); - i = event_base_loop(eb, 0); - if (i != 0) - printf("event_dispatch() = %d\n", i); + CLI_Init(); + printf("Child dies\n"); } Modified: trunk/varnish-cache/bin/varnishd/cli_event.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cli_event.h 2006-08-02 22:53:56 UTC (rev 614) +++ trunk/varnish-cache/bin/varnishd/cli_event.h 2006-08-03 06:45:58 UTC (rev 615) @@ -15,3 +15,4 @@ void cli_suspend(struct cli *cli); void cli_resume(struct cli *cli); void cli_encode_string(struct evbuffer *buf, char *b); +extern struct cli_proto CLI_cmds[]; From phk at projects.linpro.no Thu Aug 3 09:45:14 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 3 Aug 2006 11:45:14 +0200 (CEST) Subject: r616 - trunk/varnish-cache/bin/varnishd Message-ID: <20060803094514.D19E71EC499@projects.linpro.no> Author: phk Date: 2006-08-03 11:45:14 +0200 (Thu, 03 Aug 2006) New Revision: 616 Added: trunk/varnish-cache/bin/varnishd/cli_common.c trunk/varnish-cache/bin/varnishd/common_cli.c trunk/varnish-cache/bin/varnishd/common_cli.h trunk/varnish-cache/bin/varnishd/mgt_cli.c Removed: trunk/varnish-cache/bin/varnishd/cli_event.c trunk/varnish-cache/bin/varnishd/cli_event.h Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_main.c trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: Rip out the old CLI handling and start over, more or less. Still bits missing. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-03 09:45:14 UTC (rev 616) @@ -1,6 +1,6 @@ # $Id$ -INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/contrib/libevent +INCLUDES = -I$(top_srcdir)/include bin_PROGRAMS = varnishd @@ -8,7 +8,7 @@ varnishd_SOURCES = \ cache.h \ - cli_event.h \ + common_cli.h \ hash_slinger.h \ heritage.h \ mgt.h \ @@ -33,10 +33,11 @@ cache_vrt.c \ cache_vrt_acl.c \ cache_vrt_re.c \ - cli_event.c \ + common_cli.c \ hash_simple_list.c \ hash_classic.c \ mgt_child.c \ + mgt_cli.c \ rfc2616.c \ shmlog.c \ storage_file.c \ @@ -51,6 +52,5 @@ $(top_builddir)/lib/libsbuf/libsbuf.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvcl/libvcl.la \ - $(top_builddir)/contrib/libevent/libevent.la \ -lpthread \ -lmd Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-03 09:45:14 UTC (rev 616) @@ -10,13 +10,11 @@ #include #include -#include "event.h" /* XXX only as long as it takes */ - #include "libvarnish.h" #include "shmlog.h" #include "cli.h" #include "cli_priv.h" -#include "cli_event.h" +#include "common_cli.h" #include "cache.h" #include "sbuf.h" #include "heritage.h" @@ -54,24 +52,6 @@ { NULL } }; -static int -cli_writes(const char *s, const char *r, const char *t) -{ - int i, l; - struct iovec iov[3]; - - iov[0].iov_base = (void*)(uintptr_t)s; - iov[1].iov_base = (void*)(uintptr_t)r; - iov[2].iov_base = (void*)(uintptr_t)t; - for (l = i = 0; i < 3; i++) { - iov[i].iov_len = strlen(iov[i].iov_base); - l += iov[i].iov_len; - } - i = writev(heritage.fds[1], iov, 3); - VSL(SLT_CLI, 0, "Wr %d %s %s", i != l, s, r); - return (i != l); -} - void CLI_Init(void) { @@ -80,7 +60,6 @@ unsigned nbuf, lbuf; struct cli *cli, clis; int i; - char res[30]; cli = &clis; memset(cli, 0, sizeof *cli); @@ -116,11 +95,13 @@ sbuf_clear(cli->sb); cli_dispatch(cli, CLI_cmds, buf); sbuf_finish(cli->sb); - sprintf(res, "%d ", cli->result); - if (cli_writes(res, sbuf_data(cli->sb), "\n")) { + i = cli_writeres(heritage.fds[2], cli); + if (i) { VSL(SLT_Error, 0, "CLI write failed (errno=%d)", errno); return; } + VSL(SLT_CLI, 0, "Wr %d %d %s", + i, cli->result, sbuf_data(cli->sb)); i = ++p - buf; assert(i <= nbuf); if (i < nbuf) Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-03 09:45:14 UTC (rev 616) @@ -11,7 +11,6 @@ #include "heritage.h" #include "shmlog.h" #include "cache.h" -#include "event.h" struct stevedore *stevedore; Copied: trunk/varnish-cache/bin/varnishd/cli_common.c (from rev 585, trunk/varnish-cache/bin/varnishd/cli_event.c) =================================================================== --- trunk/varnish-cache/bin/varnishd/cli_event.c 2006-08-01 12:38:26 UTC (rev 585) +++ trunk/varnish-cache/bin/varnishd/cli_common.c 2006-08-03 09:45:14 UTC (rev 616) @@ -0,0 +1,46 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "sbuf.h" + +#include +#include +#include + +void +cli_out(struct cli *cli, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + sbuf_vprintf(cli->sb, fmt, ap); + va_end(ap); +} + +void +cli_param(struct cli *cli) +{ + + cli->result = CLIS_PARAM; + cli_out(cli, "Parameter error, use \"help [command]\" for more info.\n"); +} + +void +cli_result(struct cli *cli, unsigned res) +{ + + cli->result = res; +} + Deleted: trunk/varnish-cache/bin/varnishd/cli_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cli_event.c 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/cli_event.c 2006-08-03 09:45:14 UTC (rev 616) @@ -1,172 +0,0 @@ -/* - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include -#include - -#include "heritage.h" -#include "cli_event.h" - -void -cli_encode_string(struct evbuffer *buf, char *b) -{ - char *p, *q; - - evbuffer_add_printf(buf, "\""); - for (p = q = b; *p != '\0'; p++) { - if ((*p != '"' && *p != '\\' && isgraph(*p)) || *p == ' ') - continue; - if (p != q) - evbuffer_add(buf, q, p - q); - if (*p == '\n') - evbuffer_add_printf(buf, "\\n"); - else - evbuffer_add_printf(buf, "\\x%02x", *p); - q = p + 1; - } - if (p != q) - evbuffer_add(buf, q, p - q); - evbuffer_add_printf(buf, "\""); -} - - -void -cli_out(struct cli *cli, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - sbuf_vprintf(cli->sb, fmt, ap); - va_end(ap); -} - -void -cli_param(struct cli *cli) -{ - - cli->result = CLIS_PARAM; - cli_out(cli, "Parameter error, use \"help [command]\" for more info.\n"); -} - -void -cli_result(struct cli *cli, unsigned res) -{ - - cli->result = res; -} - -static void -encode_output(struct cli *cli) -{ - - if (cli->verbose) { - if (cli->result != CLIS_OK) - evbuffer_add_printf(cli->bev1->output, "ERROR %d ", - cli->result); - evbuffer_add(cli->bev1->output, - sbuf_data(cli->sb), sbuf_len(cli->sb)); - if (cli->result == CLIS_OK) - evbuffer_add_printf(cli->bev1->output, "OK\n"); - return; - } - evbuffer_add_printf(cli->bev1->output, "%d ", cli->result); - cli_encode_string(cli->bev1->output, sbuf_data(cli->sb)); - evbuffer_add_printf(cli->bev1->output, "\n"); -} - -static void -rdcb(struct bufferevent *bev, void *arg) -{ - const char *p; - struct cli *cli = arg; - - p = evbuffer_readline(bev->input); - if (p == NULL) - return; - sbuf_clear(cli->sb); - cli_dispatch(cli, cli->cli_proto, p); - if (!cli->suspend) { - sbuf_finish(cli->sb); - /* XXX: syslog results ? */ - encode_output(cli); - AZ(bufferevent_enable(cli->bev1, EV_WRITE)); - } -} - -static void -wrcb(struct bufferevent *bev, void *arg) -{ - struct cli *cli = arg; - - (void)bev; - AZ(bufferevent_disable(cli->bev1, EV_WRITE)); -} - -static void -excb(struct bufferevent *bev, short what, void *arg) -{ - printf("%s(%p, %d, %p)\n", __func__, (void*)bev, (int)what, arg); -} - -struct cli * -cli_setup(struct event_base *eb, int fdr, int fdw, int ver, struct cli_proto *cli_proto) -{ - struct cli *cli; - - cli = calloc(sizeof *cli, 1); - assert(cli != NULL); - - cli->bev0 = bufferevent_new(fdr, rdcb, wrcb, excb, cli); - assert(cli->bev0 != NULL); - AZ(bufferevent_base_set(eb, cli->bev0)); - if (fdr == fdw) - cli->bev1 = cli->bev0; - else - cli->bev1 = bufferevent_new(fdw, rdcb, wrcb, excb, cli); - assert(cli->bev1 != NULL); - AZ(bufferevent_base_set(eb, cli->bev1)); - cli->sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(cli->sb != NULL); - - cli->verbose = ver; - cli->cli_proto = cli_proto; - - AZ(bufferevent_enable(cli->bev0, EV_READ)); - return (cli); -} - -void -cli_suspend(struct cli *cli) -{ - - cli->suspend = 1; - AZ(bufferevent_disable(cli->bev0, EV_READ)); -} - -void -cli_resume(struct cli *cli) -{ - sbuf_finish(cli->sb); - /* XXX: syslog results ? */ - encode_output(cli); - AZ(bufferevent_enable(cli->bev1, EV_WRITE)); - cli->suspend = 0; - AZ(bufferevent_enable(cli->bev0, EV_READ)); -} - Deleted: trunk/varnish-cache/bin/varnishd/cli_event.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cli_event.h 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/cli_event.h 2006-08-03 09:45:14 UTC (rev 616) @@ -1,18 +0,0 @@ -/* - * $Id$ - */ - -struct cli { - struct bufferevent *bev0, *bev1; - struct sbuf *sb; - unsigned verbose; - unsigned suspend; - enum cli_status_e result; - struct cli_proto *cli_proto; -}; - -struct cli *cli_setup(struct event_base *eb, int fdr, int fdw, int ver, struct cli_proto *cli_proto); -void cli_suspend(struct cli *cli); -void cli_resume(struct cli *cli); -void cli_encode_string(struct evbuffer *buf, char *b); -extern struct cli_proto CLI_cmds[]; Added: trunk/varnish-cache/bin/varnishd/common_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-03 09:45:14 UTC (rev 616) @@ -0,0 +1,67 @@ +/* + * $Id: cli_event.c 466 2006-07-12 23:30:49Z phk $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "sbuf.h" + +#include "cli.h" +#include "cli_priv.h" +#include "common_cli.h" +#include "libvarnish.h" + +void +cli_out(struct cli *cli, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + sbuf_vprintf(cli->sb, fmt, ap); + va_end(ap); +} + +void +cli_param(struct cli *cli) +{ + + cli->result = CLIS_PARAM; + cli_out(cli, "Parameter error, use \"help [command]\" for more info.\n"); +} + +void +cli_result(struct cli *cli, unsigned res) +{ + + cli->result = res; +} + +int +cli_writeres(int fd, struct cli *cli) +{ + int i, l; + struct iovec iov[3]; + char res[32]; + + sprintf(res, "%d %d\n", cli->result, sbuf_len(cli->sb)); + iov[0].iov_base = (void*)(uintptr_t)res; + iov[1].iov_base = (void*)(uintptr_t)sbuf_data(cli->sb); + iov[2].iov_base = (void*)(uintptr_t)"\n"; + for (l = i = 0; i < 3; i++) { + iov[i].iov_len = strlen(iov[i].iov_base); + l += iov[i].iov_len; + } + i = writev(fd, iov, 3); + return (i != l); +} Copied: trunk/varnish-cache/bin/varnishd/common_cli.h (from rev 615, trunk/varnish-cache/bin/varnishd/cli_event.h) =================================================================== --- trunk/varnish-cache/bin/varnishd/cli_event.h 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-03 09:45:14 UTC (rev 616) @@ -0,0 +1,16 @@ +/* + * $Id$ + */ + +struct cli { + struct sbuf *sb; + unsigned verbose; + unsigned suspend; + enum cli_status_e result; + struct cli_proto *cli_proto; +}; + +void cli_suspend(struct cli *cli); +void cli_resume(struct cli *cli); +int cli_writeres(int fd, struct cli *cli); +extern struct cli_proto CLI_cmds[]; Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-03 09:45:14 UTC (rev 616) @@ -4,15 +4,17 @@ #include "common.h" -extern struct event_base *mgt_eb; +/* mgt_child.c */ +void mgt_run(int dflag); +void mgt_start_child(void); +void mgt_stop_child(void); -void mgt_child_start(void); -void mgt_child_stop(void); -void mgt_child_kill(void); -void mgt_sigchld(int, short, void *); +/* mgt_cli.c */ -typedef void mgt_ccb_f(unsigned, const char *, void *); -void mgt_child_request(mgt_ccb_f *, void *, char **argv, const char *fmt, ...); +void mgt_cli_init(void); +void mgt_cli_setup(int fdi, int fdo, int verbose); +void mgt_cli_start_child(int fdi, int fdo); +void mgt_cli_stop_child(void); /* tcp.c */ int open_tcp(const char *port); Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-03 09:45:14 UTC (rev 616) @@ -4,214 +4,65 @@ * The mechanics of handling the child process */ -#include -#include -#include -#include -#include -#include +#include #include +#include #include -#include -#include - +#include +#include +#include +#include +#include +#include #include -#include "queue.h" -#include -#include +#include /* XXX */ -#include -#include - -#include "cli_event.h" /* for cli_encode_string */ +#include "libvarnish.h" #include "heritage.h" #include "mgt.h" +static pid_t child_pid = -1; +static int child_fds[2]; +static unsigned child_should_run; +static pthread_t child_listen_thread; +static pthread_t child_poker_thread; +static pthread_mutex_t child_mtx; +static pthread_cond_t child_cv; +static unsigned child_ticker; + /*--------------------------------------------------------------------*/ -static enum { - H_STOP = 0, - H_START -} desired; - -static pid_t child_pid; -static int child_fds[2]; - -static struct bufferevent *child_std; -static struct bufferevent *child_cli0, *child_cli1; - -static struct event ev_child_pingpong; - -struct creq { - TAILQ_ENTRY(creq) list; - char *req; - char **argv; - mgt_ccb_f *func; - void *priv; -}; - -static TAILQ_HEAD(,creq) creqhead = TAILQ_HEAD_INITIALIZER(creqhead); - -/*-------------------------------------------------------------------- - * Handle stdout+stderr from the child. - */ - -static void -std_rdcb(struct bufferevent *bev, void *arg) +static void * +child_listener(void *arg) { - const char *p; + FILE *f; + char buf[BUFSIZ]; (void)arg; - while (1) { - p = evbuffer_readline(bev->input); - if (p == NULL) - return; - printf("Child said <%s>\n", p); + f = fdopen(child_fds[0], "r"); + assert(f != NULL); + while (fgets(buf, sizeof buf, f)) { + printf("Child said: %s", buf); } + return (NULL); } -static void -std_wrcb(struct bufferevent *bev, void *arg) -{ - - printf("%s(%p, %p)\n", - (const char *)__func__, (void*)bev, arg); - exit (2); -} - -static void -std_excb(struct bufferevent *bev, short what, void *arg) -{ - - printf("%s(%p, %d, %p)\n", - (const char *)__func__, (void*)bev, what, arg); - exit (2); -} - -/*-------------------------------------------------------------------- - * Multiplex requests/answers to the child - */ - -static void -send_req(void) -{ - struct creq *cr; - int u; - - cr = TAILQ_FIRST(&creqhead); - if (cr == NULL) - return; - if (0) - printf("Send Request <%s>\n", cr->req); - evbuffer_add_printf(child_cli1->output, "%s", cr->req); - for (u = 0; cr->argv != NULL && cr->argv[u] != NULL; u++) { - evbuffer_add_printf(child_cli1->output, " "); - cli_encode_string(child_cli1->output, cr->argv[u]); - } - evbuffer_add_printf(child_cli1->output, "\n"); - AZ(bufferevent_enable(child_cli1, EV_WRITE)); -} - -void -mgt_child_request(mgt_ccb_f *func, void *priv, char **argv, const char *fmt, ...) -{ - struct creq *cr; - va_list ap; - int i; - - cr = calloc(sizeof *cr, 1); - assert(cr != NULL); - cr->func = func; - cr->priv = priv; - cr->argv = argv; - va_start(ap, fmt); - vasprintf(&cr->req, fmt, ap); - va_end(ap); - i = TAILQ_EMPTY(&creqhead); - TAILQ_INSERT_TAIL(&creqhead, cr, list); - if (i) - send_req(); -} - -static void -cli_rdcb(struct bufferevent *bev, void *arg) -{ - const char *p; - char **av; - struct creq *cr; - - (void)arg; - - p = evbuffer_readline(bev->input); - if (p == NULL) - return; - cr = TAILQ_FIRST(&creqhead); - assert(cr != NULL); - av = ParseArgv(p, 0); - if (av[0] != NULL) - cr->func(CLIS_SYNTAX, av[0], cr->priv); - else - cr->func(strtoul(av[1], NULL, 0), av[2], cr->priv); - FreeArgv(av); - TAILQ_REMOVE(&creqhead, cr, list); - free(cr->req); - free(cr); - send_req(); -} - -static void -cli_wrcb(struct bufferevent *bev, void *arg) -{ - - (void)bev; - (void)arg; -} - -static void -cli_excb(struct bufferevent *bev, short what, void *arg) -{ - - printf("%s(%p, %d, %p)\n", - (const char *)__func__, (void*)bev, what, arg); - exit (2); -} - /*--------------------------------------------------------------------*/ -static void -child_pingpong_ccb(unsigned u, const char *r, void *priv) +static void * +child_poker(void *arg) { - (void)u; - (void)r; - (void)priv; - /* XXX: reset keepalive timer */ -} - - -static void -child_pingpong(int a, short b, void *c) -{ - time_t t; - struct timeval tv; - - (void)a; - (void)b; - (void)c; - - t = time(NULL); - mgt_child_request(child_pingpong_ccb, NULL, NULL, "ping %ld", t); - if (1) { - tv.tv_sec = 10; - tv.tv_usec = 0; - AZ(evtimer_del(&ev_child_pingpong)); - AZ(evtimer_add(&ev_child_pingpong, &tv)); + (void)arg; + while (1) { + sleep (1); + /* CLI: ping/pong */ + child_ticker = 0; } } - /*--------------------------------------------------------------------*/ static void @@ -219,13 +70,14 @@ { int i; - assert(pipe(&heritage.fds[0]) == 0); - assert(pipe(&heritage.fds[2]) == 0); - assert(pipe(child_fds) == 0); + AZ(pipe(&heritage.fds[0])); + AZ(pipe(&heritage.fds[2])); + AZ(pipe(child_fds)); i = fork(); if (i < 0) errx(1, "Could not fork child"); if (i == 0) { + AZ(pthread_single_np()); /* Redirect stdin/out/err */ AZ(close(0)); i = open("/dev/null", O_RDONLY); @@ -243,99 +95,119 @@ exit (1); } - child_pid = i; printf("start child pid %d\n", i); AZ(close(child_fds[1])); AZ(close(heritage.fds[1])); AZ(close(heritage.fds[2])); + mgt_cli_start_child(heritage.fds[0], heritage.fds[3]); + child_pid = i; + AZ(pthread_create(&child_listen_thread, NULL, child_listener, NULL)); + AZ(pthread_create(&child_poker_thread, NULL, child_poker, NULL)); +} - child_std = bufferevent_new(child_fds[0], - std_rdcb, std_wrcb, std_excb, NULL); - assert(child_std != NULL); - AZ(bufferevent_base_set(mgt_eb, child_std)); - bufferevent_enable(child_std, EV_READ); +/*--------------------------------------------------------------------*/ - child_cli0 = bufferevent_new(heritage.fds[0], - cli_rdcb, cli_wrcb, cli_excb, NULL); - assert(child_cli0 != NULL); - AZ(bufferevent_base_set(mgt_eb, child_cli0)); - bufferevent_enable(child_cli0, EV_READ); +static void +stop_child(void) +{ - child_cli1 = bufferevent_new(heritage.fds[3], - cli_rdcb, cli_wrcb, cli_excb, NULL); - assert(child_cli1 != NULL); - AZ(bufferevent_base_set(mgt_eb, child_cli1)); - - evtimer_set(&ev_child_pingpong, child_pingpong, NULL); - AZ(event_base_set(mgt_eb, &ev_child_pingpong)); - child_pingpong(0, 0, NULL); + exit(2); + /* kill child, if relevant */ + /* join child_listen_thread */ + /* join child_poker_thread */ + /* close heritage.fds */ + /* close child_fds */ } - /*--------------------------------------------------------------------*/ -void -mgt_child_start(void) +static void +mgt_sigchld(int arg) { + int status; + pid_t r; - if (desired == H_START) - return; - desired = H_START; - start_child(); + (void)arg; + r = wait4(-1, &status, WNOHANG, NULL); + if (r == child_pid) { + printf("Cache child died pid=%d status=0x%x\n", + r, status); + child_pid = -1; + } else { + printf("Unknown child died pid=%d status=0x%x\n", + r, status); + } } -/*--------------------------------------------------------------------*/ +/*-------------------------------------------------------------------- + * This thread is the master thread in the management process. + * The relatively simple task is to start and stop the child process + * and to reincarnate it in case of trouble. + */ void -mgt_child_stop(void) +mgt_run(int dflag) { + struct timespec to; + struct sigaction sac; + int i, dstarts = 0; - if (desired == H_STOP) - return; - desired = H_STOP; +#if 1 + if (dflag) + mgt_cli_setup(0, 1, 1); +#else + dflag = 0; +#endif + + sac.sa_handler = mgt_sigchld; + sac.sa_flags = SA_NOCLDSTOP; + AZ(sigaction(SIGCHLD, &sac, NULL)); + child_should_run = !dflag; + + AZ(pthread_cond_init(&child_cv, NULL)); + AZ(pthread_mutex_init(&child_mtx, NULL)); + + while (1) { + if (!child_should_run && child_pid != -1) + stop_child(); + else if (child_should_run && child_pid == -1) { + if (dflag && dstarts) + exit(2); + start_child(); + dstarts = 1; + } + + /* XXX POSIXBRAINDAMAGE */ + AZ(clock_gettime(CLOCK_REALTIME, &to)); + to.tv_sec += 1; + + AZ(pthread_mutex_lock(&child_mtx)); + i = pthread_cond_timedwait(&child_cv, &child_mtx, &to); + AZ(pthread_mutex_unlock(&child_mtx)); + if (i == ETIMEDOUT && ++child_ticker > 5 && child_pid != -1) { + stop_child(); + if (dflag) + exit (2); + } + } } /*--------------------------------------------------------------------*/ void -mgt_child_kill(void) +mgt_start_child(void) { - desired = H_STOP; - kill(child_pid, 9); + child_should_run = 1; + AZ(pthread_cond_signal(&child_cv)); } -/*--------------------------------------------------------------------*/ - void -mgt_sigchld(int a, short b, void *c) +mgt_stop_child(void) { - pid_t p; - int status; - printf("sig_chld(%d, %d, %p)\n", a, b, c); - - p = wait4(-1, &status, WNOHANG, NULL); - if (p == 0) - return; - printf("pid = %d status = 0x%x\n", p, status); - assert(p == child_pid); - - printf("Child died :-(\n"); - exit (0); - - bufferevent_free(child_std); /* XXX: is this enough ? */ - child_std = NULL; - - AZ(close(heritage.fds[0])); - AZ(close(heritage.fds[1])); - AZ(close(heritage.fds[2])); - AZ(close(heritage.fds[3])); - AZ(close(child_fds[0])); - AZ(close(child_fds[1])); - - if (desired == H_START) - start_child(); + child_should_run = 0; + AZ(pthread_cond_signal(&child_cv)); } Added: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-03 09:45:14 UTC (rev 616) @@ -0,0 +1,508 @@ +/* + * $Id$ + * + * The management process' CLI handling + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "libvarnish.h" +#include "cli_priv.h" +#include "cli.h" +#include "sbuf.h" +#include "common_cli.h" +#include "mgt.h" + +static int cli_i = -1, cli_o = -1; + +/*--------------------------------------------------------------------*/ + +static void +mcf_server_start(struct cli *cli) +{ + + (void)cli; + mgt_start_child(); +} + + +/*--------------------------------------------------------------------*/ + +static struct cli_proto *cli_proto; + +static struct cli_proto mgt_cli_proto[] = { + { CLI_HELP, cli_func_help, NULL }, /* must be first */ + { CLI_SERVER_START, mcf_server_start, NULL }, + { CLI_CONFIG_LOAD }, +#if 0 + { CLI_CONFIG_LOAD, m_cli_func_config_load, NULL }, + { CLI_CONFIG_INLINE, m_cli_func_config_inline, NULL }, + { CLI_SERVER_STOP, m_cli_func_server_stop, NULL }, + { CLI_SERVER_RESTART }, + { CLI_PING, m_cli_func_ping, NULL }, + { CLI_STATS, m_cli_func_stats, NULL }, + { CLI_ZERO }, + { CLI_VERBOSE, m_cli_func_verbose, NULL }, + { CLI_EXIT, m_cli_func_exit, NULL}, +#endif + { CLI_QUIT }, + { CLI_BYE }, + { NULL } +}; + + +/*--------------------------------------------------------------------*/ + +void +mgt_cli_init(void) +{ + struct cli_proto *cp; + unsigned u, v; + + + /* + * Build the joint cli_proto by combining the manager process + * entries with with the cache process entries. The latter + * get a "passthough" function in the joint list + */ + u = 0; + for (cp = mgt_cli_proto; cp->request != NULL; cp++) + u++; + for (cp = CLI_cmds; cp->request != NULL; cp++) + u++; + cli_proto = calloc(sizeof *cli_proto, u + 1); + assert(cli_proto != NULL); + u = 0; + for (cp = mgt_cli_proto; cp->request != NULL; cp++) + cli_proto[u++] = *cp; + for (cp = CLI_cmds; cp->request != NULL; cp++) { + /* Skip any cache commands we already have in the manager */ + for (v = 0; v < u; v++) + if (!strcmp(cli_proto[v].request, cp->request)) + break; + if (v < u) + continue; + cli_proto[u] = *cp; + cli_proto[u].func = NULL; /* XXX: pass */ + u++; + } + + /* Fixup the entry for 'help' entry */ + assert(!strcmp(cli_proto[0].request, "help")); + cli_proto[0].priv = cli_proto; + + /* XXX: open listening sockets, contact cluster server etc */ +} + +/*--------------------------------------------------------------------*/ + +void +mgt_cli_start_child(int fdi, int fdo) +{ + + cli_i = fdi; + cli_o = fdo; +} + +/*--------------------------------------------------------------------*/ + +void +mgt_cli_stop_child(void) +{ + + cli_i = -1; + cli_o = -1; + /* XXX: kick any users */ +} + +/*--------------------------------------------------------------------*/ + +struct cli_port { + int fdi; + int fdo; + int verbose; + char *buf; + unsigned nbuf; + unsigned lbuf; + struct cli cli[1]; +}; + +static void * +mgt_cli_main(void *arg) +{ + struct cli_port *cp; + char *p; + int i; + + assert(arg != NULL); + cp = arg; + + cp->lbuf = 4096; + cp->buf = malloc(cp->lbuf); + assert(cp->buf != NULL); + cp->cli->sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(cp->cli->sb != NULL); + while (1) { + if (cp->nbuf == cp->lbuf) { + cp->lbuf += cp->lbuf; + cp->buf = realloc(cp->buf, cp->lbuf); + assert(cp->buf != NULL); + } + i = read(cp->fdi, cp->buf + cp->nbuf, cp->lbuf - cp->nbuf); + if (i <= 0) + break; + cp->nbuf += i; + p = strchr(cp->buf, '\n'); + if (p == NULL) + continue; + *p = '\0'; + sbuf_clear(cp->cli->sb); + cli_dispatch(cp->cli, cli_proto, cp->buf); + sbuf_finish(cp->cli->sb); + /* XXX: cp->verbose */ + if (cli_writeres(cp->fdo, cp->cli)) + break; + i = ++p - cp->buf; + assert(i <= cp->nbuf); + if (i < cp->nbuf) + memcpy(cp->buf, p, cp->nbuf - i); + cp->nbuf -= i; + } + sbuf_delete(cp->cli->sb); + free(cp->buf); + close(cp->fdi); + close(cp->fdo); + free(cp); + return (NULL); +} + +void +mgt_cli_setup(int fdi, int fdo, int verbose) +{ + struct cli_port *cp; + pthread_t tp; + + cp = calloc(sizeof *cp, 1); + assert(cp != NULL); + + cp->fdi = fdi; + cp->fdo = fdo; + cp->verbose = verbose; + AZ(pthread_create(&tp, NULL, mgt_cli_main, cp)); + AZ(pthread_detach(tp)); +} + +#if 0 + +/*-------------------------------------------------------------------- + * Generic passthrough for CLI functions + */ + +static void +cli_passthrough_cb(unsigned u, const char *r, void *priv) +{ + struct cli *cli = priv; + + cli_out(cli, "%s\n", r); + cli_result(cli, u); + cli_resume(cli); +} + +static void +m_cli_func_passthrough(struct cli *cli, char **av, void *priv) +{ + + (void)av; + (void)priv; + + cli_suspend(cli); + mgt_child_request(cli_passthrough_cb, cli, &av[2], av[1]); +} + +static void +m_cli_func_config_inline(struct cli *cli, char **av, void *priv) +{ + char *vf; + struct sbuf *sb; + + (void)priv; + + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(sb != NULL); + vf = VCC_Compile(sb, av[3], NULL); + sbuf_finish(sb); + if (sbuf_len(sb) > 0) { + cli_out(cli, "%s", sbuf_data(sb)); + sbuf_delete(sb); + return; + } + sbuf_delete(sb); + cli_suspend(cli); + mgt_child_request(cli_passthrough_cb, cli, NULL, + "config.load %s %s", av[2], vf); +} + +/* XXX: m prefix to avoid name clash */ +static void +m_cli_func_config_load(struct cli *cli, char **av, void *priv) +{ + char *vf; + struct sbuf *sb; + + (void)priv; + + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(sb != NULL); + vf = VCC_CompileFile(sb, av[3]); + sbuf_finish(sb); + if (sbuf_len(sb) > 0) { + cli_out(cli, "%s", sbuf_data(sb)); + sbuf_delete(sb); + return; + } + sbuf_delete(sb); + cli_suspend(cli); + mgt_child_request(cli_passthrough_cb, cli, NULL, + "config.load %s %s", av[2], vf); +} + +static char * +vcl_file(const char *fflag) +{ + char *vf; + struct sbuf *sb; + + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(sb != NULL); + vf = VCC_CompileFile(sb, fflag); + sbuf_finish(sb); + if (sbuf_len(sb) > 0) { + fprintf(stderr, "%s", sbuf_data(sb)); + sbuf_delete(sb); + return (NULL); + } + sbuf_delete(sb); + return (vf); +} + + +/*--------------------------------------------------------------------*/ + +static void +m_cli_func_server_start(struct cli *cli, char **av, void *priv) +{ + + (void)cli; + (void)av; + (void)priv; + + mgt_child_start(); +} + +/*--------------------------------------------------------------------*/ + +static void +m_cli_func_server_stop(struct cli *cli, char **av, void *priv) +{ + + (void)cli; + (void)av; + (void)priv; + + mgt_child_stop(); +} + +/*--------------------------------------------------------------------*/ + +static void +m_cli_func_exit(struct cli *cli, char **av, void *priv) +{ + + (void)cli; + (void)av; + (void)priv; + mgt_child_kill(); + exit (0); +} + +/*--------------------------------------------------------------------*/ + +static void +m_cli_func_verbose(struct cli *cli, char **av, void *priv) +{ + + (void)av; + (void)priv; + + cli->verbose = !cli->verbose; +} + + +static void +m_cli_func_ping(struct cli *cli, char **av, void *priv) +{ + time_t t; + + (void)priv; + + if (av[2] != NULL) { + cli_out(cli, "Got your %s\n", av[2]); + } + t = time(NULL); + cli_out(cli, "PONG %ld\n", t); +} + +/*--------------------------------------------------------------------*/ + +static void +m_cli_func_stats(struct cli *cli, char **av, void *priv) +{ + + (void)av; + (void)priv; + + assert (VSL_stats != NULL); +#define MAC_STAT(n,t,f,d) \ + cli_out(cli, "%12ju " d "\n", (VSL_stats->n)); +#include "stat_field.h" +#undef MAC_STAT +} + +/*--------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------*/ + +/* for development purposes */ +#include + +int +main(int argc, char *argv[]) +{ + int o; + const char *portnumber = "8080"; + unsigned dflag = 0; + const char *bflag = NULL; + const char *fflag = NULL; + const char *sflag = "file"; + const char *hflag = "classic"; + + (void)register_printf_render_std((const unsigned char *)"HVQ"); + + setbuf(stdout, NULL); + setbuf(stderr, NULL); + + VCC_InitCompile(default_vcl); + + heritage.default_ttl = 120; + heritage.wthread_min = 1; + heritage.wthread_max = UINT_MAX; + heritage.wthread_timeout = 10; + heritage.mem_workspace = 4096; + + while ((o = getopt(argc, argv, "b:df:h:p:s:t:w:")) != -1) + switch (o) { + case 'b': + bflag = optarg; + break; + case 'd': + dflag++; + break; + case 'f': + fflag = optarg; + break; + case 'h': + hflag = optarg; + break; + case 'p': + portnumber = optarg; + break; + case 's': + sflag = optarg; + break; + case 't': + heritage.default_ttl = strtoul(optarg, NULL, 0); + break; + case 'w': + tackle_warg(optarg); + break; + default: + usage(); + } + + argc -= optind; + argv += optind; + + if (argc != 0) { + fprintf(stderr, "Too many arguments\n"); + usage(); + } + + if (bflag != NULL && fflag != NULL) { + fprintf(stderr, "Only one of -b or -f can be specified\n"); + usage(); + } + if (bflag == NULL && fflag == NULL) { + fprintf(stderr, "One of -b or -f must be specified\n"); + usage(); + } + + if (bflag != NULL) + heritage.vcl_file = vcl_default(bflag); + else + heritage.vcl_file = vcl_file(fflag); + if (heritage.vcl_file == NULL) + exit (1); + + setup_storage(sflag); + setup_hash(hflag); + + /* + * XXX: Lacking the suspend/resume facility (due to the socket API + * missing an unlisten(2) facility) we may want to push this into + * the child to limit the amount of time where the socket(s) exists + * but do not answer. That, on the other hand, would eliminate the + * possibility of doing a "no-glitch" restart of the child process. + */ + open_tcp(portnumber); + + VSL_MgtInit(SHMLOG_FILENAME, 8*1024*1024); + + if (dflag) + DebugStunt(); + daemon(dflag, dflag); + if (dflag) + printf("%d\n%d\n%d\n", getpid(), getsid(0), getpgrp()); + + { + struct event e_sigchld; + struct cli *cli; + int i; + + mgt_eb = event_init(); + assert(mgt_eb != NULL); + + if (dflag) + cli = cli_setup(mgt_eb, 0, 1, 1, cli_proto); + + signal_set(&e_sigchld, SIGCHLD, mgt_sigchld, NULL); + AZ(event_base_set(mgt_eb, &e_sigchld)); + AZ(signal_add(&e_sigchld, NULL)); + + mgt_child_start(); + + i = event_base_loop(mgt_eb, 0); + if (i != 0) + printf("event_dispatch() = %d\n", i); + + } + + exit(0); +} +#endif Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-03 06:45:58 UTC (rev 615) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-03 09:45:14 UTC (rev 616) @@ -17,20 +17,17 @@ #include #include -#include - -#include "event.h" #include "sbuf.h" -#include -#include -#include -#include +#include "libvarnish.h" +#include "libvcl.h" +#include "cli.h" +#include "cli_priv.h" +#include "common_cli.h" #include "mgt.h" #include "heritage.h" #include "shmlog.h" -#include "cli_event.h" /*--------------------------------------------------------------------*/ @@ -75,8 +72,8 @@ /*--------------------------------------------------------------------*/ struct heritage heritage; -struct event_base *mgt_eb; +#if 0 /*-------------------------------------------------------------------- * Generic passthrough for CLI functions */ @@ -101,6 +98,7 @@ cli_suspend(cli); mgt_child_request(cli_passthrough_cb, cli, &av[2], av[1]); } +#endif /*--------------------------------------------------------------------*/ @@ -149,7 +147,7 @@ free(buf); return (vf); } - +#if 0 static void m_cli_func_config_inline(struct cli *cli, char **av, void *priv) { @@ -196,6 +194,7 @@ mgt_child_request(cli_passthrough_cb, cli, NULL, "config.load %s %s", av[2], vf); } +#endif static char * vcl_file(const char *fflag) @@ -216,6 +215,7 @@ return (vf); } +#if 0 /*--------------------------------------------------------------------*/ @@ -329,6 +329,7 @@ { NULL } }; +#endif /*--------------------------------------------------------------------*/ @@ -585,6 +586,7 @@ /*--------------------------------------------------------------------*/ + /* for development purposes */ #include @@ -686,28 +688,9 @@ if (dflag) printf("%d\n%d\n%d\n", getpid(), getsid(0), getpgrp()); - { - struct event e_sigchld; - struct cli *cli; - int i; + mgt_cli_init(); - mgt_eb = event_init(); - assert(mgt_eb != NULL); + mgt_run(dflag); - if (dflag) - cli = cli_setup(mgt_eb, 0, 1, 1, cli_proto); - - signal_set(&e_sigchld, SIGCHLD, mgt_sigchld, NULL); - AZ(event_base_set(mgt_eb, &e_sigchld)); - AZ(signal_add(&e_sigchld, NULL)); - - mgt_child_start(); - - i = event_base_loop(mgt_eb, 0); - if (i != 0) - printf("event_dispatch() = %d\n", i); - - } - exit(0); } From phk at projects.linpro.no Thu Aug 3 09:45:36 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 3 Aug 2006 11:45:36 +0200 (CEST) Subject: r617 - in trunk/varnish-cache: . bin/varnishtester Message-ID: <20060803094536.2A0DD1EC499@projects.linpro.no> Author: phk Date: 2006-08-03 11:45:36 +0200 (Thu, 03 Aug 2006) New Revision: 617 Modified: trunk/varnish-cache/Makefile.am trunk/varnish-cache/autogen.sh trunk/varnish-cache/bin/varnishtester/Makefile.am Log: Remove libevent from the picture. Modified: trunk/varnish-cache/Makefile.am =================================================================== --- trunk/varnish-cache/Makefile.am 2006-08-03 09:45:14 UTC (rev 616) +++ trunk/varnish-cache/Makefile.am 2006-08-03 09:45:36 UTC (rev 617) @@ -1,3 +1,3 @@ # $Id$ -SUBDIRS = contrib include lib bin +SUBDIRS = include lib bin Modified: trunk/varnish-cache/autogen.sh =================================================================== --- trunk/varnish-cache/autogen.sh 2006-08-03 09:45:14 UTC (rev 616) +++ trunk/varnish-cache/autogen.sh 2006-08-03 09:45:36 UTC (rev 617) @@ -11,7 +11,7 @@ fi base=$(cd $(dirname $0) && pwd) -for dir in $base $base/contrib/libevent ; do +for dir in $base ; do ( echo $dir cd $dir Modified: trunk/varnish-cache/bin/varnishtester/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishtester/Makefile.am 2006-08-03 09:45:14 UTC (rev 616) +++ trunk/varnish-cache/bin/varnishtester/Makefile.am 2006-08-03 09:45:36 UTC (rev 617) @@ -1,6 +1,6 @@ # $Id: Makefile.am 426 2006-07-11 12:31:44Z phk $ -INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/contrib/libevent +INCLUDES = -I$(top_srcdir)/include bin_PROGRAMS = varnishtester @@ -12,5 +12,4 @@ # varnishd_LDFLAGS = -export-dynamic varnishtester_LDADD = \ - $(top_builddir)/lib/libvarnish/libvarnish.la \ - $(top_builddir)/contrib/libevent/libevent.la + $(top_builddir)/lib/libvarnish/libvarnish.la From andersb at projects.linpro.no Thu Aug 3 10:16:21 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Thu, 3 Aug 2006 12:16:21 +0200 (CEST) Subject: r618 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060803101621.0A7F21EC499@projects.linpro.no> Author: andersb Date: 2006-08-03 12:16:20 +0200 (Thu, 03 Aug 2006) New Revision: 618 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Think I have found a program structure that works. Filling in bits to build logline. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-03 09:45:36 UTC (rev 617) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-03 10:16:20 UTC (rev 618) @@ -34,14 +34,14 @@ struct logline { char df_h[4 * (3 + 1)]; // Datafield for %h (IP adress) - // // int y; - // // unsigned char *df_l; // Datafield for %l - // // unsigned char *df_u; // Datafield for %u - // // unsigned char *df_t; // Datafield for %t - // // unsigned char *df_r; // Datafield for %r - // // unsigned char *df_s; // Datafield for %s - // // unsigned char *df_b; // Datafield for %b - // // unsigned char *df_R; // Datafield for %{Referer}i + // int y; + // unsigned char *df_l; // Datafield for %l + // unsigned char *df_u; // Datafield for %u + // unsigned char *df_t; // Datafield for %t + unsigned char *df_r; // Datafield for %r + // unsigned char *df_s; // Datafield for %s + // unsigned char *df_b; // Datafield for %b + // unsigned char *df_R; // Datafield for %{Referer}i unsigned char *df_U; // Datafield for %{User-agent}i }; @@ -99,6 +99,9 @@ } switch (p[0]) { + // XXX remember to check for NULL when strdup, if no allocate + // XXX also remember to free() after strdup? + case SLT_SessionOpen: // Finding the IP adress when data is: "XXX.XXX.XXX.XXX somenumber" @@ -110,6 +113,41 @@ break; + case SLT_RxRequest: + // XXX: Remember to support more than GET, HEAD and POST. + // http://rfc.net/rfc2616.html#p51 + + if (p[1] >= 4 && !strncasecmp((void *)&p[4], "HEAD",11)){ + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + //printf("Got a HEAD\n"); + } + + if (p[1] >= 4 && !strncasecmp((void *)&p[4], "POST",11)){ + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + //printf("Got a POST\n"); + } + + if (p[1] >= 3 && !strncasecmp((void *)&p[4], "GET",11)){ + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + //printf("Got a GET\n"); + } + + break; + + case SLT_RxURL: + + sbuf_cat(ob[u], " "); + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + + break; + + case SLT_RxProtocol: + + sbuf_cat(ob[u], " "); + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + + break; + case SLT_RxHeader: if (p[1] >= 11 && !strncasecmp((void *)&p[4], "user-agent:",11)){ @@ -119,11 +157,23 @@ break; case SLT_SessionClose: - printf("Session close [%d]: %s %s\n",u, ll[u].df_h, ll[u].df_U); + + printf("Session close [%d]: %s ",u, ll[u].df_h); + sbuf_finish(ob[u]); + printf("\"%s\"", sbuf_data(ob[u])); + printf(" \"%s\"\n", ll[u].df_U); + sbuf_clear(ob[u]); + break; case SLT_SessionReuse: - printf("Session reuse [%d]: %s %s\n",u, ll[u].df_h, ll[u].df_U); + + printf("Session reuse [%d]: %s ",u, ll[u].df_h); + sbuf_finish(ob[u]); + printf("\"%s\"", sbuf_data(ob[u])); + printf(" \"%s\"\n", ll[u].df_U); + sbuf_clear(ob[u]); + break; default: From phk at projects.linpro.no Thu Aug 3 10:37:01 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 3 Aug 2006 12:37:01 +0200 (CEST) Subject: r619 - trunk/varnish-cache/bin/varnishd Message-ID: <20060803103701.872331EC4D4@projects.linpro.no> Author: phk Date: 2006-08-03 12:37:01 +0200 (Thu, 03 Aug 2006) New Revision: 619 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: Add stop command as well. Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-03 10:16:20 UTC (rev 618) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-03 10:37:01 UTC (rev 619) @@ -24,21 +24,25 @@ /*--------------------------------------------------------------------*/ static void -mcf_server_start(struct cli *cli) +mcf_server_startstop(struct cli *cli, char **av, void *priv) { (void)cli; - mgt_start_child(); + (void)av; + if (priv != NULL) + mgt_stop_child(); + else + mgt_start_child(); } - /*--------------------------------------------------------------------*/ static struct cli_proto *cli_proto; static struct cli_proto mgt_cli_proto[] = { { CLI_HELP, cli_func_help, NULL }, /* must be first */ - { CLI_SERVER_START, mcf_server_start, NULL }, + { CLI_SERVER_START, mcf_server_startstop, NULL }, + { CLI_SERVER_STOP, mcf_server_startstop, &cli_proto }, { CLI_CONFIG_LOAD }, #if 0 { CLI_CONFIG_LOAD, m_cli_func_config_load, NULL }, From phk at projects.linpro.no Thu Aug 3 10:37:22 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 3 Aug 2006 12:37:22 +0200 (CEST) Subject: r620 - trunk/varnish-cache/bin Message-ID: <20060803103722.647091EC4E3@projects.linpro.no> Author: phk Date: 2006-08-03 12:37:22 +0200 (Thu, 03 Aug 2006) New Revision: 620 Modified: trunk/varnish-cache/bin/Makefile.am Log: Take varnishtester out of the loop until it can be de-libevented Modified: trunk/varnish-cache/bin/Makefile.am =================================================================== --- trunk/varnish-cache/bin/Makefile.am 2006-08-03 10:37:01 UTC (rev 619) +++ trunk/varnish-cache/bin/Makefile.am 2006-08-03 10:37:22 UTC (rev 620) @@ -1,3 +1,6 @@ # $Id$ -SUBDIRS = varnishd varnishlog varnishncsa varnishstat varnishtester varnishtop +SUBDIRS = varnishd varnishlog varnishncsa varnishstat varnishtop + +# Awaiting dis-libeventing +# SUBDIRS += varnistester From phk at projects.linpro.no Thu Aug 3 11:45:23 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 3 Aug 2006 13:45:23 +0200 (CEST) Subject: r621 - trunk/varnish-cache/bin/varnishd Message-ID: <20060803114523.C12E31EC4E2@projects.linpro.no> Author: phk Date: 2006-08-03 13:45:23 +0200 (Thu, 03 Aug 2006) New Revision: 621 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: Make the pipe-stunt debug process smarter. Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-03 10:37:22 UTC (rev 620) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-03 11:45:23 UTC (rev 621) @@ -556,6 +556,7 @@ pfd[1].fd = pipes[1][0]; pfd[1].events = POLLIN; + signal(SIGPIPE, SIG_IGN); signal(SIGINT, DebugSigPass); i = read(pipes[1][0], buf, sizeof buf - 1); buf[i] = '\0'; @@ -569,15 +570,17 @@ while (1) { i = poll(pfd, 2, INFTIM); for (k = 0; k < 2; k++) { - if (pfd[k].revents) { - j = read(pipes[k][0], buf, sizeof buf); - if (j == 0) - exit (0); - if (j > 0) { - i = write(pipes[k][1], buf, j); - if (i != j) - err(1, "i = %d j = %d\n", i, j); - } + if (pfd[k].revents == 0) + continue; + if (pfd[k].revents != POLLIN) + exit (2); + j = read(pipes[k][0], buf, sizeof buf); + if (j == 0) + exit (0); + if (j > 0) { + i = write(pipes[k][1], buf, j); + if (i != j) + err(1, "i = %d j = %d\n", i, j); } } } From phk at projects.linpro.no Thu Aug 3 11:46:52 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 3 Aug 2006 13:46:52 +0200 (CEST) Subject: r622 - trunk/varnish-cache/bin/varnishd Message-ID: <20060803114652.C881B1EC4E3@projects.linpro.no> Author: phk Date: 2006-08-03 13:46:52 +0200 (Thu, 03 Aug 2006) New Revision: 622 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c Log: Imlement stopping and restarting of child process. Not as useful as it will be yet, see ticket 22 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-03 11:45:23 UTC (rev 621) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-03 11:46:52 UTC (rev 622) @@ -23,6 +23,7 @@ #include "mgt.h" static pid_t child_pid = -1; +static pid_t mgr_pid; static int child_fds[2]; static unsigned child_should_run; static pthread_t child_listen_thread; @@ -30,20 +31,24 @@ static pthread_mutex_t child_mtx; static pthread_cond_t child_cv; static unsigned child_ticker; +static unsigned gotint; +static unsigned dstarts; /*--------------------------------------------------------------------*/ static void * child_listener(void *arg) { - FILE *f; + int i; char buf[BUFSIZ]; (void)arg; - f = fdopen(child_fds[0], "r"); - assert(f != NULL); - while (fgets(buf, sizeof buf, f)) { + while (1) { + i = read(child_fds[0], buf, sizeof buf - 1); + if (i <= 0) + break; + buf[i] = '\0'; printf("Child said: %s", buf); } return (NULL); @@ -77,7 +82,6 @@ if (i < 0) errx(1, "Could not fork child"); if (i == 0) { - AZ(pthread_single_np()); /* Redirect stdin/out/err */ AZ(close(0)); i = open("/dev/null", O_RDONLY); @@ -90,6 +94,7 @@ AZ(close(heritage.fds[0])); AZ(close(heritage.fds[3])); + setproctitle("Varnish-Chld"); child_main(); exit (1); @@ -98,13 +103,18 @@ printf("start child pid %d\n", i); AZ(close(child_fds[1])); + child_fds[1] = -1; + mgt_cli_start_child(heritage.fds[0], heritage.fds[3]); AZ(close(heritage.fds[1])); + heritage.fds[1] = -1; AZ(close(heritage.fds[2])); - mgt_cli_start_child(heritage.fds[0], heritage.fds[3]); + heritage.fds[2] = -1; child_pid = i; AZ(pthread_create(&child_listen_thread, NULL, child_listener, NULL)); + AZ(pthread_detach(child_listen_thread)); AZ(pthread_create(&child_poker_thread, NULL, child_poker, NULL)); + AZ(pthread_detach(child_poker_thread)); } /*--------------------------------------------------------------------*/ @@ -112,13 +122,45 @@ static void stop_child(void) { + int i; - exit(2); - /* kill child, if relevant */ - /* join child_listen_thread */ - /* join child_poker_thread */ - /* close heritage.fds */ - /* close child_fds */ + assert(child_pid != -1); + + printf("Stop child\n"); + AZ(pthread_cancel(child_poker_thread)); + mgt_cli_stop_child(); + + /* We tell the child to die gracefully by closing the CLI */ + AZ(close(heritage.fds[0])); + heritage.fds[0] = -1; + AZ(close(heritage.fds[3])); + heritage.fds[3] = -1; + + /* + * Give it one second to die, then wack it hard + * then another second and then we get real angry + */ + for (i = 0; i < 30; i++) { + printf("Waiting %d %d\n",i, child_pid); + if (child_pid == -2) + break; + if (i == 10) { + printf("Giving cacher SIGINT\n"); + kill(child_pid, SIGINT); + } + if (i == 20) { + printf("Giving cacher SIGKILL\n"); + kill(child_pid, SIGKILL); + } + usleep(100000); + } + + assert(child_pid == -2); + + AZ(close(child_fds[0])); + child_fds[0] = -1; + child_pid = -1; + printf("Child stopped\n"); } /*--------------------------------------------------------------------*/ @@ -134,13 +176,29 @@ if (r == child_pid) { printf("Cache child died pid=%d status=0x%x\n", r, status); - child_pid = -1; + child_pid = -2; } else { printf("Unknown child died pid=%d status=0x%x\n", r, status); } } +/*--------------------------------------------------------------------*/ + +static void +mgt_sigint(int arg) +{ + + (void)arg; + if (getpid() != mgr_pid) { + printf("Got SIGINT\n"); + exit (2); + } + printf("Manager got SIGINT\n"); + gotint = 1; + child_should_run = 0; +} + /*-------------------------------------------------------------------- * This thread is the master thread in the management process. * The relatively simple task is to start and stop the child process @@ -152,29 +210,49 @@ { struct timespec to; struct sigaction sac; - int i, dstarts = 0; + int i; -#if 1 + mgr_pid = getpid(); + if (dflag) mgt_cli_setup(0, 1, 1); -#else - dflag = 0; -#endif sac.sa_handler = mgt_sigchld; - sac.sa_flags = SA_NOCLDSTOP; + sac.sa_flags = SA_RESTART | SA_NOCLDSTOP; AZ(sigaction(SIGCHLD, &sac, NULL)); + + sac.sa_handler = mgt_sigint; + sac.sa_flags = SA_RESTART; + AZ(sigaction(SIGINT, &sac, NULL)); + AZ(sigaction(SIGTERM, &sac, NULL)); + + setproctitle("Varnish-Mgr"); + + sac.sa_handler = SIG_IGN; + sac.sa_flags = SA_RESTART; + AZ(sigaction(SIGPIPE, &sac, NULL)); + AZ(sigaction(SIGHUP, &sac, NULL)); + child_should_run = !dflag; AZ(pthread_cond_init(&child_cv, NULL)); AZ(pthread_mutex_init(&child_mtx, NULL)); while (1) { + if (child_should_run && child_pid == -2) + stop_child(); if (!child_should_run && child_pid != -1) stop_child(); - else if (child_should_run && child_pid == -1) { - if (dflag && dstarts) + if (gotint) { + printf("Manager died due to sigint\n"); + exit(2); + } + if (child_should_run && child_pid == -1) { + if (dflag && dstarts) { + printf( + "Manager not autostarting in debug mode\n"); exit(2); + } start_child(); dstarts = 1; } @@ -200,6 +278,7 @@ mgt_start_child(void) { + dstarts = 0; child_should_run = 1; AZ(pthread_cond_signal(&child_cv)); } From phk at projects.linpro.no Thu Aug 3 19:20:02 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 3 Aug 2006 21:20:02 +0200 (CEST) Subject: r623 - trunk/varnish-cache/bin/varnishd Message-ID: <20060803192002.66A161EC1E6@projects.linpro.no> Author: phk Date: 2006-08-03 21:20:02 +0200 (Thu, 03 Aug 2006) New Revision: 623 Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c Log: Sanitycheck that the length of an object adds up, right when we fetch it. Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-03 11:46:52 UTC (rev 622) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-03 19:20:02 UTC (rev 623) @@ -242,6 +242,17 @@ } else cls = 0; + { + /* Sanity check fetch methods accounting */ + struct storage *st; + unsigned uu; + + uu = 0; + TAILQ_FOREACH(st, &sp->obj->store, list) + uu += st->len; + assert(uu == sp->obj->len); + } + http_CopyHttp(&sp->obj->http, hp); if (http_GetHdr(vc->http, H_Connection, &b) && !strcasecmp(b, "close")) From phk at projects.linpro.no Thu Aug 3 19:21:55 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 3 Aug 2006 21:21:55 +0200 (CEST) Subject: r624 - trunk/varnish-cache/bin/varnishd Message-ID: <20060803192155.CC6201EC4E8@projects.linpro.no> Author: phk Date: 2006-08-03 21:21:55 +0200 (Thu, 03 Aug 2006) New Revision: 624 Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c Log: Fix copy&paste bug in fetch_chunked. Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-03 19:20:02 UTC (rev 623) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-03 19:21:55 UTC (rev 624) @@ -127,7 +127,7 @@ } else if (i >= v) { memcpy(p, q, v); p += v; - st->len += i; + st->len += v; q += v; u -= v; v -= v; From andersb at projects.linpro.no Thu Aug 3 22:01:51 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Fri, 4 Aug 2006 00:01:51 +0200 (CEST) Subject: r625 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060803220151.2B6971EC4E7@projects.linpro.no> Author: andersb Date: 2006-08-04 00:01:51 +0200 (Fri, 04 Aug 2006) New Revision: 625 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Got a workaround for IP adress fetching. If we connect logger while Varnish is running, we won't catch the IP from SessionOpen since it's already done that. Workaround is to catch the IP from SessionReuse if IP of session is NULL Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-03 19:21:55 UTC (rev 624) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-03 22:01:51 UTC (rev 625) @@ -97,6 +97,7 @@ ob[u] = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); assert(ob[u] != NULL); } + //printf("Hele [%d]: %s %s\n",u, p+4); switch (p[0]) { // XXX remember to check for NULL when strdup, if no allocate @@ -109,29 +110,37 @@ j = strlen(p + 4) - strlen(tmpPtr); // length of IP strncpy(ll[u].df_h, p + 4, j); ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. - printf("New session [%d]: %s \n",u, ll[u].df_h); + //printf("New session [%d]: %s \n",u, ll[u].df_h); break; case SLT_RxRequest: // XXX: Remember to support more than GET, HEAD and POST. // http://rfc.net/rfc2616.html#p51 + // + // Have to gather together data in SLT_RxRequest, SLT_RxURL, SLT_RxProtocol + // to build the request, so I use a sbuf. - if (p[1] >= 4 && !strncasecmp((void *)&p[4], "HEAD",11)){ + if (p[1] >= 4 && !strncasecmp((void *)&p[4], "HEAD",4)){ sbuf_bcat(ob[u], p + 4, strlen(p + 4)); //printf("Got a HEAD\n"); } - if (p[1] >= 4 && !strncasecmp((void *)&p[4], "POST",11)){ + else if (p[1] >= 4 && !strncasecmp((void *)&p[4], "POST",4)){ sbuf_bcat(ob[u], p + 4, strlen(p + 4)); //printf("Got a POST\n"); } - if (p[1] >= 3 && !strncasecmp((void *)&p[4], "GET",11)){ + else if (p[1] >= 3 && !strncasecmp((void *)&p[4], "GET",3)){ sbuf_bcat(ob[u], p + 4, strlen(p + 4)); //printf("Got a GET\n"); } + else { + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + //printf("Got something other than HEAD, POST, GET\n"); + } + break; case SLT_RxURL: @@ -158,22 +167,43 @@ case SLT_SessionClose: - printf("Session close [%d]: %s ",u, ll[u].df_h); - sbuf_finish(ob[u]); - printf("\"%s\"", sbuf_data(ob[u])); - printf(" \"%s\"\n", ll[u].df_U); - sbuf_clear(ob[u]); + if (p[1] >= 7 && !strncasecmp((void *)&p[4], "timeout",7)){ + printf("Timeout...\n"); + } + else{ + + printf("%s ", ll[u].df_h); + sbuf_finish(ob[u]); + printf("\"%s\"", sbuf_data(ob[u])); + printf(" \"%s\"\n", ll[u].df_U); + sbuf_clear(ob[u]); + + } break; case SLT_SessionReuse: - printf("Session reuse [%d]: %s ",u, ll[u].df_h); + // XXX have to catch the IP in the SessionReuse in case + // We never got the SessionOpen and the client keeps open + + if (ll[u].df_h[0] == '\0'){ + // If we are here, there is a session going on, and we haven't + // catched the IP in SessionOpen, we "steal" it from SessionReuse. + // + tmpPtr = strchr(p + 4, ' '); + j = strlen(p + 4) - strlen(tmpPtr); // length of IP + strncpy(ll[u].df_h, p + 4, j); + ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. + + } + + printf("%s ", ll[u].df_h); sbuf_finish(ob[u]); printf("\"%s\"", sbuf_data(ob[u])); printf(" \"%s\"\n", ll[u].df_U); sbuf_clear(ob[u]); - + break; default: From andersb at projects.linpro.no Thu Aug 3 23:42:47 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Fri, 4 Aug 2006 01:42:47 +0200 (CEST) Subject: r626 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060803234247.5FA941EC4E8@projects.linpro.no> Author: andersb Date: 2006-08-04 01:42:47 +0200 (Fri, 04 Aug 2006) New Revision: 626 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Placed a new sbuf_clear at a more strategic place. It got cluttered when a host left without SessionClose of SessionReuse. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-03 22:01:51 UTC (rev 625) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-03 23:42:47 UTC (rev 626) @@ -120,6 +120,8 @@ // // Have to gather together data in SLT_RxRequest, SLT_RxURL, SLT_RxProtocol // to build the request, so I use a sbuf. + + sbuf_clear(ob[u]); if (p[1] >= 4 && !strncasecmp((void *)&p[4], "HEAD",4)){ sbuf_bcat(ob[u], p + 4, strlen(p + 4)); From phk at projects.linpro.no Fri Aug 4 06:21:32 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 08:21:32 +0200 (CEST) Subject: r627 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804062132.D21A41EC53A@projects.linpro.no> Author: phk Date: 2006-08-04 08:21:32 +0200 (Fri, 04 Aug 2006) New Revision: 627 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c Log: Typo: write cli result to correct pipe. Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-03 23:42:47 UTC (rev 626) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-04 06:21:32 UTC (rev 627) @@ -95,7 +95,7 @@ sbuf_clear(cli->sb); cli_dispatch(cli, CLI_cmds, buf); sbuf_finish(cli->sb); - i = cli_writeres(heritage.fds[2], cli); + i = cli_writeres(heritage.fds[1], cli); if (i) { VSL(SLT_Error, 0, "CLI write failed (errno=%d)", errno); return; From phk at projects.linpro.no Fri Aug 4 06:21:56 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 08:21:56 +0200 (CEST) Subject: r628 - trunk/varnish-cache/include Message-ID: <20060804062156.589D01EC499@projects.linpro.no> Author: phk Date: 2006-08-04 08:21:56 +0200 (Fri, 04 Aug 2006) New Revision: 628 Modified: trunk/varnish-cache/include/cli.h Log: Add CLIS_CANT status code for when something is valid but currently impossible. Modified: trunk/varnish-cache/include/cli.h =================================================================== --- trunk/varnish-cache/include/cli.h 2006-08-04 06:21:32 UTC (rev 627) +++ trunk/varnish-cache/include/cli.h 2006-08-04 06:21:56 UTC (rev 628) @@ -178,5 +178,6 @@ CLIS_TOOFEW = 104, CLIS_TOOMANY = 105, CLIS_PARAM = 106, - CLIS_OK = 200 + CLIS_OK = 200, + CLIS_CANT = 300 }; From phk at projects.linpro.no Fri Aug 4 06:23:08 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 08:23:08 +0200 (CEST) Subject: r629 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804062308.8C4E51EC53C@projects.linpro.no> Author: phk Date: 2006-08-04 08:23:08 +0200 (Fri, 04 Aug 2006) New Revision: 629 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: (Re)Implement passthru of cli commands, we can now talk with the cache process again. Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 06:21:56 UTC (rev 628) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 06:23:08 UTC (rev 629) @@ -20,6 +20,7 @@ #include "mgt.h" static int cli_i = -1, cli_o = -1; +static pthread_mutex_t cli_mtx; /*--------------------------------------------------------------------*/ @@ -35,6 +36,69 @@ mgt_start_child(); } +/*-------------------------------------------------------------------- + * Passthru of cli commands. + */ + +static void +mcf_passthru(struct cli *cli, char **av, void *priv) +{ + char buf[BUFSIZ], *bp, *be; + char *p; + unsigned u, v; + int i, j, k; + + AZ(pthread_mutex_lock(&cli_mtx)); + /* Request */ + if (cli_o <= 0) { + AZ(pthread_mutex_unlock(&cli_mtx)); + cli_result(cli, CLIS_CANT); + cli_out(cli, "Cache process not running"); + return; + } + (void)priv; + bp = buf; + be = bp + sizeof buf; + for (u = 1; av[u] != NULL; u++) { + v = strlen(av[u]); + if (5 + bp + 4 * v > be) { + *bp = '\0'; + v = bp - buf; + i = write(cli_o, buf, v); + assert(i == v); + bp = buf; + } + *bp++ = '"'; + for (p = av[u]; *p; p++) { + switch (*p) { + case '\\': *bp++ = '\\'; *bp++ = '\\'; break; + case '\n': *bp++ = '\\'; *bp++ = 'n'; break; + case '"': *bp++ = '\\'; *bp++ = '"'; break; + default: *bp++ = *p; break; + } + } + *bp++ = '"'; + *bp++ = ' '; + } + if (bp != buf) { + *bp++ = '\n'; + v = bp - buf; + i = write(cli_o, buf, v); + assert(i == v); + } + + /* Response */ + i = read(cli_i, buf, sizeof buf - 1); + assert(i > 0); + buf[i] = '\0'; + j = sscanf(buf, "%u %u\n%n", &u, &v, &k); + assert(j == 2); + assert(i == k + v + 1); + cli_result(cli, u); + cli_out(cli, "%*.*s", v, v, buf + k); + AZ(pthread_mutex_unlock(&cli_mtx)); +} + /*--------------------------------------------------------------------*/ static struct cli_proto *cli_proto; @@ -70,6 +134,7 @@ unsigned u, v; + AZ(pthread_mutex_init(&cli_mtx, NULL)); /* * Build the joint cli_proto by combining the manager process * entries with with the cache process entries. The latter @@ -93,7 +158,7 @@ if (v < u) continue; cli_proto[u] = *cp; - cli_proto[u].func = NULL; /* XXX: pass */ + cli_proto[u].func = mcf_passthru; u++; } From phk at projects.linpro.no Fri Aug 4 06:53:26 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 08:53:26 +0200 (CEST) Subject: r630 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20060804065326.3B2371EC53B@projects.linpro.no> Author: phk Date: 2006-08-04 08:53:26 +0200 (Fri, 04 Aug 2006) New Revision: 630 Modified: trunk/varnish-cache/bin/varnishd/common_cli.c trunk/varnish-cache/bin/varnishd/common_cli.h trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/include/cli.h Log: Change the CLI protocol in a subtle but useful way: The first line of the response has a fixed format ("%-3d %-8u\n") and consequently fixed length (CLI_LINE0_LEN == 13). This makes parsing responses more efficient. Add a function in common_cli to do so. Modified: trunk/varnish-cache/bin/varnishd/common_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-04 06:23:08 UTC (rev 629) +++ trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-04 06:53:26 UTC (rev 630) @@ -52,9 +52,14 @@ { int i, l; struct iovec iov[3]; - char res[32]; + char res[CLI_LINE0_LEN + 2]; /* + * NUL + one more so we can catch + * any misformats by snprintf + */ - sprintf(res, "%d %d\n", cli->result, sbuf_len(cli->sb)); + i = snprintf(res, sizeof res, + "%-3d %-8d\n", cli->result, sbuf_len(cli->sb)); + assert(i == CLI_LINE0_LEN); iov[0].iov_base = (void*)(uintptr_t)res; iov[1].iov_base = (void*)(uintptr_t)sbuf_data(cli->sb); iov[2].iov_base = (void*)(uintptr_t)"\n"; @@ -65,3 +70,36 @@ i = writev(fd, iov, 3); return (i != l); } + +int +cli_readres(int fd, unsigned *status, char **ptr) +{ + char res[CLI_LINE0_LEN + 1]; /* For NUL */ + int i, j; + unsigned u, v; + char *p; + + i = read(fd, res, CLI_LINE0_LEN); + if (i < 0) + return (i); + assert(i == CLI_LINE0_LEN); /* XXX: handle */ + assert(res[3] == ' '); + assert(res[CLI_LINE0_LEN - 1] == '\n'); + j = sscanf(res, "%u %u\n", &u, &v); + assert(j == 2); + if (status != NULL) + *status = u; + p = malloc(v + 1); + assert(p != NULL); + i = read(fd, p, v + 1); + if (i < 0) + return (i); + assert(i == v + 1); + assert(p[v] == '\n'); + p[v] = '\0'; + if (ptr == NULL) + free(p); + else + *ptr = p; + return (0); +} Modified: trunk/varnish-cache/bin/varnishd/common_cli.h =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-04 06:23:08 UTC (rev 629) +++ trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-04 06:53:26 UTC (rev 630) @@ -13,4 +13,5 @@ void cli_suspend(struct cli *cli); void cli_resume(struct cli *cli); int cli_writeres(int fd, struct cli *cli); +int cli_readres(int fd, unsigned *status, char **ptr); extern struct cli_proto CLI_cmds[]; Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 06:23:08 UTC (rev 629) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 06:53:26 UTC (rev 630) @@ -37,18 +37,21 @@ } /*-------------------------------------------------------------------- - * Passthru of cli commands. + * Passthru of cli commands. It is more or less just undoing what + * the cli parser did, but such is life... */ static void mcf_passthru(struct cli *cli, char **av, void *priv) { - char buf[BUFSIZ], *bp, *be; - char *p; + char *p, *q, *r; unsigned u, v; - int i, j, k; + int i; + (void)priv; + AZ(pthread_mutex_lock(&cli_mtx)); + /* Request */ if (cli_o <= 0) { AZ(pthread_mutex_unlock(&cli_mtx)); @@ -56,46 +59,37 @@ cli_out(cli, "Cache process not running"); return; } - (void)priv; - bp = buf; - be = bp + sizeof buf; + v = 0; + for (u = 1; av[u] != NULL; u++) + v += strlen(av[u]) + 3; + p = malloc(v); + assert(p != NULL); + q = p; for (u = 1; av[u] != NULL; u++) { - v = strlen(av[u]); - if (5 + bp + 4 * v > be) { - *bp = '\0'; - v = bp - buf; - i = write(cli_o, buf, v); - assert(i == v); - bp = buf; - } - *bp++ = '"'; - for (p = av[u]; *p; p++) { - switch (*p) { - case '\\': *bp++ = '\\'; *bp++ = '\\'; break; - case '\n': *bp++ = '\\'; *bp++ = 'n'; break; - case '"': *bp++ = '\\'; *bp++ = '"'; break; - default: *bp++ = *p; break; + *q++ = '"'; + for (r = av[u]; *r; r++) { + switch (*r) { + case '\\': *q++ = '\\'; *q++ = '\\'; break; + case '\n': *q++ = '\\'; *q++ = 'n'; break; + case '"': *q++ = '\\'; *q++ = '"'; break; + default: *q++ = *r; break; } } - *bp++ = '"'; - *bp++ = ' '; + *q++ = '"'; + *q++ = ' '; } - if (bp != buf) { - *bp++ = '\n'; - v = bp - buf; - i = write(cli_o, buf, v); - assert(i == v); - } + *q++ = '\n'; + v = q - p; + i = write(cli_o, p, v); + assert(i == v); + free(p); - /* Response */ - i = read(cli_i, buf, sizeof buf - 1); - assert(i > 0); - buf[i] = '\0'; - j = sscanf(buf, "%u %u\n%n", &u, &v, &k); - assert(j == 2); - assert(i == k + v + 1); + i = cli_readres(cli_i, &u, &p); + assert(i == 0); cli_result(cli, u); - cli_out(cli, "%*.*s", v, v, buf + k); + cli_out(cli, "%s", p); + free(p); + AZ(pthread_mutex_unlock(&cli_mtx)); } Modified: trunk/varnish-cache/include/cli.h =================================================================== --- trunk/varnish-cache/include/cli.h 2006-08-04 06:23:08 UTC (rev 629) +++ trunk/varnish-cache/include/cli.h 2006-08-04 06:53:26 UTC (rev 630) @@ -181,3 +181,6 @@ CLIS_OK = 200, CLIS_CANT = 300 }; + +/* Length of first line of response */ +#define CLI_LINE0_LEN 13 From phk at projects.linpro.no Fri Aug 4 07:19:51 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 09:19:51 +0200 (CEST) Subject: r631 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804071951.621E21EC49F@projects.linpro.no> Author: phk Date: 2006-08-04 09:19:51 +0200 (Fri, 04 Aug 2006) New Revision: 631 Modified: trunk/varnish-cache/bin/varnishd/cache_main.c Log: SIGCHLD has already been taken care of earlier. Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-04 06:53:26 UTC (rev 630) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-04 07:19:51 UTC (rev 631) @@ -22,9 +22,6 @@ child_main(void) { - /* XXX: SO_NOSIGPIPE does not work reliably :-( */ - signal(SIGPIPE, SIG_IGN); - setbuf(stdout, NULL); setbuf(stderr, NULL); printf("Child starts\n"); From phk at projects.linpro.no Fri Aug 4 07:20:49 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 09:20:49 +0200 (CEST) Subject: r632 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804072049.7AAB71EC4CD@projects.linpro.no> Author: phk Date: 2006-08-04 09:20:49 +0200 (Fri, 04 Aug 2006) New Revision: 632 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/common_cli.c trunk/varnish-cache/bin/varnishd/common_cli.h Log: Move cli_func_ping to common_cli Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-04 07:19:51 UTC (rev 631) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-04 07:20:49 UTC (rev 632) @@ -21,24 +21,6 @@ /*--------------------------------------------------------------------*/ -static void -cli_func_ping(struct cli *cli, char **av, void *priv) -{ - time_t t; - - (void)priv; -#if 0 - arm_keepalive(); -#endif - if (av[2] != NULL) { - /* XXX: check clock skew is pointless here */ - } - t = time(NULL); - cli_out(cli, "PONG %ld", t); -} - -/*--------------------------------------------------------------------*/ - struct cli_proto CLI_cmds[] = { { CLI_PING, cli_func_ping }, #if 0 Modified: trunk/varnish-cache/bin/varnishd/common_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-04 07:19:51 UTC (rev 631) +++ trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-04 07:20:49 UTC (rev 632) @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -103,3 +104,16 @@ *ptr = p; return (0); } + +/*--------------------------------------------------------------------*/ + +void +cli_func_ping(struct cli *cli, char **av, void *priv) +{ + time_t t; + + (void)priv; + (void)av; + t = time(NULL); + cli_out(cli, "PONG %ld", t); +} Modified: trunk/varnish-cache/bin/varnishd/common_cli.h =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-04 07:19:51 UTC (rev 631) +++ trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-04 07:20:49 UTC (rev 632) @@ -15,3 +15,5 @@ int cli_writeres(int fd, struct cli *cli); int cli_readres(int fd, unsigned *status, char **ptr); extern struct cli_proto CLI_cmds[]; + +cli_func_t cli_func_ping; From phk at projects.linpro.no Fri Aug 4 07:21:50 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 09:21:50 +0200 (CEST) Subject: r633 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804072150.45FDB1EC53F@projects.linpro.no> Author: phk Date: 2006-08-04 09:21:50 +0200 (Fri, 04 Aug 2006) New Revision: 633 Modified: trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: Implement CLI ping in manager, this is a "per hop" command. Add mgt_cli_askchild() function to poke the CLI interface to the child. Use it to ping the child every second. Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-04 07:20:49 UTC (rev 632) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-04 07:21:50 UTC (rev 633) @@ -15,7 +15,9 @@ void mgt_cli_setup(int fdi, int fdo, int verbose); void mgt_cli_start_child(int fdi, int fdo); void mgt_cli_stop_child(void); +int mgt_cli_askchild(int *status, char **resp, const char *fmt, ...); + /* tcp.c */ int open_tcp(const char *port); Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-04 07:20:49 UTC (rev 632) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-04 07:21:50 UTC (rev 633) @@ -63,8 +63,8 @@ (void)arg; while (1) { sleep (1); - /* CLI: ping/pong */ - child_ticker = 0; + if (!mgt_cli_askchild(NULL, NULL, "ping\n")) + child_ticker = 0; } } Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 07:20:49 UTC (rev 632) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 07:21:50 UTC (rev 633) @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -99,6 +100,7 @@ static struct cli_proto mgt_cli_proto[] = { { CLI_HELP, cli_func_help, NULL }, /* must be first */ + { CLI_PING, cli_func_ping }, { CLI_SERVER_START, mcf_server_startstop, NULL }, { CLI_SERVER_STOP, mcf_server_startstop, &cli_proto }, { CLI_CONFIG_LOAD }, @@ -163,6 +165,36 @@ /* XXX: open listening sockets, contact cluster server etc */ } +/*-------------------------------------------------------------------- + * Ask the child something over CLI, return zero only if everything is + * happy happy. + */ + +int +mgt_cli_askchild(int *status, char **resp, const char *fmt, ...) +{ + char *p; + int i, j; + va_list ap; + + va_start(ap, fmt); + i = vasprintf(&p, fmt, ap); + va_end(ap); + if (i < 0) + return (i); + AZ(pthread_mutex_lock(&cli_mtx)); + assert(p[i - 1] == '\n'); + i = write(cli_o, p, strlen(p)); + assert(i == strlen(p)); + free(p); + + i = cli_readres(cli_i, &j, resp); + AZ(pthread_mutex_unlock(&cli_mtx)); + if (status != NULL) + *status = j; + return (j == CLIS_OK ? 0 : j); +} + /*--------------------------------------------------------------------*/ void From phk at projects.linpro.no Fri Aug 4 09:06:08 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 11:06:08 +0200 (CEST) Subject: r634 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804090608.17EC91EC55F@projects.linpro.no> Author: phk Date: 2006-08-04 11:06:07 +0200 (Fri, 04 Aug 2006) New Revision: 634 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: reimplement CLI stats Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 07:21:50 UTC (rev 633) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 09:06:07 UTC (rev 634) @@ -19,6 +19,7 @@ #include "sbuf.h" #include "common_cli.h" #include "mgt.h" +#include "shmlog.h" static int cli_i = -1, cli_o = -1; static pthread_mutex_t cli_mtx; @@ -37,6 +38,23 @@ mgt_start_child(); } +/*--------------------------------------------------------------------*/ + +static void +mcf_stats(struct cli *cli, char **av, void *priv) +{ + + (void)av; + (void)priv; + + assert (VSL_stats != NULL); +#define MAC_STAT(n,t,f,d) \ + cli_out(cli, "%12ju " d "\n", (VSL_stats->n)); +#include "stat_field.h" +#undef MAC_STAT +} + + /*-------------------------------------------------------------------- * Passthru of cli commands. It is more or less just undoing what * the cli parser did, but such is life... @@ -103,6 +121,7 @@ { CLI_PING, cli_func_ping }, { CLI_SERVER_START, mcf_server_startstop, NULL }, { CLI_SERVER_STOP, mcf_server_startstop, &cli_proto }, + { CLI_STATS, mcf_stats, NULL }, { CLI_CONFIG_LOAD }, #if 0 { CLI_CONFIG_LOAD, m_cli_func_config_load, NULL }, @@ -110,7 +129,6 @@ { CLI_SERVER_STOP, m_cli_func_server_stop, NULL }, { CLI_SERVER_RESTART }, { CLI_PING, m_cli_func_ping, NULL }, - { CLI_STATS, m_cli_func_stats, NULL }, { CLI_ZERO }, { CLI_VERBOSE, m_cli_func_verbose, NULL }, { CLI_EXIT, m_cli_func_exit, NULL}, From phk at projects.linpro.no Fri Aug 4 09:06:41 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 11:06:41 +0200 (CEST) Subject: r635 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804090641.058871EC560@projects.linpro.no> Author: phk Date: 2006-08-04 11:06:40 +0200 (Fri, 04 Aug 2006) New Revision: 635 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: Remove old cli related stuff, it now lives elsewhere Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-04 09:06:07 UTC (rev 634) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-04 09:06:40 UTC (rev 635) @@ -73,33 +73,6 @@ struct heritage heritage; -#if 0 -/*-------------------------------------------------------------------- - * Generic passthrough for CLI functions - */ - -static void -cli_passthrough_cb(unsigned u, const char *r, void *priv) -{ - struct cli *cli = priv; - - cli_out(cli, "%s\n", r); - cli_result(cli, u); - cli_resume(cli); -} - -static void -m_cli_func_passthrough(struct cli *cli, char **av, void *priv) -{ - - (void)av; - (void)priv; - - cli_suspend(cli); - mgt_child_request(cli_passthrough_cb, cli, &av[2], av[1]); -} -#endif - /*--------------------------------------------------------------------*/ static char * @@ -215,124 +188,8 @@ return (vf); } -#if 0 - /*--------------------------------------------------------------------*/ -static void -m_cli_func_server_start(struct cli *cli, char **av, void *priv) -{ - - (void)cli; - (void)av; - (void)priv; - - mgt_child_start(); -} - -/*--------------------------------------------------------------------*/ - -static void -m_cli_func_server_stop(struct cli *cli, char **av, void *priv) -{ - - (void)cli; - (void)av; - (void)priv; - - mgt_child_stop(); -} - -/*--------------------------------------------------------------------*/ - -static void -m_cli_func_exit(struct cli *cli, char **av, void *priv) -{ - - (void)cli; - (void)av; - (void)priv; - mgt_child_kill(); - exit (0); -} - -/*--------------------------------------------------------------------*/ - -static void -m_cli_func_verbose(struct cli *cli, char **av, void *priv) -{ - - (void)av; - (void)priv; - - cli->verbose = !cli->verbose; -} - - -static void -m_cli_func_ping(struct cli *cli, char **av, void *priv) -{ - time_t t; - - (void)priv; - - if (av[2] != NULL) { - cli_out(cli, "Got your %s\n", av[2]); - } - t = time(NULL); - cli_out(cli, "PONG %ld\n", t); -} - -/*--------------------------------------------------------------------*/ - -static void -m_cli_func_stats(struct cli *cli, char **av, void *priv) -{ - - (void)av; - (void)priv; - - assert (VSL_stats != NULL); -#define MAC_STAT(n,t,f,d) \ - cli_out(cli, "%12ju " d "\n", (VSL_stats->n)); -#include "stat_field.h" -#undef MAC_STAT -} - -/*--------------------------------------------------------------------*/ - -static struct cli_proto cli_proto[] = { - /* URL manipulation */ - { CLI_URL_QUERY, m_cli_func_passthrough, NULL }, - { CLI_URL_PURGE, m_cli_func_passthrough, NULL }, - { CLI_URL_STATUS, m_cli_func_passthrough, NULL }, - { CLI_CONFIG_LOAD, m_cli_func_config_load, NULL }, - { CLI_CONFIG_INLINE, m_cli_func_config_inline, NULL }, - { CLI_CONFIG_UNLOAD, m_cli_func_passthrough, NULL }, - { CLI_CONFIG_LIST, m_cli_func_passthrough, NULL }, - { CLI_CONFIG_USE, m_cli_func_passthrough, NULL }, - { CLI_SERVER_FREEZE, m_cli_func_passthrough, NULL }, - { CLI_SERVER_THAW, m_cli_func_passthrough, NULL }, - { CLI_SERVER_SUSPEND, m_cli_func_passthrough, NULL }, - { CLI_SERVER_RESUME, m_cli_func_passthrough, NULL }, - { CLI_SERVER_STOP, m_cli_func_server_stop, NULL }, - { CLI_SERVER_START, m_cli_func_server_start, NULL }, - { CLI_SERVER_RESTART }, - { CLI_PING, m_cli_func_ping, NULL }, - { CLI_STATS, m_cli_func_stats, NULL }, - { CLI_ZERO }, - { CLI_HELP, cli_func_help, cli_proto }, - { CLI_VERBOSE, m_cli_func_verbose, NULL }, - { CLI_EXIT, m_cli_func_exit, NULL}, - { CLI_QUIT }, - { CLI_BYE }, - { NULL } -}; - -#endif - -/*--------------------------------------------------------------------*/ - static int cmp_hash(struct hash_slinger *s, const char *p, const char *q) { From phk at projects.linpro.no Fri Aug 4 09:19:40 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 11:19:40 +0200 (CEST) Subject: r636 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804091940.61EFA1EC55F@projects.linpro.no> Author: phk Date: 2006-08-04 11:19:40 +0200 (Fri, 04 Aug 2006) New Revision: 636 Added: trunk/varnish-cache/bin/varnishd/mgt_vcc.c Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/varnishd.c Log: Move VCL compiler related stuff to mgt_vcc.c Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-04 09:06:40 UTC (rev 635) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-04 09:19:40 UTC (rev 636) @@ -38,6 +38,7 @@ hash_classic.c \ mgt_child.c \ mgt_cli.c \ + mgt_vcc.c \ rfc2616.c \ shmlog.c \ storage_file.c \ Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-04 09:06:40 UTC (rev 635) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-04 09:19:40 UTC (rev 636) @@ -17,6 +17,10 @@ void mgt_cli_stop_child(void); int mgt_cli_askchild(int *status, char **resp, const char *fmt, ...); +/* mgt_vcc.c */ +void mgt_vcc_init(void); +char *mgt_vcc_default(const char *bflag); +char *mgt_vcc_file(const char *fflag); /* tcp.c */ int open_tcp(const char *port); Added: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-04 09:06:40 UTC (rev 635) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-04 09:19:40 UTC (rev 636) @@ -0,0 +1,205 @@ +/* + * $Id$ + * + * VCL compiler stuff + */ + +#include +#include +#include +#include +#include + +#include "sbuf.h" + +#include "libvarnish.h" +#include "libvcl.h" +#include "cli.h" +#include "cli_priv.h" +#include "common_cli.h" + +#include "mgt.h" + +/*--------------------------------------------------------------------*/ + +static const char *default_vcl = + "sub default_vcl_recv {\n" + " if (req.request != \"GET\" && req.request != \"HEAD\") {\n" + " pipe;\n" + " }\n" + " if (req.http.Expect) {\n" + " pipe;\n" + " }\n" + " if (req.http.Authenticate || req.http.Cookie) {\n" + " pass;\n" + " }\n" + " lookup;\n" + "}\n" + "\n" + "sub default_vcl_hit {\n" + " if (!obj.cacheable) {\n" + " pass;\n" + " }\n" + " deliver;\n" + "}\n" + "\n" + "sub default_vcl_miss {\n" + " fetch;\n" + "}\n" + "\n" + "sub default_vcl_fetch {\n" + " if (!obj.valid) {\n" + " error;\n" + " }\n" + " if (!obj.cacheable) {\n" + " insert_pass;\n" + " }\n" + " insert;\n" + "}\n" + "sub default_vcl_timeout {\n" + " discard;\n" + "}\n"; + +/*--------------------------------------------------------------------*/ + +char * +mgt_vcc_default(const char *bflag) +{ + char *buf, *vf; + const char *p, *q; + struct sbuf *sb; + + /* + * XXX: should do a "HEAD /" on the -b argument to see that + * XXX: it even works. On the other hand, we should do that + * XXX: for all backends in the cache process whenever we + * XXX: change config, but for a complex VCL, it might not be + * XXX: a bug for a backend to not reply at that time, so then + * XXX: again: we should check it here in the "trivial" case. + */ + p = strchr(bflag, ' '); + if (p != NULL) { + q = p + 1; + } else { + p = strchr(bflag, '\0'); + assert(p != NULL); + q = "http"; + } + + buf = NULL; + asprintf(&buf, + "backend default {\n" + " set backend.host = \"%*.*s\";\n" + " set backend.port = \"%s\";\n" + "}\n", (int)(p - bflag), (int)(p - bflag), bflag, q); + assert(buf != NULL); + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(sb != NULL); + vf = VCC_Compile(sb, buf, NULL); + sbuf_finish(sb); + if (sbuf_len(sb) > 0) { + fprintf(stderr, "%s", sbuf_data(sb)); + free(buf); + sbuf_delete(sb); + return (NULL); + } + sbuf_delete(sb); + free(buf); + return (vf); +} + +/*--------------------------------------------------------------------*/ + +char * +mgt_vcc_file(const char *fflag) +{ + char *vf; + struct sbuf *sb; + + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(sb != NULL); + vf = VCC_CompileFile(sb, fflag); + sbuf_finish(sb); + if (sbuf_len(sb) > 0) { + fprintf(stderr, "%s", sbuf_data(sb)); + sbuf_delete(sb); + return (NULL); + } + sbuf_delete(sb); + return (vf); +} + +/*--------------------------------------------------------------------*/ + +void +mgt_vcc_init(void) +{ + + VCC_InitCompile(default_vcl); +} + + +#if 0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mgt.h" + +static void +m_cli_func_config_inline(struct cli *cli, char **av, void *priv) +{ + char *vf; + struct sbuf *sb; + + (void)priv; + + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(sb != NULL); + vf = VCC_Compile(sb, av[3], NULL); + sbuf_finish(sb); + if (sbuf_len(sb) > 0) { + cli_out(cli, "%s", sbuf_data(sb)); + sbuf_delete(sb); + return; + } + sbuf_delete(sb); + cli_suspend(cli); + mgt_child_request(cli_passthrough_cb, cli, NULL, + "config.load %s %s", av[2], vf); +} + +/* XXX: m prefix to avoid name clash */ +static void +m_cli_func_config_load(struct cli *cli, char **av, void *priv) +{ + char *vf; + struct sbuf *sb; + + (void)priv; + + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(sb != NULL); + vf = VCC_CompileFile(sb, av[3]); + sbuf_finish(sb); + if (sbuf_len(sb) > 0) { + cli_out(cli, "%s", sbuf_data(sb)); + sbuf_delete(sb); + return; + } + sbuf_delete(sb); + cli_suspend(cli); + mgt_child_request(cli_passthrough_cb, cli, NULL, + "config.load %s %s", av[2], vf); +} + +#endif Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-04 09:06:40 UTC (rev 635) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-04 09:19:40 UTC (rev 636) @@ -20,7 +20,6 @@ #include "sbuf.h" #include "libvarnish.h" -#include "libvcl.h" #include "cli.h" #include "cli_priv.h" #include "common_cli.h" @@ -29,167 +28,10 @@ #include "heritage.h" #include "shmlog.h" -/*--------------------------------------------------------------------*/ - -static const char *default_vcl = - "sub default_vcl_recv {\n" - " if (req.request != \"GET\" && req.request != \"HEAD\") {\n" - " pipe;\n" - " }\n" - " if (req.http.Expect) {\n" - " pipe;\n" - " }\n" - " if (req.http.Authenticate || req.http.Cookie) {\n" - " pass;\n" - " }\n" - " lookup;\n" - "}\n" - "\n" - "sub default_vcl_hit {\n" - " if (!obj.cacheable) {\n" - " pass;\n" - " }\n" - " deliver;\n" - "}\n" - "\n" - "sub default_vcl_miss {\n" - " fetch;\n" - "}\n" - "\n" - "sub default_vcl_fetch {\n" - " if (!obj.valid) {\n" - " error;\n" - " }\n" - " if (!obj.cacheable) {\n" - " insert_pass;\n" - " }\n" - " insert;\n" - "}\n" - "sub default_vcl_timeout {\n" - " discard;\n" - "}\n"; - -/*--------------------------------------------------------------------*/ - struct heritage heritage; /*--------------------------------------------------------------------*/ -static char * -vcl_default(const char *bflag) -{ - char *buf, *vf; - const char *p, *q; - struct sbuf *sb; - - /* - * XXX: should do a "HEAD /" on the -b argument to see that - * XXX: it even works. On the other hand, we should do that - * XXX: for all backends in the cache process whenever we - * XXX: change config, but for a complex VCL, it might not be - * XXX: a bug for a backend to not reply at that time, so then - * XXX: again: we should check it here in the "trivial" case. - */ - p = strchr(bflag, ' '); - if (p != NULL) { - q = p + 1; - } else { - p = strchr(bflag, '\0'); - assert(p != NULL); - q = "http"; - } - - buf = NULL; - asprintf(&buf, - "backend default {\n" - " set backend.host = \"%*.*s\";\n" - " set backend.port = \"%s\";\n" - "}\n", (int)(p - bflag), (int)(p - bflag), bflag, q); - assert(buf != NULL); - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(sb != NULL); - vf = VCC_Compile(sb, buf, NULL); - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - fprintf(stderr, "%s", sbuf_data(sb)); - free(buf); - sbuf_delete(sb); - return (NULL); - } - sbuf_delete(sb); - free(buf); - return (vf); -} -#if 0 -static void -m_cli_func_config_inline(struct cli *cli, char **av, void *priv) -{ - char *vf; - struct sbuf *sb; - - (void)priv; - - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(sb != NULL); - vf = VCC_Compile(sb, av[3], NULL); - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - cli_out(cli, "%s", sbuf_data(sb)); - sbuf_delete(sb); - return; - } - sbuf_delete(sb); - cli_suspend(cli); - mgt_child_request(cli_passthrough_cb, cli, NULL, - "config.load %s %s", av[2], vf); -} - -/* XXX: m prefix to avoid name clash */ -static void -m_cli_func_config_load(struct cli *cli, char **av, void *priv) -{ - char *vf; - struct sbuf *sb; - - (void)priv; - - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(sb != NULL); - vf = VCC_CompileFile(sb, av[3]); - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - cli_out(cli, "%s", sbuf_data(sb)); - sbuf_delete(sb); - return; - } - sbuf_delete(sb); - cli_suspend(cli); - mgt_child_request(cli_passthrough_cb, cli, NULL, - "config.load %s %s", av[2], vf); -} -#endif - -static char * -vcl_file(const char *fflag) -{ - char *vf; - struct sbuf *sb; - - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(sb != NULL); - vf = VCC_CompileFile(sb, fflag); - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - fprintf(stderr, "%s", sbuf_data(sb)); - sbuf_delete(sb); - return (NULL); - } - sbuf_delete(sb); - return (vf); -} - -/*--------------------------------------------------------------------*/ - static int cmp_hash(struct hash_slinger *s, const char *p, const char *q) { @@ -465,9 +307,9 @@ setbuf(stdout, NULL); setbuf(stderr, NULL); - - VCC_InitCompile(default_vcl); + mgt_vcc_init(); + heritage.default_ttl = 120; heritage.wthread_min = 1; heritage.wthread_max = UINT_MAX; @@ -522,9 +364,9 @@ } if (bflag != NULL) - heritage.vcl_file = vcl_default(bflag); + heritage.vcl_file = mgt_vcc_default(bflag); else - heritage.vcl_file = vcl_file(fflag); + heritage.vcl_file = mgt_vcc_file(fflag); if (heritage.vcl_file == NULL) exit (1); From phk at projects.linpro.no Fri Aug 4 10:23:51 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 12:23:51 +0200 (CEST) Subject: r637 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804102351.D46101EC4CF@projects.linpro.no> Author: phk Date: 2006-08-04 12:23:51 +0200 (Fri, 04 Aug 2006) New Revision: 637 Added: trunk/varnish-cache/bin/varnishd/mgt_cli.h Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_main.c trunk/varnish-cache/bin/varnishd/cache_vcl.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: Redo our management of compiled VCL programs: Take default_vcl out of heritage. Keep track of all compiled VCL files and delete them at exit. After starting child, use CLI to load all vcl programs and then issue "start" via the CLI. In the cacher, don't start the acceptor until we get a start command. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-04 10:23:51 UTC (rev 637) @@ -12,6 +12,7 @@ hash_slinger.h \ heritage.h \ mgt.h \ + mgt_cli.h \ stevedore.h \ \ cache_acceptor.c \ Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-04 10:23:51 UTC (rev 637) @@ -21,8 +21,23 @@ /*--------------------------------------------------------------------*/ +static void +cli_func_start(struct cli *cli, char **av, void *priv) +{ + + (void)cli; + (void)av; + (void)priv; + VCA_Init(); + return; +} + + +/*--------------------------------------------------------------------*/ + struct cli_proto CLI_cmds[] = { { CLI_PING, cli_func_ping }, + { CLI_SERVER_START, cli_func_start }, #if 0 { CLI_URL_QUERY, cli_func_url_query }, #endif Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-04 10:23:51 UTC (rev 637) @@ -27,7 +27,6 @@ printf("Child starts\n"); VCL_Init(); - VCL_Load(heritage.vcl_file, "boot", NULL); HTTP_Init(); SES_Init(); @@ -36,7 +35,6 @@ VSL_Init(); WRK_Init(); - VCA_Init(); EXP_Init(); HSH_Init(); BAN_Init(); Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-04 10:23:51 UTC (rev 637) @@ -96,12 +96,6 @@ vcl->dlh = dlopen(fn, RTLD_NOW | RTLD_LOCAL); - /* - * Delete the file, either we got hold of it, or we couldn't care - * less about it anyway. - */ - (void)unlink(fn); - if (vcl->dlh == NULL) { if (cli == NULL) fprintf(stderr, "dlopen(%s): %s\n", fn, dlerror()); Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-04 10:23:51 UTC (rev 637) @@ -25,9 +25,6 @@ int vsl_fd; unsigned vsl_size; - /* Initial VCL file */ - char *vcl_file; - /* Storage method */ struct stevedore *stevedore; Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-04 10:23:51 UTC (rev 637) @@ -8,19 +8,20 @@ void mgt_run(int dflag); void mgt_start_child(void); void mgt_stop_child(void); +extern pid_t mgt_pid; /* mgt_cli.c */ void mgt_cli_init(void); void mgt_cli_setup(int fdi, int fdo, int verbose); +int mgt_cli_askchild(int *status, char **resp, const char *fmt, ...); void mgt_cli_start_child(int fdi, int fdo); void mgt_cli_stop_child(void); -int mgt_cli_askchild(int *status, char **resp, const char *fmt, ...); /* mgt_vcc.c */ void mgt_vcc_init(void); -char *mgt_vcc_default(const char *bflag); -char *mgt_vcc_file(const char *fflag); +int mgt_vcc_default(const char *bflag, const char *fflag); +int mgt_push_vcls_and_start(int *status, char **p); /* tcp.c */ int open_tcp(const char *port); Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-04 10:23:51 UTC (rev 637) @@ -21,9 +21,12 @@ #include "libvarnish.h" #include "heritage.h" #include "mgt.h" +#include "cli_priv.h" +#include "mgt_cli.h" +pid_t mgt_pid; + static pid_t child_pid = -1; -static pid_t mgr_pid; static int child_fds[2]; static unsigned child_should_run; static pthread_t child_listen_thread; @@ -74,6 +77,7 @@ start_child(void) { int i; + char *p; AZ(pipe(&heritage.fds[0])); AZ(pipe(&heritage.fds[2])); @@ -115,6 +119,12 @@ AZ(pthread_detach(child_listen_thread)); AZ(pthread_create(&child_poker_thread, NULL, child_poker, NULL)); AZ(pthread_detach(child_poker_thread)); + if (mgt_push_vcls_and_start(&i, &p)) { + fprintf(stderr, "Pushing vcls failed:\n%s\n", p); + free(p); + exit (2); + } + child_ticker = 0; } /*--------------------------------------------------------------------*/ @@ -190,7 +200,7 @@ { (void)arg; - if (getpid() != mgr_pid) { + if (getpid() != mgt_pid) { printf("Got SIGINT\n"); exit (2); } @@ -212,7 +222,7 @@ struct sigaction sac; int i; - mgr_pid = getpid(); + mgt_pid = getpid(); if (dflag) mgt_cli_setup(0, 1, 1); @@ -275,18 +285,17 @@ /*--------------------------------------------------------------------*/ void -mgt_start_child(void) +mcf_server_startstop(struct cli *cli, char **av, void *priv) { + (void)cli; + (void)av; + if (priv != NULL) { + child_should_run = 0; + AZ(pthread_cond_signal(&child_cv)); + return; + } dstarts = 0; child_should_run = 1; AZ(pthread_cond_signal(&child_cv)); } - -void -mgt_stop_child(void) -{ - - child_should_run = 0; - AZ(pthread_cond_signal(&child_cv)); -} Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 10:23:51 UTC (rev 637) @@ -19,6 +19,7 @@ #include "sbuf.h" #include "common_cli.h" #include "mgt.h" +#include "mgt_cli.h" #include "shmlog.h" static int cli_i = -1, cli_o = -1; @@ -27,20 +28,6 @@ /*--------------------------------------------------------------------*/ static void -mcf_server_startstop(struct cli *cli, char **av, void *priv) -{ - - (void)cli; - (void)av; - if (priv != NULL) - mgt_stop_child(); - else - mgt_start_child(); -} - -/*--------------------------------------------------------------------*/ - -static void mcf_stats(struct cli *cli, char **av, void *priv) { @@ -122,10 +109,9 @@ { CLI_SERVER_START, mcf_server_startstop, NULL }, { CLI_SERVER_STOP, mcf_server_startstop, &cli_proto }, { CLI_STATS, mcf_stats, NULL }, - { CLI_CONFIG_LOAD }, + { CLI_CONFIG_LOAD, mcf_config_load, NULL }, + { CLI_CONFIG_INLINE, mcf_config_inline, NULL }, #if 0 - { CLI_CONFIG_LOAD, m_cli_func_config_load, NULL }, - { CLI_CONFIG_INLINE, m_cli_func_config_inline, NULL }, { CLI_SERVER_STOP, m_cli_func_server_stop, NULL }, { CLI_SERVER_RESTART }, { CLI_PING, m_cli_func_ping, NULL }, Added: trunk/varnish-cache/bin/varnishd/mgt_cli.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.h 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.h 2006-08-04 10:23:51 UTC (rev 637) @@ -0,0 +1,10 @@ +/* + * $Id$ + */ + +/* mgt_child.c */ +cli_func_t mcf_server_startstop; + +/* mgt_vcc.c */ +cli_func_t mcf_config_load; +cli_func_t mcf_config_inline; Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-04 10:23:51 UTC (rev 637) @@ -5,12 +5,15 @@ */ #include +#include #include #include #include +#include #include #include "sbuf.h" +#include "queue.h" #include "libvarnish.h" #include "libvcl.h" @@ -19,7 +22,20 @@ #include "common_cli.h" #include "mgt.h" +#include "mgt_cli.h" +struct vcls { + TAILQ_ENTRY(vcls) list; + char *name; + char *fname; + int active; +}; + + +static TAILQ_HEAD(, vcls) vclhead = TAILQ_HEAD_INITIALIZER(vclhead); + +static pthread_mutex_t vcc_mtx; + /*--------------------------------------------------------------------*/ static const char *default_vcl = @@ -62,104 +78,163 @@ /*--------------------------------------------------------------------*/ -char * -mgt_vcc_default(const char *bflag) +static struct vcls * +mgt_vcc_add(const char *name, char *file) { + struct vcls *vp; + + vp = calloc(sizeof *vp, 1); + assert(vp != NULL); + vp->name = strdup(name); + vp->fname = file; + AZ(pthread_mutex_lock(&vcc_mtx)); + TAILQ_INSERT_TAIL(&vclhead, vp, list); + AZ(pthread_mutex_unlock(&vcc_mtx)); + return (vp); +} + +static void +mgt_vcc_del(struct vcls *vp) +{ + TAILQ_REMOVE(&vclhead, vp, list); + printf("unlink %s\n", vp->fname); + AZ(unlink(vp->fname)); /* XXX assert for now */ + free(vp->fname); + free(vp->name); + free(vp); +} + +static int +mgt_vcc_delbyname(const char *name) +{ + struct vcls *vp; + + TAILQ_FOREACH(vp, &vclhead, list) { + if (!strcmp(name, vp->name)) { + mgt_vcc_del(vp); + return (0); + } + } + return (1); +} + +/*--------------------------------------------------------------------*/ + +int +mgt_vcc_default(const char *bflag, const char *fflag) +{ char *buf, *vf; const char *p, *q; struct sbuf *sb; + struct vcls *vp; - /* - * XXX: should do a "HEAD /" on the -b argument to see that - * XXX: it even works. On the other hand, we should do that - * XXX: for all backends in the cache process whenever we - * XXX: change config, but for a complex VCL, it might not be - * XXX: a bug for a backend to not reply at that time, so then - * XXX: again: we should check it here in the "trivial" case. - */ - p = strchr(bflag, ' '); - if (p != NULL) { - q = p + 1; + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(sb != NULL); + if (bflag != NULL) { + /* + * XXX: should do a "HEAD /" on the -b argument to see that + * XXX: it even works. On the other hand, we should do that + * XXX: for all backends in the cache process whenever we + * XXX: change config, but for a complex VCL, it might not be + * XXX: a bug for a backend to not reply at that time, so then + * XXX: again: we should check it here in the "trivial" case. + */ + p = strchr(bflag, ' '); + if (p != NULL) { + q = p + 1; + } else { + p = strchr(bflag, '\0'); + assert(p != NULL); + q = "http"; + } + + buf = NULL; + asprintf(&buf, + "backend default {\n" + " set backend.host = \"%*.*s\";\n" + " set backend.port = \"%s\";\n" + "}\n", (int)(p - bflag), (int)(p - bflag), bflag, q); + assert(buf != NULL); + vf = VCC_Compile(sb, buf, NULL); + free(buf); } else { - p = strchr(bflag, '\0'); - assert(p != NULL); - q = "http"; + vf = VCC_CompileFile(sb, fflag); } - - buf = NULL; - asprintf(&buf, - "backend default {\n" - " set backend.host = \"%*.*s\";\n" - " set backend.port = \"%s\";\n" - "}\n", (int)(p - bflag), (int)(p - bflag), bflag, q); - assert(buf != NULL); - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(sb != NULL); - vf = VCC_Compile(sb, buf, NULL); sbuf_finish(sb); if (sbuf_len(sb) > 0) { fprintf(stderr, "%s", sbuf_data(sb)); - free(buf); sbuf_delete(sb); - return (NULL); + return (1); } sbuf_delete(sb); - free(buf); - return (vf); + vp = mgt_vcc_add("boot", vf); + vp->active = 1; + return (0); } /*--------------------------------------------------------------------*/ -char * -mgt_vcc_file(const char *fflag) +int +mgt_push_vcls_and_start(int *status, char **p) { - char *vf; - struct sbuf *sb; + struct vcls *vp; - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(sb != NULL); - vf = VCC_CompileFile(sb, fflag); - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - fprintf(stderr, "%s", sbuf_data(sb)); - sbuf_delete(sb); - return (NULL); + AZ(pthread_mutex_lock(&vcc_mtx)); + TAILQ_FOREACH(vp, &vclhead, list) { + if (mgt_cli_askchild(status, p, + "config.load %s %s\n", vp->name, vp->fname)) + return (1); + if (vp->active) + if (mgt_cli_askchild(status, p, + "config.use %s\n", vp->name, vp->fname)) + return (1); } - sbuf_delete(sb); - return (vf); + AZ(pthread_mutex_unlock(&vcc_mtx)); + if (mgt_cli_askchild(status, p, "start\n")) + return (1); + return (0); } /*--------------------------------------------------------------------*/ +static void +mgt_vcc_atexit(void) +{ + struct vcls *vp; + + if (getpid() != mgt_pid) + return; + AZ(pthread_mutex_lock(&vcc_mtx)); + TAILQ_FOREACH(vp, &vclhead, list) { + printf("Has %s %s\n", vp->name, vp->fname); + } + while (1) { + vp = TAILQ_FIRST(&vclhead); + if (vp == NULL) + break; + mgt_vcc_del(vp); + } + AZ(pthread_mutex_unlock(&vcc_mtx)); +} + +void mgt_vcc_init(void) { + AZ(pthread_mutex_init(&vcc_mtx, NULL)); VCC_InitCompile(default_vcl); + AZ(atexit(mgt_vcc_atexit)); } +/*--------------------------------------------------------------------*/ -#if 0 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mgt.h" - -static void -m_cli_func_config_inline(struct cli *cli, char **av, void *priv) +void +mcf_config_inline(struct cli *cli, char **av, void *priv) { - char *vf; + char *vf, *p; struct sbuf *sb; + int status; (void)priv; @@ -170,20 +245,26 @@ if (sbuf_len(sb) > 0) { cli_out(cli, "%s", sbuf_data(sb)); sbuf_delete(sb); + cli_result(cli, CLIS_PARAM); return; } sbuf_delete(sb); - cli_suspend(cli); - mgt_child_request(cli_passthrough_cb, cli, NULL, - "config.load %s %s", av[2], vf); + if (mgt_cli_askchild(&status, &p, "config.load %s %s\n", av[2], vf)) { + cli_result(cli, status); + cli_out(cli, "%s", p); + free(p); + return; + } + mgt_vcc_add(av[2], vf); } -/* XXX: m prefix to avoid name clash */ -static void -m_cli_func_config_load(struct cli *cli, char **av, void *priv) +void +mcf_config_load(struct cli *cli, char **av, void *priv) { char *vf; struct sbuf *sb; + int status; + char *p; (void)priv; @@ -194,12 +275,15 @@ if (sbuf_len(sb) > 0) { cli_out(cli, "%s", sbuf_data(sb)); sbuf_delete(sb); + cli_result(cli, CLIS_PARAM); return; } sbuf_delete(sb); - cli_suspend(cli); - mgt_child_request(cli_passthrough_cb, cli, NULL, - "config.load %s %s", av[2], vf); + if (mgt_cli_askchild(&status, &p, "config.load %s %s\n", av[2], vf)) { + cli_result(cli, status); + cli_out(cli, "%s", p); + free(p); + return; + } + mgt_vcc_add(av[2], vf); } - -#endif Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-04 09:19:40 UTC (rev 636) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-04 10:23:51 UTC (rev 637) @@ -363,12 +363,8 @@ usage(); } - if (bflag != NULL) - heritage.vcl_file = mgt_vcc_default(bflag); - else - heritage.vcl_file = mgt_vcc_file(fflag); - if (heritage.vcl_file == NULL) - exit (1); + if (mgt_vcc_default(bflag, fflag)) + exit (2); setup_storage(sflag); setup_hash(hflag); From phk at projects.linpro.no Fri Aug 4 10:54:31 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 12:54:31 +0200 (CEST) Subject: r638 - in trunk/varnish-cache: bin/varnishd include lib/libvcl Message-ID: <20060804105431.0B4611EC563@projects.linpro.no> Author: phk Date: 2006-08-04 12:54:30 +0200 (Fri, 04 Aug 2006) New Revision: 638 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_vcl.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_cli.h trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/include/cli.h trunk/varnish-cache/include/vcl.h trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl Log: Redo VCL program handling. Keep track of all loaded VCL programs in the manager and tell the child to load them via VCL. Don't start he acceptor thread until a "start" command cones down the CLI. XXX: Right now we leak stuff when a VCL program is dicarded Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-04 10:23:51 UTC (rev 637) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-04 10:54:30 UTC (rev 638) @@ -406,7 +406,7 @@ #ifdef CLI_PRIV_H cli_func_t cli_func_config_list; cli_func_t cli_func_config_load; -cli_func_t cli_func_config_unload; +cli_func_t cli_func_config_discard; cli_func_t cli_func_config_use; #endif Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-04 10:23:51 UTC (rev 637) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-04 10:54:30 UTC (rev 638) @@ -44,7 +44,7 @@ { CLI_URL_PURGE, cli_func_url_purge }, { CLI_CONFIG_LOAD, cli_func_config_load }, { CLI_CONFIG_LIST, cli_func_config_list }, - { CLI_CONFIG_UNLOAD, cli_func_config_unload }, + { CLI_CONFIG_DISCARD, cli_func_config_discard }, { CLI_CONFIG_USE, cli_func_config_use }, { NULL } }; Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-04 10:23:51 UTC (rev 637) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-04 10:54:30 UTC (rev 638) @@ -25,6 +25,7 @@ const char *name; void *dlh; struct VCL_conf *conf; + int discard; }; /* @@ -58,10 +59,24 @@ void VCL_Rel(struct VCL_conf *vc) { + struct vcls *vcl; AZ(pthread_mutex_lock(&vcl_mtx)); + assert(vc->busy > 0); vc->busy--; + vcl = vc->priv; /* XXX miniobj */ + if (vc->busy == 0 && vcl_active != vcl) { + /* XXX: purge backends */ + } + if (vc->busy == 0 && vcl->discard) { + TAILQ_REMOVE(&vcl_head, vcl, list); + } else { + vcl = NULL; + } AZ(pthread_mutex_unlock(&vcl_mtx)); + if (vcl != NULL) { + /* XXX: dispose of vcl */ + } } /*--------------------------------------------------------------------*/ @@ -114,6 +129,7 @@ free(vcl); return (1); } + if (vcl->conf->magic != VCL_CONF_MAGIC) { if (cli == NULL) fprintf(stderr, "Wrong VCL_CONF_MAGIC\n"); @@ -123,6 +139,7 @@ free(vcl); return (1); } + vcl->conf->priv = vcl; vcl->name = strdup(name); assert(vcl->name != NULL); TAILQ_INSERT_TAIL(&vcl_head, vcl, list); @@ -167,12 +184,34 @@ } void -cli_func_config_unload(struct cli *cli, char **av, void *priv) +cli_func_config_discard(struct cli *cli, char **av, void *priv) { + struct vcls *vcl; (void)av; (void)priv; - cli_result(cli, CLIS_UNIMPL); + vcl = vcl_find(av[2]); + if (vcl->discard) { + cli_result(cli, CLIS_PARAM); + cli_out(cli, "VCL %s already discarded", av[2]); + return; + } + AZ(pthread_mutex_lock(&vcl_mtx)); + if (vcl == vcl_active) { + AZ(pthread_mutex_unlock(&vcl_mtx)); + cli_result(cli, CLIS_PARAM); + cli_out(cli, "VCL %s is the active VCL", av[2]); + return; + } + vcl->discard = 1; + if (vcl->conf->busy == 0) + TAILQ_REMOVE(&vcl_head, vcl, list); + else + vcl = NULL; + AZ(pthread_mutex_unlock(&vcl_mtx)); + if (vcl != NULL) { + /* XXX dispose of vcl */ + } } void @@ -183,14 +222,19 @@ (void)av; (void)priv; vcl = vcl_find(av[2]); - if (vcl != NULL) { - AZ(pthread_mutex_lock(&vcl_mtx)); - vcl_active = vcl; - AZ(pthread_mutex_unlock(&vcl_mtx)); - } else { - cli_out(cli, "No config named '%s' loaded", av[2]); + if (vcl == NULL) { + cli_out(cli, "No VCL named '%s'", av[2]); cli_result(cli, CLIS_PARAM); + return; } + if (vcl->discard) { + cli_out(cli, "VCL '%s' has been discarded", av[2]); + cli_result(cli, CLIS_PARAM); + return; + } + AZ(pthread_mutex_lock(&vcl_mtx)); + vcl_active = vcl; + AZ(pthread_mutex_unlock(&vcl_mtx)); } /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 10:23:51 UTC (rev 637) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 10:54:30 UTC (rev 638) @@ -111,6 +111,8 @@ { CLI_STATS, mcf_stats, NULL }, { CLI_CONFIG_LOAD, mcf_config_load, NULL }, { CLI_CONFIG_INLINE, mcf_config_inline, NULL }, + { CLI_CONFIG_USE, mcf_config_use, NULL }, + { CLI_CONFIG_DISCARD, mcf_config_discard, NULL }, #if 0 { CLI_SERVER_STOP, m_cli_func_server_stop, NULL }, { CLI_SERVER_RESTART }, Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.h 2006-08-04 10:23:51 UTC (rev 637) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.h 2006-08-04 10:54:30 UTC (rev 638) @@ -8,3 +8,5 @@ /* mgt_vcc.c */ cli_func_t mcf_config_load; cli_func_t mcf_config_inline; +cli_func_t mcf_config_use; +cli_func_t mcf_config_discard; Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-04 10:23:51 UTC (rev 637) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-04 10:54:30 UTC (rev 638) @@ -206,9 +206,6 @@ if (getpid() != mgt_pid) return; AZ(pthread_mutex_lock(&vcc_mtx)); - TAILQ_FOREACH(vp, &vclhead, list) { - printf("Has %s %s\n", vp->name, vp->fname); - } while (1) { vp = TAILQ_FIRST(&vclhead); if (vp == NULL) @@ -287,3 +284,71 @@ } mgt_vcc_add(av[2], vf); } + +static struct vcls * +mcf_find_vcl(struct cli *cli, const char *name) +{ + struct vcls *vp; + + TAILQ_FOREACH(vp, &vclhead, list) + if (!strcmp(vp->name, name)) + break; + if (vp == NULL) { + cli_result(cli, CLIS_PARAM); + cli_out(cli, "No configuration named %s known.", name); + } + return (vp); +} + +void +mcf_config_use(struct cli *cli, char **av, void *priv) +{ + int status; + char *p; + struct vcls *vp; + + (void)priv; + AZ(pthread_mutex_lock(&vcc_mtx)); + vp = mcf_find_vcl(cli, av[2]); + if (vp != NULL && vp->active == 0) { + if (mgt_cli_askchild(&status, &p, "config.use %s\n", av[2])) { + cli_result(cli, status); + cli_out(cli, "%s", p); + free(p); + } else { + vp->active = 2; + TAILQ_FOREACH(vp, &vclhead, list) { + if (vp->active == 1) + vp->active = 0; + else if (vp->active == 2) + vp->active = 1; + } + } + } + AZ(pthread_mutex_unlock(&vcc_mtx)); +} + +void +mcf_config_discard(struct cli *cli, char **av, void *priv) +{ + int status; + char *p; + struct vcls *vp; + (void)priv; + AZ(pthread_mutex_lock(&vcc_mtx)); + vp = mcf_find_vcl(cli, av[2]); + if (vp != NULL && vp->active) { + cli_result(cli, CLIS_PARAM); + cli_out(cli, "Cannot discard active VCL program\n"); + } else if (vp != NULL) { + if (mgt_cli_askchild(&status, &p, + "config.discard %s\n", av[2])) { + cli_result(cli, status); + cli_out(cli, "%s", p); + free(p); + } else { + AZ(mgt_vcc_delbyname(av[2])); + } + } + AZ(pthread_mutex_unlock(&vcc_mtx)); +} Modified: trunk/varnish-cache/include/cli.h =================================================================== --- trunk/varnish-cache/include/cli.h 2006-08-04 10:23:51 UTC (rev 637) +++ trunk/varnish-cache/include/cli.h 2006-08-04 10:54:30 UTC (rev 638) @@ -59,9 +59,9 @@ "\tCompile and load the VCL data under the name provided.", \ 2, 2 -#define CLI_CONFIG_UNLOAD \ - "config.unload", \ - "config.unload ", \ +#define CLI_CONFIG_DISCARD \ + "config.discard", \ + "config.discard ", \ "\tUnload the named configuration (when possible).", \ 1, 1 Modified: trunk/varnish-cache/include/vcl.h =================================================================== --- trunk/varnish-cache/include/vcl.h 2006-08-04 10:23:51 UTC (rev 637) +++ trunk/varnish-cache/include/vcl.h 2006-08-04 10:54:30 UTC (rev 638) @@ -22,6 +22,8 @@ unsigned nref; unsigned busy; + void *priv; + vcl_init_f *init_func; vcl_fini_f *fini_func; Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2006-08-04 10:23:51 UTC (rev 637) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2006-08-04 10:54:30 UTC (rev 638) @@ -455,6 +455,8 @@ fputs(" unsigned nref;\n", f); fputs(" unsigned busy;\n", f); fputs("\n", f); + fputs(" void *priv;\n", f); + fputs("\n", f); fputs(" vcl_init_f *init_func;\n", f); fputs(" vcl_fini_f *fini_func;\n", f); fputs("\n", f); Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2006-08-04 10:23:51 UTC (rev 637) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2006-08-04 10:54:30 UTC (rev 638) @@ -110,6 +110,8 @@ unsigned nref; unsigned busy; + void *priv; + vcl_init_f *init_func; vcl_fini_f *fini_func; } From phk at projects.linpro.no Fri Aug 4 11:10:57 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 13:10:57 +0200 (CEST) Subject: r639 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804111057.791941EC55E@projects.linpro.no> Author: phk Date: 2006-08-04 13:10:57 +0200 (Fri, 04 Aug 2006) New Revision: 639 Modified: trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_cli.h trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: Now that we keep track of loaded VCLs in the manager, we might as well allow their manipulation also when the child is not running. Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-04 10:54:30 UTC (rev 638) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-04 11:10:57 UTC (rev 639) @@ -8,7 +8,7 @@ void mgt_run(int dflag); void mgt_start_child(void); void mgt_stop_child(void); -extern pid_t mgt_pid; +extern pid_t mgt_pid, child_pid; /* mgt_cli.c */ Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-04 10:54:30 UTC (rev 638) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-04 11:10:57 UTC (rev 639) @@ -25,8 +25,8 @@ #include "mgt_cli.h" pid_t mgt_pid; +pid_t child_pid = -1; -static pid_t child_pid = -1; static int child_fds[2]; static unsigned child_should_run; static pthread_t child_listen_thread; Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 10:54:30 UTC (rev 638) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-04 11:10:57 UTC (rev 639) @@ -113,6 +113,7 @@ { CLI_CONFIG_INLINE, mcf_config_inline, NULL }, { CLI_CONFIG_USE, mcf_config_use, NULL }, { CLI_CONFIG_DISCARD, mcf_config_discard, NULL }, + { CLI_CONFIG_LIST, mcf_config_list, NULL }, #if 0 { CLI_SERVER_STOP, m_cli_func_server_stop, NULL }, { CLI_SERVER_RESTART }, Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.h 2006-08-04 10:54:30 UTC (rev 638) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.h 2006-08-04 11:10:57 UTC (rev 639) @@ -10,3 +10,4 @@ cli_func_t mcf_config_inline; cli_func_t mcf_config_use; cli_func_t mcf_config_discard; +cli_func_t mcf_config_list; Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-04 10:54:30 UTC (rev 638) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-04 11:10:57 UTC (rev 639) @@ -246,7 +246,8 @@ return; } sbuf_delete(sb); - if (mgt_cli_askchild(&status, &p, "config.load %s %s\n", av[2], vf)) { + if (child_pid >= 0 && + mgt_cli_askchild(&status, &p, "config.load %s %s\n", av[2], vf)) { cli_result(cli, status); cli_out(cli, "%s", p); free(p); @@ -276,7 +277,8 @@ return; } sbuf_delete(sb); - if (mgt_cli_askchild(&status, &p, "config.load %s %s\n", av[2], vf)) { + if (child_pid >= 0 && + mgt_cli_askchild(&status, &p, "config.load %s %s\n", av[2], vf)) { cli_result(cli, status); cli_out(cli, "%s", p); free(p); @@ -334,6 +336,7 @@ int status; char *p; struct vcls *vp; + (void)priv; AZ(pthread_mutex_lock(&vcc_mtx)); vp = mcf_find_vcl(cli, av[2]); @@ -352,3 +355,29 @@ } AZ(pthread_mutex_unlock(&vcc_mtx)); } + +void +mcf_config_list(struct cli *cli, char **av, void *priv) +{ + int status; + char *p; + struct vcls *vp; + + (void)av; + (void)priv; + if (child_pid >= 0) { + mgt_cli_askchild(&status, &p, "config.list\n"); + cli_result(cli, status); + cli_out(cli, "%s", p); + free(p); + } else { + AZ(pthread_mutex_lock(&vcc_mtx)); + TAILQ_FOREACH(vp, &vclhead, list) { + cli_out(cli, "%s %6s %s\n", + vp->active ? "*" : " ", + "N/A", vp->name); + } + AZ(pthread_mutex_unlock(&vcc_mtx)); + } +} + From phk at projects.linpro.no Fri Aug 4 19:36:36 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 21:36:36 +0200 (CEST) Subject: r640 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804193636.3DED31EC4CF@projects.linpro.no> Author: phk Date: 2006-08-04 21:36:35 +0200 (Fri, 04 Aug 2006) New Revision: 640 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_pass.c trunk/varnish-cache/bin/varnishd/cache_pipe.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/cache_session.c Log: More comprehensive performance stats and a few asserts, just in case. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-04 11:10:57 UTC (rev 639) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-04 19:36:35 UTC (rev 640) @@ -235,7 +235,9 @@ const char *doclose; struct http *http; + struct timespec t_open; struct timespec t_req; + struct timespec t_resp; struct timespec t_idle; enum step step; Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-04 11:10:57 UTC (rev 639) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-04 19:36:35 UTC (rev 640) @@ -49,6 +49,7 @@ sp = SES_New(addr, l); assert(sp != NULL); /* XXX handle */ + (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); sp->fd = i; sp->id = i; @@ -246,6 +247,7 @@ SES_Delete(sp); return; } + (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); } @@ -364,6 +366,7 @@ SES_Delete(sp); return; } + (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); if (http_RecvPrepAgain(sp->http)) vca_handover(sp, 0); Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-04 11:10:57 UTC (rev 639) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-04 19:36:35 UTC (rev 640) @@ -195,8 +195,10 @@ TAILQ_REMOVE(&bp->connlist, vc, list); } else { vc2 = TAILQ_FIRST(&vbe_head); - if (vc2 != NULL) + if (vc2 != NULL) { + VSL_stats->backend_unused--; TAILQ_REMOVE(&vbe_head, vc2, list); + } } AZ(pthread_mutex_unlock(&vbemtx)); if (vc == NULL) @@ -229,6 +231,7 @@ if (vc->fd < 0) { vc->backend = NULL; TAILQ_INSERT_HEAD(&vbe_head, vc, list); + VSL_stats->backend_unused++; vc = NULL; } else { vc->backend = bp; @@ -262,6 +265,7 @@ vc->backend = NULL; AZ(pthread_mutex_lock(&vbemtx)); TAILQ_INSERT_HEAD(&vbe_head, vc, list); + VSL_stats->backend_unused++; AZ(pthread_mutex_unlock(&vbemtx)); } Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-04 11:10:57 UTC (rev 639) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-04 19:36:35 UTC (rev 640) @@ -79,9 +79,21 @@ DOT ] */ +static double +cnt_dt(struct timespec *t1, struct timespec *t2) +{ + double dt; + + dt = (t2->tv_sec - t1->tv_sec); + dt += (t2->tv_nsec - t1->tv_nsec) * 1e-9; + return (dt); +} + static int cnt_done(struct sess *sp) { + double dh, dp, da; + struct timespec te; assert(sp->obj == NULL); assert(sp->vbc == NULL); @@ -90,6 +102,14 @@ VCL_Rel(sp->vcl); sp->vcl = NULL; + clock_gettime(CLOCK_REALTIME, &te); + dh = cnt_dt(&sp->t_open, &sp->t_req); + dp = cnt_dt(&sp->t_req, &sp->t_resp); + da = cnt_dt(&sp->t_resp, &te); + VSL(SLT_ReqServTime, sp->fd, "%u %ld.%09ld %.9f %.9f %.9f", + sp->xid, (long)sp->t_req.tv_sec, (long)sp->t_req.tv_nsec, + dh, dp, da); + SES_Charge(sp); vca_return_session(sp); return (1); @@ -523,6 +543,7 @@ char *b; sp->t0 = time(NULL); + assert(sp->vcl == NULL); sp->vcl = VCL_Get(); assert(sp->obj == NULL); Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-04 11:10:57 UTC (rev 639) +++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-04 19:36:35 UTC (rev 640) @@ -149,6 +149,8 @@ assert(vc != NULL); sp->vbc = NULL; + clock_gettime(CLOCK_REALTIME, &sp->t_resp); + http_ClrHeader(sp->http); http_CopyResp(sp->fd, sp->http, vc->http); http_FilterHeader(sp->fd, sp->http, vc->http, HTTPH_A_PASS); Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-04 11:10:57 UTC (rev 639) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-04 19:36:35 UTC (rev 640) @@ -68,6 +68,8 @@ return; } + clock_gettime(CLOCK_REALTIME, &sp->t_resp); + memset(fds, 0, sizeof fds); fds[0].fd = vc->fd; fds[0].events = POLLIN | POLLERR; Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-04 11:10:57 UTC (rev 639) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-04 19:36:35 UTC (rev 640) @@ -128,15 +128,9 @@ { struct storage *st; unsigned u = 0; - double dt; - struct timespec t_resp; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - clock_gettime(CLOCK_REALTIME, &t_resp); - dt = (t_resp.tv_sec - sp->t_req.tv_sec); - dt += (t_resp.tv_nsec - sp->t_req.tv_nsec) * 1e-9; - VSL(SLT_ReqServTime, sp->fd, "%ld.%09ld %.9f", - (long)sp->t_req.tv_sec, (long)sp->t_req.tv_nsec, dt); + clock_gettime(CLOCK_REALTIME, &sp->t_resp); if (sp->obj->response == 200 && sp->http->conds && res_do_conds(sp)) return; Modified: trunk/varnish-cache/bin/varnishd/cache_session.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-04 11:10:57 UTC (rev 639) +++ trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-04 19:36:35 UTC (rev 640) @@ -217,6 +217,8 @@ struct acct *b = &sp->acct; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + assert(sp->obj == NULL); + assert(sp->vcl == NULL); VSL_stats->n_sess--; ses_relsrcaddr(sp); VSL(SLT_StatSess, sp->id, "%s %s %d %ju %ju %ju %ju %ju %ju %ju", From phk at projects.linpro.no Fri Aug 4 19:36:50 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 21:36:50 +0200 (CEST) Subject: r641 - trunk/varnish-cache/include Message-ID: <20060804193650.A31F81EC566@projects.linpro.no> Author: phk Date: 2006-08-04 21:36:50 +0200 (Fri, 04 Aug 2006) New Revision: 641 Modified: trunk/varnish-cache/include/stat_field.h Log: Stats field changes Modified: trunk/varnish-cache/include/stat_field.h =================================================================== --- trunk/varnish-cache/include/stat_field.h 2006-08-04 19:36:35 UTC (rev 640) +++ trunk/varnish-cache/include/stat_field.h 2006-08-04 19:36:50 UTC (rev 641) @@ -9,6 +9,7 @@ MAC_STAT(backend_conn, uint64_t, "u", "Backend connections initiated") MAC_STAT(backend_recycle, uint64_t, "u", "Backend connections recyles") +MAC_STAT(backend_unused, uint64_t, "u", "Backend connections unused") MAC_STAT(n_srcaddr, uint64_t, "u", "N struct srcaddr") MAC_STAT(n_srcaddr_act, uint64_t, "u", "N active struct srcaddr") @@ -16,7 +17,6 @@ MAC_STAT(n_object, uint64_t, "u", "N struct object") MAC_STAT(n_objecthead, uint64_t, "u", "N struct objecthead") MAC_STAT(n_smf, uint64_t, "u", "N struct smf") -MAC_STAT(n_vbe, uint64_t, "u", "N struct vbe") MAC_STAT(n_vbe_conn, uint64_t, "u", "N struct vbe_conn") MAC_STAT(n_wrk, uint64_t, "u", "N worker threads") MAC_STAT(n_wrk_create, uint64_t, "u", "N worker threads created") From phk at projects.linpro.no Fri Aug 4 19:42:37 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 21:42:37 +0200 (CEST) Subject: r642 - trunk/varnish-cache/bin/varnishd Message-ID: <20060804194237.DC05D1EC567@projects.linpro.no> Author: phk Date: 2006-08-04 21:42:37 +0200 (Fri, 04 Aug 2006) New Revision: 642 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: Use id for printing Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-04 19:36:50 UTC (rev 641) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-04 19:42:37 UTC (rev 642) @@ -106,7 +106,7 @@ dh = cnt_dt(&sp->t_open, &sp->t_req); dp = cnt_dt(&sp->t_req, &sp->t_resp); da = cnt_dt(&sp->t_resp, &te); - VSL(SLT_ReqServTime, sp->fd, "%u %ld.%09ld %.9f %.9f %.9f", + VSL(SLT_ReqServTime, sp->id, "%u %ld.%09ld %.9f %.9f %.9f", sp->xid, (long)sp->t_req.tv_sec, (long)sp->t_req.tv_nsec, dh, dp, da); From phk at projects.linpro.no Fri Aug 4 20:03:36 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 4 Aug 2006 22:03:36 +0200 (CEST) Subject: r643 - trunk/varnish-cache/lib/libvarnishapi Message-ID: <20060804200336.34B021EC568@projects.linpro.no> Author: phk Date: 2006-08-04 22:03:36 +0200 (Fri, 04 Aug 2006) New Revision: 643 Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c Log: Initialize all directions to "opposite" for -b and -c to avoid spurious first entries. Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-04 19:42:37 UTC (rev 642) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-04 20:03:36 UTC (rev 643) @@ -122,6 +122,12 @@ vd->logend = vd->logstart + vsl_lh->size; vd->ptr = vd->logstart; + if (vd->b_opt) + memset(vd->dir, 1, sizeof vd->dir); + + if (vd->c_opt) + memset(vd->dir, 2, sizeof vd->dir); + if (!vd->d_opt) while (vsl_nextlog(vd, &p) == 1) continue; From andersb at projects.linpro.no Sat Aug 5 01:17:47 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Sat, 5 Aug 2006 03:17:47 +0200 (CEST) Subject: r644 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060805011747.DBC941EC569@projects.linpro.no> Author: andersb Date: 2006-08-05 03:17:47 +0200 (Sat, 05 Aug 2006) New Revision: 644 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Got the IP, Request and User-Agent sorted out. Working on the time Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-04 20:03:36 UTC (rev 643) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-05 01:17:47 UTC (rev 644) @@ -20,6 +20,7 @@ #include #include #include +#include #include "shmlog.h" #include "varnishapi.h" @@ -37,7 +38,7 @@ // int y; // unsigned char *df_l; // Datafield for %l // unsigned char *df_u; // Datafield for %u - // unsigned char *df_t; // Datafield for %t + struct tm *logline_time; // Datafield for %t unsigned char *df_r; // Datafield for %r // unsigned char *df_s; // Datafield for %s // unsigned char *df_b; // Datafield for %b @@ -81,11 +82,16 @@ unsigned u; int i,j; unsigned char *tmpPtr; + char *tmpPtra; + char *tmpPtrb; + char *tmpPtrc; // Declare the int's that are used to determin if we have all data. - int ll_h = 0; // %h - int ll_U = 0; // %{User-agent}i + int timesec = 0; // Where we store the utime for request as int. + char temp_time[27]; // Where we store the string we take from the log // Declare the data where we store the differnt parts + time_t req_time; + if (w_opt != NULL){ // printf(" Has w_opt\n"); } else { @@ -98,6 +104,9 @@ assert(ob[u] != NULL); } //printf("Hele [%d]: %s %s\n",u, p+4); + + i = 0; + switch (p[0]) { // XXX remember to check for NULL when strdup, if no allocate @@ -167,14 +176,48 @@ break; + case SLT_ReqServTime: + + // First clear temp_time + temp_time[0] = '\0'; + + tmpPtrb = strdup(p + 4); + + for ( tmpPtra = strtok(tmpPtrb," "); tmpPtra != NULL; tmpPtra = strtok(NULL, " ")){ + if (i = 1){ + tmpPtrc = tmpPtra; + } + printf("ReqServTime number %d: %s\n", i, tmpPtra); + + i++; + } + + + //printf("Br: %s\n",tmpPtrc); + + /* + tmpPtr = strchr(tmpPtrc, '.'); + j = strlen(tmpPtrc) - strlen(tmpPtr); // length of timestamp + strncpy(temp_time, tmpPtrc, j); + temp_time[j] = '\0'; + printf("j: %s",temp_time); + timesec = atoi(temp_time); + */ + timesec = 1; + req_time = timesec; + ll[u].logline_time = localtime(&req_time); + strftime (temp_time, 50, "[%d/%b/%Y:%X %z] ", ll[u].logline_time); + + break; + case SLT_SessionClose: if (p[1] >= 7 && !strncasecmp((void *)&p[4], "timeout",7)){ - printf("Timeout...\n"); + //printf("Timeout...\n"); } else{ - printf("%s ", ll[u].df_h); + printf("%s %s", ll[u].df_h, temp_time); sbuf_finish(ob[u]); printf("\"%s\"", sbuf_data(ob[u])); printf(" \"%s\"\n", ll[u].df_U); @@ -200,7 +243,7 @@ } - printf("%s ", ll[u].df_h); + printf("%s %s", ll[u].df_h, temp_time); sbuf_finish(ob[u]); printf("\"%s\"", sbuf_data(ob[u])); printf(" \"%s\"\n", ll[u].df_U); From phk at projects.linpro.no Sat Aug 5 08:19:41 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 10:19:41 +0200 (CEST) Subject: r645 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805081941.64D2B1EC53D@projects.linpro.no> Author: phk Date: 2006-08-05 10:19:41 +0200 (Sat, 05 Aug 2006) New Revision: 645 Added: trunk/varnish-cache/bin/varnishd/mgt_event.c trunk/varnish-cache/bin/varnishd/mgt_event.h Modified: trunk/varnish-cache/bin/varnishd/Makefile.am Log: Add a miniature event engine based on poll(2). It's general enough to find other uses, but right now it's only for the manager process. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-05 01:17:47 UTC (rev 644) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-05 08:19:41 UTC (rev 645) @@ -13,6 +13,7 @@ heritage.h \ mgt.h \ mgt_cli.h \ + mgt_event.h \ stevedore.h \ \ cache_acceptor.c \ @@ -39,6 +40,7 @@ hash_classic.c \ mgt_child.c \ mgt_cli.c \ + mgt_event.c \ mgt_vcc.c \ rfc2616.c \ shmlog.c \ Added: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 01:17:47 UTC (rev 644) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 08:19:41 UTC (rev 645) @@ -0,0 +1,290 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include +#include + +#include "mgt_event.h" +#include "miniobj.h" +#include "binary_heap.h" + +struct evbase { + unsigned magic; +#define EVBASE_MAGIC 0x0cfd976f + TAILQ_HEAD(,ev) events; + struct pollfd *pfd; + unsigned npfd; + unsigned lpfd; + struct binheap *binheap; + unsigned char compact_pfd; + unsigned char disturbed; +}; + +/*--------------------------------------------------------------------*/ + +static double +ev_now(void) +{ + double t; + struct timespec ts; + + assert(clock_gettime(CLOCK_MONOTONIC, &ts) == 0); + t = ts.tv_sec + ts.tv_nsec * 1e-9; + return (t); +} + +/*--------------------------------------------------------------------*/ + +static void +ev_bh_update(void *priv, void *a, unsigned u) +{ + struct evbase *evb; + struct ev *e; + + CAST_OBJ_NOTNULL(evb, priv, EVBASE_MAGIC); + CAST_OBJ_NOTNULL(e, a, EV_MAGIC); + e->__binheap_idx = u; +} + +static int +ev_bh_cmp(void *priv, void *a, void *b) +{ + struct evbase *evb; + struct ev *ea, *eb; + + CAST_OBJ_NOTNULL(evb, priv, EVBASE_MAGIC); + CAST_OBJ_NOTNULL(ea, a, EV_MAGIC); + CAST_OBJ_NOTNULL(eb, b, EV_MAGIC); + return (ea->__when < eb->__when); +} + +/*--------------------------------------------------------------------*/ + +struct evbase * +ev_new_base(void) +{ + struct evbase *evb; + + evb = calloc(sizeof *evb, 1); + if (!evb) + return (evb); + evb->magic = EVBASE_MAGIC; + TAILQ_INIT(&evb->events); + evb->npfd = 1; + evb->pfd = calloc(sizeof *evb->pfd, evb->npfd); + if (evb->pfd == NULL) { + free(evb); + return (NULL); + } + evb->binheap = binheap_new(evb, ev_bh_cmp, ev_bh_update); + return (evb); +} + +/*--------------------------------------------------------------------*/ + +void +ev_destroy_base(struct evbase *evb) +{ + CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); + evb->magic = 0; + free(evb); +} + +/*--------------------------------------------------------------------*/ + +static int +ev_get_pfd(struct evbase *evb) +{ + unsigned u; + void *p; + + if (evb->lpfd <= evb->npfd) + return (0); + + if (evb->npfd > 256) + u = evb->npfd + 256; + else + u = evb->npfd * 2; + p = realloc(evb->pfd, sizeof *evb->pfd * u); + if (p == NULL) + return (1); + evb->npfd = u; + evb->pfd = p; + return (0); +} + +/*--------------------------------------------------------------------*/ + +int +ev_add(struct evbase *evb, struct ev *e) +{ + + CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); + assert(e->magic != EV_MAGIC); + assert(e->callback != NULL); + + if (e->timeout < 0.0) + return (EINVAL); + + if (e->fd >= 0) { + if (ev_get_pfd(evb)) + return (ENOMEM); + evb->pfd[evb->lpfd].fd = e->fd; + evb->pfd[evb->lpfd].events = + e->flags & (EV_RD|EV_WR|EV_ERR|EV_HUP); + e->__poll_idx = evb->lpfd; + evb->lpfd++; + } + + if (e->timeout != 0.0) { + e->__when += ev_now() + e->timeout; + binheap_insert(evb->binheap, e); + } else { + e->__when = 0.0; + } + + e->magic = EV_MAGIC; + e->__evb = evb; + e->__binheap_idx = 0; + e->__privflags = 0; + e->__poll_idx = -1; + if (e->fd < 0) + TAILQ_INSERT_TAIL(&evb->events, e, __list); + else + TAILQ_INSERT_HEAD(&evb->events, e, __list); + + return (0); +} + +/*--------------------------------------------------------------------*/ + +void +ev_del(struct evbase *evb, struct ev *e) +{ + CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); + CHECK_OBJ_NOTNULL(e, EV_MAGIC); + assert(evb == e->__evb); + + if (e->__binheap_idx != 0) + binheap_delete(evb->binheap, e->__binheap_idx); + assert(e->__binheap_idx == 0); + + if (e->fd >= 0) { + evb->pfd[e->__poll_idx].fd = -1; + evb->compact_pfd++; + e->fd = -1; + } + + TAILQ_REMOVE(&evb->events, e, __list); + + e->magic = 0; + e->__evb = NULL; + + evb->disturbed = 1; +} + +/*--------------------------------------------------------------------*/ + +int +ev_schedule(struct evbase *evb) +{ + int i; + + CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); + do + i = ev_schedule(evb); + while (i == 1); + return (i); +} + +/*--------------------------------------------------------------------*/ + +static void +ev_compact_pfd(struct evbase *evb) +{ + /* XXX TBD */ + evb->compact_pfd = 0; +} + +/*--------------------------------------------------------------------*/ + +static void +ev_sched_timeout(struct evbase *evb, struct ev *e, double t) +{ + int i; + + i = e->callback(e, 0); + if (i) { + ev_del(evb, e); + } else { + e->__when += t + e->timeout; + binheap_delete(evb->binheap, 0); + binheap_insert(evb->binheap, e); + } +} + +int +ev_schedule_one(struct evbase *evb) +{ + double t; + struct ev *e, *e2; + int i, j, tmo; + struct pollfd *pfd; + + CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); + e = binheap_root(evb->binheap); + if (e != NULL) { + CHECK_OBJ_NOTNULL(e, EV_MAGIC); + t = ev_now(); + if (e->__when <= t) { + ev_sched_timeout(evb, e, t); + return (1); + } + tmo = (e->__when - t) * 1e3; + } else + tmo = INFTIM; + + if (evb->compact_pfd) + ev_compact_pfd(evb); + + if (tmo == INFTIM && evb->lpfd == 0) + return (0); + i = poll(evb->pfd, evb->lpfd, tmo); + if (i == 0) { + assert(e != NULL); + t = ev_now(); + if (e->__when <= t) + ev_sched_timeout(evb, e, t); + return (1); + } + evb->disturbed = 0; + TAILQ_FOREACH_SAFE(e, &evb->events, __list, e2) { + if (i == 0) + break; + if (e->fd < 0) + continue; + assert(e->__poll_idx < evb->lpfd); + pfd = &evb->pfd[e->__poll_idx]; + assert(pfd->fd == e->fd); + assert(pfd->events == e->flags); + if (!pfd->revents) + continue; + j = e->callback(e, pfd->revents); + i--; + if (evb->disturbed) { + TAILQ_FOREACH(e2, &evb->events, __list) + if (e2 == e) + break; + assert(e2 == e); + e2 = TAILQ_NEXT(e, __list); + evb->disturbed = 0; + } + if (j) + ev_del(evb, e); + } + return (1); +} Added: trunk/varnish-cache/bin/varnishd/mgt_event.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.h 2006-08-05 01:17:47 UTC (rev 644) +++ trunk/varnish-cache/bin/varnishd/mgt_event.h 2006-08-05 08:19:41 UTC (rev 645) @@ -0,0 +1,41 @@ + +#include "queue.h" + +struct ev; +struct evbase; + +typedef int ev_cb_f(struct ev *, unsigned what); + +struct ev { + unsigned magic; +#define EV_MAGIC 0x15c8134b + + /* pub */ + int fd; + unsigned flags; +#define EV_RD POLLIN +#define EV_WR POLLOUT +#define EV_ERR POLLERR +#define EV_HUP POLLHUP + double timeout; + ev_cb_f *callback; + void *priv; + + /* priv */ + double __when; + TAILQ_ENTRY(ev) __list; + unsigned __binheap_idx; + unsigned __privflags; + struct evbase *__evb; + int __poll_idx; +}; + +struct evbase; + +struct evbase *ev_new_base(void); +void ev_destroy_base(struct evbase *evb); +int ev_add(struct evbase *evb, struct ev *e); +void ev_del(struct evbase *evb, struct ev *e); + +int ev_schedule_one(struct evbase *evb); +int ev_schedule(struct evbase *evb); From phk at projects.linpro.no Sat Aug 5 08:49:54 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 10:49:54 +0200 (CEST) Subject: r646 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805084954.3FAF21EC564@projects.linpro.no> Author: phk Date: 2006-08-05 10:49:54 +0200 (Sat, 05 Aug 2006) New Revision: 646 Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c trunk/varnish-cache/bin/varnishd/mgt_event.h Log: bugfixes Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 08:19:41 UTC (rev 645) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 08:49:54 UTC (rev 646) @@ -138,7 +138,8 @@ e->flags & (EV_RD|EV_WR|EV_ERR|EV_HUP); e->__poll_idx = evb->lpfd; evb->lpfd++; - } + } else + e->__poll_idx = -1; if (e->timeout != 0.0) { e->__when += ev_now() + e->timeout; @@ -151,7 +152,6 @@ e->__evb = evb; e->__binheap_idx = 0; e->__privflags = 0; - e->__poll_idx = -1; if (e->fd < 0) TAILQ_INSERT_TAIL(&evb->events, e, __list); else @@ -196,7 +196,7 @@ CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); do - i = ev_schedule(evb); + i = ev_schedule_one(evb); while (i == 1); return (i); } @@ -220,6 +220,7 @@ i = e->callback(e, 0); if (i) { ev_del(evb, e); + free(e); } else { e->__when += t + e->timeout; binheap_delete(evb->binheap, 0); @@ -273,7 +274,9 @@ assert(pfd->events == e->flags); if (!pfd->revents) continue; +printf("Call %p %s (%u)\n", e, e->name, pfd->revents); j = e->callback(e, pfd->revents); +printf("Back from %p %s (%u)\n", e, e->name, pfd->revents); i--; if (evb->disturbed) { TAILQ_FOREACH(e2, &evb->events, __list) @@ -283,8 +286,10 @@ e2 = TAILQ_NEXT(e, __list); evb->disturbed = 0; } - if (j) + if (j) { ev_del(evb, e); + free(e); + } } return (1); } Modified: trunk/varnish-cache/bin/varnishd/mgt_event.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.h 2006-08-05 08:19:41 UTC (rev 645) +++ trunk/varnish-cache/bin/varnishd/mgt_event.h 2006-08-05 08:49:54 UTC (rev 646) @@ -1,4 +1,5 @@ +#include #include "queue.h" struct ev; @@ -11,6 +12,7 @@ #define EV_MAGIC 0x15c8134b /* pub */ + const char *name; int fd; unsigned flags; #define EV_RD POLLIN From phk at projects.linpro.no Sat Aug 5 09:27:57 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 11:27:57 +0200 (CEST) Subject: r647 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805092757.6B2781EC564@projects.linpro.no> Author: phk Date: 2006-08-05 11:27:57 +0200 (Sat, 05 Aug 2006) New Revision: 647 Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c trunk/varnish-cache/bin/varnishd/mgt_event.h Log: Add signal support. Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 08:49:54 UTC (rev 646) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 09:27:57 UTC (rev 647) @@ -2,16 +2,29 @@ * $Id$ */ +#include #include #include #include #include +#include +#include #include #include "mgt_event.h" #include "miniobj.h" #include "binary_heap.h" +struct evsig { + struct evbase *evb; + struct ev *ev; + struct sigaction sigact; + unsigned char happened; +}; + +static struct evsig *ev_sigs; +static unsigned ev_nsig; + struct evbase { unsigned magic; #define EVBASE_MAGIC 0x0cfd976f @@ -64,6 +77,64 @@ /*--------------------------------------------------------------------*/ +static int +ev_get_pfd(struct evbase *evb) +{ + unsigned u; + void *p; + + if (evb->lpfd < evb->npfd) + return (0); + + if (evb->npfd > 256) + u = evb->npfd + 256; + else if (evb->npfd > 8) + u = evb->npfd * 2; + else + u = 8; + p = realloc(evb->pfd, sizeof *evb->pfd * u); + if (p == NULL) + return (1); + evb->npfd = u; + evb->pfd = p; + return (0); +} + +/*--------------------------------------------------------------------*/ + +static int +ev_get_sig(int sig) +{ + struct evsig *os; + + if (sig < ev_nsig) + return (0); + + os = calloc(sizeof *os, (sig + 1)); + if (os == NULL) + return (ENOMEM); + + memcpy(os, ev_sigs, ev_nsig); + + free(ev_sigs); + ev_sigs = os; + ev_nsig = sig + 1; + + return (0); +} + +/*--------------------------------------------------------------------*/ + +static void +ev_sighandler(int sig) +{ + assert(sig < ev_nsig); + assert(ev_sigs != NULL); + ev_sigs[sig].happened = 1; +} + +/*--------------------------------------------------------------------*/ + struct evbase * ev_new_base(void) { @@ -72,14 +143,12 @@ evb = calloc(sizeof *evb, 1); if (!evb) return (evb); - evb->magic = EVBASE_MAGIC; - TAILQ_INIT(&evb->events); - evb->npfd = 1; - evb->pfd = calloc(sizeof *evb->pfd, evb->npfd); - if (evb->pfd == NULL) { + if (ev_get_pfd(evb)) { free(evb); return (NULL); } + evb->magic = EVBASE_MAGIC; + TAILQ_INIT(&evb->events); evb->binheap = binheap_new(evb, ev_bh_cmp, ev_bh_update); return (evb); } @@ -94,48 +163,42 @@ free(evb); } -/*--------------------------------------------------------------------*/ -static int -ev_get_pfd(struct evbase *evb) -{ - unsigned u; - void *p; - - if (evb->lpfd <= evb->npfd) - return (0); - - if (evb->npfd > 256) - u = evb->npfd + 256; - else - u = evb->npfd * 2; - p = realloc(evb->pfd, sizeof *evb->pfd * u); - if (p == NULL) - return (1); - evb->npfd = u; - evb->pfd = p; - return (0); -} - /*--------------------------------------------------------------------*/ int ev_add(struct evbase *evb, struct ev *e) { + struct evsig *es; CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); assert(e->magic != EV_MAGIC); assert(e->callback != NULL); + assert(e->signal >= 0); + assert(e->timeout >= 0.0); - if (e->timeout < 0.0) - return (EINVAL); + if (e->signal > 0 && ev_get_sig(e->signal)) + return (ENOMEM); + if (e->fd >= 0 && ev_get_pfd(evb)) + return (ENOMEM); + + if (e->signal > 0) { + es = &ev_sigs[e->signal]; + if (es->ev != NULL) + return (EBUSY); + assert(es->happened == 0); + es->ev = e; + es->sigact.sa_flags = e->sig_flags; + es->sigact.sa_handler = ev_sighandler; + assert(sigaction(e->signal, &es->sigact, NULL) == 0); + es->evb = evb; + } + if (e->fd >= 0) { - if (ev_get_pfd(evb)) - return (ENOMEM); evb->pfd[evb->lpfd].fd = e->fd; evb->pfd[evb->lpfd].events = - e->flags & (EV_RD|EV_WR|EV_ERR|EV_HUP); + e->fd_flags & (EV_RD|EV_WR|EV_ERR|EV_HUP); e->__poll_idx = evb->lpfd; evb->lpfd++; } else @@ -165,6 +228,8 @@ void ev_del(struct evbase *evb, struct ev *e) { + struct evsig *es; + CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); CHECK_OBJ_NOTNULL(e, EV_MAGIC); assert(evb == e->__evb); @@ -179,6 +244,18 @@ e->fd = -1; } + if (e->signal > 0) { + assert(e->signal < ev_nsig); + es = &ev_sigs[e->signal]; + assert(es->ev == e); + es->ev = NULL; + es->evb = NULL; + es->sigact.sa_flags = e->sig_flags; + es->sigact.sa_handler = SIG_DFL; + assert(sigaction(e->signal, &es->sigact, NULL) == 0); + es->happened = 0; + } + TAILQ_REMOVE(&evb->events, e, __list); e->magic = 0; @@ -217,7 +294,9 @@ { int i; +printf("Call %p %s (TMO)\n", e, e->name); i = e->callback(e, 0); +printf("Back %p %s (TMO)\n", e, e->name); if (i) { ev_del(evb, e); free(e); @@ -255,6 +334,23 @@ if (tmo == INFTIM && evb->lpfd == 0) return (0); i = poll(evb->pfd, evb->lpfd, tmo); + if(i == -1 && errno == EINTR) { + for (j = 0; j < ev_nsig; j++) { + if (!ev_sigs[j].happened || ev_sigs[j].evb != evb) + continue; + ev_sigs[j].happened = 0; + e = ev_sigs[j].ev; + assert(e != NULL); +printf("Call %p %s (sig %d)\n", e, e->name, j); + i = e->callback(e, EV_SIG); +printf("Back %p %s (sig %d)\n", e, e->name, j); + if (i) { + ev_del(evb, e); + free(e); + } + } + return (1); + } if (i == 0) { assert(e != NULL); t = ev_now(); @@ -271,12 +367,12 @@ assert(e->__poll_idx < evb->lpfd); pfd = &evb->pfd[e->__poll_idx]; assert(pfd->fd == e->fd); - assert(pfd->events == e->flags); + assert(pfd->events == e->fd_flags); if (!pfd->revents) continue; printf("Call %p %s (%u)\n", e, e->name, pfd->revents); j = e->callback(e, pfd->revents); -printf("Back from %p %s (%u)\n", e, e->name, pfd->revents); +printf("Back %p %s (%u)\n", e, e->name, pfd->revents); i--; if (evb->disturbed) { TAILQ_FOREACH(e2, &evb->events, __list) Modified: trunk/varnish-cache/bin/varnishd/mgt_event.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.h 2006-08-05 08:49:54 UTC (rev 646) +++ trunk/varnish-cache/bin/varnishd/mgt_event.h 2006-08-05 09:27:57 UTC (rev 647) @@ -14,11 +14,14 @@ /* pub */ const char *name; int fd; - unsigned flags; + unsigned fd_flags; #define EV_RD POLLIN #define EV_WR POLLOUT #define EV_ERR POLLERR #define EV_HUP POLLHUP +#define EV_SIG -1 + int signal; + unsigned sig_flags; double timeout; ev_cb_f *callback; void *priv; From phk at projects.linpro.no Sat Aug 5 10:31:30 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 12:31:30 +0200 (CEST) Subject: r648 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805103130.2CC471EC53E@projects.linpro.no> Author: phk Date: 2006-08-05 12:31:30 +0200 (Sat, 05 Aug 2006) New Revision: 648 Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c trunk/varnish-cache/bin/varnishd/mgt_event.h Log: bugfixes Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 09:27:57 UTC (rev 647) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 10:31:30 UTC (rev 648) @@ -35,6 +35,7 @@ struct binheap *binheap; unsigned char compact_pfd; unsigned char disturbed; + unsigned psig; }; /*--------------------------------------------------------------------*/ @@ -114,7 +115,7 @@ if (os == NULL) return (ENOMEM); - memcpy(os, ev_sigs, ev_nsig); + memcpy(os, ev_sigs, ev_nsig * sizeof *os); free(ev_sigs); ev_sigs = os; @@ -128,9 +129,15 @@ static void ev_sighandler(int sig) { + struct evsig *es; + assert(sig < ev_nsig); assert(ev_sigs != NULL); - ev_sigs[sig].happened = 1; + es = &ev_sigs[sig]; + if (!es->happened) + es->evb->psig++; + es->happened = 1; +printf("SIG %d happened\n", sig); } /*--------------------------------------------------------------------*/ @@ -163,7 +170,20 @@ free(evb); } +/*--------------------------------------------------------------------*/ +struct ev * +ev_new(void) +{ + struct ev *e; + + e = calloc(sizeof *e, 1); + if (e != NULL) { + e->fd = -1; + } + return (e); +} + /*--------------------------------------------------------------------*/ int @@ -174,25 +194,27 @@ CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); assert(e->magic != EV_MAGIC); assert(e->callback != NULL); - assert(e->signal >= 0); + assert(e->sig >= 0); assert(e->timeout >= 0.0); + assert(e->fd < 0 || e->fd_flags); - if (e->signal > 0 && ev_get_sig(e->signal)) + if (e->sig > 0 && ev_get_sig(e->sig)) return (ENOMEM); if (e->fd >= 0 && ev_get_pfd(evb)) return (ENOMEM); - if (e->signal > 0) { - es = &ev_sigs[e->signal]; + if (e->sig > 0) { + es = &ev_sigs[e->sig]; if (es->ev != NULL) return (EBUSY); assert(es->happened == 0); es->ev = e; + es->evb = evb; es->sigact.sa_flags = e->sig_flags; es->sigact.sa_handler = ev_sighandler; - assert(sigaction(e->signal, &es->sigact, NULL) == 0); - es->evb = evb; + } else { + es = NULL; } if (e->fd >= 0) { @@ -220,6 +242,11 @@ else TAILQ_INSERT_HEAD(&evb->events, e, __list); + if (e->sig > 0) { + assert(es != NULL); + assert(sigaction(e->sig, &es->sigact, NULL) == 0); + } + return (0); } @@ -244,15 +271,15 @@ e->fd = -1; } - if (e->signal > 0) { - assert(e->signal < ev_nsig); - es = &ev_sigs[e->signal]; + if (e->sig > 0) { + assert(e->sig < ev_nsig); + es = &ev_sigs[e->sig]; assert(es->ev == e); es->ev = NULL; es->evb = NULL; es->sigact.sa_flags = e->sig_flags; es->sigact.sa_handler = SIG_DFL; - assert(sigaction(e->signal, &es->sigact, NULL) == 0); + assert(sigaction(e->sig, &es->sigact, NULL) == 0); es->happened = 0; } @@ -307,11 +334,36 @@ } } +static void +ev_sched_signal(struct evbase *evb) +{ + int i, j; + struct evsig *es; + struct ev *e; + + es = ev_sigs; + for (j = 0; j < ev_nsig; j++, es++) { + if (!es->happened || es->evb != evb) + continue; + evb->psig--; + es->happened = 0; + e = es->ev; + assert(e != NULL); +printf("Call %p %s (sig %d)\n", e, e->name, j); + i = e->callback(e, EV_SIG); +printf("Back %p %s (sig %d)\n", e, e->name, j); + if (i) { + ev_del(evb, e); + free(e); + } + } +} + int ev_schedule_one(struct evbase *evb) { double t; - struct ev *e, *e2; + struct ev *e, *e2, *e3; int i, j, tmo; struct pollfd *pfd; @@ -333,22 +385,16 @@ if (tmo == INFTIM && evb->lpfd == 0) return (0); + + if (evb->psig) { +printf("hassig\n"); + ev_sched_signal(evb); + return (1); + } i = poll(evb->pfd, evb->lpfd, tmo); if(i == -1 && errno == EINTR) { - for (j = 0; j < ev_nsig; j++) { - if (!ev_sigs[j].happened || ev_sigs[j].evb != evb) - continue; - ev_sigs[j].happened = 0; - e = ev_sigs[j].ev; - assert(e != NULL); -printf("Call %p %s (sig %d)\n", e, e->name, j); - i = e->callback(e, EV_SIG); -printf("Back %p %s (sig %d)\n", e, e->name, j); - if (i) { - ev_del(evb, e); - free(e); - } - } +printf("gotsig\n"); + ev_sched_signal(evb); return (1); } if (i == 0) { @@ -375,11 +421,14 @@ printf("Back %p %s (%u)\n", e, e->name, pfd->revents); i--; if (evb->disturbed) { - TAILQ_FOREACH(e2, &evb->events, __list) - if (e2 == e) + TAILQ_FOREACH(e3, &evb->events, __list) { + if (e3 == e) { + e3 = TAILQ_NEXT(e, __list); break; - assert(e2 == e); - e2 = TAILQ_NEXT(e, __list); + } else if (e3 == e2) + break; + } + e2 = e3; evb->disturbed = 0; } if (j) { Modified: trunk/varnish-cache/bin/varnishd/mgt_event.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.h 2006-08-05 09:27:57 UTC (rev 647) +++ trunk/varnish-cache/bin/varnishd/mgt_event.h 2006-08-05 10:31:30 UTC (rev 648) @@ -5,7 +5,7 @@ struct ev; struct evbase; -typedef int ev_cb_f(struct ev *, unsigned what); +typedef int ev_cb_f(struct ev *, int what); struct ev { unsigned magic; @@ -20,7 +20,7 @@ #define EV_ERR POLLERR #define EV_HUP POLLHUP #define EV_SIG -1 - int signal; + int sig; unsigned sig_flags; double timeout; ev_cb_f *callback; @@ -39,6 +39,9 @@ struct evbase *ev_new_base(void); void ev_destroy_base(struct evbase *evb); + +struct ev *ev_new(void); + int ev_add(struct evbase *evb, struct ev *e); void ev_del(struct evbase *evb, struct ev *e); From phk at projects.linpro.no Sat Aug 5 11:07:49 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 13:07:49 +0200 (CEST) Subject: r649 - trunk/varnish-cache/lib/libvarnish Message-ID: <20060805110749.6A0731EC4DA@projects.linpro.no> Author: phk Date: 2006-08-05 13:07:49 +0200 (Sat, 05 Aug 2006) New Revision: 649 Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c Log: Add assert Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/binary_heap.c 2006-08-05 10:31:30 UTC (rev 648) +++ trunk/varnish-cache/lib/libvarnish/binary_heap.c 2006-08-05 11:07:49 UTC (rev 649) @@ -177,8 +177,8 @@ assert(bh->magic == BINHEAP_MAGIC); assert(bh->next > ROOT_IDX); assert(idx < bh->next); - if (bh->update != NULL) - bh->update(bh->priv, bh->array[idx], 0); + assert(idx > 0); + bh->update(bh->priv, bh->array[idx], 0); if (idx == --bh->next) return; bh->array[idx] = bh->array[bh->next]; From phk at projects.linpro.no Sat Aug 5 11:08:26 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 13:08:26 +0200 (CEST) Subject: r650 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805110826.C2E201EC55B@projects.linpro.no> Author: phk Date: 2006-08-05 13:08:26 +0200 (Sat, 05 Aug 2006) New Revision: 650 Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c Log: More bugfixes Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 11:07:49 UTC (rev 649) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 11:08:26 UTC (rev 650) @@ -226,16 +226,18 @@ } else e->__poll_idx = -1; + e->magic = EV_MAGIC; /* before binheap_insert() */ + if (e->timeout != 0.0) { e->__when += ev_now() + e->timeout; binheap_insert(evb->binheap, e); + assert(e->__binheap_idx > 0); } else { e->__when = 0.0; + e->__binheap_idx = 0; } - e->magic = EV_MAGIC; e->__evb = evb; - e->__binheap_idx = 0; e->__privflags = 0; if (e->fd < 0) TAILQ_INSERT_TAIL(&evb->events, e, __list); @@ -316,11 +318,12 @@ /*--------------------------------------------------------------------*/ -static void +static int ev_sched_timeout(struct evbase *evb, struct ev *e, double t) { int i; + printf("Call %p %s (TMO)\n", e, e->name); i = e->callback(e, 0); printf("Back %p %s (TMO)\n", e, e->name); @@ -328,13 +331,14 @@ ev_del(evb, e); free(e); } else { - e->__when += t + e->timeout; - binheap_delete(evb->binheap, 0); + e->__when = t + e->timeout; + binheap_delete(evb->binheap, e->__binheap_idx); binheap_insert(evb->binheap, e); } + return (1); } -static void +static int ev_sched_signal(struct evbase *evb) { int i, j; @@ -357,6 +361,7 @@ free(e); } } + return (1); } int @@ -370,13 +375,14 @@ CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); e = binheap_root(evb->binheap); if (e != NULL) { + assert(e->__binheap_idx == 1); CHECK_OBJ_NOTNULL(e, EV_MAGIC); t = ev_now(); - if (e->__when <= t) { - ev_sched_timeout(evb, e, t); - return (1); - } + if (e->__when <= t) + return (ev_sched_timeout(evb, e, t)); tmo = (e->__when - t) * 1e3; + if (tmo == 0) + tmo = 1; } else tmo = INFTIM; @@ -386,23 +392,16 @@ if (tmo == INFTIM && evb->lpfd == 0) return (0); - if (evb->psig) { -printf("hassig\n"); - ev_sched_signal(evb); - return (1); - } + if (evb->psig) + return (ev_sched_signal(evb)); i = poll(evb->pfd, evb->lpfd, tmo); - if(i == -1 && errno == EINTR) { -printf("gotsig\n"); - ev_sched_signal(evb); - return (1); - } + if(i == -1 && errno == EINTR) + return (ev_sched_signal(evb)); if (i == 0) { assert(e != NULL); t = ev_now(); if (e->__when <= t) - ev_sched_timeout(evb, e, t); - return (1); + return (ev_sched_timeout(evb, e, t)); } evb->disturbed = 0; TAILQ_FOREACH_SAFE(e, &evb->events, __list, e2) { From phk at projects.linpro.no Sat Aug 5 11:12:44 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 13:12:44 +0200 (CEST) Subject: r651 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805111244.6CFDE1EC564@projects.linpro.no> Author: phk Date: 2006-08-05 13:12:44 +0200 (Sat, 05 Aug 2006) New Revision: 651 Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c Log: Remove debugging printfs Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 11:08:26 UTC (rev 650) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 11:12:44 UTC (rev 651) @@ -137,7 +137,6 @@ if (!es->happened) es->evb->psig++; es->happened = 1; -printf("SIG %d happened\n", sig); } /*--------------------------------------------------------------------*/ @@ -324,9 +323,7 @@ int i; -printf("Call %p %s (TMO)\n", e, e->name); i = e->callback(e, 0); -printf("Back %p %s (TMO)\n", e, e->name); if (i) { ev_del(evb, e); free(e); @@ -353,9 +350,7 @@ es->happened = 0; e = es->ev; assert(e != NULL); -printf("Call %p %s (sig %d)\n", e, e->name, j); i = e->callback(e, EV_SIG); -printf("Back %p %s (sig %d)\n", e, e->name, j); if (i) { ev_del(evb, e); free(e); @@ -415,9 +410,7 @@ assert(pfd->events == e->fd_flags); if (!pfd->revents) continue; -printf("Call %p %s (%u)\n", e, e->name, pfd->revents); j = e->callback(e, pfd->revents); -printf("Back %p %s (%u)\n", e, e->name, pfd->revents); i--; if (evb->disturbed) { TAILQ_FOREACH(e3, &evb->events, __list) { From phk at projects.linpro.no Sat Aug 5 11:13:42 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 13:13:42 +0200 (CEST) Subject: r652 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805111342.92A341EC565@projects.linpro.no> Author: phk Date: 2006-08-05 13:13:42 +0200 (Sat, 05 Aug 2006) New Revision: 652 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c Log: Remove pthread.h include, it's included in cache.h Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-05 11:12:44 UTC (rev 651) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-05 11:13:42 UTC (rev 652) @@ -8,7 +8,6 @@ #include #include #include -#include #include "libvarnish.h" #include "shmlog.h" From phk at projects.linpro.no Sat Aug 5 11:16:03 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 13:16:03 +0200 (CEST) Subject: r653 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805111603.3A6F91EC56F@projects.linpro.no> Author: phk Date: 2006-08-05 13:16:03 +0200 (Sat, 05 Aug 2006) New Revision: 653 Modified: trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: Change manager to use mgt_event.h instead of threads to be lazy thread developer compatible. POSIX, no surprise, doesn't really tell what should happen to a threaded process which forks and consequently implemenations vary somewhat, from Solaris which seems to Do The Right Thing, via Linux where it works "most of the time" and to FreeBSD which more or less actively sabotages any such attempt. Grin and live with it... Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-05 11:13:42 UTC (rev 652) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-05 11:16:03 UTC (rev 653) @@ -3,7 +3,10 @@ */ #include "common.h" +#include "miniobj.h" +extern struct evbase *mgt_evb; + /* mgt_child.c */ void mgt_run(int dflag); void mgt_start_child(void); Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 11:13:42 UTC (rev 652) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 11:16:03 UTC (rev 653) @@ -6,13 +6,13 @@ #include #include +#include #include #include #include #include #include #include -#include #include #include @@ -23,52 +23,50 @@ #include "mgt.h" #include "cli_priv.h" #include "mgt_cli.h" +#include "mgt_event.h" pid_t mgt_pid; pid_t child_pid = -1; static int child_fds[2]; static unsigned child_should_run; -static pthread_t child_listen_thread; -static pthread_t child_poker_thread; -static pthread_mutex_t child_mtx; -static pthread_cond_t child_cv; static unsigned child_ticker; -static unsigned gotint; static unsigned dstarts; +struct evbase *mgt_evb; + /*--------------------------------------------------------------------*/ -static void * -child_listener(void *arg) +static int +child_listener(struct ev *e, int what) { int i; char buf[BUFSIZ]; - (void)arg; - - while (1) { - i = read(child_fds[0], buf, sizeof buf - 1); - if (i <= 0) - break; - buf[i] = '\0'; - printf("Child said: %s", buf); - } - return (NULL); + (void)e; + if ((what & ~EV_RD)) + return (1); + i = read(child_fds[0], buf, sizeof buf - 1); + if (i <= 0) + return (1); + buf[i] = '\0'; + printf("Child said: <<%s>>\n", buf); + return (0); } /*--------------------------------------------------------------------*/ -static void * -child_poker(void *arg) +static int +child_poker(struct ev *e, int what) { - (void)arg; - while (1) { - sleep (1); - if (!mgt_cli_askchild(NULL, NULL, "ping\n")) - child_ticker = 0; - } + (void)e; + (void)what; + if (!child_should_run) + return (1); + if (child_pid > 0 && mgt_cli_askchild(NULL, NULL, "ping\n")) + kill(child_pid, SIGKILL); + return (0); } /*--------------------------------------------------------------------*/ @@ -78,7 +76,13 @@ { int i; char *p; + struct ev *e; + if (child_pid >= 0) + return; + + child_should_run = 1; + AZ(pipe(&heritage.fds[0])); AZ(pipe(&heritage.fds[2])); AZ(pipe(child_fds)); @@ -99,6 +103,8 @@ AZ(close(heritage.fds[3])); setproctitle("Varnish-Chld"); + + signal(SIGINT, SIG_DFL); child_main(); exit (1); @@ -109,16 +115,28 @@ AZ(close(child_fds[1])); child_fds[1] = -1; + e = ev_new(); + assert(e != NULL); + e->fd = child_fds[0]; + e->fd_flags = EV_RD; + e->name = "Child listener"; + e->callback = child_listener; + AZ(ev_add(mgt_evb, e)); + + e = ev_new(); + assert(e != NULL); + e->timeout = 3.0; + e->callback = child_poker; + e->name = "child poker"; + AZ(ev_add(mgt_evb, e)); + + mgt_cli_start_child(heritage.fds[0], heritage.fds[3]); AZ(close(heritage.fds[1])); heritage.fds[1] = -1; AZ(close(heritage.fds[2])); heritage.fds[2] = -1; child_pid = i; - AZ(pthread_create(&child_listen_thread, NULL, child_listener, NULL)); - AZ(pthread_detach(child_listen_thread)); - AZ(pthread_create(&child_poker_thread, NULL, child_poker, NULL)); - AZ(pthread_detach(child_poker_thread)); if (mgt_push_vcls_and_start(&i, &p)) { fprintf(stderr, "Pushing vcls failed:\n%s\n", p); free(p); @@ -132,12 +150,13 @@ static void stop_child(void) { - int i; - assert(child_pid != -1); + if (child_pid < 0) + return; - printf("Stop child\n"); - AZ(pthread_cancel(child_poker_thread)); + child_should_run = 0; + + printf("Clean child\n"); mgt_cli_stop_child(); /* We tell the child to die gracefully by closing the CLI */ @@ -146,67 +165,61 @@ AZ(close(heritage.fds[3])); heritage.fds[3] = -1; - /* - * Give it one second to die, then wack it hard - * then another second and then we get real angry - */ - for (i = 0; i < 30; i++) { - printf("Waiting %d %d\n",i, child_pid); - if (child_pid == -2) - break; - if (i == 10) { - printf("Giving cacher SIGINT\n"); - kill(child_pid, SIGINT); - } - if (i == 20) { - printf("Giving cacher SIGKILL\n"); - kill(child_pid, SIGKILL); - } - usleep(100000); - } - - assert(child_pid == -2); - - AZ(close(child_fds[0])); - child_fds[0] = -1; - child_pid = -1; printf("Child stopped\n"); } /*--------------------------------------------------------------------*/ -static void -mgt_sigchld(int arg) +static int +mgt_sigchld(struct ev *e, int what) { int status; pid_t r; - (void)arg; + (void)e; + (void)what; r = wait4(-1, &status, WNOHANG, NULL); - if (r == child_pid) { - printf("Cache child died pid=%d status=0x%x\n", - r, status); - child_pid = -2; - } else { + if (r != child_pid) { printf("Unknown child died pid=%d status=0x%x\n", r, status); + return (0); } + printf("Cache child died pid=%d status=0x%x\n", r, status); + child_pid = -1; + + if (child_should_run) { + printf("Clean child\n"); + mgt_cli_stop_child(); + + /* We tell the child to die gracefully by closing the CLI */ + AZ(close(heritage.fds[0])); + heritage.fds[0] = -1; + AZ(close(heritage.fds[3])); + heritage.fds[3] = -1; + } + + AZ(close(child_fds[0])); + child_fds[0] = -1; + printf("Child cleaned\n"); + + if (child_should_run) + start_child(); + return (0); } /*--------------------------------------------------------------------*/ -static void -mgt_sigint(int arg) +static int +mgt_sigint(struct ev *e, int what) { - (void)arg; - if (getpid() != mgt_pid) { - printf("Got SIGINT\n"); - exit (2); - } + (void)e; + (void)what; printf("Manager got SIGINT\n"); - gotint = 1; - child_should_run = 0; + fflush(stdout); + if (child_pid >= 0) + stop_child(); + exit (2); } /*-------------------------------------------------------------------- @@ -218,23 +231,30 @@ void mgt_run(int dflag) { - struct timespec to; struct sigaction sac; - int i; + struct ev *ev_sigchld, *ev_sigint; mgt_pid = getpid(); + mgt_evb = ev_new_base(); + assert(mgt_evb != NULL); + if (dflag) mgt_cli_setup(0, 1, 1); - sac.sa_handler = mgt_sigchld; - sac.sa_flags = SA_RESTART | SA_NOCLDSTOP; - AZ(sigaction(SIGCHLD, &sac, NULL)); + ev_sigint = ev_new(); + assert(ev_sigint != NULL); + ev_sigint->sig = SIGINT; + ev_sigint->callback = mgt_sigint; + ev_sigint->name = "mgt_sigint"; + AZ(ev_add(mgt_evb, ev_sigint)); - sac.sa_handler = mgt_sigint; - sac.sa_flags = SA_RESTART; - AZ(sigaction(SIGINT, &sac, NULL)); - AZ(sigaction(SIGTERM, &sac, NULL)); + ev_sigchld = ev_new(); + ev_sigchld->sig = SIGCHLD; + ev_sigchld->sig_flags = SA_NOCLDSTOP; + ev_sigchld->callback = mgt_sigchld; + ev_sigchld->name = "mgt_sigchild"; + AZ(ev_add(mgt_evb, ev_sigchld)); setproctitle("Varnish-Mgr"); @@ -243,43 +263,14 @@ AZ(sigaction(SIGPIPE, &sac, NULL)); AZ(sigaction(SIGHUP, &sac, NULL)); - child_should_run = !dflag; + printf("rolling...\n"); + if (!dflag) + start_child(); - AZ(pthread_cond_init(&child_cv, NULL)); - AZ(pthread_mutex_init(&child_mtx, NULL)); + ev_schedule(mgt_evb); - while (1) { - if (child_should_run && child_pid == -2) - stop_child(); - if (!child_should_run && child_pid != -1) - stop_child(); - if (gotint) { - printf("Manager died due to sigint\n"); - exit(2); - } - if (child_should_run && child_pid == -1) { - if (dflag && dstarts) { - printf( - "Manager not autostarting in debug mode\n"); - exit(2); - } - start_child(); - dstarts = 1; - } - - /* XXX POSIXBRAINDAMAGE */ - AZ(clock_gettime(CLOCK_REALTIME, &to)); - to.tv_sec += 1; - - AZ(pthread_mutex_lock(&child_mtx)); - i = pthread_cond_timedwait(&child_cv, &child_mtx, &to); - AZ(pthread_mutex_unlock(&child_mtx)); - if (i == ETIMEDOUT && ++child_ticker > 5 && child_pid != -1) { - stop_child(); - if (dflag) - exit (2); - } - } + printf("manager dies\n"); + exit(2); } /*--------------------------------------------------------------------*/ @@ -291,11 +282,9 @@ (void)cli; (void)av; if (priv != NULL) { - child_should_run = 0; - AZ(pthread_cond_signal(&child_cv)); + stop_child(); return; } dstarts = 0; - child_should_run = 1; - AZ(pthread_cond_signal(&child_cv)); + start_child(); } Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-05 11:13:42 UTC (rev 652) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-05 11:16:03 UTC (rev 653) @@ -10,7 +10,6 @@ #include #include #include -#include #include #include "libvarnish.h" @@ -20,10 +19,10 @@ #include "common_cli.h" #include "mgt.h" #include "mgt_cli.h" +#include "mgt_event.h" #include "shmlog.h" static int cli_i = -1, cli_o = -1; -static pthread_mutex_t cli_mtx; /*--------------------------------------------------------------------*/ @@ -56,11 +55,8 @@ (void)priv; - AZ(pthread_mutex_lock(&cli_mtx)); - /* Request */ if (cli_o <= 0) { - AZ(pthread_mutex_unlock(&cli_mtx)); cli_result(cli, CLIS_CANT); cli_out(cli, "Cache process not running"); return; @@ -96,7 +92,6 @@ cli_out(cli, "%s", p); free(p); - AZ(pthread_mutex_unlock(&cli_mtx)); } /*--------------------------------------------------------------------*/ @@ -137,7 +132,6 @@ unsigned u, v; - AZ(pthread_mutex_init(&cli_mtx, NULL)); /* * Build the joint cli_proto by combining the manager process * entries with with the cache process entries. The latter @@ -189,14 +183,12 @@ va_end(ap); if (i < 0) return (i); - AZ(pthread_mutex_lock(&cli_mtx)); assert(p[i - 1] == '\n'); i = write(cli_o, p, strlen(p)); assert(i == strlen(p)); free(p); i = cli_readres(cli_i, &j, resp); - AZ(pthread_mutex_unlock(&cli_mtx)); if (status != NULL) *status = j; return (j == CLIS_OK ? 0 : j); @@ -226,6 +218,9 @@ /*--------------------------------------------------------------------*/ struct cli_port { + unsigned magic; +#define CLI_PORT_MAGIC 0x5791079f + struct ev *ev; int fdi; int fdo; int verbose; @@ -233,24 +228,19 @@ unsigned nbuf; unsigned lbuf; struct cli cli[1]; + char name[30]; }; -static void * -mgt_cli_main(void *arg) +static int +mgt_cli_callback(struct ev *e, unsigned what) { struct cli_port *cp; char *p; int i; - assert(arg != NULL); - cp = arg; + CAST_OBJ_NOTNULL(cp, e->priv, CLI_PORT_MAGIC); - cp->lbuf = 4096; - cp->buf = malloc(cp->lbuf); - assert(cp->buf != NULL); - cp->cli->sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(cp->cli->sb != NULL); - while (1) { + while (!(what & (EV_ERR | EV_HUP))) { if (cp->nbuf == cp->lbuf) { cp->lbuf += cp->lbuf; cp->buf = realloc(cp->buf, cp->lbuf); @@ -262,7 +252,7 @@ cp->nbuf += i; p = strchr(cp->buf, '\n'); if (p == NULL) - continue; + return (0); *p = '\0'; sbuf_clear(cp->cli->sb); cli_dispatch(cp->cli, cli_proto, cp->buf); @@ -275,336 +265,43 @@ if (i < cp->nbuf) memcpy(cp->buf, p, cp->nbuf - i); cp->nbuf -= i; + return (0); } sbuf_delete(cp->cli->sb); free(cp->buf); close(cp->fdi); close(cp->fdo); free(cp); - return (NULL); + return (1); } void mgt_cli_setup(int fdi, int fdo, int verbose) { struct cli_port *cp; - pthread_t tp; cp = calloc(sizeof *cp, 1); assert(cp != NULL); + sprintf(cp->name, "cli %d->%d", fdi, fdo); + cp->magic = CLI_PORT_MAGIC; + cp->fdi = fdi; cp->fdo = fdo; cp->verbose = verbose; - AZ(pthread_create(&tp, NULL, mgt_cli_main, cp)); - AZ(pthread_detach(tp)); -} -#if 0 + cp->lbuf = 4096; + cp->buf = malloc(cp->lbuf); + assert(cp->buf != NULL); -/*-------------------------------------------------------------------- - * Generic passthrough for CLI functions - */ + cp->cli->sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(cp->cli->sb != NULL); -static void -cli_passthrough_cb(unsigned u, const char *r, void *priv) -{ - struct cli *cli = priv; - - cli_out(cli, "%s\n", r); - cli_result(cli, u); - cli_resume(cli); + cp->ev = calloc(sizeof *cp->ev, 1); + cp->ev->name = cp->name; + cp->ev->fd = fdi; + cp->ev->fd_flags = EV_RD; + cp->ev->callback = mgt_cli_callback; + cp->ev->priv = cp; + ev_add(mgt_evb, cp->ev); } - -static void -m_cli_func_passthrough(struct cli *cli, char **av, void *priv) -{ - - (void)av; - (void)priv; - - cli_suspend(cli); - mgt_child_request(cli_passthrough_cb, cli, &av[2], av[1]); -} - -static void -m_cli_func_config_inline(struct cli *cli, char **av, void *priv) -{ - char *vf; - struct sbuf *sb; - - (void)priv; - - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(sb != NULL); - vf = VCC_Compile(sb, av[3], NULL); - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - cli_out(cli, "%s", sbuf_data(sb)); - sbuf_delete(sb); - return; - } - sbuf_delete(sb); - cli_suspend(cli); - mgt_child_request(cli_passthrough_cb, cli, NULL, - "config.load %s %s", av[2], vf); -} - -/* XXX: m prefix to avoid name clash */ -static void -m_cli_func_config_load(struct cli *cli, char **av, void *priv) -{ - char *vf; - struct sbuf *sb; - - (void)priv; - - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(sb != NULL); - vf = VCC_CompileFile(sb, av[3]); - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - cli_out(cli, "%s", sbuf_data(sb)); - sbuf_delete(sb); - return; - } - sbuf_delete(sb); - cli_suspend(cli); - mgt_child_request(cli_passthrough_cb, cli, NULL, - "config.load %s %s", av[2], vf); -} - -static char * -vcl_file(const char *fflag) -{ - char *vf; - struct sbuf *sb; - - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - assert(sb != NULL); - vf = VCC_CompileFile(sb, fflag); - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - fprintf(stderr, "%s", sbuf_data(sb)); - sbuf_delete(sb); - return (NULL); - } - sbuf_delete(sb); - return (vf); -} - - -/*--------------------------------------------------------------------*/ - -static void -m_cli_func_server_start(struct cli *cli, char **av, void *priv) -{ - - (void)cli; - (void)av; - (void)priv; - - mgt_child_start(); -} - -/*--------------------------------------------------------------------*/ - -static void -m_cli_func_server_stop(struct cli *cli, char **av, void *priv) -{ - - (void)cli; - (void)av; - (void)priv; - - mgt_child_stop(); -} - -/*--------------------------------------------------------------------*/ - -static void -m_cli_func_exit(struct cli *cli, char **av, void *priv) -{ - - (void)cli; - (void)av; - (void)priv; - mgt_child_kill(); - exit (0); -} - -/*--------------------------------------------------------------------*/ - -static void -m_cli_func_verbose(struct cli *cli, char **av, void *priv) -{ - - (void)av; - (void)priv; - - cli->verbose = !cli->verbose; -} - - -static void -m_cli_func_ping(struct cli *cli, char **av, void *priv) -{ - time_t t; - - (void)priv; - - if (av[2] != NULL) { - cli_out(cli, "Got your %s\n", av[2]); - } - t = time(NULL); - cli_out(cli, "PONG %ld\n", t); -} - -/*--------------------------------------------------------------------*/ - -static void -m_cli_func_stats(struct cli *cli, char **av, void *priv) -{ - - (void)av; - (void)priv; - - assert (VSL_stats != NULL); -#define MAC_STAT(n,t,f,d) \ - cli_out(cli, "%12ju " d "\n", (VSL_stats->n)); -#include "stat_field.h" -#undef MAC_STAT -} - -/*--------------------------------------------------------------------*/ - - -/*--------------------------------------------------------------------*/ - -/* for development purposes */ -#include - -int -main(int argc, char *argv[]) -{ - int o; - const char *portnumber = "8080"; - unsigned dflag = 0; - const char *bflag = NULL; - const char *fflag = NULL; - const char *sflag = "file"; - const char *hflag = "classic"; - - (void)register_printf_render_std((const unsigned char *)"HVQ"); - - setbuf(stdout, NULL); - setbuf(stderr, NULL); - - VCC_InitCompile(default_vcl); - - heritage.default_ttl = 120; - heritage.wthread_min = 1; - heritage.wthread_max = UINT_MAX; - heritage.wthread_timeout = 10; - heritage.mem_workspace = 4096; - - while ((o = getopt(argc, argv, "b:df:h:p:s:t:w:")) != -1) - switch (o) { - case 'b': - bflag = optarg; - break; - case 'd': - dflag++; - break; - case 'f': - fflag = optarg; - break; - case 'h': - hflag = optarg; - break; - case 'p': - portnumber = optarg; - break; - case 's': - sflag = optarg; - break; - case 't': - heritage.default_ttl = strtoul(optarg, NULL, 0); - break; - case 'w': - tackle_warg(optarg); - break; - default: - usage(); - } - - argc -= optind; - argv += optind; - - if (argc != 0) { - fprintf(stderr, "Too many arguments\n"); - usage(); - } - - if (bflag != NULL && fflag != NULL) { - fprintf(stderr, "Only one of -b or -f can be specified\n"); - usage(); - } - if (bflag == NULL && fflag == NULL) { - fprintf(stderr, "One of -b or -f must be specified\n"); - usage(); - } - - if (bflag != NULL) - heritage.vcl_file = vcl_default(bflag); - else - heritage.vcl_file = vcl_file(fflag); - if (heritage.vcl_file == NULL) - exit (1); - - setup_storage(sflag); - setup_hash(hflag); - - /* - * XXX: Lacking the suspend/resume facility (due to the socket API - * missing an unlisten(2) facility) we may want to push this into - * the child to limit the amount of time where the socket(s) exists - * but do not answer. That, on the other hand, would eliminate the - * possibility of doing a "no-glitch" restart of the child process. - */ - open_tcp(portnumber); - - VSL_MgtInit(SHMLOG_FILENAME, 8*1024*1024); - - if (dflag) - DebugStunt(); - daemon(dflag, dflag); - if (dflag) - printf("%d\n%d\n%d\n", getpid(), getsid(0), getpgrp()); - - { - struct event e_sigchld; - struct cli *cli; - int i; - - mgt_eb = event_init(); - assert(mgt_eb != NULL); - - if (dflag) - cli = cli_setup(mgt_eb, 0, 1, 1, cli_proto); - - signal_set(&e_sigchld, SIGCHLD, mgt_sigchld, NULL); - AZ(event_base_set(mgt_eb, &e_sigchld)); - AZ(signal_add(&e_sigchld, NULL)); - - mgt_child_start(); - - i = event_base_loop(mgt_eb, 0); - if (i != 0) - printf("event_dispatch() = %d\n", i); - - } - - exit(0); -} -#endif Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-05 11:13:42 UTC (rev 652) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-05 11:16:03 UTC (rev 653) @@ -9,7 +9,6 @@ #include #include #include -#include #include #include "sbuf.h" @@ -34,8 +33,6 @@ static TAILQ_HEAD(, vcls) vclhead = TAILQ_HEAD_INITIALIZER(vclhead); -static pthread_mutex_t vcc_mtx; - /*--------------------------------------------------------------------*/ static const char *default_vcl = @@ -87,9 +84,7 @@ assert(vp != NULL); vp->name = strdup(name); vp->fname = file; - AZ(pthread_mutex_lock(&vcc_mtx)); TAILQ_INSERT_TAIL(&vclhead, vp, list); - AZ(pthread_mutex_unlock(&vcc_mtx)); return (vp); } @@ -179,7 +174,6 @@ { struct vcls *vp; - AZ(pthread_mutex_lock(&vcc_mtx)); TAILQ_FOREACH(vp, &vclhead, list) { if (mgt_cli_askchild(status, p, "config.load %s %s\n", vp->name, vp->fname)) @@ -189,7 +183,6 @@ "config.use %s\n", vp->name, vp->fname)) return (1); } - AZ(pthread_mutex_unlock(&vcc_mtx)); if (mgt_cli_askchild(status, p, "start\n")) return (1); return (0); @@ -205,21 +198,18 @@ if (getpid() != mgt_pid) return; - AZ(pthread_mutex_lock(&vcc_mtx)); while (1) { vp = TAILQ_FIRST(&vclhead); if (vp == NULL) break; mgt_vcc_del(vp); } - AZ(pthread_mutex_unlock(&vcc_mtx)); } void mgt_vcc_init(void) { - AZ(pthread_mutex_init(&vcc_mtx, NULL)); VCC_InitCompile(default_vcl); AZ(atexit(mgt_vcc_atexit)); } @@ -310,7 +300,6 @@ struct vcls *vp; (void)priv; - AZ(pthread_mutex_lock(&vcc_mtx)); vp = mcf_find_vcl(cli, av[2]); if (vp != NULL && vp->active == 0) { if (mgt_cli_askchild(&status, &p, "config.use %s\n", av[2])) { @@ -327,7 +316,6 @@ } } } - AZ(pthread_mutex_unlock(&vcc_mtx)); } void @@ -338,7 +326,6 @@ struct vcls *vp; (void)priv; - AZ(pthread_mutex_lock(&vcc_mtx)); vp = mcf_find_vcl(cli, av[2]); if (vp != NULL && vp->active) { cli_result(cli, CLIS_PARAM); @@ -353,7 +340,6 @@ AZ(mgt_vcc_delbyname(av[2])); } } - AZ(pthread_mutex_unlock(&vcc_mtx)); } void @@ -371,13 +357,11 @@ cli_out(cli, "%s", p); free(p); } else { - AZ(pthread_mutex_lock(&vcc_mtx)); TAILQ_FOREACH(vp, &vclhead, list) { cli_out(cli, "%s %6s %s\n", vp->active ? "*" : " ", "N/A", vp->name); } - AZ(pthread_mutex_unlock(&vcc_mtx)); } } From phk at projects.linpro.no Sat Aug 5 11:44:37 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 13:44:37 +0200 (CEST) Subject: r654 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805114437.E4A571EC572@projects.linpro.no> Author: phk Date: 2006-08-05 13:44:37 +0200 (Sat, 05 Aug 2006) New Revision: 654 Removed: trunk/varnish-cache/bin/varnishd/cli_common.c Log: remove old file Deleted: trunk/varnish-cache/bin/varnishd/cli_common.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cli_common.c 2006-08-05 11:16:03 UTC (rev 653) +++ trunk/varnish-cache/bin/varnishd/cli_common.c 2006-08-05 11:44:37 UTC (rev 654) @@ -1,46 +0,0 @@ -/* - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "sbuf.h" - -#include -#include -#include - -void -cli_out(struct cli *cli, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - sbuf_vprintf(cli->sb, fmt, ap); - va_end(ap); -} - -void -cli_param(struct cli *cli) -{ - - cli->result = CLIS_PARAM; - cli_out(cli, "Parameter error, use \"help [command]\" for more info.\n"); -} - -void -cli_result(struct cli *cli, unsigned res) -{ - - cli->result = res; -} - From phk at projects.linpro.no Sat Aug 5 12:16:48 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:16:48 +0200 (CEST) Subject: r655 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805121648.886BE1EC576@projects.linpro.no> Author: phk Date: 2006-08-05 14:16:48 +0200 (Sat, 05 Aug 2006) New Revision: 655 Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: Rename struct vcls to vclprog Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-05 11:44:37 UTC (rev 654) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-05 12:16:48 UTC (rev 655) @@ -23,15 +23,15 @@ #include "mgt.h" #include "mgt_cli.h" -struct vcls { - TAILQ_ENTRY(vcls) list; +struct vclprog { + TAILQ_ENTRY(vclprog) list; char *name; char *fname; int active; }; -static TAILQ_HEAD(, vcls) vclhead = TAILQ_HEAD_INITIALIZER(vclhead); +static TAILQ_HEAD(, vclprog) vclhead = TAILQ_HEAD_INITIALIZER(vclhead); /*--------------------------------------------------------------------*/ @@ -75,10 +75,10 @@ /*--------------------------------------------------------------------*/ -static struct vcls * +static struct vclprog * mgt_vcc_add(const char *name, char *file) { - struct vcls *vp; + struct vclprog *vp; vp = calloc(sizeof *vp, 1); assert(vp != NULL); @@ -89,7 +89,7 @@ } static void -mgt_vcc_del(struct vcls *vp) +mgt_vcc_del(struct vclprog *vp) { TAILQ_REMOVE(&vclhead, vp, list); printf("unlink %s\n", vp->fname); @@ -102,7 +102,7 @@ static int mgt_vcc_delbyname(const char *name) { - struct vcls *vp; + struct vclprog *vp; TAILQ_FOREACH(vp, &vclhead, list) { if (!strcmp(name, vp->name)) { @@ -121,7 +121,7 @@ char *buf, *vf; const char *p, *q; struct sbuf *sb; - struct vcls *vp; + struct vclprog *vp; sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); assert(sb != NULL); @@ -172,7 +172,7 @@ int mgt_push_vcls_and_start(int *status, char **p) { - struct vcls *vp; + struct vclprog *vp; TAILQ_FOREACH(vp, &vclhead, list) { if (mgt_cli_askchild(status, p, @@ -194,7 +194,7 @@ void mgt_vcc_atexit(void) { - struct vcls *vp; + struct vclprog *vp; if (getpid() != mgt_pid) return; @@ -277,10 +277,10 @@ mgt_vcc_add(av[2], vf); } -static struct vcls * +static struct vclprog * mcf_find_vcl(struct cli *cli, const char *name) { - struct vcls *vp; + struct vclprog *vp; TAILQ_FOREACH(vp, &vclhead, list) if (!strcmp(vp->name, name)) @@ -297,7 +297,7 @@ { int status; char *p; - struct vcls *vp; + struct vclprog *vp; (void)priv; vp = mcf_find_vcl(cli, av[2]); @@ -323,7 +323,7 @@ { int status; char *p; - struct vcls *vp; + struct vclprog *vp; (void)priv; vp = mcf_find_vcl(cli, av[2]); @@ -347,7 +347,7 @@ { int status; char *p; - struct vcls *vp; + struct vclprog *vp; (void)av; (void)priv; From phk at projects.linpro.no Sat Aug 5 12:17:26 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:17:26 +0200 (CEST) Subject: r656 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805121726.DD77D1EC575@projects.linpro.no> Author: phk Date: 2006-08-05 14:17:26 +0200 (Sat, 05 Aug 2006) New Revision: 656 Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c Log: style fix Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 12:16:48 UTC (rev 655) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 12:17:26 UTC (rev 656) @@ -147,7 +147,7 @@ struct evbase *evb; evb = calloc(sizeof *evb, 1); - if (!evb) + if (evb == NULL) return (evb); if (ev_get_pfd(evb)) { free(evb); From phk at projects.linpro.no Sat Aug 5 12:17:56 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:17:56 +0200 (CEST) Subject: r657 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805121756.D42C01EC576@projects.linpro.no> Author: phk Date: 2006-08-05 14:17:56 +0200 (Sat, 05 Aug 2006) New Revision: 657 Modified: trunk/varnish-cache/bin/varnishd/flint.sh Log: don't search libevent for includes Modified: trunk/varnish-cache/bin/varnishd/flint.sh =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.sh 2006-08-05 12:17:26 UTC (rev 656) +++ trunk/varnish-cache/bin/varnishd/flint.sh 2006-08-05 12:17:56 UTC (rev 657) @@ -5,7 +5,6 @@ -I/usr/include \ -I. \ -I../../include \ - -I../../contrib/libevent \ flint.lnt \ *.c > $T 2>&1 From phk at projects.linpro.no Sat Aug 5 12:18:45 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:18:45 +0200 (CEST) Subject: r658 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805121845.DE3831EC577@projects.linpro.no> Author: phk Date: 2006-08-05 14:18:45 +0200 (Sat, 05 Aug 2006) New Revision: 658 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_http.c trunk/varnish-cache/bin/varnishd/cache_main.c trunk/varnish-cache/bin/varnishd/cache_pipe.c Log: Remove unused includes Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-05 12:17:56 UTC (rev 657) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-05 12:18:45 UTC (rev 658) @@ -19,7 +19,6 @@ #include #include -#include "config.h" #include "libvarnish.h" #include "heritage.h" #include "shmlog.h" Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-05 12:17:56 UTC (rev 657) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-05 12:18:45 UTC (rev 658) @@ -12,7 +12,6 @@ #include #include -#include "libvarnish.h" #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/cache_main.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-05 12:17:56 UTC (rev 657) +++ trunk/varnish-cache/bin/varnishd/cache_main.c 2006-08-05 12:18:45 UTC (rev 658) @@ -7,7 +7,6 @@ #include #include -#include "libvarnish.h" #include "heritage.h" #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-05 12:17:56 UTC (rev 657) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-05 12:18:45 UTC (rev 658) @@ -11,7 +11,6 @@ #include #include -#include "libvarnish.h" #include "shmlog.h" #include "cache.h" From phk at projects.linpro.no Sat Aug 5 12:19:03 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:19:03 +0200 (CEST) Subject: r659 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805121903.921511EC579@projects.linpro.no> Author: phk Date: 2006-08-05 14:19:03 +0200 (Sat, 05 Aug 2006) New Revision: 659 Modified: trunk/varnish-cache/bin/varnishd/mgt.h Log: Remove prototypes for no longer existing functions Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-05 12:18:45 UTC (rev 658) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-05 12:19:03 UTC (rev 659) @@ -9,8 +9,6 @@ /* mgt_child.c */ void mgt_run(int dflag); -void mgt_start_child(void); -void mgt_stop_child(void); extern pid_t mgt_pid, child_pid; /* mgt_cli.c */ From phk at projects.linpro.no Sat Aug 5 12:19:33 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:19:33 +0200 (CEST) Subject: r660 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805121933.76A011EC578@projects.linpro.no> Author: phk Date: 2006-08-05 14:19:33 +0200 (Sat, 05 Aug 2006) New Revision: 660 Modified: trunk/varnish-cache/bin/varnishd/common_cli.h Log: Cleanup unused stuff Modified: trunk/varnish-cache/bin/varnishd/common_cli.h =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-05 12:19:03 UTC (rev 659) +++ trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-05 12:19:33 UTC (rev 660) @@ -4,14 +4,9 @@ struct cli { struct sbuf *sb; - unsigned verbose; - unsigned suspend; enum cli_status_e result; - struct cli_proto *cli_proto; }; -void cli_suspend(struct cli *cli); -void cli_resume(struct cli *cli); int cli_writeres(int fd, struct cli *cli); int cli_readres(int fd, unsigned *status, char **ptr); extern struct cli_proto CLI_cmds[]; From phk at projects.linpro.no Sat Aug 5 12:20:13 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:20:13 +0200 (CEST) Subject: r661 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805122013.BCAAA1EC57A@projects.linpro.no> Author: phk Date: 2006-08-05 14:20:13 +0200 (Sat, 05 Aug 2006) New Revision: 661 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_vcl.c Log: Remove unused "ip" from backend. Make VCL_Load static, and give it a NULL check. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-05 12:19:33 UTC (rev 660) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-05 12:20:13 UTC (rev 661) @@ -25,7 +25,6 @@ #define HTTP_HDR_RESPONSE 4 #define HTTP_HDR_FIRST 5 -struct event_base; struct cli; struct sbuf; struct sess; @@ -265,7 +264,6 @@ const char *vcl_name; const char *hostname; const char *portname; - unsigned ip; struct addrinfo *addr; struct addrinfo *last_addr; @@ -397,7 +395,6 @@ void VCL_Init(void); void VCL_Rel(struct VCL_conf *vc); struct VCL_conf *VCL_Get(void); -int VCL_Load(const char *fn, const char *name, struct cli *cli); #define VCL_RET_MAC(l,u,b,n) #define VCL_MET_MAC(l,u,b) void VCL_##l##_method(struct sess *); Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-05 12:19:33 UTC (rev 660) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-05 12:20:13 UTC (rev 661) @@ -92,7 +92,7 @@ return (NULL); } -int +static int VCL_Load(const char *fn, const char *name, struct cli *cli) { struct vcls *vcl; @@ -191,6 +191,11 @@ (void)av; (void)priv; vcl = vcl_find(av[2]); + if (vcl == NULL) { + cli_result(cli, CLIS_PARAM); + cli_out(cli, "VCL '%s' unknown", av[2]); + return; + } if (vcl->discard) { cli_result(cli, CLIS_PARAM); cli_out(cli, "VCL %s already discarded", av[2]); From phk at projects.linpro.no Sat Aug 5 12:22:46 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:22:46 +0200 (CEST) Subject: r662 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805122246.F1F6E1EC57C@projects.linpro.no> Author: phk Date: 2006-08-05 14:22:46 +0200 (Sat, 05 Aug 2006) New Revision: 662 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c Log: Make sure we don't overflow the line buffer Remove unused #include Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-05 12:20:13 UTC (rev 661) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-05 12:22:46 UTC (rev 662) @@ -9,7 +9,6 @@ #include #include -#include "libvarnish.h" #include "shmlog.h" #include "cli.h" #include "cli_priv.h" @@ -72,7 +71,7 @@ i = poll(pfd, 1, 5000); if (i == 0) continue; - if (nbuf == lbuf) { + if ((nbuf + 2) >= lbuf) { lbuf += lbuf; buf = realloc(buf, lbuf); assert(buf != NULL); @@ -80,6 +79,7 @@ i = read(heritage.fds[2], buf + nbuf, lbuf - nbuf); if (i <= 0) { VSL(SLT_Error, 0, "CLI read %d (errno=%d)", i, errno); + free(buf); return; } nbuf += i; @@ -94,6 +94,7 @@ i = cli_writeres(heritage.fds[1], cli); if (i) { VSL(SLT_Error, 0, "CLI write failed (errno=%d)", errno); + free(buf); return; } VSL(SLT_CLI, 0, "Wr %d %d %s", From phk at projects.linpro.no Sat Aug 5 12:23:09 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:23:09 +0200 (CEST) Subject: r663 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805122309.9A4E81EC57B@projects.linpro.no> Author: phk Date: 2006-08-05 14:23:09 +0200 (Sat, 05 Aug 2006) New Revision: 663 Modified: trunk/varnish-cache/bin/varnishd/common_cli.c Log: Remove unused include free buffer on error. Modified: trunk/varnish-cache/bin/varnishd/common_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-05 12:22:46 UTC (rev 662) +++ trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-05 12:23:09 UTC (rev 663) @@ -21,7 +21,6 @@ #include "cli.h" #include "cli_priv.h" #include "common_cli.h" -#include "libvarnish.h" void cli_out(struct cli *cli, const char *fmt, ...) @@ -93,8 +92,10 @@ p = malloc(v + 1); assert(p != NULL); i = read(fd, p, v + 1); - if (i < 0) + if (i < 0) { + free(p); return (i); + } assert(i == v + 1); assert(p[v] == '\n'); p[v] = '\0'; From phk at projects.linpro.no Sat Aug 5 12:23:44 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:23:44 +0200 (CEST) Subject: r664 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805122344.EFC5C1EC57D@projects.linpro.no> Author: phk Date: 2006-08-05 14:23:44 +0200 (Sat, 05 Aug 2006) New Revision: 664 Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c Log: Make sanity check of binheap permanent and fix style accordingly. Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-08-05 12:23:09 UTC (rev 663) +++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-08-05 12:23:44 UTC (rev 664) @@ -106,6 +106,7 @@ struct object *o; time_t t; struct sess *sp; + struct object *o2; (void)arg; @@ -123,12 +124,12 @@ continue; } binheap_delete(exp_heap, o->heap_idx); -{ - struct object *o2; - o2 = binheap_root(exp_heap); - if (o2 != NULL) - assert(o2->ttl >= o->ttl); -} + + /* Sanity check */ + o2 = binheap_root(exp_heap); + if (o2 != NULL) + assert(o2->ttl >= o->ttl); + AZ(pthread_mutex_unlock(&exp_mtx)); VSL(SLT_ExpPick, 0, "%u", o->xid); From phk at projects.linpro.no Sat Aug 5 12:24:05 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:24:05 +0200 (CEST) Subject: r665 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805122405.DFE771EC57E@projects.linpro.no> Author: phk Date: 2006-08-05 14:24:05 +0200 (Sat, 05 Aug 2006) New Revision: 665 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: Remove unused include Fix function arg type Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-05 12:23:44 UTC (rev 664) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-05 12:24:05 UTC (rev 665) @@ -12,7 +12,6 @@ #include #include -#include "libvarnish.h" #include "cli_priv.h" #include "cli.h" #include "sbuf.h" @@ -232,7 +231,7 @@ }; static int -mgt_cli_callback(struct ev *e, unsigned what) +mgt_cli_callback(struct ev *e, int what) { struct cli_port *cp; char *p; From phk at projects.linpro.no Sat Aug 5 12:24:25 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:24:25 +0200 (CEST) Subject: r666 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805122425.BA6981EC57F@projects.linpro.no> Author: phk Date: 2006-08-05 14:24:25 +0200 (Sat, 05 Aug 2006) New Revision: 666 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c Log: Style cleanup. remove two unused variables. Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 12:24:05 UTC (rev 665) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 12:24:25 UTC (rev 666) @@ -30,8 +30,6 @@ static int child_fds[2]; static unsigned child_should_run; -static unsigned child_ticker; -static unsigned dstarts; struct evbase *mgt_evb; @@ -142,7 +140,6 @@ free(p); exit (2); } - child_ticker = 0; } /*--------------------------------------------------------------------*/ @@ -232,7 +229,7 @@ mgt_run(int dflag) { struct sigaction sac; - struct ev *ev_sigchld, *ev_sigint; + struct ev *e; mgt_pid = getpid(); @@ -242,19 +239,20 @@ if (dflag) mgt_cli_setup(0, 1, 1); - ev_sigint = ev_new(); - assert(ev_sigint != NULL); - ev_sigint->sig = SIGINT; - ev_sigint->callback = mgt_sigint; - ev_sigint->name = "mgt_sigint"; - AZ(ev_add(mgt_evb, ev_sigint)); + e = ev_new(); + assert(e != NULL); + e->sig = SIGINT; + e->callback = mgt_sigint; + e->name = "mgt_sigint"; + AZ(ev_add(mgt_evb, e)); - ev_sigchld = ev_new(); - ev_sigchld->sig = SIGCHLD; - ev_sigchld->sig_flags = SA_NOCLDSTOP; - ev_sigchld->callback = mgt_sigchld; - ev_sigchld->name = "mgt_sigchild"; - AZ(ev_add(mgt_evb, ev_sigchld)); + e = ev_new(); + assert(e != NULL); + e->sig = SIGCHLD; + e->sig_flags = SA_NOCLDSTOP; + e->callback = mgt_sigchld; + e->name = "mgt_sigchild"; + AZ(ev_add(mgt_evb, e)); setproctitle("Varnish-Mgr"); @@ -285,6 +283,5 @@ stop_child(); return; } - dstarts = 0; start_child(); } From phk at projects.linpro.no Sat Aug 5 12:24:37 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:24:37 +0200 (CEST) Subject: r667 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805122437.9DA5F1EC57F@projects.linpro.no> Author: phk Date: 2006-08-05 14:24:37 +0200 (Sat, 05 Aug 2006) New Revision: 667 Modified: trunk/varnish-cache/bin/varnishd/flint.lnt Log: Improve. Modified: trunk/varnish-cache/bin/varnishd/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-05 12:24:25 UTC (rev 666) +++ trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-05 12:24:37 UTC (rev 667) @@ -1,8 +1,12 @@ --passes=12 +-passes=3 ++libh mgt_event.h + // Fix strchr() semtics, it can only return NULL if arg2 != 0 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) +-ffc // No automatic custody + -e763 // Redundant declaration for symbol '...' previously declared -e726 // Extraneous comma ignored -e728 // Symbol ... not explicitly initialized From phk at projects.linpro.no Sat Aug 5 12:45:45 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 14:45:45 +0200 (CEST) Subject: r668 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805124545.A07BD1EC572@projects.linpro.no> Author: phk Date: 2006-08-05 14:45:45 +0200 (Sat, 05 Aug 2006) New Revision: 668 Modified: trunk/varnish-cache/bin/varnishd/common_cli.c trunk/varnish-cache/bin/varnishd/common_cli.h trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: Add a timeout to reads from the child CLI pipe so we don't hang for ever. Modified: trunk/varnish-cache/bin/varnishd/common_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-05 12:24:37 UTC (rev 667) +++ trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-05 12:45:45 UTC (rev 668) @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -71,15 +72,31 @@ return (i != l); } +static int +read_tmo(int fd, void *ptr, unsigned len, double tmo) +{ + int i; + struct pollfd pfd[1]; + + pfd->fd = fd; + pfd->events = POLLIN; + i = poll(pfd, 1, (int)(tmo * 1e3)); + if (i == 0) { + errno = ETIMEDOUT; + return (-1); + } + return (read(fd, ptr, len)); +} + int -cli_readres(int fd, unsigned *status, char **ptr) +cli_readres(int fd, unsigned *status, char **ptr, double tmo) { - char res[CLI_LINE0_LEN + 1]; /* For NUL */ + char res[CLI_LINE0_LEN]; /* For NUL */ int i, j; unsigned u, v; char *p; - i = read(fd, res, CLI_LINE0_LEN); + i = read_tmo(fd, res, CLI_LINE0_LEN, tmo); if (i < 0) return (i); assert(i == CLI_LINE0_LEN); /* XXX: handle */ @@ -91,7 +108,7 @@ *status = u; p = malloc(v + 1); assert(p != NULL); - i = read(fd, p, v + 1); + i = read_tmo(fd, p, v + 1, tmo); if (i < 0) { free(p); return (i); Modified: trunk/varnish-cache/bin/varnishd/common_cli.h =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-05 12:24:37 UTC (rev 667) +++ trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-05 12:45:45 UTC (rev 668) @@ -8,7 +8,7 @@ }; int cli_writeres(int fd, struct cli *cli); -int cli_readres(int fd, unsigned *status, char **ptr); +int cli_readres(int fd, unsigned *status, char **ptr, double tmo); extern struct cli_proto CLI_cmds[]; cli_func_t cli_func_ping; Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-05 12:24:37 UTC (rev 667) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-05 12:45:45 UTC (rev 668) @@ -85,7 +85,7 @@ assert(i == v); free(p); - i = cli_readres(cli_i, &u, &p); + i = cli_readres(cli_i, &u, &p, 3.0); assert(i == 0); cli_result(cli, u); cli_out(cli, "%s", p); @@ -187,7 +187,8 @@ assert(i == strlen(p)); free(p); - i = cli_readres(cli_i, &j, resp); + i = cli_readres(cli_i, &j, resp, 3.0); + assert(i == 0); if (status != NULL) *status = j; return (j == CLIS_OK ? 0 : j); From phk at projects.linpro.no Sat Aug 5 14:22:33 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 16:22:33 +0200 (CEST) Subject: r669 - trunk/varnish-cache/lib/libvarnish Message-ID: <20060805142233.3D0D31EC581@projects.linpro.no> Author: phk Date: 2006-08-05 16:22:33 +0200 (Sat, 05 Aug 2006) New Revision: 669 Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c Log: More defensive coding. Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/binary_heap.c 2006-08-05 12:45:45 UTC (rev 668) +++ trunk/varnish-cache/lib/libvarnish/binary_heap.c 2006-08-05 14:22:33 UTC (rev 669) @@ -178,10 +178,14 @@ assert(bh->next > ROOT_IDX); assert(idx < bh->next); assert(idx > 0); + assert(bh->array[idx] != NULL); bh->update(bh->priv, bh->array[idx], 0); - if (idx == --bh->next) + if (idx == --bh->next) { + bh->array[bh->next] = NULL; return; + } bh->array[idx] = bh->array[bh->next]; + bh->array[bh->next] = NULL; binheap_update(bh, idx); idx = binheap_trickleup(bh, idx); binheap_trickledown(bh, idx); From phk at projects.linpro.no Sat Aug 5 14:24:21 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 16:24:21 +0200 (CEST) Subject: r670 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805142421.023991EC582@projects.linpro.no> Author: phk Date: 2006-08-05 16:24:21 +0200 (Sat, 05 Aug 2006) New Revision: 670 Modified: trunk/varnish-cache/bin/varnishd/common_cli.c trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_event.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: More defensive coding and a couple of bugs less. Modified: trunk/varnish-cache/bin/varnishd/common_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-05 14:22:33 UTC (rev 669) +++ trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-05 14:24:21 UTC (rev 670) @@ -76,11 +76,11 @@ read_tmo(int fd, void *ptr, unsigned len, double tmo) { int i; - struct pollfd pfd[1]; + struct pollfd pfd; - pfd->fd = fd; - pfd->events = POLLIN; - i = poll(pfd, 1, (int)(tmo * 1e3)); + pfd.fd = fd; + pfd.events = POLLIN; + i = poll(&pfd, 1, (int)(tmo * 1e3)); if (i == 0) { errno = ETIMEDOUT; return (-1); Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-05 14:22:33 UTC (rev 669) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-05 14:24:21 UTC (rev 670) @@ -15,14 +15,14 @@ void mgt_cli_init(void); void mgt_cli_setup(int fdi, int fdo, int verbose); -int mgt_cli_askchild(int *status, char **resp, const char *fmt, ...); +int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...); void mgt_cli_start_child(int fdi, int fdo); void mgt_cli_stop_child(void); /* mgt_vcc.c */ void mgt_vcc_init(void); int mgt_vcc_default(const char *bflag, const char *fflag); -int mgt_push_vcls_and_start(int *status, char **p); +int mgt_push_vcls_and_start(unsigned *status, char **p); /* tcp.c */ int open_tcp(const char *port); Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 14:22:33 UTC (rev 669) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 14:24:21 UTC (rev 670) @@ -32,6 +32,8 @@ static unsigned child_should_run; struct evbase *mgt_evb; +struct ev *ev_poker; +struct ev *ev_listen; /*--------------------------------------------------------------------*/ @@ -42,11 +44,15 @@ char buf[BUFSIZ]; (void)e; - if ((what & ~EV_RD)) + if ((what & ~EV_RD)) { + ev_listen = NULL; return (1); + } i = read(child_fds[0], buf, sizeof buf - 1); - if (i <= 0) + if (i <= 0) { + ev_listen = NULL; return (1); + } buf[i] = '\0'; printf("Child said: <<%s>>\n", buf); return (0); @@ -120,6 +126,7 @@ e->name = "Child listener"; e->callback = child_listener; AZ(ev_add(mgt_evb, e)); + ev_listen = e; e = ev_new(); assert(e != NULL); @@ -127,8 +134,8 @@ e->callback = child_poker; e->name = "child poker"; AZ(ev_add(mgt_evb, e)); + ev_poker = e; - mgt_cli_start_child(heritage.fds[0], heritage.fds[3]); AZ(close(heritage.fds[1])); heritage.fds[1] = -1; @@ -151,6 +158,10 @@ if (child_pid < 0) return; + if (ev_poker != NULL) + ev_del(mgt_evb, ev_poker); + ev_poker = NULL; + child_should_run = 0; printf("Clean child\n"); @@ -175,6 +186,11 @@ (void)e; (void)what; + + if (ev_poker != NULL) + ev_del(mgt_evb, ev_poker); + ev_poker = NULL; + r = wait4(-1, &status, WNOHANG, NULL); if (r != child_pid) { printf("Unknown child died pid=%d status=0x%x\n", @@ -195,6 +211,10 @@ heritage.fds[3] = -1; } + if (ev_listen != NULL) + ev_del(mgt_evb, ev_listen); + ev_listen = NULL; + AZ(close(child_fds[0])); child_fds[0] = -1; printf("Child cleaned\n"); @@ -261,7 +281,8 @@ AZ(sigaction(SIGPIPE, &sac, NULL)); AZ(sigaction(SIGHUP, &sac, NULL)); - printf("rolling...\n"); + printf("rolling(1)...\n"); + fprintf(stderr, "rolling(2)...\n"); if (!dflag) start_child(); Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-05 14:22:33 UTC (rev 669) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-05 14:24:21 UTC (rev 670) @@ -171,11 +171,12 @@ */ int -mgt_cli_askchild(int *status, char **resp, const char *fmt, ...) +mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) { char *p; - int i, j; + int i; va_list ap; + unsigned u; va_start(ap, fmt); i = vasprintf(&p, fmt, ap); @@ -187,11 +188,11 @@ assert(i == strlen(p)); free(p); - i = cli_readres(cli_i, &j, resp, 3.0); + i = cli_readres(cli_i, &u, resp, 3.0); assert(i == 0); if (status != NULL) - *status = j; - return (j == CLIS_OK ? 0 : j); + *status = u; + return (u == CLIS_OK ? 0 : u); } /*--------------------------------------------------------------------*/ @@ -254,6 +255,7 @@ if (p == NULL) return (0); *p = '\0'; +fprintf(stderr, "CLI <%s>\n", cp->buf); sbuf_clear(cp->cli->sb); cli_dispatch(cp->cli, cli_proto, cp->buf); sbuf_finish(cp->cli->sb); Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 14:22:33 UTC (rev 669) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 14:24:21 UTC (rev 670) @@ -89,10 +89,10 @@ if (evb->npfd > 256) u = evb->npfd + 256; - else if (evb->npfd > 8) + else if (evb->npfd < 8) + u = 8; + else u = evb->npfd * 2; - else - u = 8; p = realloc(evb->pfd, sizeof *evb->pfd * u); if (p == NULL) return (1); @@ -217,6 +217,7 @@ } if (e->fd >= 0) { + assert(evb->lpfd < evb->npfd); evb->pfd[evb->lpfd].fd = e->fd; evb->pfd[evb->lpfd].events = e->fd_flags & (EV_RD|EV_WR|EV_ERR|EV_HUP); @@ -268,7 +269,10 @@ if (e->fd >= 0) { evb->pfd[e->__poll_idx].fd = -1; - evb->compact_pfd++; + if (e->__poll_idx == evb->lpfd - 1) + evb->lpfd--; + else + evb->compact_pfd++; e->fd = -1; } @@ -311,7 +315,25 @@ static void ev_compact_pfd(struct evbase *evb) { - /* XXX TBD */ + unsigned u; + struct pollfd *p; + struct ev *ep; + + p = evb->pfd; + ep = TAILQ_FIRST(&evb->events); + for (u = 0; u < evb->lpfd; u++, p++) { + if (p->fd >= 0) + continue; + for(; ep != NULL; ep = TAILQ_NEXT(ep, __list)) { + if (ep->fd >= 0 && ep->__poll_idx > u) + break; + } + if (ep == NULL) + break; + *p = evb->pfd[ep->__poll_idx]; + ep->__poll_idx = u; + } + evb->lpfd = u; evb->compact_pfd = 0; } @@ -370,8 +392,8 @@ CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC); e = binheap_root(evb->binheap); if (e != NULL) { + CHECK_OBJ_NOTNULL(e, EV_MAGIC); assert(e->__binheap_idx == 1); - CHECK_OBJ_NOTNULL(e, EV_MAGIC); t = ev_now(); if (e->__when <= t) return (ev_sched_timeout(evb, e, t)); @@ -389,6 +411,7 @@ if (evb->psig) return (ev_sched_signal(evb)); + assert(evb->lpfd < evb->npfd); i = poll(evb->pfd, evb->lpfd, tmo); if(i == -1 && errno == EINTR) return (ev_sched_signal(evb)); @@ -407,7 +430,6 @@ assert(e->__poll_idx < evb->lpfd); pfd = &evb->pfd[e->__poll_idx]; assert(pfd->fd == e->fd); - assert(pfd->events == e->fd_flags); if (!pfd->revents) continue; j = e->callback(e, pfd->revents); Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-05 14:22:33 UTC (rev 669) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-05 14:24:21 UTC (rev 670) @@ -170,7 +170,7 @@ /*--------------------------------------------------------------------*/ int -mgt_push_vcls_and_start(int *status, char **p) +mgt_push_vcls_and_start(unsigned *status, char **p) { struct vclprog *vp; @@ -221,7 +221,7 @@ { char *vf, *p; struct sbuf *sb; - int status; + unsigned status; (void)priv; @@ -251,7 +251,7 @@ { char *vf; struct sbuf *sb; - int status; + unsigned status; char *p; (void)priv; @@ -295,7 +295,7 @@ void mcf_config_use(struct cli *cli, char **av, void *priv) { - int status; + unsigned status; char *p; struct vclprog *vp; @@ -321,7 +321,7 @@ void mcf_config_discard(struct cli *cli, char **av, void *priv) { - int status; + unsigned status; char *p; struct vclprog *vp; @@ -345,7 +345,7 @@ void mcf_config_list(struct cli *cli, char **av, void *priv) { - int status; + unsigned status; char *p; struct vclprog *vp; From phk at projects.linpro.no Sat Aug 5 15:35:41 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 17:35:41 +0200 (CEST) Subject: r671 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805153541.588361EC584@projects.linpro.no> Author: phk Date: 2006-08-05 17:35:41 +0200 (Sat, 05 Aug 2006) New Revision: 671 Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c Log: We don't disturb ourselves. Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 14:24:21 UTC (rev 670) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-05 15:35:41 UTC (rev 671) @@ -447,6 +447,7 @@ } if (j) { ev_del(evb, e); + evb->disturbed = 0; free(e); } } From phk at projects.linpro.no Sat Aug 5 15:38:27 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 17:38:27 +0200 (CEST) Subject: r672 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805153827.E2FD11EC585@projects.linpro.no> Author: phk Date: 2006-08-05 17:38:27 +0200 (Sat, 05 Aug 2006) New Revision: 672 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: Polish the debugstunt and make it possible to avoid it. Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-05 15:35:41 UTC (rev 671) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-05 15:38:27 UTC (rev 672) @@ -267,22 +267,31 @@ assert(j == i); while (1) { + if (pfd[0].fd == -1 && pfd[1].fd == -1) + break; i = poll(pfd, 2, INFTIM); for (k = 0; k < 2; k++) { if (pfd[k].revents == 0) continue; - if (pfd[k].revents != POLLIN) - exit (2); + if (pfd[k].revents != POLLIN) { + printf("k %d rev %d\n", k, pfd[k].revents); + pfd[k].fd = -1; + } j = read(pipes[k][0], buf, sizeof buf); - if (j == 0) - exit (0); + if (j == 0) { + printf("k %d eof\n", k); + pfd[k].fd = -1; + } if (j > 0) { i = write(pipes[k][1], buf, j); - if (i != j) - err(1, "i = %d j = %d\n", i, j); + if (i != j) { + printf("k %d write (%d %d)\n", k, i, j); + pfd[k].fd = -1; + } } } } + exit (0); } @@ -380,7 +389,7 @@ VSL_MgtInit(SHMLOG_FILENAME, 8*1024*1024); - if (dflag) + if (dflag == 1) DebugStunt(); daemon(dflag, dflag); if (dflag) From phk at projects.linpro.no Sat Aug 5 15:38:51 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 17:38:51 +0200 (CEST) Subject: r673 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805153851.7C93D1EC585@projects.linpro.no> Author: phk Date: 2006-08-05 17:38:51 +0200 (Sat, 05 Aug 2006) New Revision: 673 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: Bail if the cli pipe is not ready Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-05 15:38:27 UTC (rev 672) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-05 15:38:51 UTC (rev 673) @@ -178,6 +178,8 @@ va_list ap; unsigned u; + if (cli_i < 0|| cli_o < 0) + return (CLIS_CANT); va_start(ap, fmt); i = vasprintf(&p, fmt, ap); va_end(ap); From phk at projects.linpro.no Sat Aug 5 15:40:41 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 17:40:41 +0200 (CEST) Subject: r674 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805154041.CD3ED1EC585@projects.linpro.no> Author: phk Date: 2006-08-05 17:40:41 +0200 (Sat, 05 Aug 2006) New Revision: 674 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c Log: Replace client_should_run with a 5 state enum to avoid races if multiple CLI sources yell at the same time. Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 15:38:51 UTC (rev 673) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 15:40:41 UTC (rev 674) @@ -29,7 +29,13 @@ pid_t child_pid = -1; static int child_fds[2]; -static unsigned child_should_run; +static enum { + CH_STOPPED = 0, + CH_STARTING = 1, + CH_RUNNING = 2, + CH_STOPPING = 3, + CH_DIED = 4 +} child_state = CH_STOPPED; struct evbase *mgt_evb; struct ev *ev_poker; @@ -54,7 +60,7 @@ return (1); } buf[i] = '\0'; - printf("Child said: <<%s>>\n", buf); + printf("Child said (%d, %d): <<%s>>\n", child_state, child_pid, buf); return (0); } @@ -66,7 +72,7 @@ (void)e; (void)what; - if (!child_should_run) + if (child_state != CH_RUNNING) return (1); if (child_pid > 0 && mgt_cli_askchild(NULL, NULL, "ping\n")) kill(child_pid, SIGKILL); @@ -82,10 +88,10 @@ char *p; struct ev *e; - if (child_pid >= 0) + if (child_state != CH_STOPPED && child_state != CH_DIED) return; - child_should_run = 1; + child_state = CH_STARTING; AZ(pipe(&heritage.fds[0])); AZ(pipe(&heritage.fds[2])); @@ -147,6 +153,7 @@ free(p); exit (2); } + child_state = CH_RUNNING; } /*--------------------------------------------------------------------*/ @@ -155,15 +162,15 @@ stop_child(void) { - if (child_pid < 0) + if (child_state != CH_RUNNING) return; + child_state = CH_STOPPING; + if (ev_poker != NULL) ev_del(mgt_evb, ev_poker); ev_poker = NULL; - child_should_run = 0; - printf("Clean child\n"); mgt_cli_stop_child(); @@ -173,7 +180,7 @@ AZ(close(heritage.fds[3])); heritage.fds[3] = -1; - printf("Child stopped\n"); + printf("Child stopping\n"); } /*--------------------------------------------------------------------*/ @@ -200,7 +207,8 @@ printf("Cache child died pid=%d status=0x%x\n", r, status); child_pid = -1; - if (child_should_run) { + if (child_state == CH_RUNNING) { + child_state = CH_DIED; printf("Clean child\n"); mgt_cli_stop_child(); @@ -219,8 +227,10 @@ child_fds[0] = -1; printf("Child cleaned\n"); - if (child_should_run) + if (child_state == CH_DIED) start_child(); + else if (child_state == CH_STOPPING) + child_state = CH_STOPPED; return (0); } @@ -278,6 +288,7 @@ sac.sa_handler = SIG_IGN; sac.sa_flags = SA_RESTART; + AZ(sigaction(SIGPIPE, &sac, NULL)); AZ(sigaction(SIGHUP, &sac, NULL)); From phk at projects.linpro.no Sat Aug 5 15:55:34 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 17:55:34 +0200 (CEST) Subject: r675 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805155534.3B07B1EC585@projects.linpro.no> Author: phk Date: 2006-08-05 17:55:34 +0200 (Sat, 05 Aug 2006) New Revision: 675 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: Plug memory leaks related to starting/stopping child. Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 15:40:41 UTC (rev 674) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 15:55:34 UTC (rev 675) @@ -125,6 +125,7 @@ AZ(close(child_fds[1])); child_fds[1] = -1; + assert(ev_listen == NULL); e = ev_new(); assert(e != NULL); e->fd = child_fds[0]; @@ -134,6 +135,7 @@ AZ(ev_add(mgt_evb, e)); ev_listen = e; + assert(ev_poker == NULL); e = ev_new(); assert(e != NULL); e->timeout = 3.0; @@ -167,8 +169,10 @@ child_state = CH_STOPPING; - if (ev_poker != NULL) + if (ev_poker != NULL) { ev_del(mgt_evb, ev_poker); + free(ev_poker); + } ev_poker = NULL; printf("Clean child\n"); @@ -194,8 +198,10 @@ (void)e; (void)what; - if (ev_poker != NULL) + if (ev_poker != NULL) { ev_del(mgt_evb, ev_poker); + free(ev_poker); + } ev_poker = NULL; r = wait4(-1, &status, WNOHANG, NULL); @@ -219,8 +225,10 @@ heritage.fds[3] = -1; } - if (ev_listen != NULL) + if (ev_listen != NULL) { ev_del(mgt_evb, ev_listen); + free(ev_listen); + } ev_listen = NULL; AZ(close(child_fds[0])); Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-05 15:40:41 UTC (rev 674) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-05 15:55:34 UTC (rev 675) @@ -178,13 +178,17 @@ if (mgt_cli_askchild(status, p, "config.load %s %s\n", vp->name, vp->fname)) return (1); - if (vp->active) - if (mgt_cli_askchild(status, p, + free(*p); + if (vp->active && + mgt_cli_askchild(status, p, "config.use %s\n", vp->name, vp->fname)) return (1); + free(*p); } if (mgt_cli_askchild(status, p, "start\n")) return (1); + free(*p); + *p = NULL; return (0); } From phk at projects.linpro.no Sat Aug 5 16:31:24 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 18:31:24 +0200 (CEST) Subject: r676 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805163124.AE67D1EC588@projects.linpro.no> Author: phk Date: 2006-08-05 18:31:24 +0200 (Sat, 05 Aug 2006) New Revision: 676 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: More work on the debug stunt Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-05 15:55:34 UTC (rev 675) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-05 16:31:24 UTC (rev 676) @@ -271,21 +271,31 @@ break; i = poll(pfd, 2, INFTIM); for (k = 0; k < 2; k++) { + if (pfd[k].fd == -1) + continue; if (pfd[k].revents == 0) continue; if (pfd[k].revents != POLLIN) { printf("k %d rev %d\n", k, pfd[k].revents); + AZ(close(pipes[k][0])); + AZ(close(pipes[k][1])); pfd[k].fd = -1; + if (k == 1) + exit (0); } j = read(pipes[k][0], buf, sizeof buf); if (j == 0) { printf("k %d eof\n", k); + AZ(close(pipes[k][0])); + AZ(close(pipes[k][1])); pfd[k].fd = -1; } if (j > 0) { i = write(pipes[k][1], buf, j); if (i != j) { printf("k %d write (%d %d)\n", k, i, j); + AZ(close(pipes[k][0])); + AZ(close(pipes[k][1])); pfd[k].fd = -1; } } @@ -391,7 +401,8 @@ if (dflag == 1) DebugStunt(); - daemon(dflag, dflag); + if (dflag != 2) + daemon(dflag, dflag); if (dflag) printf("%d\n%d\n%d\n", getpid(), getsid(0), getpgrp()); From phk at projects.linpro.no Sat Aug 5 16:32:19 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 18:32:19 +0200 (CEST) Subject: r677 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805163219.3C0361EC58A@projects.linpro.no> Author: phk Date: 2006-08-05 18:32:19 +0200 (Sat, 05 Aug 2006) New Revision: 677 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c Log: Also trap SIGTERM Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 16:31:24 UTC (rev 676) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 16:32:19 UTC (rev 677) @@ -115,6 +115,7 @@ setproctitle("Varnish-Chld"); signal(SIGINT, SIG_DFL); + signal(SIGTERM, SIG_DFL); child_main(); exit (1); @@ -279,6 +280,13 @@ e = ev_new(); assert(e != NULL); + e->sig = SIGTERM; + e->callback = mgt_sigint; + e->name = "mgt_sigterm"; + AZ(ev_add(mgt_evb, e)); + + e = ev_new(); + assert(e != NULL); e->sig = SIGINT; e->callback = mgt_sigint; e->name = "mgt_sigint"; From phk at projects.linpro.no Sat Aug 5 16:41:12 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 18:41:12 +0200 (CEST) Subject: r678 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805164112.080DD1EC58B@projects.linpro.no> Author: phk Date: 2006-08-05 18:41:11 +0200 (Sat, 05 Aug 2006) New Revision: 678 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c Log: Issue error message for CLI::start and CLI::stop if child is not in a legal state for command. Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 16:32:19 UTC (rev 677) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 16:41:11 UTC (rev 678) @@ -21,6 +21,7 @@ #include "libvarnish.h" #include "heritage.h" #include "mgt.h" +#include "cli.h" #include "cli_priv.h" #include "mgt_cli.h" #include "mgt_event.h" @@ -37,6 +38,14 @@ CH_DIED = 4 } child_state = CH_STOPPED; +const char *ch_state[] = { + [CH_STOPPED] = "stopped", + [CH_STARTING] = "starting", + [CH_RUNNING] = "running", + [CH_STOPPING] = "stopping", + [CH_DIED] = "died, (restarting)", +}; + struct evbase *mgt_evb; struct ev *ev_poker; struct ev *ev_listen; @@ -327,9 +336,12 @@ (void)cli; (void)av; - if (priv != NULL) { + if (priv != NULL && child_state == CH_RUNNING) stop_child(); - return; - } - start_child(); + else if (priv == NULL && child_state == CH_STOPPED) + start_child(); + else { + cli_result(cli, CLIS_CANT); + cli_out(cli, "Child in state %s", ch_state[child_state]); + } } From phk at projects.linpro.no Sat Aug 5 17:04:25 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 19:04:25 +0200 (CEST) Subject: r679 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805170425.AD3321EC58C@projects.linpro.no> Author: phk Date: 2006-08-05 19:04:25 +0200 (Sat, 05 Aug 2006) New Revision: 679 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_pool.c Log: Add some undocumented code to look for something that worries me. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-05 16:41:11 UTC (rev 678) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-05 17:04:25 UTC (rev 679) @@ -30,6 +30,7 @@ struct sess; struct object; struct objhead; +struct workreq; /*--------------------------------------------------------------------*/ @@ -94,6 +95,7 @@ unsigned nbr; pthread_cond_t cv; TAILQ_ENTRY(worker) list; + struct workreq *wrq; int *wfd; unsigned werr; /* valid after WRK_Flush() */ @@ -407,6 +409,7 @@ cli_func_t cli_func_config_load; cli_func_t cli_func_config_discard; cli_func_t cli_func_config_use; +cli_func_t cli_func_dump_pool; #endif /* rfc2616.c */ Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-05 16:41:11 UTC (rev 678) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-05 17:04:25 UTC (rev 679) @@ -44,6 +44,11 @@ { CLI_CONFIG_LIST, cli_func_config_list }, { CLI_CONFIG_DISCARD, cli_func_config_discard }, { CLI_CONFIG_USE, cli_func_config_use }, + + /* Undocumented */ + { "dump.pool", "dump.pool", + "\tDump the worker thread pool state\n", + 0, 0, cli_func_dump_pool }, { NULL } }; Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-05 16:41:11 UTC (rev 678) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-05 17:04:25 UTC (rev 679) @@ -14,6 +14,7 @@ #include "heritage.h" #include "shmlog.h" #include "vcl.h" +#include "cli_priv.h" #include "cache.h" static pthread_mutex_t wrk_mtx; @@ -21,7 +22,8 @@ /* Number of work requests queued in excess of worker threads available */ static unsigned wrk_overflow; -static TAILQ_HEAD(, worker) wrk_head = TAILQ_HEAD_INITIALIZER(wrk_head); +static TAILQ_HEAD(, worker) wrk_idle = TAILQ_HEAD_INITIALIZER(wrk_idle); +static TAILQ_HEAD(, worker) wrk_busy = TAILQ_HEAD_INITIALIZER(wrk_busy); static TAILQ_HEAD(, workreq) wrk_reqhead = TAILQ_HEAD_INITIALIZER(wrk_reqhead); /*-------------------------------------------------------------------- @@ -107,7 +109,9 @@ VSL_stats->n_wrk_queue--; AZ(pthread_mutex_unlock(&wrk_mtx)); CHECK_OBJ_NOTNULL(wrq->sess, SESS_MAGIC); + assert(wrq->sess->wrk == NULL); wrq->sess->wrk = w; + w->wrq = wrq; if (wrq->sess->srcaddr == NULL) { w->acct.sess++; SES_RefSrcAddr(wrq->sess); @@ -121,6 +125,8 @@ CHECK_OBJ(w->nobj, OBJECT_MAGIC); if (w->nobjhead != NULL) CHECK_OBJ(w->nobjhead, OBJHEAD_MAGIC); + wrq->sess->wrk = NULL; + w->wrq = NULL; AZ(pthread_mutex_lock(&wrk_mtx)); VSL_stats->n_wrk_busy--; } @@ -143,6 +149,7 @@ VSL_stats->n_wrk_create++; VSL(SLT_WorkThread, 0, "%u born dynamic", w->nbr); } + TAILQ_INSERT_HEAD(&wrk_busy, w, list); while (1) { CHECK_OBJ_NOTNULL(w, WORKER_MAGIC); @@ -153,7 +160,8 @@ continue; } - TAILQ_INSERT_HEAD(&wrk_head, w, list); + TAILQ_REMOVE(&wrk_busy, w, list); + TAILQ_INSERT_HEAD(&wrk_idle, w, list); /* If we are a reserved thread we don't die */ if (priv != NULL) { @@ -164,7 +172,7 @@ ts.tv_sec += heritage.wthread_timeout; if (pthread_cond_timedwait(&w->cv, &wrk_mtx, &ts)) { VSL_stats->n_wrk--; - TAILQ_REMOVE(&wrk_head, w, list); + TAILQ_REMOVE(&wrk_idle, w, list); AZ(pthread_mutex_unlock(&wrk_mtx)); VSL(SLT_WorkThread, 0, "%u suicide", w->nbr); AZ(pthread_cond_destroy(&w->cv)); @@ -172,7 +180,7 @@ } } - /* we are already removed from wrk_head */ + /* we are already removed from wrk_idle */ wrk_do_one(w); } } @@ -194,10 +202,11 @@ VSL_stats->n_wrk_queue++; /* If there are idle threads, we tickle the first one into action */ - w = TAILQ_FIRST(&wrk_head); + w = TAILQ_FIRST(&wrk_idle); if (w != NULL) { AZ(pthread_cond_signal(&w->cv)); - TAILQ_REMOVE(&wrk_head, w, list); + TAILQ_REMOVE(&wrk_idle, w, list); + TAILQ_INSERT_TAIL(&wrk_busy, w, list); AZ(pthread_mutex_unlock(&wrk_mtx)); return; } @@ -248,3 +257,39 @@ AZ(pthread_detach(tp)); } } + + +/*--------------------------------------------------------------------*/ + +void +cli_func_dump_pool(struct cli *cli, char **av, void *priv) +{ + unsigned u; + struct sess *s; + time_t t; + + (void)av; + (void)priv; + struct worker *w; + AZ(pthread_mutex_lock(&wrk_mtx)); + t = time(NULL); + TAILQ_FOREACH(w, &wrk_busy, list) { + cli_out(cli, "\n"); + cli_out(cli, "W %p nbr %d ", w, w->nbr); + if (w->wrq == NULL) + continue; + s = w->wrq->sess; + if (s == NULL) + continue; + cli_out(cli, "sess %p fd %d xid %u step %d handling %d age %d", + s, s->fd, s->xid, s->step, s->handling, + t - s->t_req.tv_sec); + } + cli_out(cli, "\n"); + + u = 0; + TAILQ_FOREACH(w, &wrk_idle, list) + u++; + cli_out(cli, "%u idle workers\n", u); + AZ(pthread_mutex_unlock(&wrk_mtx)); +} From phk at projects.linpro.no Sat Aug 5 17:30:08 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 19:30:08 +0200 (CEST) Subject: r680 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805173008.9382B1EC58D@projects.linpro.no> Author: phk Date: 2006-08-05 19:30:08 +0200 (Sat, 05 Aug 2006) New Revision: 680 Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c Log: This was not a valid test. Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-05 17:04:25 UTC (rev 679) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-05 17:30:08 UTC (rev 680) @@ -109,7 +109,6 @@ VSL_stats->n_wrk_queue--; AZ(pthread_mutex_unlock(&wrk_mtx)); CHECK_OBJ_NOTNULL(wrq->sess, SESS_MAGIC); - assert(wrq->sess->wrk == NULL); wrq->sess->wrk = w; w->wrq = wrq; if (wrq->sess->srcaddr == NULL) { From phk at projects.linpro.no Sat Aug 5 17:30:54 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 19:30:54 +0200 (CEST) Subject: r681 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805173054.ECBE81EC58E@projects.linpro.no> Author: phk Date: 2006-08-05 19:30:54 +0200 (Sat, 05 Aug 2006) New Revision: 681 Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c Log: And that is not a good idea either. Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-05 17:30:08 UTC (rev 680) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-05 17:30:54 UTC (rev 681) @@ -124,7 +124,6 @@ CHECK_OBJ(w->nobj, OBJECT_MAGIC); if (w->nobjhead != NULL) CHECK_OBJ(w->nobjhead, OBJHEAD_MAGIC); - wrq->sess->wrk = NULL; w->wrq = NULL; AZ(pthread_mutex_lock(&wrk_mtx)); VSL_stats->n_wrk_busy--; From phk at projects.linpro.no Sat Aug 5 18:11:31 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 20:11:31 +0200 (CEST) Subject: r682 - in trunk/varnish-cache: include lib/libvcl Message-ID: <20060805181131.AC4261EC58F@projects.linpro.no> Author: phk Date: 2006-08-05 20:11:31 +0200 (Sat, 05 Aug 2006) New Revision: 682 Modified: trunk/varnish-cache/include/vcl.h trunk/varnish-cache/include/vcl_returns.h trunk/varnish-cache/include/vrt.h trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Make vcl methods call their defaults as a last resort. Fix the location table so it knows about the default code too. Modified: trunk/varnish-cache/include/vcl.h =================================================================== --- trunk/varnish-cache/include/vcl.h 2006-08-05 17:30:54 UTC (rev 681) +++ trunk/varnish-cache/include/vcl.h 2006-08-05 18:11:31 UTC (rev 682) @@ -22,7 +22,7 @@ unsigned nref; unsigned busy; - void *priv; + void *priv; vcl_init_f *init_func; vcl_fini_f *fini_func; Modified: trunk/varnish-cache/include/vcl_returns.h =================================================================== --- trunk/varnish-cache/include/vcl_returns.h 2006-08-05 17:30:54 UTC (rev 681) +++ trunk/varnish-cache/include/vcl_returns.h 2006-08-05 18:11:31 UTC (rev 682) @@ -1,5 +1,5 @@ /* - * $Id: vcc_gen_fixed_token.tcl 556 2006-07-22 09:38:09Z phk $ + * $Id: vcc_gen_fixed_token.tcl 638 2006-08-04 10:54:30Z phk $ * * NB: This file is machine generated, DO NOT EDIT! * Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2006-08-05 17:30:54 UTC (rev 681) +++ trunk/varnish-cache/include/vrt.h 2006-08-05 18:11:31 UTC (rev 682) @@ -3,7 +3,7 @@ * * Runtime support for compiled VCL programs. * - * XXX: When this file is changed, lib/libvcl/vcl_gen_fixed_token.tcl + * XXX: When this file is changed, lib/libvcl/vcc_gen_fixed_token.tcl * XXX: *MUST* be rerun. */ @@ -13,6 +13,7 @@ struct VCL_conf; struct vrt_ref { + unsigned file; unsigned line; unsigned pos; unsigned count; Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-05 17:30:54 UTC (rev 681) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-05 18:11:31 UTC (rev 682) @@ -190,7 +190,22 @@ return (p); } +/*--------------------------------------------------------------------*/ +static int +IsMethod(struct token *t) +{ + struct method *m; + + for(m = method_tab; m->name != NULL; m++) { + if (vcc_IdIs(t, m->defname)) + return (2); + if (vcc_IdIs(t, m->name)) + return (1); + } + return (0); +} + /*-------------------------------------------------------------------- * Keep track of definitions and references */ @@ -997,17 +1012,26 @@ static void Function(struct tokenlist *tl) { + struct token *tn; vcc_NextToken(tl); ExpectErr(tl, ID); tl->curproc = AddProc(tl, tl->t, 1); tl->curproc->exists++; + tn = tl->t; AddDef(tl, tl->t, R_FUNC); Fh(tl, 0, "static int VGC_function_%T (struct sess *sp);\n", tl->t); Fc(tl, 1, "static int\n"); Fc(tl, 1, "VGC_function_%T (struct sess *sp)\n", tl->t); vcc_NextToken(tl); + tl->indent += INDENT; + Fc(tl, 1, "{\n"); L(tl, Compound(tl)); + if (IsMethod(tn) == 1) { + Fc(tl, 1, "VGC_function_default_%T(sp);\n", tn); + } + Fc(tl, 1, "}\n"); + tl->indent -= INDENT; Fc(tl, 0, "\n"); } @@ -1221,19 +1245,26 @@ LocTable(struct tokenlist *tl) { struct token *t; - unsigned lin, pos; + unsigned fil, lin, pos; const char *p; Fh(tl, 0, "#define VGC_NREFS %u\n", tl->cnt + 1); Fh(tl, 0, "static struct vrt_ref VGC_ref[VGC_NREFS];\n"); Fc(tl, 0, "static struct vrt_ref VGC_ref[VGC_NREFS] = {\n"); + fil = 0; lin = 1; pos = 0; - p = tl->b; + p = vcc_default_vcl_b; TAILQ_FOREACH(t, &tl->tokens, list) { if (t->cnt == 0) continue; for (;p < t->b; p++) { + if (p == vcc_default_vcl_e) { + p = tl->b; + fil = 1; + lin = 1; + pos = 0; + } if (*p == '\n') { lin++; pos = 0; @@ -1244,8 +1275,8 @@ pos++; } - Fc(tl, 0, " [%3u] = { %4u, %3u, 0, \"%T\" },\n", - t->cnt, lin, pos + 1, t); + Fc(tl, 0, " [%3u] = { %d, %4u, %3u, 0, \"%T\" },\n", + t->cnt, fil, lin, pos + 1, t); } Fc(tl, 0, "};\n"); } @@ -1341,8 +1372,8 @@ e = strchr(b, '\0'); assert(e != NULL); tokens.e = e; + vcc_Lexer(&tokens, vcc_default_vcl_b, vcc_default_vcl_e); vcc_Lexer(&tokens, b, e); - vcc_Lexer(&tokens, vcc_default_vcl_b, vcc_default_vcl_e); vcc_AddToken(&tokens, EOI, e, e); if (tokens.err) goto done; Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2006-08-05 17:30:54 UTC (rev 681) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2006-08-05 18:11:31 UTC (rev 682) @@ -455,7 +455,7 @@ fputs(" unsigned nref;\n", f); fputs(" unsigned busy;\n", f); fputs("\n", f); - fputs(" void *priv;\n", f); + fputs(" void *priv;\n", f); fputs("\n", f); fputs(" vcl_init_f *init_func;\n", f); fputs(" vcl_fini_f *fini_func;\n", f); @@ -471,7 +471,7 @@ fputs(" *\n", f); fputs(" * Runtime support for compiled VCL programs.\n", f); fputs(" *\n", f); - fputs(" * XXX: When this file is changed, lib/libvcl/vcl_gen_fixed_token.tcl\n", f); + fputs(" * XXX: When this file is changed, lib/libvcl/vcc_gen_fixed_token.tcl\n", f); fputs(" * XXX: *MUST* be rerun.\n", f); fputs(" */\n", f); fputs("\n", f); @@ -481,6 +481,7 @@ fputs("struct VCL_conf;\n", f); fputs("\n", f); fputs("struct vrt_ref {\n", f); + fputs(" unsigned file;\n", f); fputs(" unsigned line;\n", f); fputs(" unsigned pos;\n", f); fputs(" unsigned count;\n", f); From phk at projects.linpro.no Sat Aug 5 20:52:05 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 5 Aug 2006 22:52:05 +0200 (CEST) Subject: r683 - trunk/varnish-cache/bin/varnishd Message-ID: <20060805205205.84DB11EC594@projects.linpro.no> Author: phk Date: 2006-08-05 22:52:05 +0200 (Sat, 05 Aug 2006) New Revision: 683 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: For consistency: Go to deliver state instead of delivering locally. Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-05 18:11:31 UTC (rev 682) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-05 20:52:05 UTC (rev 683) @@ -272,10 +272,7 @@ sp->handling = VCL_RET_PASS; if (sp->handling == VCL_RET_DELIVER) { - RES_WriteObj(sp); - HSH_Deref(sp->obj); - sp->obj = NULL; - sp->step = STP_DONE; + sp->step = STP_DELIVER; return (0); } if (sp->handling == VCL_RET_PASS) { From andersb at projects.linpro.no Sat Aug 5 21:11:50 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Sat, 5 Aug 2006 23:11:50 +0200 (CEST) Subject: r684 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060805211150.30E921EC596@projects.linpro.no> Author: andersb Date: 2006-08-05 23:11:50 +0200 (Sat, 05 Aug 2006) New Revision: 684 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Added user, loginname, statuscode (200, 304 etc.), byte and referer to make a logline compliant. User and loginname is hardcoded. Referer and User-agen is unclean. Timecode is not working. This version leaks memory bigtime, and is not ready for alpha yet. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-05 20:52:05 UTC (rev 683) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-05 21:11:50 UTC (rev 684) @@ -40,9 +40,9 @@ // unsigned char *df_u; // Datafield for %u struct tm *logline_time; // Datafield for %t unsigned char *df_r; // Datafield for %r - // unsigned char *df_s; // Datafield for %s - // unsigned char *df_b; // Datafield for %b - // unsigned char *df_R; // Datafield for %{Referer}i + unsigned char *df_s; // Datafield for %s + unsigned char *df_b; // Datafield for %b + unsigned char *df_R; // Datafield for %{Referer}i unsigned char *df_U; // Datafield for %{User-agent}i }; @@ -173,6 +173,14 @@ if (p[1] >= 11 && !strncasecmp((void *)&p[4], "user-agent:",11)){ ll[u].df_U = strdup(p + 4); } + if (p[1] >= 8 && !strncasecmp((void *)&p[4], "referer:",8)){ + ll[u].df_R = strdup(p + 4); + } + else if (ll[u].df_R == NULL){ + ll[u].df_R = strdup(p + 4); + ll[u].df_R[0] = '-'; + ll[u].df_R[1] = '\0'; + } break; @@ -184,10 +192,10 @@ tmpPtrb = strdup(p + 4); for ( tmpPtra = strtok(tmpPtrb," "); tmpPtra != NULL; tmpPtra = strtok(NULL, " ")){ - if (i = 1){ + //if (i = 1){ tmpPtrc = tmpPtra; - } - printf("ReqServTime number %d: %s\n", i, tmpPtra); + //} + //printf("ReqServTime number %d: %s\n", i, tmpPtra); i++; } @@ -210,6 +218,22 @@ break; + case SLT_TxStatus: + + ll[u].df_s = strdup(p + 4); + + break; + + case SLT_Length: + + ll[u].df_b = strdup(p + 4); + if (!atoi(ll[u].df_b)){ + ll[u].df_b[0] = '-'; + ll[u].df_b[1] = '\0'; + } + + break; + case SLT_SessionClose: if (p[1] >= 7 && !strncasecmp((void *)&p[4], "timeout",7)){ @@ -217,11 +241,13 @@ } else{ - printf("%s %s", ll[u].df_h, temp_time); + printf("%s - - %s", ll[u].df_h, temp_time); sbuf_finish(ob[u]); printf("\"%s\"", sbuf_data(ob[u])); - printf(" \"%s\"\n", ll[u].df_U); + printf(" %s %s \"%s\" \"%s\"\n", ll[u].df_s, ll[u].df_b, ll[u].df_R, ll[u].df_U); sbuf_clear(ob[u]); + //free(ll[u].df_R); + //free(ll[u].df_U); } @@ -243,11 +269,13 @@ } - printf("%s %s", ll[u].df_h, temp_time); + printf("%s - - %s", ll[u].df_h, temp_time); sbuf_finish(ob[u]); printf("\"%s\"", sbuf_data(ob[u])); - printf(" \"%s\"\n", ll[u].df_U); + printf(" %s %s \"%s\" \"%s\"\n", ll[u].df_s, ll[u].df_b, ll[u].df_R, ll[u].df_U); sbuf_clear(ob[u]); + //free(ll[u].df_R); + //free(ll[u].df_U); break; From andersb at projects.linpro.no Sat Aug 5 21:35:54 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Sat, 5 Aug 2006 23:35:54 +0200 (CEST) Subject: r685 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060805213554.EAB921EC597@projects.linpro.no> Author: andersb Date: 2006-08-05 23:35:54 +0200 (Sat, 05 Aug 2006) New Revision: 685 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Centralized the stringwriting at last, also started memory cleanup. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-05 21:11:50 UTC (rev 684) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-05 21:35:54 UTC (rev 685) @@ -79,19 +79,27 @@ static void extended_log_format(unsigned char *p, char *w_opt) { - unsigned u; + unsigned u,v; int i,j; unsigned char *tmpPtr; char *tmpPtra; char *tmpPtrb; char *tmpPtrc; - // Declare the int's that are used to determin if we have all data. int timesec = 0; // Where we store the utime for request as int. char temp_time[27]; // Where we store the string we take from the log - // Declare the data where we store the differnt parts - time_t req_time; + time_t req_time; // Timeobject used for making the requesttime. + // Variables used to clean memory. + int cm_h = 0; + int cm_r = 0; + int cm_s = 0; + int cm_b = 0; + int cm_R = 0; + int cm_U = 0; + + + if (w_opt != NULL){ // printf(" Has w_opt\n"); } else { @@ -106,6 +114,7 @@ //printf("Hele [%d]: %s %s\n",u, p+4); i = 0; + v = 0; switch (p[0]) { @@ -172,9 +181,11 @@ if (p[1] >= 11 && !strncasecmp((void *)&p[4], "user-agent:",11)){ ll[u].df_U = strdup(p + 4); + cm_U = 1; } if (p[1] >= 8 && !strncasecmp((void *)&p[4], "referer:",8)){ ll[u].df_R = strdup(p + 4); + cm_R = 1; } else if (ll[u].df_R == NULL){ ll[u].df_R = strdup(p + 4); @@ -241,15 +252,10 @@ } else{ - printf("%s - - %s", ll[u].df_h, temp_time); - sbuf_finish(ob[u]); - printf("\"%s\"", sbuf_data(ob[u])); - printf(" %s %s \"%s\" \"%s\"\n", ll[u].df_s, ll[u].df_b, ll[u].df_R, ll[u].df_U); - sbuf_clear(ob[u]); - //free(ll[u].df_R); - //free(ll[u].df_U); } + + v = 1; // We are done, clean memory break; @@ -269,13 +275,8 @@ } - printf("%s - - %s", ll[u].df_h, temp_time); - sbuf_finish(ob[u]); - printf("\"%s\"", sbuf_data(ob[u])); - printf(" %s %s \"%s\" \"%s\"\n", ll[u].df_s, ll[u].df_b, ll[u].df_R, ll[u].df_U); - sbuf_clear(ob[u]); - //free(ll[u].df_R); - //free(ll[u].df_U); + + v = 1; // We are done, clean memory break; @@ -284,8 +285,26 @@ break; } - if (0) { + // Memorycleaner and stringwriter. + if (v) { + + + printf("%s - - %s", ll[u].df_h, temp_time); + sbuf_finish(ob[u]); + printf("\"%s\"", sbuf_data(ob[u])); + printf(" %s %s \"%s\" \"%s\"\n", ll[u].df_s, ll[u].df_b, ll[u].df_R, ll[u].df_U); + sbuf_clear(ob[u]); + + if (cm_R){ + // Clean the memory for Referer + free(ll[u].df_R); + } + if (cm_U){ + // Clean memory for User-Agent + free(ll[u].df_U); + } + } From andersb at projects.linpro.no Sat Aug 5 22:12:28 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Sun, 6 Aug 2006 00:12:28 +0200 (CEST) Subject: r686 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060805221228.DAF961EC596@projects.linpro.no> Author: andersb Date: 2006-08-06 00:12:28 +0200 (Sun, 06 Aug 2006) New Revision: 686 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Loglines with no IP should no longer appear. That also cleared all lines containing a null. Not sure if my check for IP is to harsly implemented and cleans to much. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-05 21:35:54 UTC (rev 685) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-05 22:12:28 UTC (rev 686) @@ -35,7 +35,10 @@ struct logline { char df_h[4 * (3 + 1)]; // Datafield for %h (IP adress) - // int y; + // XXX Set to 1 if we have a IP adress. Not sure when to unset. + // Know for sure when we have a real SessionClose. Probably + // When we clean also. When we have timeout. Are there any more? + int w; // unsigned char *df_l; // Datafield for %l // unsigned char *df_u; // Datafield for %u struct tm *logline_time; // Datafield for %t @@ -79,7 +82,7 @@ static void extended_log_format(unsigned char *p, char *w_opt) { - unsigned u,v; + unsigned u,v,w; int i,j; unsigned char *tmpPtr; char *tmpPtra; @@ -115,6 +118,7 @@ i = 0; v = 0; + w = 0; switch (p[0]) { @@ -129,6 +133,8 @@ strncpy(ll[u].df_h, p + 4, j); ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. //printf("New session [%d]: %s \n",u, ll[u].df_h); + ll[u].w = 1; // We have IP + //printf("w = 1\n"); break; @@ -191,6 +197,7 @@ ll[u].df_R = strdup(p + 4); ll[u].df_R[0] = '-'; ll[u].df_R[1] = '\0'; + cm_R = 1; } break; @@ -226,6 +233,7 @@ req_time = timesec; ll[u].logline_time = localtime(&req_time); strftime (temp_time, 50, "[%d/%b/%Y:%X %z] ", ll[u].logline_time); + cm_r = 1; break; @@ -248,15 +256,17 @@ case SLT_SessionClose: if (p[1] >= 7 && !strncasecmp((void *)&p[4], "timeout",7)){ + // XXX what to do with the timeout? + // Right now I am gonna just let it pass, and not even clean memory. //printf("Timeout...\n"); + ll[u].w = 0; } else{ - - + + v = 1; // We are done, clean memory + ll[u].w = 0; } - v = 1; // We are done, clean memory - break; case SLT_SessionReuse: @@ -272,6 +282,8 @@ j = strlen(p + 4) - strlen(tmpPtr); // length of IP strncpy(ll[u].df_h, p + 4, j); ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. + ll[u].w = 1; // We have a IP + //printf("w = 1\n"); } @@ -285,8 +297,13 @@ break; } - // Memorycleaner and stringwriter. - if (v) { + // Memorycleaner and stringwriter. v is 1 after SLT_SessionClose OR SLT_SessionReuse that + // do something useful. w is set when we have a real IP adress, somewhere we are getting + // requests without. + // + // XXX Find out why we don't have IP and get rid of w. + // + if (v && ll[u].w) { @@ -304,6 +321,10 @@ // Clean memory for User-Agent free(ll[u].df_U); } + if (cm_r){ + // Clean memory for Date variables + free(tmpPtrb); + } } From andersb at projects.linpro.no Sat Aug 5 22:43:01 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Sun, 6 Aug 2006 00:43:01 +0200 (CEST) Subject: r687 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060805224301.8D4191EC59D@projects.linpro.no> Author: andersb Date: 2006-08-06 00:43:01 +0200 (Sun, 06 Aug 2006) New Revision: 687 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Checks show that my IP adress checker is very restrictive and probably deletes other loglines. We still bleeds null lines also. This will have to be cleaned up. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-05 22:12:28 UTC (rev 686) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-05 22:43:01 UTC (rev 687) @@ -134,7 +134,6 @@ ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. //printf("New session [%d]: %s \n",u, ll[u].df_h); ll[u].w = 1; // We have IP - //printf("w = 1\n"); break; @@ -283,7 +282,6 @@ strncpy(ll[u].df_h, p + 4, j); ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. ll[u].w = 1; // We have a IP - //printf("w = 1\n"); } From andersb at projects.linpro.no Sun Aug 6 00:44:10 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Sun, 6 Aug 2006 02:44:10 +0200 (CEST) Subject: r688 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060806004410.46D6D1EC59C@projects.linpro.no> Author: andersb Date: 2006-08-06 02:44:10 +0200 (Sun, 06 Aug 2006) New Revision: 688 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: I have realized that I have major structure problems. I will have to study varnishlog output a bit more to understand it better. May wanna start clean again, and use hardearned knowledge to make better and more robust structure. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-05 22:43:01 UTC (rev 687) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-06 00:44:10 UTC (rev 688) @@ -38,6 +38,8 @@ // XXX Set to 1 if we have a IP adress. Not sure when to unset. // Know for sure when we have a real SessionClose. Probably // When we clean also. When we have timeout. Are there any more? + int v; + // Set to 1 if we wanna print the loglinestring because we are done int w; // unsigned char *df_l; // Datafield for %l // unsigned char *df_u; // Datafield for %u @@ -119,6 +121,7 @@ i = 0; v = 0; w = 0; + ll[u].w = 0; switch (p[0]) { @@ -133,8 +136,13 @@ strncpy(ll[u].df_h, p + 4, j); ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. //printf("New session [%d]: %s \n",u, ll[u].df_h); - ll[u].w = 1; // We have IP + ll[u].v = 1; // We have IP + // We have a new session. This is a good place to initialize and + // clean data from previous sessions with same filedescriptor. + + //free(ll[u].df_U); + break; case SLT_RxRequest: @@ -258,14 +266,16 @@ // XXX what to do with the timeout? // Right now I am gonna just let it pass, and not even clean memory. //printf("Timeout...\n"); - ll[u].w = 0; + //ll[u].w = 1; } else{ - v = 1; // We are done, clean memory - ll[u].w = 0; + ll[u].w = 1; // We are done, clean memory + } + free(ll[u].df_U); + break; case SLT_SessionReuse: @@ -281,12 +291,12 @@ j = strlen(p + 4) - strlen(tmpPtr); // length of IP strncpy(ll[u].df_h, p + 4, j); ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. - ll[u].w = 1; // We have a IP + ll[u].v = 1; // We have a IP } - v = 1; // We are done, clean memory + ll[u].w = 1; // We are done, clean memory break; @@ -295,13 +305,13 @@ break; } - // Memorycleaner and stringwriter. v is 1 after SLT_SessionClose OR SLT_SessionReuse that - // do something useful. w is set when we have a real IP adress, somewhere we are getting + // Memorycleaner and stringwriter. w is 1 after SLT_SessionClose OR SLT_SessionReuse that + // do something useful. v is set when we have a real IP adress, somewhere we are getting // requests without. // - // XXX Find out why we don't have IP and get rid of w. + // XXX Find out why we don't have IP and get rid of v. // - if (v && ll[u].w) { + if (ll[u].w && ll[u].v) { @@ -310,19 +320,30 @@ printf("\"%s\"", sbuf_data(ob[u])); printf(" %s %s \"%s\" \"%s\"\n", ll[u].df_s, ll[u].df_b, ll[u].df_R, ll[u].df_U); sbuf_clear(ob[u]); + ll[u].df_U == NULL; + + if (cm_R){ // Clean the memory for Referer free(ll[u].df_R); } if (cm_U){ + // Clean User-Agent. + // Clean memory for User-Agent free(ll[u].df_U); + + // Initialize User-Agent. + ll[u].df_U == NULL; + } if (cm_r){ // Clean memory for Date variables free(tmpPtrb); } + // XXX We reinitialize the struct logline + // free(ll[u]); } From des at projects.linpro.no Sun Aug 6 12:20:56 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 14:20:56 +0200 (CEST) Subject: r689 - in trunk/varnish-cache: . bin Message-ID: <20060806122056.31C751EC56E@projects.linpro.no> Author: des Date: 2006-08-06 14:20:56 +0200 (Sun, 06 Aug 2006) New Revision: 689 Modified: trunk/varnish-cache/bin/Makefile.am trunk/varnish-cache/configure.ac Log: Fully disconnect varnishtester. Modified: trunk/varnish-cache/bin/Makefile.am =================================================================== --- trunk/varnish-cache/bin/Makefile.am 2006-08-06 00:44:10 UTC (rev 688) +++ trunk/varnish-cache/bin/Makefile.am 2006-08-06 12:20:56 UTC (rev 689) @@ -1,6 +1,3 @@ # $Id$ SUBDIRS = varnishd varnishlog varnishncsa varnishstat varnishtop - -# Awaiting dis-libeventing -# SUBDIRS += varnistester Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-06 00:44:10 UTC (rev 688) +++ trunk/varnish-cache/configure.ac 2006-08-06 12:20:56 UTC (rev 689) @@ -71,7 +71,6 @@ bin/varnishlog/Makefile bin/varnishncsa/Makefile bin/varnishstat/Makefile - bin/varnishtester/Makefile bin/varnishtop/Makefile contrib/Makefile include/Makefile From des at projects.linpro.no Sun Aug 6 12:23:06 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 14:23:06 +0200 (CEST) Subject: r690 - trunk/varnish-cache Message-ID: <20060806122306.23B511EC570@projects.linpro.no> Author: des Date: 2006-08-06 14:23:06 +0200 (Sun, 06 Aug 2006) New Revision: 690 Removed: trunk/varnish-cache/contrib/ Modified: trunk/varnish-cache/Makefile.am trunk/varnish-cache/configure.ac Log: Retire libevent. Modified: trunk/varnish-cache/Makefile.am =================================================================== --- trunk/varnish-cache/Makefile.am 2006-08-06 12:20:56 UTC (rev 689) +++ trunk/varnish-cache/Makefile.am 2006-08-06 12:23:06 UTC (rev 690) @@ -1,3 +1,3 @@ # $Id$ -SUBDIRS = include lib bin +SUBDIRS = contrib include lib bin Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-06 12:20:56 UTC (rev 689) +++ trunk/varnish-cache/configure.ac 2006-08-06 12:23:06 UTC (rev 690) @@ -72,7 +72,6 @@ bin/varnishncsa/Makefile bin/varnishstat/Makefile bin/varnishtop/Makefile - contrib/Makefile include/Makefile lib/Makefile lib/libcompat/Makefile @@ -81,5 +80,4 @@ lib/libvarnishapi/Makefile lib/libvcl/Makefile ]) -AC_CONFIG_SUBDIRS(contrib/libevent) AC_OUTPUT From des at projects.linpro.no Sun Aug 6 12:23:45 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 14:23:45 +0200 (CEST) Subject: r691 - trunk/varnish-cache Message-ID: <20060806122345.D34851EC570@projects.linpro.no> Author: des Date: 2006-08-06 14:23:45 +0200 (Sun, 06 Aug 2006) New Revision: 691 Modified: trunk/varnish-cache/Makefile.am Log: Umm, *really* retire libevent. Modified: trunk/varnish-cache/Makefile.am =================================================================== --- trunk/varnish-cache/Makefile.am 2006-08-06 12:23:06 UTC (rev 690) +++ trunk/varnish-cache/Makefile.am 2006-08-06 12:23:45 UTC (rev 691) @@ -1,3 +1,3 @@ # $Id$ -SUBDIRS = contrib include lib bin +SUBDIRS = include lib bin From des at projects.linpro.no Sun Aug 6 12:25:29 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 14:25:29 +0200 (CEST) Subject: r692 - trunk/varnish-cache/include Message-ID: <20060806122529.901521EC570@projects.linpro.no> Author: des Date: 2006-08-06 14:25:29 +0200 (Sun, 06 Aug 2006) New Revision: 692 Modified: trunk/varnish-cache/include/Makefile.am Log: Add missing headers. Modified: trunk/varnish-cache/include/Makefile.am =================================================================== --- trunk/varnish-cache/include/Makefile.am 2006-08-06 12:23:45 UTC (rev 691) +++ trunk/varnish-cache/include/Makefile.am 2006-08-06 12:25:29 UTC (rev 692) @@ -9,6 +9,7 @@ http_headers.h \ libvarnish.h \ libvcl.h \ + miniobj.h \ queue.h \ sbuf.h \ shmlog.h \ @@ -20,4 +21,6 @@ varnishapi.h \ vcl.h \ vcl_returns.h \ - vrt.h + vrt.h \ + vrt_obj.h + From des at projects.linpro.no Sun Aug 6 12:26:12 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 14:26:12 +0200 (CEST) Subject: r693 - trunk/varnish-cache Message-ID: <20060806122612.5A72C1EC570@projects.linpro.no> Author: des Date: 2006-08-06 14:26:12 +0200 (Sun, 06 Aug 2006) New Revision: 693 Modified: trunk/varnish-cache/autogen.sh Log: We no longer have any CONFIG_SUBDIRS. Modified: trunk/varnish-cache/autogen.sh =================================================================== --- trunk/varnish-cache/autogen.sh 2006-08-06 12:25:29 UTC (rev 692) +++ trunk/varnish-cache/autogen.sh 2006-08-06 12:26:12 UTC (rev 693) @@ -6,19 +6,12 @@ set -ex if [ -d /usr/local/gnu-autotools/bin ] ; then - PATH=${PATH}:/usr/local/gnu-autotools/bin + PATH=/usr/local/gnu-autotools/bin:${PATH} export PATH fi -base=$(cd $(dirname $0) && pwd) -for dir in $base ; do - ( - echo $dir - cd $dir - aclocal - libtoolize --copy --force - autoheader - automake --add-missing --copy --force --foreign - autoconf - ) -done +aclocal +libtoolize --copy --force +autoheader +automake --add-missing --copy --force --foreign +autoconf From des at projects.linpro.no Sun Aug 6 12:26:22 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 14:26:22 +0200 (CEST) Subject: r694 - in trunk/varnish-cache/bin: varnishd varnishlog varnishncsa varnishstat Message-ID: <20060806122622.83FDE1EC5A5@projects.linpro.no> Author: des Date: 2006-08-06 14:26:22 +0200 (Sun, 06 Aug 2006) New Revision: 694 Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishlog/Makefile.am trunk/varnish-cache/bin/varnishncsa/Makefile.am trunk/varnish-cache/bin/varnishstat/Makefile.am Log: Add missing headers and man pages. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-06 12:26:12 UTC (rev 693) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-06 12:26:22 UTC (rev 694) @@ -4,7 +4,7 @@ bin_PROGRAMS = varnishd -man_MANS = varnishd.1 +dist_man_MANS = varnishd.1 varnishd_SOURCES = \ cache.h \ @@ -49,6 +49,10 @@ tcp.c \ varnishd.c +noinst_HEADERS = \ + common.h \ + steps.h + varnishd_LDFLAGS = -export-dynamic varnishd_LDADD = \ Modified: trunk/varnish-cache/bin/varnishlog/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishlog/Makefile.am 2006-08-06 12:26:12 UTC (rev 693) +++ trunk/varnish-cache/bin/varnishlog/Makefile.am 2006-08-06 12:26:22 UTC (rev 694) @@ -4,7 +4,7 @@ bin_PROGRAMS = varnishlog -man_MANS = varnishlog.1 +dist_man_MANS = varnishlog.1 varnishlog_SOURCES = varnishlog.c Modified: trunk/varnish-cache/bin/varnishncsa/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-06 12:26:12 UTC (rev 693) +++ trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-06 12:26:22 UTC (rev 694) @@ -4,7 +4,7 @@ bin_PROGRAMS = varnishncsa -man_MANS = varnishncsa.1 +dist_man_MANS = varnishncsa.1 varnishncsa_SOURCES = varnishncsa.c Modified: trunk/varnish-cache/bin/varnishstat/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishstat/Makefile.am 2006-08-06 12:26:12 UTC (rev 693) +++ trunk/varnish-cache/bin/varnishstat/Makefile.am 2006-08-06 12:26:22 UTC (rev 694) @@ -4,7 +4,7 @@ bin_PROGRAMS = varnishstat -man_MANS = varnishstat.1 +dist_man_MANS = varnishstat.1 varnishstat_SOURCES = varnishstat.c From des at projects.linpro.no Sun Aug 6 12:49:41 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 14:49:41 +0200 (CEST) Subject: r695 - in trunk/varnish-cache: bin/varnishlog bin/varnishncsa bin/varnishstat bin/varnishtester bin/varnishtop lib/libcompat lib/libsbuf lib/libvcl Message-ID: <20060806124941.A40F61EC5A6@projects.linpro.no> Author: des Date: 2006-08-06 14:49:41 +0200 (Sun, 06 Aug 2006) New Revision: 695 Modified: trunk/varnish-cache/bin/varnishlog/ trunk/varnish-cache/bin/varnishncsa/ trunk/varnish-cache/bin/varnishstat/ trunk/varnish-cache/bin/varnishtester/ trunk/varnish-cache/bin/varnishtop/ trunk/varnish-cache/lib/libcompat/ trunk/varnish-cache/lib/libsbuf/ trunk/varnish-cache/lib/libvcl/ Log: Adjust directory properties. Property changes on: trunk/varnish-cache/bin/varnishlog ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in varnishlog Property changes on: trunk/varnish-cache/bin/varnishncsa ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in varnishncsa Property changes on: trunk/varnish-cache/bin/varnishstat ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in varnishstat Property changes on: trunk/varnish-cache/bin/varnishtester ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in varnishtester Property changes on: trunk/varnish-cache/bin/varnishtop ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in varnishtop Property changes on: trunk/varnish-cache/lib/libcompat ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in libcompat.a Property changes on: trunk/varnish-cache/lib/libsbuf ___________________________________________________________________ Name: svn:ignore - .deps .libs Makefile Makefile.in + .deps .libs Makefile Makefile.in libsbuf.a Property changes on: trunk/varnish-cache/lib/libvcl ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in libvcl.a From des at projects.linpro.no Sun Aug 6 12:51:02 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 14:51:02 +0200 (CEST) Subject: r696 - trunk/varnish-cache Message-ID: <20060806125102.387F91EC5A7@projects.linpro.no> Author: des Date: 2006-08-06 14:51:02 +0200 (Sun, 06 Aug 2006) New Revision: 696 Modified: trunk/varnish-cache/ Log: Adjust directory properties. Property changes on: trunk/varnish-cache ___________________________________________________________________ Name: svn:ignore - .deps Makefile Makefile.in aclocal.m4 autom4te.cache config.guess config.h config.h.in config.log config.status config.sub configure depcomp install-sh libtool ltmain.sh missing stamp-h1 + .deps Makefile Makefile.in aclocal.m4 autom4te.cache config.guess config.h config.h.in config.log config.status config.sub configure configure.lineno depcomp install-sh libtool ltmain.sh missing stamp-h1 From des at projects.linpro.no Sun Aug 6 13:49:59 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 15:49:59 +0200 (CEST) Subject: r697 - trunk/varnish-cache Message-ID: <20060806134959.16C651EC5A8@projects.linpro.no> Author: des Date: 2006-08-06 15:49:58 +0200 (Sun, 06 Aug 2006) New Revision: 697 Modified: trunk/varnish-cache/configure.ac Log: Include -pipe in CFLAGS. Reduce optimization level to -O when debugging. Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-06 12:51:02 UTC (rev 696) +++ trunk/varnish-cache/configure.ac 2006-08-06 13:49:58 UTC (rev 697) @@ -14,14 +14,14 @@ # Compiler flags (assume GCC). # This section *must* come before AC_PROG_CC / AC_PROG_CPP. -CFLAGS="${CFLAGS:--O2}" +CFLAGS="${CFLAGS:--O2 -pipe}" DEVELOPER_CFLAGS="-Wall -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls" AC_ARG_ENABLE(developer-warnings, AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]), CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}") AC_ARG_ENABLE(debugging-symbols, AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]), - CFLAGS="${CFLAGS} -g -fno-inline -fno-builtin") + CFLAGS="${CFLAGS} -O -g -fno-inline -fno-builtin") AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]), CFLAGS="${CFLAGS} -Werror") From des at projects.linpro.no Sun Aug 6 13:51:48 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 15:51:48 +0200 (CEST) Subject: r698 - trunk/varnish-cache Message-ID: <20060806135148.F300E1EC5A9@projects.linpro.no> Author: des Date: 2006-08-06 15:51:48 +0200 (Sun, 06 Aug 2006) New Revision: 698 Modified: trunk/varnish-cache/configure.ac Log: Change version to "trunk" until I can figure out a way to have it reflect the current date. Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-06 13:49:58 UTC (rev 697) +++ trunk/varnish-cache/configure.ac 2006-08-06 13:51:48 UTC (rev 698) @@ -3,7 +3,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [0.2], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [trunk], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) From des at projects.linpro.no Sun Aug 6 14:33:08 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 16:33:08 +0200 (CEST) Subject: r699 - trunk/varnish-cache/bin/varnishd Message-ID: <20060806143308.A0B851EC5AA@projects.linpro.no> Author: des Date: 2006-08-06 16:33:08 +0200 (Sun, 06 Aug 2006) New Revision: 699 Modified: trunk/varnish-cache/bin/varnishd/Makefile.am Log: Forcibly include config.h. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-06 13:51:48 UTC (rev 698) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) @@ -53,6 +53,8 @@ common.h \ steps.h +varnishd_CFLAGS = -include config.h + varnishd_LDFLAGS = -export-dynamic varnishd_LDADD = \ From des at projects.linpro.no Sun Aug 6 15:02:57 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 17:02:57 +0200 (CEST) Subject: r700 - in trunk/varnish-cache: bin/varnishlog bin/varnishncsa bin/varnishstat bin/varnishtester bin/varnishtop lib/libcompat lib/libsbuf lib/libvarnish lib/libvarnishapi lib/libvcl Message-ID: <20060806150257.E672A1EC5AC@projects.linpro.no> Author: des Date: 2006-08-06 17:02:57 +0200 (Sun, 06 Aug 2006) New Revision: 700 Modified: trunk/varnish-cache/bin/varnishlog/Makefile.am trunk/varnish-cache/bin/varnishncsa/Makefile.am trunk/varnish-cache/bin/varnishstat/Makefile.am trunk/varnish-cache/bin/varnishtester/Makefile.am trunk/varnish-cache/bin/varnishtop/Makefile.am trunk/varnish-cache/lib/libcompat/Makefile.am trunk/varnish-cache/lib/libsbuf/Makefile.am trunk/varnish-cache/lib/libvarnish/Makefile.am trunk/varnish-cache/lib/libvarnishapi/Makefile.am trunk/varnish-cache/lib/libvcl/Makefile.am Log: Systematically include config.h. Modified: trunk/varnish-cache/bin/varnishlog/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishlog/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) +++ trunk/varnish-cache/bin/varnishlog/Makefile.am 2006-08-06 15:02:57 UTC (rev 700) @@ -8,6 +8,8 @@ varnishlog_SOURCES = varnishlog.c +varnishlog_CFLAGS = -include config.h + varnishlog_LDADD = \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libsbuf/libsbuf.a Modified: trunk/varnish-cache/bin/varnishncsa/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) +++ trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-06 15:02:57 UTC (rev 700) @@ -8,6 +8,8 @@ varnishncsa_SOURCES = varnishncsa.c +varnishncsa_CFLAGS = -include config.h + varnishncsa_LDADD = \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libsbuf/libsbuf.a Modified: trunk/varnish-cache/bin/varnishstat/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishstat/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) +++ trunk/varnish-cache/bin/varnishstat/Makefile.am 2006-08-06 15:02:57 UTC (rev 700) @@ -8,6 +8,8 @@ varnishstat_SOURCES = varnishstat.c +varnishstat_CFLAGS = -include config.h + varnishstat_LDADD = \ -lcurses \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la Modified: trunk/varnish-cache/bin/varnishtester/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishtester/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) +++ trunk/varnish-cache/bin/varnishtester/Makefile.am 2006-08-06 15:02:57 UTC (rev 700) @@ -4,12 +4,12 @@ bin_PROGRAMS = varnishtester -# man_MANS = varnishd.1 +# dist_man_MANS = varnishtester.1 varnishtester_SOURCES = \ varnishtester.c -# varnishd_LDFLAGS = -export-dynamic +varnishtester_CFLAGS = -include config.h varnishtester_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la Modified: trunk/varnish-cache/bin/varnishtop/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishtop/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) +++ trunk/varnish-cache/bin/varnishtop/Makefile.am 2006-08-06 15:02:57 UTC (rev 700) @@ -4,10 +4,12 @@ bin_PROGRAMS = varnishtop -# man_MANS = varnishtop.1 +# dist_man_MANS = varnishtop.1 varnishtop_SOURCES = varnishtop.c +varnishtop_CFLAGS = -include config.h + varnishtop_LDADD = \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libsbuf/libsbuf.a \ Modified: trunk/varnish-cache/lib/libcompat/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) +++ trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-06 15:02:57 UTC (rev 700) @@ -7,3 +7,5 @@ libcompat_a_SOURCES = \ strlcat.c \ strlcpy.c + +libcompat_a_CFLAGS = -include config.h Modified: trunk/varnish-cache/lib/libsbuf/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libsbuf/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) +++ trunk/varnish-cache/lib/libsbuf/Makefile.am 2006-08-06 15:02:57 UTC (rev 700) @@ -6,3 +6,5 @@ libsbuf_a_SOURCES = \ sbuf.c + +libsbuf_a_CFLAGS = -include config.h Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnish/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) +++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2006-08-06 15:02:57 UTC (rev 700) @@ -9,3 +9,5 @@ binary_heap.c \ cli.c \ time.c + +libvarnish_la_CFLAGS = -include config.h Modified: trunk/varnish-cache/lib/libvarnishapi/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) +++ trunk/varnish-cache/lib/libvarnishapi/Makefile.am 2006-08-06 15:02:57 UTC (rev 700) @@ -7,7 +7,4 @@ libvarnishapi_la_SOURCES = \ shmlog.c - -# varnish_debug.c -# varnish_log.c -# varnish_util.c +libvarnishapi_la_CFLAGS = -include config.h Modified: trunk/varnish-cache/lib/libvcl/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvcl/Makefile.am 2006-08-06 14:33:08 UTC (rev 699) +++ trunk/varnish-cache/lib/libvcl/Makefile.am 2006-08-06 15:02:57 UTC (rev 700) @@ -14,3 +14,5 @@ vcc_fixed_token.c \ vcc_obj.c \ vcc_token.c + +libvcl_la_CFLAGS = -include config.h From phk at projects.linpro.no Sun Aug 6 16:55:58 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 6 Aug 2006 18:55:58 +0200 (CEST) Subject: r701 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060806165558.B7DF91EC5AC@projects.linpro.no> Author: phk Date: 2006-08-06 18:55:58 +0200 (Sun, 06 Aug 2006) New Revision: 701 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: Make -w - work as expected. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-06 15:02:57 UTC (rev 700) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-06 16:55:58 UTC (rev 701) @@ -232,7 +232,10 @@ Usage(); if (w_opt != NULL) { - wfile = fopen(w_opt, "w"); + if (!strcmp(w_opt, "-")) + wfile = stdout; + else + wfile = fopen(w_opt, "w"); if (wfile == NULL) { perror(w_opt); exit (1); @@ -249,10 +252,10 @@ if (w_opt == NULL) { if (o_flag && ++v == 100) clean_order(); - fflush(stdout); + fflush(stderr); } else if (++v == 100) { fflush(wfile); - printf("\nFlushed\n"); + fprintf(stderr, "\nFlushed\n"); } usleep(50000); continue; @@ -264,8 +267,8 @@ perror(w_opt); u++; if (!(u % 1000)) { - printf("%u\r", u); - fflush(stdout); + fprintf(stderr, "%u\r", u); + fflush(stderr); } continue; } From des at projects.linpro.no Sun Aug 6 17:00:18 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 6 Aug 2006 19:00:18 +0200 (CEST) Subject: r702 - trunk/varnish-cache Message-ID: <20060806170018.E9EE81EC5AD@projects.linpro.no> Author: des Date: 2006-08-06 19:00:18 +0200 (Sun, 06 Aug 2006) New Revision: 702 Modified: trunk/varnish-cache/ Log: Add compile to svn:ignore. Property changes on: trunk/varnish-cache ___________________________________________________________________ Name: svn:ignore - .deps Makefile Makefile.in aclocal.m4 autom4te.cache config.guess config.h config.h.in config.log config.status config.sub configure configure.lineno depcomp install-sh libtool ltmain.sh missing stamp-h1 + .deps Makefile Makefile.in aclocal.m4 autom4te.cache compile config.guess config.h config.h.in config.log config.status config.sub configure configure.lineno depcomp install-sh libtool ltmain.sh missing stamp-h1 From andersb at projects.linpro.no Mon Aug 7 00:21:34 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Mon, 7 Aug 2006 02:21:34 +0200 (CEST) Subject: r703 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060807002134.953051EC5AD@projects.linpro.no> Author: andersb Date: 2006-08-07 02:21:34 +0200 (Mon, 07 Aug 2006) New Revision: 703 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Fresh start after study of output from varnishlog -o. First off is IP adress logging and clearing. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-06 17:00:18 UTC (rev 702) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 00:21:34 UTC (rev 703) @@ -35,20 +35,8 @@ struct logline { char df_h[4 * (3 + 1)]; // Datafield for %h (IP adress) - // XXX Set to 1 if we have a IP adress. Not sure when to unset. - // Know for sure when we have a real SessionClose. Probably - // When we clean also. When we have timeout. Are there any more? - int v; - // Set to 1 if we wanna print the loglinestring because we are done - int w; - // unsigned char *df_l; // Datafield for %l - // unsigned char *df_u; // Datafield for %u - struct tm *logline_time; // Datafield for %t - unsigned char *df_r; // Datafield for %r - unsigned char *df_s; // Datafield for %s - unsigned char *df_b; // Datafield for %b - unsigned char *df_R; // Datafield for %{Referer}i - unsigned char *df_U; // Datafield for %{User-agent}i + unsigned char *df_r; // Datafield for %r (Request) + }; /* We make a array of pointers to sbuf's. Sbuf is a string buffer. @@ -85,219 +73,96 @@ extended_log_format(unsigned char *p, char *w_opt) { unsigned u,v,w; - int i,j; + + // Used for getting IP. unsigned char *tmpPtr; - char *tmpPtra; - char *tmpPtrb; - char *tmpPtrc; - int timesec = 0; // Where we store the utime for request as int. - char temp_time[27]; // Where we store the string we take from the log - time_t req_time; // Timeobject used for making the requesttime. + int j; - // Variables used to clean memory. - int cm_h = 0; - int cm_r = 0; - int cm_s = 0; - int cm_b = 0; - int cm_R = 0; - int cm_U = 0; - - - - - if (w_opt != NULL){ - // printf(" Has w_opt\n"); - } else { - //printf(" Does not have w_opt:\n"); - } - u = (p[2] << 8) | p[3]; if (ob[u] == NULL) { ob[u] = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); assert(ob[u] != NULL); } - //printf("Hele [%d]: %s %s\n",u, p+4); - i = 0; v = 0; w = 0; - ll[u].w = 0; switch (p[0]) { - // XXX remember to check for NULL when strdup, if no allocate - // XXX also remember to free() after strdup? - case SLT_SessionOpen: - // Finding the IP adress when data is: "XXX.XXX.XXX.XXX somenumber" + // We catch the IP adress of the session. + // We also catch IP in SessionReuse because we can not always + // be sure we see a SessionOpen when we start logging. + tmpPtr = strchr(p + 4, ' '); - j = strlen(p + 4) - strlen(tmpPtr); // length of IP - strncpy(ll[u].df_h, p + 4, j); - ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. - //printf("New session [%d]: %s \n",u, ll[u].df_h); - ll[u].v = 1; // We have IP + j = strlen(p + 4) - strlen(tmpPtr); // length of IP + strncpy(ll[u].df_h, p + 4, j); + ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. + //printf("New session [%d]: %s \n",u, ll[u].df_h); - // We have a new session. This is a good place to initialize and - // clean data from previous sessions with same filedescriptor. - - //free(ll[u].df_U); - break; case SLT_RxRequest: - // XXX: Remember to support more than GET, HEAD and POST. - // http://rfc.net/rfc2616.html#p51 - // - // Have to gather together data in SLT_RxRequest, SLT_RxURL, SLT_RxProtocol - // to build the request, so I use a sbuf. - - sbuf_clear(ob[u]); - - if (p[1] >= 4 && !strncasecmp((void *)&p[4], "HEAD",4)){ - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); - //printf("Got a HEAD\n"); - } - else if (p[1] >= 4 && !strncasecmp((void *)&p[4], "POST",4)){ - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); - //printf("Got a POST\n"); - } - - else if (p[1] >= 3 && !strncasecmp((void *)&p[4], "GET",3)){ - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); - //printf("Got a GET\n"); - } - - else { - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); - //printf("Got something other than HEAD, POST, GET\n"); - } - break; case SLT_RxURL: - sbuf_cat(ob[u], " "); - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); - break; case SLT_RxProtocol: - sbuf_cat(ob[u], " "); - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); - break; case SLT_RxHeader: - if (p[1] >= 11 && !strncasecmp((void *)&p[4], "user-agent:",11)){ - ll[u].df_U = strdup(p + 4); - cm_U = 1; - } - if (p[1] >= 8 && !strncasecmp((void *)&p[4], "referer:",8)){ - ll[u].df_R = strdup(p + 4); - cm_R = 1; - } - else if (ll[u].df_R == NULL){ - ll[u].df_R = strdup(p + 4); - ll[u].df_R[0] = '-'; - ll[u].df_R[1] = '\0'; - cm_R = 1; - } - break; case SLT_ReqServTime: - // First clear temp_time - temp_time[0] = '\0'; - - tmpPtrb = strdup(p + 4); - - for ( tmpPtra = strtok(tmpPtrb," "); tmpPtra != NULL; tmpPtra = strtok(NULL, " ")){ - //if (i = 1){ - tmpPtrc = tmpPtra; - //} - //printf("ReqServTime number %d: %s\n", i, tmpPtra); - - i++; - } - - - //printf("Br: %s\n",tmpPtrc); - - /* - tmpPtr = strchr(tmpPtrc, '.'); - j = strlen(tmpPtrc) - strlen(tmpPtr); // length of timestamp - strncpy(temp_time, tmpPtrc, j); - temp_time[j] = '\0'; - printf("j: %s",temp_time); - timesec = atoi(temp_time); - */ - timesec = 1; - req_time = timesec; - ll[u].logline_time = localtime(&req_time); - strftime (temp_time, 50, "[%d/%b/%Y:%X %z] ", ll[u].logline_time); - cm_r = 1; - break; case SLT_TxStatus: - ll[u].df_s = strdup(p + 4); - break; case SLT_Length: - ll[u].df_b = strdup(p + 4); - if (!atoi(ll[u].df_b)){ - ll[u].df_b[0] = '-'; - ll[u].df_b[1] = '\0'; - } - break; case SLT_SessionClose: - if (p[1] >= 7 && !strncasecmp((void *)&p[4], "timeout",7)){ - // XXX what to do with the timeout? - // Right now I am gonna just let it pass, and not even clean memory. - //printf("Timeout...\n"); - //ll[u].w = 1; - } - else{ + // Session is closed, we clean up things. But do not write. - ll[u].w = 1; // We are done, clean memory + //printf("Session close [%d]\n", u); + + v = 1; - } - free(ll[u].df_U); - break; case SLT_SessionReuse: - // XXX have to catch the IP in the SessionReuse in case - // We never got the SessionOpen and the client keeps open + // It's in SessionReuse we wrap things up. + // SessionClose is not suited to use for a write, but to clean up. + // Catch IP if not already done. + if (ll[u].df_h[0] == '\0'){ - // If we are here, there is a session going on, and we haven't - // catched the IP in SessionOpen, we "steal" it from SessionReuse. - // + // We don't have IP, fetch it. + tmpPtr = strchr(p + 4, ' '); - j = strlen(p + 4) - strlen(tmpPtr); // length of IP - strncpy(ll[u].df_h, p + 4, j); - ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. - ll[u].v = 1; // We have a IP - + j = strlen(p + 4) - strlen(tmpPtr); // length of IP + strncpy(ll[u].df_h, p + 4, j); + ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. + printf("Got IP from Reuse [%d] : %s\n", u, ll[u].df_h); } - - ll[u].w = 1; // We are done, clean memory - + //printf("Session reuse [%d]\n", u); + + w = 1; + break; default: @@ -305,46 +170,20 @@ break; } - // Memorycleaner and stringwriter. w is 1 after SLT_SessionClose OR SLT_SessionReuse that - // do something useful. v is set when we have a real IP adress, somewhere we are getting - // requests without. - // - // XXX Find out why we don't have IP and get rid of v. - // - if (ll[u].w && ll[u].v) { - - + if (v) { + // We have a SessionClose. Lets clean. + // + // Clean IP adress + ll[u].df_h[0] = '\0'; + + } - printf("%s - - %s", ll[u].df_h, temp_time); - sbuf_finish(ob[u]); - printf("\"%s\"", sbuf_data(ob[u])); - printf(" %s %s \"%s\" \"%s\"\n", ll[u].df_s, ll[u].df_b, ll[u].df_R, ll[u].df_U); - sbuf_clear(ob[u]); - ll[u].df_U == NULL; - + if (w) { + // We have a SessionReuse. Lets print the logline + // - - if (cm_R){ - // Clean the memory for Referer - free(ll[u].df_R); - } - if (cm_U){ - // Clean User-Agent. - - // Clean memory for User-Agent - free(ll[u].df_U); - - // Initialize User-Agent. - ll[u].df_U == NULL; - - } - if (cm_r){ - // Clean memory for Date variables - free(tmpPtrb); - } - // XXX We reinitialize the struct logline - // free(ll[u]); - + printf("%s ", ll[u].df_h); + printf("\n"); } From des at projects.linpro.no Mon Aug 7 05:47:30 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 07:47:30 +0200 (CEST) Subject: r704 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807054730.6BF361EC5AE@projects.linpro.no> Author: des Date: 2006-08-07 07:47:30 +0200 (Mon, 07 Aug 2006) New Revision: 704 Modified: trunk/varnish-cache/bin/varnishd/Makefile.am Log: List headers in noinst_HEADERS instead of SOURCES. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-07 00:21:34 UTC (rev 703) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-07 05:47:30 UTC (rev 704) @@ -7,15 +7,6 @@ dist_man_MANS = varnishd.1 varnishd_SOURCES = \ - cache.h \ - common_cli.h \ - hash_slinger.h \ - heritage.h \ - mgt.h \ - mgt_cli.h \ - mgt_event.h \ - stevedore.h \ - \ cache_acceptor.c \ cache_backend.c \ cache_ban.c \ @@ -50,8 +41,16 @@ varnishd.c noinst_HEADERS = \ + cache.h \ common.h \ - steps.h + common_cli.h \ + hash_slinger.h \ + heritage.h \ + mgt.h \ + mgt_cli.h \ + mgt_event.h \ + steps.h \ + stevedore.h varnishd_CFLAGS = -include config.h From des at projects.linpro.no Mon Aug 7 05:49:17 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 07:49:17 +0200 (CEST) Subject: r705 - in trunk/varnish-cache: bin/varnishd include lib/libvarnish Message-ID: <20060807054917.66D981EC5AE@projects.linpro.no> Author: des Date: 2006-08-07 07:49:17 +0200 (Mon, 07 Aug 2006) New Revision: 705 Added: trunk/varnish-cache/include/cli_common.h trunk/varnish-cache/lib/libvarnish/cli_common.c Removed: trunk/varnish-cache/bin/varnishd/common_cli.c trunk/varnish-cache/bin/varnishd/common_cli.h Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/include/Makefile.am trunk/varnish-cache/lib/libvarnish/Makefile.am Log: Move common_cli.[ch] out of varnishd, and rename them to cli_common.[ch]. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-07 05:47:30 UTC (rev 704) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-07 05:49:17 UTC (rev 705) @@ -26,7 +26,6 @@ cache_vrt.c \ cache_vrt_acl.c \ cache_vrt_re.c \ - common_cli.c \ hash_simple_list.c \ hash_classic.c \ mgt_child.c \ @@ -43,7 +42,6 @@ noinst_HEADERS = \ cache.h \ common.h \ - common_cli.h \ hash_slinger.h \ heritage.h \ mgt.h \ Deleted: trunk/varnish-cache/bin/varnishd/common_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-07 05:47:30 UTC (rev 704) +++ trunk/varnish-cache/bin/varnishd/common_cli.c 2006-08-07 05:49:17 UTC (rev 705) @@ -1,137 +0,0 @@ -/* - * $Id: cli_event.c 466 2006-07-12 23:30:49Z phk $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "sbuf.h" - -#include "cli.h" -#include "cli_priv.h" -#include "common_cli.h" - -void -cli_out(struct cli *cli, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - sbuf_vprintf(cli->sb, fmt, ap); - va_end(ap); -} - -void -cli_param(struct cli *cli) -{ - - cli->result = CLIS_PARAM; - cli_out(cli, "Parameter error, use \"help [command]\" for more info.\n"); -} - -void -cli_result(struct cli *cli, unsigned res) -{ - - cli->result = res; -} - -int -cli_writeres(int fd, struct cli *cli) -{ - int i, l; - struct iovec iov[3]; - char res[CLI_LINE0_LEN + 2]; /* - * NUL + one more so we can catch - * any misformats by snprintf - */ - - i = snprintf(res, sizeof res, - "%-3d %-8d\n", cli->result, sbuf_len(cli->sb)); - assert(i == CLI_LINE0_LEN); - iov[0].iov_base = (void*)(uintptr_t)res; - iov[1].iov_base = (void*)(uintptr_t)sbuf_data(cli->sb); - iov[2].iov_base = (void*)(uintptr_t)"\n"; - for (l = i = 0; i < 3; i++) { - iov[i].iov_len = strlen(iov[i].iov_base); - l += iov[i].iov_len; - } - i = writev(fd, iov, 3); - return (i != l); -} - -static int -read_tmo(int fd, void *ptr, unsigned len, double tmo) -{ - int i; - struct pollfd pfd; - - pfd.fd = fd; - pfd.events = POLLIN; - i = poll(&pfd, 1, (int)(tmo * 1e3)); - if (i == 0) { - errno = ETIMEDOUT; - return (-1); - } - return (read(fd, ptr, len)); -} - -int -cli_readres(int fd, unsigned *status, char **ptr, double tmo) -{ - char res[CLI_LINE0_LEN]; /* For NUL */ - int i, j; - unsigned u, v; - char *p; - - i = read_tmo(fd, res, CLI_LINE0_LEN, tmo); - if (i < 0) - return (i); - assert(i == CLI_LINE0_LEN); /* XXX: handle */ - assert(res[3] == ' '); - assert(res[CLI_LINE0_LEN - 1] == '\n'); - j = sscanf(res, "%u %u\n", &u, &v); - assert(j == 2); - if (status != NULL) - *status = u; - p = malloc(v + 1); - assert(p != NULL); - i = read_tmo(fd, p, v + 1, tmo); - if (i < 0) { - free(p); - return (i); - } - assert(i == v + 1); - assert(p[v] == '\n'); - p[v] = '\0'; - if (ptr == NULL) - free(p); - else - *ptr = p; - return (0); -} - -/*--------------------------------------------------------------------*/ - -void -cli_func_ping(struct cli *cli, char **av, void *priv) -{ - time_t t; - - (void)priv; - (void)av; - t = time(NULL); - cli_out(cli, "PONG %ld", t); -} Deleted: trunk/varnish-cache/bin/varnishd/common_cli.h =================================================================== --- trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-07 05:47:30 UTC (rev 704) +++ trunk/varnish-cache/bin/varnishd/common_cli.h 2006-08-07 05:49:17 UTC (rev 705) @@ -1,14 +0,0 @@ -/* - * $Id$ - */ - -struct cli { - struct sbuf *sb; - enum cli_status_e result; -}; - -int cli_writeres(int fd, struct cli *cli); -int cli_readres(int fd, unsigned *status, char **ptr, double tmo); -extern struct cli_proto CLI_cmds[]; - -cli_func_t cli_func_ping; Modified: trunk/varnish-cache/include/Makefile.am =================================================================== --- trunk/varnish-cache/include/Makefile.am 2006-08-07 05:47:30 UTC (rev 704) +++ trunk/varnish-cache/include/Makefile.am 2006-08-07 05:49:17 UTC (rev 705) @@ -3,6 +3,7 @@ noinst_HEADERS = \ binary_heap.h \ cli.h \ + cli_common.h \ cli_priv.h \ compat.h \ hash.h \ Copied: trunk/varnish-cache/include/cli_common.h (from rev 668, trunk/varnish-cache/bin/varnishd/common_cli.h) Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnish/Makefile.am 2006-08-07 05:47:30 UTC (rev 704) +++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2006-08-07 05:49:17 UTC (rev 705) @@ -8,6 +8,7 @@ argv.c \ binary_heap.c \ cli.c \ + cli_common.c \ time.c libvarnish_la_CFLAGS = -include config.h Copied: trunk/varnish-cache/lib/libvarnish/cli_common.c (from rev 670, trunk/varnish-cache/bin/varnishd/common_cli.c) From des at projects.linpro.no Mon Aug 7 05:49:51 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 07:49:51 +0200 (CEST) Subject: r706 - in trunk/varnish-cache: bin/varnishd include include/varnish lib/libvarnish lib/libvarnishapi Message-ID: <20060807054951.430981EC5AE@projects.linpro.no> Author: des Date: 2006-08-07 07:49:51 +0200 (Mon, 07 Aug 2006) New Revision: 706 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_cli.h trunk/varnish-cache/bin/varnishd/mgt_event.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/include/binary_heap.h trunk/varnish-cache/include/cli_priv.h trunk/varnish-cache/include/miniobj.h trunk/varnish-cache/include/stats.h trunk/varnish-cache/include/varnish/assert.h trunk/varnish-cache/include/vrt.h trunk/varnish-cache/lib/libvarnish/argv.c trunk/varnish-cache/lib/libvarnish/binary_heap.c trunk/varnish-cache/lib/libvarnish/cli.c trunk/varnish-cache/lib/libvarnish/time.c trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c trunk/varnish-cache/lib/libvarnishapi/varnish_log.c trunk/varnish-cache/lib/libvarnishapi/varnish_util.c Log: Expand keywords. Property changes on: trunk/varnish-cache/bin/varnishd/cache_cli.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/mgt_cli.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/mgt_cli.h ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/mgt_event.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/mgt_vcc.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/include/varnish/assert.h ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/include/vrt.h ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvarnish/argv.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvarnish/binary_heap.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvarnish/cli.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvarnish/time.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvarnishapi/varnish_log.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvarnishapi/varnish_util.c ___________________________________________________________________ Name: svn:keywords + Id From des at projects.linpro.no Mon Aug 7 05:52:50 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 07:52:50 +0200 (CEST) Subject: r707 - in trunk/varnish-cache: bin/varnishd lib/libvarnish Message-ID: <20060807055250.32C031EC5AE@projects.linpro.no> Author: des Date: 2006-08-07 07:52:50 +0200 (Mon, 07 Aug 2006) New Revision: 707 Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/varnishd.c trunk/varnish-cache/lib/libvarnish/cli_common.c Log: Update #include directives. Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-07 05:49:51 UTC (rev 706) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-07 05:52:50 UTC (rev 707) @@ -12,7 +12,7 @@ #include "shmlog.h" #include "cli.h" #include "cli_priv.h" -#include "common_cli.h" +#include "cli_common.h" #include "cache.h" #include "sbuf.h" #include "heritage.h" Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 05:49:51 UTC (rev 706) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 05:52:50 UTC (rev 707) @@ -15,7 +15,7 @@ #include "cli_priv.h" #include "cli.h" #include "sbuf.h" -#include "common_cli.h" +#include "cli_common.h" #include "mgt.h" #include "mgt_cli.h" #include "mgt_event.h" Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-07 05:49:51 UTC (rev 706) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-07 05:52:50 UTC (rev 707) @@ -18,7 +18,7 @@ #include "libvcl.h" #include "cli.h" #include "cli_priv.h" -#include "common_cli.h" +#include "cli_common.h" #include "mgt.h" #include "mgt_cli.h" Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 05:49:51 UTC (rev 706) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 05:52:50 UTC (rev 707) @@ -22,7 +22,7 @@ #include "libvarnish.h" #include "cli.h" #include "cli_priv.h" -#include "common_cli.h" +#include "cli_common.h" #include "mgt.h" #include "heritage.h" Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-07 05:49:51 UTC (rev 706) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-07 05:52:50 UTC (rev 707) @@ -21,7 +21,7 @@ #include "cli.h" #include "cli_priv.h" -#include "common_cli.h" +#include "cli_common.h" void cli_out(struct cli *cli, const char *fmt, ...) From phk at projects.linpro.no Mon Aug 7 08:42:59 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 10:42:59 +0200 (CEST) Subject: r708 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807084259.0FD801EC5BF@projects.linpro.no> Author: phk Date: 2006-08-07 10:42:58 +0200 (Mon, 07 Aug 2006) New Revision: 708 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/stevedore.h trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/bin/varnishd/storage_malloc.c Log: First step of slow client handling: Lose the stevedore function for sending and instead record the fd+off_t in the storage object. This eliminates sendfile from storage_file.c, next step is to put it back in the generic code in cache_response.c Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-07 05:52:50 UTC (rev 707) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-07 08:42:58 UTC (rev 708) @@ -134,11 +134,15 @@ unsigned magic; #define STORAGE_MAGIC 0x1a4e51c0 TAILQ_ENTRY(storage) list; + struct stevedore *stevedore; + void *priv; + unsigned char *ptr; unsigned len; unsigned space; - void *priv; - struct stevedore *stevedore; + + int fd; + off_t where; }; #include "stevedore.h" Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-07 05:52:50 UTC (rev 707) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-07 08:42:58 UTC (rev 708) @@ -155,7 +155,6 @@ sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - /* XXX: conditional request handling */ if (sp->wantbody) { TAILQ_FOREACH(st, &sp->obj->store, list) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); @@ -163,15 +162,7 @@ assert(st->stevedore != NULL); u += st->len; sp->wrk->acct.bodybytes += st->len; - if (st->stevedore->send == NULL) { - WRK_Write(sp->wrk, st->ptr, st->len); - } else { - st->stevedore->send(st, sp); - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); - sp->wrk->niov = 0; - sp->wrk->liov = 0; - } + WRK_Write(sp->wrk, st->ptr, st->len); } assert(u == sp->obj->len); } Modified: trunk/varnish-cache/bin/varnishd/stevedore.h =================================================================== --- trunk/varnish-cache/bin/varnishd/stevedore.h 2006-08-07 05:52:50 UTC (rev 707) +++ trunk/varnish-cache/bin/varnishd/stevedore.h 2006-08-07 08:42:58 UTC (rev 708) @@ -11,7 +11,6 @@ typedef struct storage *storage_alloc_f(struct stevedore *, size_t size); typedef void storage_trim_f(struct storage *, size_t size); typedef void storage_free_f(struct storage *); -typedef void storage_send_f(struct storage *, struct sess *); struct stevedore { const char *name; @@ -20,7 +19,6 @@ storage_alloc_f *alloc; storage_trim_f *trim; storage_free_f *free; - storage_send_f *send; /* private fields */ void *priv; Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-07 05:52:50 UTC (rev 707) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-07 08:42:58 UTC (rev 708) @@ -515,6 +515,8 @@ smf->s.ptr = smf->ptr; smf->s.len = 0; smf->s.stevedore = st; + smf->s.fd = smf->sc->fd; + smf->s.where = smf->offset; CHECK_OBJ_NOTNULL(&smf->s, STORAGE_MAGIC); return (&smf->s); } @@ -566,43 +568,6 @@ /*--------------------------------------------------------------------*/ -static void -smf_send(struct storage *st, struct sess *sp) -{ - struct smf *smf; - int i; - off_t sent; - struct sf_hdtr sfh; - - CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); - CAST_OBJ_NOTNULL(smf, st->priv, SMF_MAGIC); - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - memset(&sfh, 0, sizeof sfh); - sfh.headers = sp->wrk->iov; - sfh.hdr_cnt = sp->wrk->niov; - i = sendfile(smf->sc->fd, - sp->fd, - smf->offset, - st->len, &sfh, &sent, 0); - - /* Check again after potentially long sleep */ - CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); - CHECK_OBJ_NOTNULL(smf, SMF_MAGIC); - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - - if (sent == st->len + sp->wrk->liov) - return; - vca_close_session(sp, "remote closed"); - if (errno == EPIPE || errno == ENOTCONN) - return; - VSL(SLT_Debug, sp->fd, - "sent i=%d sent=%ju size=%ju liov=%ju errno=%d\n", - i, (uintmax_t)sent, (uintmax_t)st->len, - (uintmax_t)sp->wrk->liov, errno); -} - -/*--------------------------------------------------------------------*/ - struct stevedore smf_stevedore = { .name = "file", .init = smf_init, @@ -610,7 +575,6 @@ .alloc = smf_alloc, .trim = smf_trim, .free = smf_free, - .send = smf_send }; #ifdef INCLUDE_TEST_DRIVER Modified: trunk/varnish-cache/bin/varnishd/storage_malloc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_malloc.c 2006-08-07 05:52:50 UTC (rev 707) +++ trunk/varnish-cache/bin/varnishd/storage_malloc.c 2006-08-07 08:42:58 UTC (rev 708) @@ -24,6 +24,7 @@ assert(sma->s.ptr != NULL); sma->s.len = 0; sma->s.space = size; + sma->s.fd = -1; sma->s.stevedore = st; return (&sma->s); } From phk at projects.linpro.no Mon Aug 7 09:21:55 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 11:21:55 +0200 (CEST) Subject: r709 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807092155.484901EC5BA@projects.linpro.no> Author: phk Date: 2006-08-07 11:21:54 +0200 (Mon, 07 Aug 2006) New Revision: 709 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Set SO_SNDTIMEO to 120 seconds Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-07 08:42:58 UTC (rev 708) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-07 09:21:54 UTC (rev 709) @@ -61,7 +61,16 @@ linger.l_linger = 0; AZ(setsockopt(sp->fd, SOL_SOCKET, SO_LINGER, &linger, sizeof linger)); #endif +#ifdef SO_SNDTIMEO + { + struct timeval tv; + tv.tv_sec = 120; + tv.tv_usec = 0; + AZ(setsockopt(sp->fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv)); + } +#endif + TCP_name(addr, l, sp->addr, sizeof sp->addr, sp->port, sizeof sp->port); VSL(SLT_SessionOpen, sp->fd, "%s %s", sp->addr, sp->port); return (sp); From phk at projects.linpro.no Mon Aug 7 10:40:19 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 12:40:19 +0200 (CEST) Subject: r710 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807104019.7F9E41EC5BB@projects.linpro.no> Author: phk Date: 2006-08-07 12:40:19 +0200 (Mon, 07 Aug 2006) New Revision: 710 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Use a 600 second timeout, 120 second is too little. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-07 09:21:54 UTC (rev 709) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-07 10:40:19 UTC (rev 710) @@ -65,7 +65,7 @@ { struct timeval tv; - tv.tv_sec = 120; + tv.tv_sec = 600; tv.tv_usec = 0; AZ(setsockopt(sp->fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv)); } From phk at projects.linpro.no Mon Aug 7 10:46:59 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 12:46:59 +0200 (CEST) Subject: r711 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807104659.924381EC5C4@projects.linpro.no> Author: phk Date: 2006-08-07 12:46:59 +0200 (Mon, 07 Aug 2006) New Revision: 711 Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c Log: Timeout pipe connections after 600 seconds. Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-07 10:40:19 UTC (rev 710) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-07 10:46:59 UTC (rev 711) @@ -78,8 +78,9 @@ while (fds[0].events || fds[1].events) { fds[0].revents = 0; fds[1].revents = 0; - i = poll(fds, 2, INFTIM); - assert(i > 0); + i = poll(fds, 2, 600000); + if (i != 1) + break; if (fds[0].revents) rdf(fds, 0); if (fds[1].revents) From des at projects.linpro.no Mon Aug 7 11:09:30 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 13:09:30 +0200 (CEST) Subject: r712 - in trunk/varnish-cache: . bin/varnishd bin/varnishlog bin/varnishncsa bin/varnishtop include lib lib/libvarnish lib/libvcl Message-ID: <20060807110930.EE8801EC5CC@projects.linpro.no> Author: des Date: 2006-08-07 13:09:30 +0200 (Mon, 07 Aug 2006) New Revision: 712 Added: trunk/varnish-cache/include/vsb.h trunk/varnish-cache/lib/libvarnish/vsb.3 trunk/varnish-cache/lib/libvarnish/vsb.c Removed: trunk/varnish-cache/include/sbuf.h trunk/varnish-cache/lib/libsbuf/ Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/cache_vrt_re.c trunk/varnish-cache/bin/varnishd/flint.lnt trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/varnishd.c trunk/varnish-cache/bin/varnishlog/Makefile.am trunk/varnish-cache/bin/varnishlog/varnishlog.c trunk/varnish-cache/bin/varnishncsa/Makefile.am trunk/varnish-cache/bin/varnishncsa/varnishncsa.c trunk/varnish-cache/bin/varnishtop/Makefile.am trunk/varnish-cache/bin/varnishtop/varnishtop.c trunk/varnish-cache/configure.ac trunk/varnish-cache/include/Makefile.am trunk/varnish-cache/include/cli_common.h trunk/varnish-cache/include/libvcl.h trunk/varnish-cache/include/vrt.h trunk/varnish-cache/lib/Makefile.am trunk/varnish-cache/lib/libvarnish/Makefile.am trunk/varnish-cache/lib/libvarnish/cli_common.c trunk/varnish-cache/lib/libvcl/vcc_acl.c trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_compile.h trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_token.c Log: Fold libsbuf into libvarnish, with s/sbuf/vsb/g. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-07 11:09:30 UTC (rev 712) @@ -56,7 +56,6 @@ varnishd_LDADD = \ $(top_builddir)/lib/libcompat/libcompat.a \ - $(top_builddir)/lib/libsbuf/libsbuf.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvcl/libvcl.la \ -lpthread \ Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-07 11:09:30 UTC (rev 712) @@ -8,7 +8,7 @@ #include #include "queue.h" -#include "sbuf.h" +#include "vsb.h" #include "vcl_returns.h" #include "common.h" @@ -26,7 +26,7 @@ #define HTTP_HDR_FIRST 5 struct cli; -struct sbuf; +struct vsb; struct sess; struct object; struct objhead; Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-07 11:09:30 UTC (rev 712) @@ -14,7 +14,7 @@ #include "cli_priv.h" #include "cli_common.h" #include "cache.h" -#include "sbuf.h" +#include "vsb.h" #include "heritage.h" /*--------------------------------------------------------------------*/ @@ -64,7 +64,7 @@ cli = &clis; memset(cli, 0, sizeof *cli); - cli->sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(cli->sb != NULL); lbuf = 4096; buf = malloc(lbuf); @@ -93,9 +93,9 @@ continue; *p = '\0'; VSL(SLT_CLI, 0, "Rd %s", buf); - sbuf_clear(cli->sb); + vsb_clear(cli->sb); cli_dispatch(cli, CLI_cmds, buf); - sbuf_finish(cli->sb); + vsb_finish(cli->sb); i = cli_writeres(heritage.fds[1], cli); if (i) { VSL(SLT_Error, 0, "CLI write failed (errno=%d)", errno); @@ -103,7 +103,7 @@ return; } VSL(SLT_CLI, 0, "Wr %d %d %s", - i, cli->result, sbuf_data(cli->sb)); + i, cli->result, vsb_data(cli->sb)); i = ++p - buf; assert(i <= nbuf); if (i < nbuf) Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-07 11:09:30 UTC (rev 712) @@ -18,9 +18,9 @@ RES_Error(struct sess *sp, int error, const char *msg) { char buf[40]; - struct sbuf *sb; + struct vsb *sb; - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(sb != NULL); if (msg == NULL) { @@ -31,11 +31,11 @@ } } - sbuf_clear(sb); - sbuf_printf(sb, "HTTP/1.1 %03d %s\r\n", error, msg); + vsb_clear(sb); + vsb_printf(sb, "HTTP/1.1 %03d %s\r\n", error, msg); TIM_format(sp->t_req.tv_sec, buf); - sbuf_printf(sb, "Date: %s\r\n", buf); - sbuf_cat(sb, + vsb_printf(sb, "Date: %s\r\n", buf); + vsb_cat(sb, "Server: Varnish\r\n" "Connection: close\r\n" "content-Type: text/html; charset=iso-8859-1\r\n" @@ -43,33 +43,33 @@ "\r\n" "\r\n" " \r\n"); - sbuf_printf(sb, " %03d %s\r\n", error, msg); - sbuf_cat(sb, + vsb_printf(sb, " %03d %s\r\n", error, msg); + vsb_cat(sb, " \r\n" " \r\n"); - sbuf_printf(sb, "

Error %03d %s

\r\n", error, msg); + vsb_printf(sb, "

Error %03d %s

\r\n", error, msg); switch(error) { case 400: - sbuf_cat(sb, + vsb_cat(sb, " Your HTTP protocol request did not make sense.\r\n"); break; case 500: default: - sbuf_cat(sb, + vsb_cat(sb, " Something unexpected happened.\r\n"); break; } - sbuf_cat(sb, + vsb_cat(sb, "

\r\n" " \r\n" " Varnish\r\n" " \r\n" "\r\n"); - sbuf_finish(sb); - WRK_Write(sp->wrk, sbuf_data(sb), sbuf_len(sb)); + vsb_finish(sb); + WRK_Write(sp->wrk, vsb_data(sb), vsb_len(sb)); WRK_Flush(sp->wrk); vca_close_session(sp, msg); - sbuf_delete(sb); + vsb_delete(sb); } Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_re.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2006-08-07 11:09:30 UTC (rev 712) @@ -12,7 +12,7 @@ #include "shmlog.h" #include "vrt.h" -#include "sbuf.h" +#include "vsb.h" #include "vcl.h" #include "cache.h" @@ -52,7 +52,7 @@ } int -VRT_re_test(struct sbuf *sb, const char *re) +VRT_re_test(struct vsb *sb, const char *re) { int i; regex_t t; @@ -65,7 +65,7 @@ return (0); } (void)regerror(i, &t, buf, sizeof buf); - sbuf_printf(sb, "Regexp compilation error:\n\n%s\n\n", buf); + vsb_printf(sb, "Regexp compilation error:\n\n%s\n\n", buf); regfree(&t); return (1); } Modified: trunk/varnish-cache/bin/varnishd/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-07 11:09:30 UTC (rev 712) @@ -24,8 +24,8 @@ -esym(534, memcpy) // Ignoring return value of function -esym(534, memmove) // Ignoring return value of function -esym(534, strcpy) // Ignoring return value of function --esym(534, sbuf_printf) // Ignoring return value of function --esym(534, sbuf_cat) // Ignoring return value of function +-esym(534, vsb_printf) // Ignoring return value of function +-esym(534, vsb_cat) // Ignoring return value of function // cache.h -emacro(506, INCOMPL) // Constant value Boolean Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 11:09:30 UTC (rev 712) @@ -14,7 +14,7 @@ #include "cli_priv.h" #include "cli.h" -#include "sbuf.h" +#include "vsb.h" #include "cli_common.h" #include "mgt.h" #include "mgt_cli.h" @@ -258,9 +258,9 @@ return (0); *p = '\0'; fprintf(stderr, "CLI <%s>\n", cp->buf); - sbuf_clear(cp->cli->sb); + vsb_clear(cp->cli->sb); cli_dispatch(cp->cli, cli_proto, cp->buf); - sbuf_finish(cp->cli->sb); + vsb_finish(cp->cli->sb); /* XXX: cp->verbose */ if (cli_writeres(cp->fdo, cp->cli)) break; @@ -271,7 +271,7 @@ cp->nbuf -= i; return (0); } - sbuf_delete(cp->cli->sb); + vsb_delete(cp->cli->sb); free(cp->buf); close(cp->fdi); close(cp->fdo); @@ -298,7 +298,7 @@ cp->buf = malloc(cp->lbuf); assert(cp->buf != NULL); - cp->cli->sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + cp->cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(cp->cli->sb != NULL); cp->ev = calloc(sizeof *cp->ev, 1); Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-07 11:09:30 UTC (rev 712) @@ -11,7 +11,7 @@ #include #include -#include "sbuf.h" +#include "vsb.h" #include "queue.h" #include "libvarnish.h" @@ -120,10 +120,10 @@ { char *buf, *vf; const char *p, *q; - struct sbuf *sb; + struct vsb *sb; struct vclprog *vp; - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(sb != NULL); if (bflag != NULL) { /* @@ -155,13 +155,13 @@ } else { vf = VCC_CompileFile(sb, fflag); } - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - fprintf(stderr, "%s", sbuf_data(sb)); - sbuf_delete(sb); + vsb_finish(sb); + if (vsb_len(sb) > 0) { + fprintf(stderr, "%s", vsb_data(sb)); + vsb_delete(sb); return (1); } - sbuf_delete(sb); + vsb_delete(sb); vp = mgt_vcc_add("boot", vf); vp->active = 1; return (0); @@ -224,22 +224,22 @@ mcf_config_inline(struct cli *cli, char **av, void *priv) { char *vf, *p; - struct sbuf *sb; + struct vsb *sb; unsigned status; (void)priv; - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(sb != NULL); vf = VCC_Compile(sb, av[3], NULL); - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - cli_out(cli, "%s", sbuf_data(sb)); - sbuf_delete(sb); + vsb_finish(sb); + if (vsb_len(sb) > 0) { + cli_out(cli, "%s", vsb_data(sb)); + vsb_delete(sb); cli_result(cli, CLIS_PARAM); return; } - sbuf_delete(sb); + vsb_delete(sb); if (child_pid >= 0 && mgt_cli_askchild(&status, &p, "config.load %s %s\n", av[2], vf)) { cli_result(cli, status); @@ -254,23 +254,23 @@ mcf_config_load(struct cli *cli, char **av, void *priv) { char *vf; - struct sbuf *sb; + struct vsb *sb; unsigned status; char *p; (void)priv; - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(sb != NULL); vf = VCC_CompileFile(sb, av[3]); - sbuf_finish(sb); - if (sbuf_len(sb) > 0) { - cli_out(cli, "%s", sbuf_data(sb)); - sbuf_delete(sb); + vsb_finish(sb); + if (vsb_len(sb) > 0) { + cli_out(cli, "%s", vsb_data(sb)); + vsb_delete(sb); cli_result(cli, CLIS_PARAM); return; } - sbuf_delete(sb); + vsb_delete(sb); if (child_pid >= 0 && mgt_cli_askchild(&status, &p, "config.load %s %s\n", av[2], vf)) { cli_result(cli, status); Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 11:09:30 UTC (rev 712) @@ -17,7 +17,7 @@ #include #include -#include "sbuf.h" +#include "vsb.h" #include "libvarnish.h" #include "cli.h" Modified: trunk/varnish-cache/bin/varnishlog/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishlog/Makefile.am 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishlog/Makefile.am 2006-08-07 11:09:30 UTC (rev 712) @@ -11,5 +11,5 @@ varnishlog_CFLAGS = -include config.h varnishlog_LDADD = \ - $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ - $(top_builddir)/lib/libsbuf/libsbuf.a + $(top_builddir)/lib/libvarnish/libvarnish.la \ + $(top_builddir)/lib/libvarnishapi/libvarnishapi.la Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-07 11:09:30 UTC (rev 712) @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include "shmlog.h" @@ -31,7 +31,7 @@ /* Ordering-----------------------------------------------------------*/ -static struct sbuf *ob[65536]; +static struct vsb *ob[65536]; static int hc[65536]; static int xrf[65536]; @@ -43,10 +43,10 @@ for (u = 0; u < 65536; u++) { if (ob[u] == NULL) continue; - sbuf_finish(ob[u]); - if (sbuf_len(ob[u])) - printf("%s\n", sbuf_data(ob[u])); - sbuf_clear(ob[u]); + vsb_finish(ob[u]); + if (vsb_len(ob[u])) + printf("%s\n", vsb_data(ob[u])); + vsb_clear(ob[u]); } } @@ -57,32 +57,32 @@ u = (p[2] << 8) | p[3]; if (ob[u] == NULL) { - ob[u] = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + ob[u] = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(ob[u] != NULL); } v = 0; switch (p[0]) { case SLT_VCL_call: - sbuf_printf(ob[u], "%02x %3d %4d %-12s", + vsb_printf(ob[u], "%02x %3d %4d %-12s", p[0], p[1], u, VSL_tags[p[0]]); if (p[1] > 0) { - sbuf_cat(ob[u], " <"); - sbuf_bcat(ob[u], p + 4, p[1]); + vsb_cat(ob[u], " <"); + vsb_bcat(ob[u], p + 4, p[1]); } if (h_opt && p[1] == 3 && !memcmp(p + 4, "hit", 3)) hc[u]++; break; case SLT_VCL_trace: if (p[1] > 0) { - sbuf_cat(ob[u], " "); - sbuf_bcat(ob[u], p + 4, p[1]); + vsb_cat(ob[u], " "); + vsb_bcat(ob[u], p + 4, p[1]); } break; case SLT_VCL_return: if (p[1] > 0) { - sbuf_cat(ob[u], " "); - sbuf_bcat(ob[u], p + 4, p[1]); - sbuf_cat(ob[u], ">\n"); + vsb_cat(ob[u], " "); + vsb_bcat(ob[u], p + 4, p[1]); + vsb_cat(ob[u], ">\n"); } if (h_opt && p[1] == 7 && !memcmp(p + 4, "deliver", 7)) hc[u]++; @@ -100,11 +100,11 @@ ; else if (p[1] > 4 && !memcmp(p + 4, "TTD:", 4)) break; - sbuf_printf(ob[u], "%02x %3d %4d %-12s", + vsb_printf(ob[u], "%02x %3d %4d %-12s", p[0], p[1], u, VSL_tags[p[0]]); if (p[1] > 0) - sbuf_cat(ob[u], vis_it(p)); - sbuf_cat(ob[u], "\n"); + vsb_cat(ob[u], vis_it(p)); + vsb_cat(ob[u], "\n"); break; case SLT_HttpError: if (!h_opt) @@ -147,19 +147,19 @@ break; } if (v) { - sbuf_printf(ob[u], "%02x %3d %4d %-12s", + vsb_printf(ob[u], "%02x %3d %4d %-12s", p[0], p[1], u, VSL_tags[p[0]]); if (p[1] > 0) { - sbuf_cat(ob[u], " <"); - sbuf_bcat(ob[u], p + 4, p[1]); - sbuf_cat(ob[u], ">"); + vsb_cat(ob[u], " <"); + vsb_bcat(ob[u], p + 4, p[1]); + vsb_cat(ob[u], ">"); } - sbuf_cat(ob[u], "\n"); + vsb_cat(ob[u], "\n"); } if (u == 0) { - sbuf_finish(ob[u]); - printf("%s", sbuf_data(ob[u])); - sbuf_clear(ob[u]); + vsb_finish(ob[u]); + printf("%s", vsb_data(ob[u])); + vsb_clear(ob[u]); return; } switch (p[0]) { @@ -167,10 +167,10 @@ case SLT_SessionReuse: case SLT_BackendClose: case SLT_BackendReuse: - sbuf_finish(ob[u]); - if ((hc[u] != 4 || h_opt == 0) && sbuf_len(ob[u]) > 1) - printf("%s\n", sbuf_data(ob[u])); - sbuf_clear(ob[u]); + vsb_finish(ob[u]); + if ((hc[u] != 4 || h_opt == 0) && vsb_len(ob[u]) > 1) + printf("%s\n", vsb_data(ob[u])); + vsb_clear(ob[u]); hc[u] = 0; xrf[u] = 0; break; Modified: trunk/varnish-cache/bin/varnishncsa/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-07 11:09:30 UTC (rev 712) @@ -11,5 +11,5 @@ varnishncsa_CFLAGS = -include config.h varnishncsa_LDADD = \ - $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ - $(top_builddir)/lib/libsbuf/libsbuf.a + $(top_builddir)/lib/libvarnish/libvarnish.la \ + $(top_builddir)/lib/libvarnishapi/libvarnishapi.la Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 11:09:30 UTC (rev 712) @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include @@ -39,13 +39,13 @@ }; -/* We make a array of pointers to sbuf's. Sbuf is a string buffer. +/* We make a array of pointers to vsb's. Sbuf is a string buffer. * * The buffer can be made/extended/cleared etc. through a API. * * The array is 65536 long because we will use sessionid as key. * * * */ -static struct sbuf *ob[65536]; +static struct vsb *ob[65536]; static struct logline ll[65536]; @@ -64,8 +64,8 @@ for (u = 0; u < 65536; u++) { if (ob[u] == NULL) continue; - sbuf_finish(ob[u]); - sbuf_clear(ob[u]); + vsb_finish(ob[u]); + vsb_clear(ob[u]); } } @@ -80,7 +80,7 @@ u = (p[2] << 8) | p[3]; if (ob[u] == NULL) { - ob[u] = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + ob[u] = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(ob[u] != NULL); } Modified: trunk/varnish-cache/bin/varnishtop/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishtop/Makefile.am 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishtop/Makefile.am 2006-08-07 11:09:30 UTC (rev 712) @@ -11,6 +11,6 @@ varnishtop_CFLAGS = -include config.h varnishtop_LDADD = \ + $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ - $(top_builddir)/lib/libsbuf/libsbuf.a \ -lcurses Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-07 11:09:30 UTC (rev 712) @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include "shmlog.h" Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/configure.ac 2006-08-07 11:09:30 UTC (rev 712) @@ -75,7 +75,6 @@ include/Makefile lib/Makefile lib/libcompat/Makefile - lib/libsbuf/Makefile lib/libvarnish/Makefile lib/libvarnishapi/Makefile lib/libvcl/Makefile Modified: trunk/varnish-cache/include/Makefile.am =================================================================== --- trunk/varnish-cache/include/Makefile.am 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/include/Makefile.am 2006-08-07 11:09:30 UTC (rev 712) @@ -12,7 +12,7 @@ libvcl.h \ miniobj.h \ queue.h \ - sbuf.h \ + vsb.h \ shmlog.h \ shmlog_tags.h \ stat_field.h \ Modified: trunk/varnish-cache/include/cli_common.h =================================================================== --- trunk/varnish-cache/include/cli_common.h 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/include/cli_common.h 2006-08-07 11:09:30 UTC (rev 712) @@ -3,7 +3,7 @@ */ struct cli { - struct sbuf *sb; + struct vsb *sb; enum cli_status_e result; }; Modified: trunk/varnish-cache/include/libvcl.h =================================================================== --- trunk/varnish-cache/include/libvcl.h 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/include/libvcl.h 2006-08-07 11:09:30 UTC (rev 712) @@ -2,8 +2,8 @@ * $Id$ */ -char *VCC_Compile(struct sbuf *sb, const char *b, const char *e); -char *VCC_CompileFile(struct sbuf *sb, const char *fn); +char *VCC_Compile(struct vsb *sb, const char *b, const char *e); +char *VCC_CompileFile(struct vsb *sb, const char *fn); void VCC_InitCompile(const char *default_vcl); Deleted: trunk/varnish-cache/include/sbuf.h =================================================================== --- trunk/varnish-cache/include/sbuf.h 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/include/sbuf.h 2006-08-07 11:09:30 UTC (rev 712) @@ -1,78 +0,0 @@ -/*- - * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Co?dan Sm?rgrav - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id$ - * $FreeBSD: src/sys/sys/sbuf.h,v 1.14 2004/07/09 11:35:30 des Exp $ - */ - -#ifndef SBUF_H_INCLUDED -#define SBUF_H_INCLUDED - -/* - * Structure definition - */ -struct sbuf { - char *s_buf; /* storage buffer */ - void *s_unused; /* binary compatibility. */ - int s_size; /* size of storage buffer */ - int s_len; /* current length of string */ -#define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ -#define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ -#define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ -#define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */ -#define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ -#define SBUF_OVERFLOWED 0x00040000 /* sbuf overflowed */ -#define SBUF_DYNSTRUCT 0x00080000 /* sbuf must be freed */ - int s_flags; /* flags */ -}; - -__BEGIN_DECLS -/* - * API functions - */ -struct sbuf *sbuf_new(struct sbuf *, char *, int, int); -void sbuf_clear(struct sbuf *); -int sbuf_setpos(struct sbuf *, int); -int sbuf_bcat(struct sbuf *, const void *, size_t); -int sbuf_bcpy(struct sbuf *, const void *, size_t); -int sbuf_cat(struct sbuf *, const char *); -int sbuf_cpy(struct sbuf *, const char *); -int sbuf_printf(struct sbuf *, const char *, ...) /* __printflike(2, 3) */; -#ifdef va_start -int sbuf_vprintf(struct sbuf *, const char *, va_list) /* __printflike(2, 0) */; -#endif -int sbuf_putc(struct sbuf *, int); -int sbuf_trim(struct sbuf *); -int sbuf_overflowed(struct sbuf *); -void sbuf_finish(struct sbuf *); -char *sbuf_data(struct sbuf *); -int sbuf_len(struct sbuf *); -int sbuf_done(struct sbuf *); -void sbuf_delete(struct sbuf *); -__END_DECLS - -#endif Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/include/vrt.h 2006-08-07 11:09:30 UTC (rev 712) @@ -8,7 +8,7 @@ */ struct sess; -struct sbuf; +struct vsb; struct backend; struct VCL_conf; @@ -38,7 +38,7 @@ void VRT_re_init(void **, const char *); void VRT_re_fini(void *); int VRT_re_match(const char *, void *re); -int VRT_re_test(struct sbuf *, const char *); +int VRT_re_test(struct vsb *, const char *); void VRT_count(struct sess *, unsigned); int VRT_rewrite(const char *, const char *); Copied: trunk/varnish-cache/include/vsb.h (from rev 710, trunk/varnish-cache/include/sbuf.h) =================================================================== --- trunk/varnish-cache/include/sbuf.h 2006-08-07 10:40:19 UTC (rev 710) +++ trunk/varnish-cache/include/vsb.h 2006-08-07 11:09:30 UTC (rev 712) @@ -0,0 +1,78 @@ +/*- + * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Co?dan Sm?rgrav + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + * $FreeBSD: src/sys/sys/vsb.h,v 1.14 2004/07/09 11:35:30 des Exp $ + */ + +#ifndef VSB_H_INCLUDED +#define VSB_H_INCLUDED + +/* + * Structure definition + */ +struct vsb { + char *s_buf; /* storage buffer */ + void *s_unused; /* binary compatibility. */ + int s_size; /* size of storage buffer */ + int s_len; /* current length of string */ +#define VSB_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ +#define VSB_AUTOEXTEND 0x00000001 /* automatically extend buffer */ +#define VSB_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ +#define VSB_DYNAMIC 0x00010000 /* s_buf must be freed */ +#define VSB_FINISHED 0x00020000 /* set by vsb_finish() */ +#define VSB_OVERFLOWED 0x00040000 /* vsb overflowed */ +#define VSB_DYNSTRUCT 0x00080000 /* vsb must be freed */ + int s_flags; /* flags */ +}; + +__BEGIN_DECLS +/* + * API functions + */ +struct vsb *vsb_new(struct vsb *, char *, int, int); +void vsb_clear(struct vsb *); +int vsb_setpos(struct vsb *, int); +int vsb_bcat(struct vsb *, const void *, size_t); +int vsb_bcpy(struct vsb *, const void *, size_t); +int vsb_cat(struct vsb *, const char *); +int vsb_cpy(struct vsb *, const char *); +int vsb_printf(struct vsb *, const char *, ...) /* __printflike(2, 3) */; +#ifdef va_start +int vsb_vprintf(struct vsb *, const char *, va_list) /* __printflike(2, 0) */; +#endif +int vsb_putc(struct vsb *, int); +int vsb_trim(struct vsb *); +int vsb_overflowed(struct vsb *); +void vsb_finish(struct vsb *); +char *vsb_data(struct vsb *); +int vsb_len(struct vsb *); +int vsb_done(struct vsb *); +void vsb_delete(struct vsb *); +__END_DECLS + +#endif Modified: trunk/varnish-cache/lib/Makefile.am =================================================================== --- trunk/varnish-cache/lib/Makefile.am 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/lib/Makefile.am 2006-08-07 11:09:30 UTC (rev 712) @@ -2,7 +2,6 @@ SUBDIRS = \ libcompat \ - libsbuf \ libvarnish \ libvarnishapi \ libvcl Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnish/Makefile.am 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2006-08-07 11:09:30 UTC (rev 712) @@ -9,6 +9,7 @@ binary_heap.c \ cli.c \ cli_common.c \ - time.c + time.c \ + vsb.c libvarnish_la_CFLAGS = -include config.h Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-07 11:09:30 UTC (rev 712) @@ -17,7 +17,7 @@ #include -#include "sbuf.h" +#include "vsb.h" #include "cli.h" #include "cli_priv.h" @@ -29,7 +29,7 @@ va_list ap; va_start(ap, fmt); - sbuf_vprintf(cli->sb, fmt, ap); + vsb_vprintf(cli->sb, fmt, ap); va_end(ap); } @@ -59,10 +59,10 @@ */ i = snprintf(res, sizeof res, - "%-3d %-8d\n", cli->result, sbuf_len(cli->sb)); + "%-3d %-8d\n", cli->result, vsb_len(cli->sb)); assert(i == CLI_LINE0_LEN); iov[0].iov_base = (void*)(uintptr_t)res; - iov[1].iov_base = (void*)(uintptr_t)sbuf_data(cli->sb); + iov[1].iov_base = (void*)(uintptr_t)vsb_data(cli->sb); iov[2].iov_base = (void*)(uintptr_t)"\n"; for (l = i = 0; i < 3; i++) { iov[i].iov_len = strlen(iov[i].iov_base); Copied: trunk/varnish-cache/lib/libvarnish/vsb.3 (from rev 710, trunk/varnish-cache/lib/libsbuf/sbuf.3) =================================================================== --- trunk/varnish-cache/lib/libsbuf/sbuf.3 2006-08-07 10:40:19 UTC (rev 710) +++ trunk/varnish-cache/lib/libvarnish/vsb.3 2006-08-07 11:09:30 UTC (rev 712) @@ -0,0 +1,338 @@ +.\"- +.\" Copyright (c) 2000 Poul Henning Kamp and Dag-Erling Co?dan Sm?rgrav +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id$ +.\" $FreeBSD: src/share/man/man9/vsb.9,v 1.25 2005/12/23 11:49:52 phk Exp $ +.\" +.Dd March 14, 2006 +.Dt VSB 3 +.Os +.Sh NAME +.Nm vsb_new , +.Nm vsb_clear , +.Nm vsb_setpos , +.Nm vsb_bcat , +.Nm vsb_bcpy , +.Nm vsb_cat , +.Nm vsb_cpy , +.Nm vsb_printf , +.Nm vsb_vprintf , +.Nm vsb_putc , +.Nm vsb_trim , +.Nm vsb_overflowed , +.Nm vsb_finish , +.Nm vsb_data , +.Nm vsb_len , +.Nm vsb_done , +.Nm vsb_delete +.Nd safe string formatting +.Sh LIBRARY +.Lb libvarnish +.Sh SYNOPSIS +.In vsb.h +.Ft struct vsb * +.Fn vsb_new "struct vsb *s" "char *buf" "int length" "int flags" +.Ft void +.Fn vsb_clear "struct vsb *s" +.Ft int +.Fn vsb_setpos "struct vsb *s" "int pos" +.Ft int +.Fn vsb_bcat "struct vsb *s" "const void *buf" "size_t len" +.Ft int +.Fn vsb_bcpy "struct vsb *s" "const void *buf" "size_t len" +.Ft int +.Fn vsb_cat "struct vsb *s" "const char *str" +.Ft int +.Fn vsb_cpy "struct vsb *s" "const char *str" +.Ft int +.Fn vsb_printf "struct vsb *s" "const char *fmt" "..." +.Ft int +.Fn vsb_vprintf "struct vsb *s" "const char *fmt" "va_list ap" +.Ft int +.Fn vsb_putc "struct vsb *s" "int c" +.Ft int +.Fn vsb_trim "struct vsb *s" +.Ft int +.Fn vsb_overflowed "struct vsb *s" +.Ft void +.Fn vsb_finish "struct vsb *s" +.Ft char * +.Fn vsb_data "struct vsb *s" +.Ft int +.Fn vsb_len "struct vsb *s" +.Ft int +.Fn vsb_done "struct vsb *s" +.Ft void +.Fn vsb_delete "struct vsb *s" +.Sh DESCRIPTION +The +.Nm vsb +family of functions allows one to safely allocate, construct and +release bounded null-terminated strings in kernel space. +Instead of arrays of characters, these functions operate on structures +called +.Fa vsbs , +defined in +.In sys/vsb.h . +.Pp +The +.Fn vsb_new +function initializes the +.Fa vsb +pointed to by its first argument. +If that pointer is +.Dv NULL , +.Fn vsb_new +allocates a +.Vt struct vsb +using +.Xr malloc 9 . +The +.Fa buf +argument is a pointer to a buffer in which to store the actual string; +if it is +.Dv NULL , +.Fn vsb_new +will allocate one using +.Xr malloc 9 . +The +.Fa length +is the initial size of the storage buffer. +The fourth argument, +.Fa flags , +may be comprised of the following flags: +.Bl -tag -width ".Dv VSB_AUTOEXTEND" +.It Dv VSB_FIXEDLEN +The storage buffer is fixed at its initial size. +Attempting to extend the vsb beyond this size results in an overflow condition. +.It Dv VSB_AUTOEXTEND +This indicates that the storage buffer may be extended as necessary, so long +as resources allow, to hold additional data. +.El +.Pp +Note that if +.Fa buf +is not +.Dv NULL , +it must point to an array of at least +.Fa length +characters. +The result of accessing that array directly while it is in use by the +vsb is undefined. +.Pp +The +.Fn vsb_delete +function clears the +.Fa vsb +and frees any memory allocated for it. +There must be a call to +.Fn vsb_delete +for every call to +.Fn vsb_new . +Any attempt to access the vsb after it has been deleted will fail. +.Pp +The +.Fn vsb_clear +function invalidates the contents of the +.Fa vsb +and resets its position to zero. +.Pp +The +.Fn vsb_setpos +function sets the +.Fa vsb Ns 's +end position to +.Fa pos , +which is a value between zero and one less than the size of the +storage buffer. +This effectively truncates the vsb at the new position. +.Pp +The +.Fn vsb_bcat +function appends the first +.Fa len +bytes from the buffer +.Fa buf +to the +.Fa vsb . +.Pp +The +.Fn vsb_bcpy +function replaces the contents of the +.Fa vsb +with the first +.Fa len +bytes from the buffer +.Fa buf . +.Pp +The +.Fn vsb_cat +function appends the NUL-terminated string +.Fa str +to the +.Fa vsb +at the current position. +.Pp +The +.Fn vsb_cpy +function replaces the contents of the +.Fa vsb +with those of the NUL-terminated string +.Fa str . +This is equivalent to calling +.Fn vsb_cat +with a fresh +.Fa vsb +or one which position has been reset to zero with +.Fn vsb_clear +or +.Fn vsb_setpos . +.Pp +The +.Fn vsb_printf +function formats its arguments according to the format string pointed +to by +.Fa fmt +and appends the resulting string to the +.Fa vsb +at the current position. +.Pp +The +.Fn vsb_vprintf +function behaves the same as +.Fn vsb_printf +except that the arguments are obtained from the variable-length argument list +.Fa ap . +.Pp +The +.Fn vsb_putc +function appends the character +.Fa c +to the +.Fa vsb +at the current position. +.Pp +The +.Fn vsb_trim +function removes trailing whitespace from the +.Fa vsb . +.Pp +The +.Fn vsb_overflowed +function returns a non-zero value if the +.Fa vsb +overflowed. +.Pp +The +.Fn vsb_finish +function null-terminates the +.Fa vsb +and marks it as finished, which means that it may no longer be +modified using +.Fn vsb_setpos , +.Fn vsb_cat , +.Fn vsb_cpy , +.Fn vsb_printf +or +.Fn vsb_putc . +.Pp +The +.Fn vsb_data +and +.Fn vsb_len +functions return the actual string and its length, respectively; +.Fn vsb_data +only works on a finished +.Fa vsb . +.Fn vsb_done +returns non-zero if the vsb is finished. +.Sh NOTES +If an operation caused an +.Fa vsb +to overflow, most subsequent operations on it will fail until the +.Fa vsb +is finished using +.Fn vsb_finish +or reset using +.Fn vsb_clear , +or its position is reset to a value between 0 and one less than the +size of its storage buffer using +.Fn vsb_setpos , +or it is reinitialized to a sufficiently short string using +.Fn vsb_cpy . +.Sh RETURN VALUES +.Fn vsb_new +returns +.Dv NULL +if it failed to allocate a storage buffer, and a pointer to the new +.Fa vsb +otherwise. +.Pp +.Fn vsb_setpos +returns \-1 if +.Fa pos +was invalid, and zero otherwise. +.Pp +.Fn vsb_cat , +.Fn vsb_cpy , +.Fn vsb_printf , +.Fn vsb_putc , +and +.Fn vsb_trim +all return \-1 if the buffer overflowed, and zero otherwise. +.Pp +.Fn vsb_overflowed +returns a non-zero value if the buffer overflowed, and zero otherwise. +.Pp +.Fn vsb_data +and +.Fn vsb_len +return +.Dv NULL +and \-1, respectively, if the buffer overflowed. +.Sh SEE ALSO +.Xr printf 3 , +.Xr strcat 3 , +.Xr strcpy 3 +.Sh HISTORY +The +.Nm vsb +family of functions first appeared in +.Fx 4.4 . +.Sh AUTHORS +.An -nosplit +The +.Nm vsb +family of functions was designed by +.An Poul-Henning Kamp Aq phk at FreeBSD.org +and implemented by +.An Dag-Erling Sm\(/orgrav Aq des at FreeBSD.org . +Additional improvements were suggested by +.An Justin T. Gibbs Aq gibbs at FreeBSD.org . +Auto-extend support added by +.An Kelly Yancey Aq kbyanc at FreeBSD.org . +.Pp +This manual page was written by +.An Dag-Erling Sm\(/orgrav Aq des at FreeBSD.org . Copied: trunk/varnish-cache/lib/libvarnish/vsb.c (from rev 710, trunk/varnish-cache/lib/libsbuf/sbuf.c) =================================================================== --- trunk/varnish-cache/lib/libsbuf/sbuf.c 2006-08-07 10:40:19 UTC (rev 710) +++ trunk/varnish-cache/lib/libvarnish/vsb.c 2006-08-07 11:09:30 UTC (rev 712) @@ -0,0 +1,468 @@ +/*- + * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Co?dan Sm?rgrav + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + * $FreeBSD: src/sys/kern/subr_sbuf.c,v 1.30 2005/12/23 11:49:53 phk Exp $ + */ + +#include +#include +#include +#include +#include + +#include "vsb.h" + +#define KASSERT(e, m) +#define SBMALLOC(size) malloc(size) +#define SBFREE(buf) free(buf) +#define min(x,y) (x < y ? x : y) + +/* + * Predicates + */ +#define VSB_ISDYNAMIC(s) ((s)->s_flags & VSB_DYNAMIC) +#define VSB_ISDYNSTRUCT(s) ((s)->s_flags & VSB_DYNSTRUCT) +#define VSB_ISFINISHED(s) ((s)->s_flags & VSB_FINISHED) +#define VSB_HASOVERFLOWED(s) ((s)->s_flags & VSB_OVERFLOWED) +#define VSB_HASROOM(s) ((s)->s_len < (s)->s_size - 1) +#define VSB_FREESPACE(s) ((s)->s_size - (s)->s_len - 1) +#define VSB_CANEXTEND(s) ((s)->s_flags & VSB_AUTOEXTEND) + +/* + * Set / clear flags + */ +#define VSB_SETFLAG(s, f) do { (s)->s_flags |= (f); } while (0) +#define VSB_CLEARFLAG(s, f) do { (s)->s_flags &= ~(f); } while (0) + +#define VSB_MINEXTENDSIZE 16 /* Should be power of 2. */ +#define VSB_MAXEXTENDSIZE 4096 +#define VSB_MAXEXTENDINCR 4096 + +/* + * Debugging support + */ +#if !defined(NDEBUG) +static void +_vsb_assert_integrity(const char *fun, struct vsb *s) +{ + KASSERT(s != NULL, + ("%s called with a NULL vsb pointer", fun)); + KASSERT(s->s_buf != NULL, + ("%s called with uninitialized or corrupt vsb", fun)); + KASSERT(s->s_len < s->s_size, + ("wrote past end of vsb (%d >= %d)", s->s_len, s->s_size)); +} + +static void +_vsb_assert_state(const char *fun, struct vsb *s, int state) +{ + KASSERT((s->s_flags & VSB_FINISHED) == state, + ("%s called with %sfinished or corrupt vsb", fun, + (state ? "un" : ""))); +} +#define vsb_assert_integrity(s) _vsb_assert_integrity(__func__, (s)) +#define vsb_assert_state(s, i) _vsb_assert_state(__func__, (s), (i)) +#else +#define vsb_assert_integrity(s) do { } while (0) +#define vsb_assert_state(s, i) do { } while (0) +#endif + +static int +vsb_extendsize(int size) +{ + int newsize; + + newsize = VSB_MINEXTENDSIZE; + while (newsize < size) { + if (newsize < (int)VSB_MAXEXTENDSIZE) + newsize *= 2; + else + newsize += VSB_MAXEXTENDINCR; + } + + return (newsize); +} + + +/* + * Extend an vsb. + */ +static int +vsb_extend(struct vsb *s, int addlen) +{ + char *newbuf; + int newsize; + + if (!VSB_CANEXTEND(s)) + return (-1); + + newsize = vsb_extendsize(s->s_size + addlen); + newbuf = (char *)SBMALLOC(newsize); + if (newbuf == NULL) + return (-1); + bcopy(s->s_buf, newbuf, s->s_size); + if (VSB_ISDYNAMIC(s)) + SBFREE(s->s_buf); + else + VSB_SETFLAG(s, VSB_DYNAMIC); + s->s_buf = newbuf; + s->s_size = newsize; + return (0); +} + +/* + * Initialize an vsb. + * If buf is non-NULL, it points to a static or already-allocated string + * big enough to hold at least length characters. + */ +struct vsb * +vsb_new(struct vsb *s, char *buf, int length, int flags) +{ + KASSERT(length >= 0, + ("attempt to create an vsb of negative length (%d)", length)); + KASSERT((flags & ~VSB_USRFLAGMSK) == 0, + ("%s called with invalid flags", __func__)); + + flags &= VSB_USRFLAGMSK; + if (s == NULL) { + s = (struct vsb *)SBMALLOC(sizeof *s); + if (s == NULL) + return (NULL); + bzero(s, sizeof *s); + s->s_flags = flags; + VSB_SETFLAG(s, VSB_DYNSTRUCT); + } else { + bzero(s, sizeof *s); + s->s_flags = flags; + } + s->s_size = length; + if (buf) { + s->s_buf = buf; + return (s); + } + if (flags & VSB_AUTOEXTEND) + s->s_size = vsb_extendsize(s->s_size); + s->s_buf = (char *)SBMALLOC(s->s_size); + if (s->s_buf == NULL) { + if (VSB_ISDYNSTRUCT(s)) + SBFREE(s); + return (NULL); + } + VSB_SETFLAG(s, VSB_DYNAMIC); + return (s); +} + +/* + * Clear an vsb and reset its position. + */ +void +vsb_clear(struct vsb *s) +{ + vsb_assert_integrity(s); + /* don't care if it's finished or not */ + + VSB_CLEARFLAG(s, VSB_FINISHED); + VSB_CLEARFLAG(s, VSB_OVERFLOWED); + s->s_len = 0; +} + +/* + * Set the vsb's end position to an arbitrary value. + * Effectively truncates the vsb at the new position. + */ +int +vsb_setpos(struct vsb *s, int pos) +{ + vsb_assert_integrity(s); + vsb_assert_state(s, 0); + + KASSERT(pos >= 0, + ("attempt to seek to a negative position (%d)", pos)); + KASSERT(pos < s->s_size, + ("attempt to seek past end of vsb (%d >= %d)", pos, s->s_size)); + + if (pos < 0 || pos > s->s_len) + return (-1); + s->s_len = pos; + return (0); +} + +/* + * Append a byte string to an vsb. + */ +int +vsb_bcat(struct vsb *s, const void *buf, size_t len) +{ + const char *str = buf; + + vsb_assert_integrity(s); + vsb_assert_state(s, 0); + + if (VSB_HASOVERFLOWED(s)) + return (-1); + + for (; len; len--) { + if (!VSB_HASROOM(s) && vsb_extend(s, len) < 0) + break; + s->s_buf[s->s_len++] = *str++; + } + if (len) { + VSB_SETFLAG(s, VSB_OVERFLOWED); + return (-1); + } + return (0); +} + +/* + * Copy a byte string into an vsb. + */ +int +vsb_bcpy(struct vsb *s, const void *buf, size_t len) +{ + vsb_assert_integrity(s); + vsb_assert_state(s, 0); + + vsb_clear(s); + return (vsb_bcat(s, buf, len)); +} + +/* + * Append a string to an vsb. + */ +int +vsb_cat(struct vsb *s, const char *str) +{ + vsb_assert_integrity(s); + vsb_assert_state(s, 0); + + if (VSB_HASOVERFLOWED(s)) + return (-1); + + while (*str) { + if (!VSB_HASROOM(s) && vsb_extend(s, strlen(str)) < 0) + break; + s->s_buf[s->s_len++] = *str++; + } + if (*str) { + VSB_SETFLAG(s, VSB_OVERFLOWED); + return (-1); + } + return (0); +} + +/* + * Copy a string into an vsb. + */ +int +vsb_cpy(struct vsb *s, const char *str) +{ + vsb_assert_integrity(s); + vsb_assert_state(s, 0); + + vsb_clear(s); + return (vsb_cat(s, str)); +} + +/* + * Format the given argument list and append the resulting string to an vsb. + */ +int +vsb_vprintf(struct vsb *s, const char *fmt, va_list ap) +{ + va_list ap_copy; + int len; + + vsb_assert_integrity(s); + vsb_assert_state(s, 0); + + KASSERT(fmt != NULL, + ("%s called with a NULL format string", __func__)); + + if (VSB_HASOVERFLOWED(s)) + return (-1); + + do { + va_copy(ap_copy, ap); + len = vsnprintf(&s->s_buf[s->s_len], VSB_FREESPACE(s) + 1, + fmt, ap_copy); + va_end(ap_copy); + } while (len > VSB_FREESPACE(s) && + vsb_extend(s, len - VSB_FREESPACE(s)) == 0); + + /* + * s->s_len is the length of the string, without the terminating nul. + * When updating s->s_len, we must subtract 1 from the length that + * we passed into vsnprintf() because that length includes the + * terminating nul. + * + * vsnprintf() returns the amount that would have been copied, + * given sufficient space, hence the min() calculation below. + */ + s->s_len += min(len, VSB_FREESPACE(s)); + if (!VSB_HASROOM(s) && !VSB_CANEXTEND(s)) + VSB_SETFLAG(s, VSB_OVERFLOWED); + + KASSERT(s->s_len < s->s_size, + ("wrote past end of vsb (%d >= %d)", s->s_len, s->s_size)); + + if (VSB_HASOVERFLOWED(s)) + return (-1); + return (0); +} + +/* + * Format the given arguments and append the resulting string to an vsb. + */ +int +vsb_printf(struct vsb *s, const char *fmt, ...) +{ + va_list ap; + int result; + + va_start(ap, fmt); + result = vsb_vprintf(s, fmt, ap); + va_end(ap); + return(result); +} + +/* + * Append a character to an vsb. + */ +int +vsb_putc(struct vsb *s, int c) +{ + vsb_assert_integrity(s); + vsb_assert_state(s, 0); + + if (VSB_HASOVERFLOWED(s)) + return (-1); + + if (!VSB_HASROOM(s) && vsb_extend(s, 1) < 0) { + VSB_SETFLAG(s, VSB_OVERFLOWED); + return (-1); + } + if (c != '\0') + s->s_buf[s->s_len++] = c; + return (0); +} + +/* + * Trim whitespace characters from end of an vsb. + */ +int +vsb_trim(struct vsb *s) +{ + vsb_assert_integrity(s); + vsb_assert_state(s, 0); + + if (VSB_HASOVERFLOWED(s)) + return (-1); + + while (s->s_len && isspace(s->s_buf[s->s_len-1])) + --s->s_len; + + return (0); +} + +/* + * Check if an vsb overflowed + */ +int +vsb_overflowed(struct vsb *s) +{ + return VSB_HASOVERFLOWED(s); +} + +/* + * Finish off an vsb. + */ +void +vsb_finish(struct vsb *s) +{ + vsb_assert_integrity(s); + vsb_assert_state(s, 0); + + s->s_buf[s->s_len] = '\0'; + VSB_CLEARFLAG(s, VSB_OVERFLOWED); + VSB_SETFLAG(s, VSB_FINISHED); +} + +/* + * Return a pointer to the vsb data. + */ +char * +vsb_data(struct vsb *s) +{ + vsb_assert_integrity(s); + vsb_assert_state(s, VSB_FINISHED); + + return s->s_buf; +} + +/* + * Return the length of the vsb data. + */ +int +vsb_len(struct vsb *s) +{ + vsb_assert_integrity(s); + /* don't care if it's finished or not */ + + if (VSB_HASOVERFLOWED(s)) + return (-1); + return s->s_len; +} + +/* + * Clear an vsb, free its buffer if necessary. + */ +void +vsb_delete(struct vsb *s) +{ + int isdyn; + + vsb_assert_integrity(s); + /* don't care if it's finished or not */ + + if (VSB_ISDYNAMIC(s)) + SBFREE(s->s_buf); + isdyn = VSB_ISDYNSTRUCT(s); + bzero(s, sizeof *s); + if (isdyn) + SBFREE(s); +} + +/* + * Check if an vsb has been finished. + */ +int +vsb_done(struct vsb *s) +{ + + return(VSB_ISFINISHED(s)); +} Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2006-08-07 11:09:30 UTC (rev 712) @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include @@ -37,10 +37,10 @@ vcc_NextToken(tl); break; default: - sbuf_printf(tl->sb, "Illegal condition "); + vsb_printf(tl->sb, "Illegal condition "); vcc_ErrToken(tl, tl->t); - sbuf_printf(tl->sb, " on IP number variable\n"); - sbuf_printf(tl->sb, " only '==', '!=' and '~' are legal\n"); + vsb_printf(tl->sb, " on IP number variable\n"); + vsb_printf(tl->sb, " only '==', '!=' and '~' are legal\n"); vcc_ErrWhere(tl, tl->t); break; } Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 11:09:30 UTC (rev 712) @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include @@ -88,7 +88,7 @@ } while (0) /*-------------------------------------------------------------------- - * Printf output to the two sbufs, possibly indented + * Printf output to the two vsbs, possibly indented */ void @@ -97,9 +97,9 @@ va_list ap; if (indent) - sbuf_printf(tl->fh, "%*.*s", tl->indent, tl->indent, ""); + vsb_printf(tl->fh, "%*.*s", tl->indent, tl->indent, ""); va_start(ap, fmt); - sbuf_vprintf(tl->fh, fmt, ap); + vsb_vprintf(tl->fh, fmt, ap); va_end(ap); } @@ -109,9 +109,9 @@ va_list ap; if (indent) - sbuf_printf(tl->fc, "%*.*s", tl->indent, tl->indent, ""); + vsb_printf(tl->fc, "%*.*s", tl->indent, tl->indent, ""); va_start(ap, fmt); - sbuf_vprintf(tl->fc, fmt, ap); + vsb_vprintf(tl->fc, fmt, ap); va_end(ap); } @@ -121,9 +121,9 @@ va_list ap; if (indent) - sbuf_printf(tl->fi, "%*.*s", tl->indent, tl->indent, ""); + vsb_printf(tl->fi, "%*.*s", tl->indent, tl->indent, ""); va_start(ap, fmt); - sbuf_vprintf(tl->fi, fmt, ap); + vsb_vprintf(tl->fi, fmt, ap); va_end(ap); } @@ -133,9 +133,9 @@ va_list ap; if (indent) - sbuf_printf(tl->ff, "%*.*s", tl->indent, tl->indent, ""); + vsb_printf(tl->ff, "%*.*s", tl->indent, tl->indent, ""); va_start(ap, fmt); - sbuf_vprintf(tl->ff, fmt, ap); + vsb_vprintf(tl->ff, fmt, ap); va_end(ap); } @@ -294,9 +294,9 @@ else if (vcc_IdIs(tl->t, "d")) sc = 60.0 * 60.0 * 24.0; else { - sbuf_printf(tl->sb, "Unknown time unit "); + vsb_printf(tl->sb, "Unknown time unit "); vcc_ErrToken(tl, tl->t); - sbuf_printf(tl->sb, ". Legal are 's', 'm', 'h' and 'd'\n"); + vsb_printf(tl->sb, ". Legal are 's', 'm', 'h' and 'd'\n"); vcc_ErrWhere(tl, tl->t); return (1.0); } @@ -323,9 +323,9 @@ else if (vcc_IdIs(tl->t, "gb") || vcc_IdIs(tl->t, "Gb")) sc = 1024.0 * 1024.0 * 1024.0; else { - sbuf_printf(tl->sb, "Unknown size unit "); + vsb_printf(tl->sb, "Unknown size unit "); vcc_ErrToken(tl, tl->t); - sbuf_printf(tl->sb, ". Legal are 'kb', 'mb' and 'gb'\n"); + vsb_printf(tl->sb, ". Legal are 'kb', 'mb' and 'gb'\n"); vcc_ErrWhere(tl, tl->t); return (1.0); } @@ -441,9 +441,9 @@ return (v); return (HeaderVar(tl, t, v)); } - sbuf_printf(tl->sb, "Unknown variable "); + vsb_printf(tl->sb, "Unknown variable "); vcc_ErrToken(tl, t); - sbuf_cat(tl->sb, "\nAt: "); + vsb_cat(tl->sb, "\nAt: "); vcc_ErrWhere(tl, t); return (NULL); } @@ -561,7 +561,7 @@ SizeVal(tl); break; default: - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "No conditions available for variable '%s'\n", vp->name); vcc_ErrWhere(tl, tl->t); @@ -570,10 +570,10 @@ Fc(tl, 0, "\n"); break; default: - sbuf_printf(tl->sb, "Illegal condition "); + vsb_printf(tl->sb, "Illegal condition "); vcc_ErrToken(tl, tl->t); - sbuf_printf(tl->sb, " on integer variable\n"); - sbuf_printf(tl->sb, + vsb_printf(tl->sb, " on integer variable\n"); + vsb_printf(tl->sb, " only '==', '!=', '<', '>', '<=' and '>=' are legal\n"); vcc_ErrWhere(tl, tl->t); break; @@ -618,7 +618,7 @@ case TIME: L(tl, Cond_Int(vp, tl)); break; /* XXX backend == */ default: - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "Variable '%s'" " has no conditions that can be checked\n", vp->name); @@ -626,11 +626,11 @@ return; } } else { - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "Syntax error in condition, expected '(', '!' or" " variable name, found "); vcc_ErrToken(tl, tl->t); - sbuf_printf(tl->sb, "\n"); + vsb_printf(tl->sb, "\n"); vcc_ErrWhere(tl, tl->t); return; } @@ -820,9 +820,9 @@ u & 0xff); break; } - sbuf_printf(tl->sb, "Illegal assignment operator "); + vsb_printf(tl->sb, "Illegal assignment operator "); vcc_ErrToken(tl, tl->t); - sbuf_printf(tl->sb, + vsb_printf(tl->sb, " only '=' is legal for IP numbers\n"); vcc_ErrWhere(tl, tl->t); return; @@ -835,21 +835,21 @@ vcc_NextToken(tl); break; } - sbuf_printf(tl->sb, "Illegal assignment operator "); + vsb_printf(tl->sb, "Illegal assignment operator "); vcc_ErrToken(tl, tl->t); - sbuf_printf(tl->sb, + vsb_printf(tl->sb, " only '=' is legal for backend\n"); vcc_ErrWhere(tl, tl->t); return; default: - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "Assignments not possible for '%s'\n", vp->name); vcc_ErrWhere(tl, tl->t); return; } return; default: - sbuf_printf(tl->sb, "Expected action, 'if' or '}'\n"); + vsb_printf(tl->sb, "Expected action, 'if' or '}'\n"); vcc_ErrWhere(tl, at); return; } @@ -881,7 +881,7 @@ Fc(tl, 1, "}\n"); return; case EOI: - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "End of input while in compound statement\n"); tl->err = 1; return; @@ -968,7 +968,7 @@ vcc_NextToken(tl); break; default: - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "Assignments not possible for '%s'\n", vp->name); vcc_ErrWhere(tl, tl->t); return; @@ -978,14 +978,14 @@ } ExpectErr(tl, '}'); if (t_host == NULL) { - sbuf_printf(tl->sb, "Backend '%T' has no hostname\n", t_be); + vsb_printf(tl->sb, "Backend '%T' has no hostname\n", t_be); vcc_ErrWhere(tl, tl->t); return; } host = EncString(t_host); ep = CheckHostPort(host, "80"); if (ep != NULL) { - sbuf_printf(tl->sb, "Backend '%T': %s\n", t_be, ep); + vsb_printf(tl->sb, "Backend '%T': %s\n", t_be, ep); vcc_ErrWhere(tl, t_host); return; } @@ -993,7 +993,7 @@ port = EncString(t_port); ep = CheckHostPort(host, port); if (ep != NULL) { - sbuf_printf(tl->sb, "Backend '%T': %s\n", t_be, ep); + vsb_printf(tl->sb, "Backend '%T': %s\n", t_be, ep); vcc_ErrWhere(tl, t_port); return; } @@ -1061,10 +1061,10 @@ case EOI: break; default: - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "Expected 'acl', 'sub' or 'backend', found "); vcc_ErrToken(tl, tl->t); - sbuf_printf(tl->sb, " at\n"); + vsb_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); return; } @@ -1120,11 +1120,11 @@ struct proccall *pc; if (!p->exists) { - sbuf_printf(tl->sb, "Function %T does not exist\n", p->name); + vsb_printf(tl->sb, "Function %T does not exist\n", p->name); return (1); } if (p->active) { - sbuf_printf(tl->sb, "Function recurses on\n"); + vsb_printf(tl->sb, "Function recurses on\n"); vcc_ErrWhere(tl, p->name); return (1); } @@ -1132,21 +1132,21 @@ if (u) { #define VCL_RET_MAC(a, b, c, d) \ if (u & VCL_RET_##b) { \ - sbuf_printf(tl->sb, "Illegal return for method\n"); \ + vsb_printf(tl->sb, "Illegal return for method\n"); \ vcc_ErrWhere(tl, p->returnt[d]); \ } #include "vcl_returns.h" #undef VCL_RET_MAC - sbuf_printf(tl->sb, "In function\n"); + vsb_printf(tl->sb, "In function\n"); vcc_ErrWhere(tl, p->name); return (1); } p->active = 1; TAILQ_FOREACH(pc, &p->calls, list) { if (Consist_Decend(tl, pc->p, returns)) { - sbuf_printf(tl->sb, "\nCalled from\n"); + vsb_printf(tl->sb, "\nCalled from\n"); vcc_ErrWhere(tl, p->name); - sbuf_printf(tl->sb, "at\n"); + vsb_printf(tl->sb, "at\n"); vcc_ErrWhere(tl, pc->t); return (1); } @@ -1172,7 +1172,7 @@ if (m->name == NULL) continue; if (Consist_Decend(tl, p, m->returns)) { - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "\nwhich is a %s method\n", m->name); return (1); } @@ -1180,7 +1180,7 @@ TAILQ_FOREACH(p, &tl->procs, list) { if (p->called) continue; - sbuf_printf(tl->sb, "Function unused\n"); + vsb_printf(tl->sb, "Function unused\n"); vcc_ErrWhere(tl, p->name); return (1); } @@ -1213,27 +1213,27 @@ break; default: ErrInternal(tl); - sbuf_printf(tl->sb, "Ref "); + vsb_printf(tl->sb, "Ref "); vcc_ErrToken(tl, r->name); - sbuf_printf(tl->sb, " has unknown type %d\n", + vsb_printf(tl->sb, " has unknown type %d\n", r->type); continue; } if (r->defcnt == 0 && r->name->tok == METHOD) { - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "No definition for method %T\n", r->name); continue; } if (r->defcnt == 0) { - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "Undefined %s %T, first reference:\n", type, r->name); vcc_ErrWhere(tl, r->name); continue; } - sbuf_printf(tl->sb, "Unused %s %T, defined:\n", type, r->name); + vsb_printf(tl->sb, "Unused %s %T, defined:\n", type, r->name); vcc_ErrWhere(tl, r->name); } return (nerr); @@ -1289,8 +1289,8 @@ { Fc(tl, 0, "\nstatic void\nVGC_Init(void)\n{\n\n"); - sbuf_finish(tl->fi); - sbuf_cat(tl->fc, sbuf_data(tl->fi)); + vsb_finish(tl->fi); + vsb_cat(tl->fc, vsb_data(tl->fi)); Fc(tl, 0, "}\n"); } @@ -1299,8 +1299,8 @@ { Fc(tl, 0, "\nstatic void\nVGC_Fini(void)\n{\n\n"); - sbuf_finish(tl->ff); - sbuf_cat(tl->fc, sbuf_data(tl->ff)); + vsb_finish(tl->ff); + vsb_cat(tl->fc, vsb_data(tl->ff)); Fc(tl, 0, "}\n"); } @@ -1335,7 +1335,7 @@ /*--------------------------------------------------------------------*/ char * -VCC_Compile(struct sbuf *sb, const char *b, const char *e) +VCC_Compile(struct vsb *sb, const char *b, const char *e) { struct tokenlist tokens; struct ref *r; @@ -1351,16 +1351,16 @@ TAILQ_INIT(&tokens.procs); tokens.sb = sb; - tokens.fc = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + tokens.fc = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(tokens.fc != NULL); - tokens.fh = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + tokens.fh = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(tokens.fh != NULL); - tokens.fi = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + tokens.fi = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(tokens.fi != NULL); - tokens.ff = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + tokens.ff = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(tokens.ff != NULL); Fh(&tokens, 0, "extern struct VCL_conf VCL_conf;\n"); @@ -1411,18 +1411,18 @@ vcl_output_lang_h(fo); fputs(vrt_obj_h, fo); - sbuf_finish(tokens.fh); - fputs(sbuf_data(tokens.fh), fo); - sbuf_delete(tokens.fh); + vsb_finish(tokens.fh); + fputs(vsb_data(tokens.fh), fo); + vsb_delete(tokens.fh); - sbuf_finish(tokens.fc); - fputs(sbuf_data(tokens.fc), fo); - sbuf_delete(tokens.fc); + vsb_finish(tokens.fc); + fputs(vsb_data(tokens.fc), fo); + vsb_delete(tokens.fc); i = pclose(fo); fprintf(stderr, "pclose=%d\n", i); if (i) { - sbuf_printf(sb, "Internal error: GCC returned 0x%04x\n", i); + vsb_printf(sb, "Internal error: GCC returned 0x%04x\n", i); unlink(of); free(of); return (NULL); @@ -1448,7 +1448,7 @@ /*--------------------------------------------------------------------*/ char * -VCC_CompileFile(struct sbuf *sb, const char *fn) +VCC_CompileFile(struct vsb *sb, const char *fn) { char *f, *r; int fd, i; @@ -1456,7 +1456,7 @@ fd = open(fn, O_RDONLY); if (fd < 0) { - sbuf_printf(sb, "Cannot open file '%s': %s", + vsb_printf(sb, "Cannot open file '%s': %s", fn, strerror(errno)); return (NULL); } Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.h 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.h 2006-08-07 11:09:30 UTC (rev 712) @@ -22,9 +22,9 @@ struct token *t; int indent; unsigned cnt; - struct sbuf *fc, *fh, *fi, *ff; + struct vsb *fc, *fh, *fi, *ff; TAILQ_HEAD(, ref) refs; - struct sbuf *sb; + struct vsb *sb; int err; int nbackend; TAILQ_HEAD(, proc) procs; Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2006-08-07 11:09:30 UTC (rev 712) @@ -476,7 +476,7 @@ fputs(" */\n", f); fputs("\n", f); fputs("struct sess;\n", f); - fputs("struct sbuf;\n", f); + fputs("struct vsb;\n", f); fputs("struct backend;\n", f); fputs("struct VCL_conf;\n", f); fputs("\n", f); @@ -506,7 +506,7 @@ fputs("void VRT_re_init(void **, const char *);\n", f); fputs("void VRT_re_fini(void *);\n", f); fputs("int VRT_re_match(const char *, void *re);\n", f); - fputs("int VRT_re_test(struct sbuf *, const char *);\n", f); + fputs("int VRT_re_test(struct vsb *, const char *);\n", f); fputs("\n", f); fputs("void VRT_count(struct sess *, unsigned);\n", f); fputs("int VRT_rewrite(const char *, const char *);\n", f); Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-07 10:46:59 UTC (rev 711) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-07 11:09:30 UTC (rev 712) @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,16 +33,16 @@ { if (t->tok == EOI) - sbuf_printf(tl->sb, "end of input"); + vsb_printf(tl->sb, "end of input"); else - sbuf_printf(tl->sb, "'%T'", t); + vsb_printf(tl->sb, "'%T'", t); } void vcc__ErrInternal(struct tokenlist *tl, const char *func, unsigned line) { - sbuf_printf(tl->sb, "VCL compiler internal error at %s():%u\n", + vsb_printf(tl->sb, "VCL compiler internal error at %s():%u\n", func, line); tl->err = 1; } @@ -77,27 +77,27 @@ } else pos++; } - sbuf_printf(tl->sb, "In %s Line %d Pos %d\n", f, lin, pos); + vsb_printf(tl->sb, "In %s Line %d Pos %d\n", f, lin, pos); x = y = 0; for (p = l; p < e && *p != '\n'; p++) { if (*p == '\t') { y &= ~7; y += 8; while (x < y) { - sbuf_bcat(tl->sb, " ", 1); + vsb_bcat(tl->sb, " ", 1); x++; } } else { x++; y++; - sbuf_bcat(tl->sb, p, 1); + vsb_bcat(tl->sb, p, 1); } } - sbuf_cat(tl->sb, "\n"); + vsb_cat(tl->sb, "\n"); x = y = 0; for (p = l; p < e && *p != '\n'; p++) { if (p >= t->b && p < t->e) { - sbuf_bcat(tl->sb, "#", 1); + vsb_bcat(tl->sb, "#", 1); x++; y++; continue; @@ -108,11 +108,11 @@ } else y++; while (x < y) { - sbuf_bcat(tl->sb, "-", 1); + vsb_bcat(tl->sb, "-", 1); x++; } } - sbuf_cat(tl->sb, "\n"); + vsb_cat(tl->sb, "\n"); tl->err = 1; } @@ -123,7 +123,7 @@ { tl->t = TAILQ_NEXT(tl->t, list); if (tl->t == NULL) { - sbuf_printf(tl->sb, + vsb_printf(tl->sb, "Ran out of input, something is missing or" " maybe unbalanced (...) or {...}\n"); tl->err = 1; @@ -136,9 +136,9 @@ { if (tl->t->tok == tok) return; - sbuf_printf(tl->sb, "Expected %s got ", vcl_tnames[tok]); + vsb_printf(tl->sb, "Expected %s got ", vcl_tnames[tok]); vcc_ErrToken(tl, tl->t); - sbuf_printf(tl->sb, "\n(program line %u), at\n", line); + vsb_printf(tl->sb, "\n(program line %u), at\n", line); vcc_ErrWhere(tl, tl->t); } @@ -286,7 +286,7 @@ continue; } vcc_AddToken(tl, EOI, p, p + 1); - sbuf_printf(tl->sb, "Syntax error at\n"); + vsb_printf(tl->sb, "Syntax error at\n"); vcc_ErrWhere(tl, tl->t); return; } From des at projects.linpro.no Mon Aug 7 12:35:50 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 14:35:50 +0200 (CEST) Subject: r713 - in trunk/varnish-cache: bin/varnishd bin/varnishlog bin/varnishncsa bin/varnishstat bin/varnishtop include lib/libvarnish Message-ID: <20060807123550.3DA401EC5BB@projects.linpro.no> Author: des Date: 2006-08-07 14:35:50 +0200 (Mon, 07 Aug 2006) New Revision: 713 Added: trunk/varnish-cache/lib/libvarnish/version.c Modified: trunk/varnish-cache/bin/varnishd/varnishd.c trunk/varnish-cache/bin/varnishlog/varnishlog.c trunk/varnish-cache/bin/varnishncsa/Makefile.am trunk/varnish-cache/bin/varnishncsa/varnishncsa.c trunk/varnish-cache/bin/varnishstat/Makefile.am trunk/varnish-cache/bin/varnishstat/varnishstat.c trunk/varnish-cache/bin/varnishtop/varnishtop.c trunk/varnish-cache/include/libvarnish.h trunk/varnish-cache/lib/libvarnish/Makefile.am Log: Add a -V option (display version and exit) to all programs. Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 11:09:30 UTC (rev 712) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 12:35:50 UTC (rev 713) @@ -151,6 +151,7 @@ fprintf(stderr, " %-28s # %s\n", "", " -s file,,"); fprintf(stderr, " %-28s # %s\n", "-t", "Default TTL"); + fprintf(stderr, " %-28s # %s\n", "-V", "version"); fprintf(stderr, " %-28s # %s\n", "-w int[,int[,int]]", "Number of worker threads"); fprintf(stderr, " %-28s # %s\n", "", @@ -335,7 +336,7 @@ heritage.wthread_timeout = 10; heritage.mem_workspace = 4096; - while ((o = getopt(argc, argv, "b:df:h:p:s:t:w:")) != -1) + while ((o = getopt(argc, argv, "b:df:h:p:s:t:Vw:")) != -1) switch (o) { case 'b': bflag = optarg; @@ -358,6 +359,9 @@ case 't': heritage.default_ttl = strtoul(optarg, NULL, 0); break; + case 'V': + varnish_version("varnishd"); + exit(0); case 'w': tackle_warg(optarg); break; Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-07 11:09:30 UTC (rev 712) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-07 12:35:50 UTC (rev 713) @@ -184,10 +184,10 @@ /*--------------------------------------------------------------------*/ static void -Usage(void) +usage(void) { - fprintf(stderr, "Usage: varnishlog [-o] [-w file] [-r file]\n"); - exit(2); + fprintf(stderr, "usage: varnishlog [-oV] [-w file] [-r file]\n"); + exit(1); } int @@ -204,7 +204,7 @@ vd = VSL_New(); - while ((c = getopt(argc, argv, VSL_ARGS "how:")) != -1) { + while ((c = getopt(argc, argv, VSL_ARGS "hoVw:")) != -1) { i = VSL_Arg(vd, c, optarg); if (i < 0) exit (1); @@ -217,11 +217,14 @@ case 'o': o_flag = 1; break; + case 'V': + varnish_version("varnishlog"); + exit(0); case 'w': w_opt = optarg; break; default: - Usage(); + usage(); } } @@ -229,7 +232,7 @@ exit (1); if (o_flag && w_opt != NULL) - Usage(); + usage(); if (w_opt != NULL) { if (!strcmp(w_opt, "-")) Modified: trunk/varnish-cache/bin/varnishncsa/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-07 11:09:30 UTC (rev 712) +++ trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-07 12:35:50 UTC (rev 713) @@ -12,4 +12,5 @@ varnishncsa_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ + $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 11:09:30 UTC (rev 712) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 12:35:50 UTC (rev 713) @@ -192,10 +192,10 @@ /*--------------------------------------------------------------------*/ static void -Usage(void) +usage(void) { - fprintf(stderr, "Usage: varnishlogfile [-w file] [-r file]\n"); - exit(2); + fprintf(stderr, "usage: varnishncsa [-V] [-w file] [-r file]\n"); + exit(1); } int @@ -217,11 +217,14 @@ if (i > 0) continue; switch (c) { + case 'V': + varnish_version("varnishncsa"); + exit(0); case 'w': w_opt = optarg; break; default: - Usage(); + usage(); } } Modified: trunk/varnish-cache/bin/varnishstat/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishstat/Makefile.am 2006-08-07 11:09:30 UTC (rev 712) +++ trunk/varnish-cache/bin/varnishstat/Makefile.am 2006-08-07 12:35:50 UTC (rev 713) @@ -11,5 +11,6 @@ varnishstat_CFLAGS = -include config.h varnishstat_LDADD = \ - -lcurses \ - $(top_builddir)/lib/libvarnishapi/libvarnishapi.la + $(top_builddir)/lib/libvarnish/libvarnish.la \ + $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ + -lcurses Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.c =================================================================== --- trunk/varnish-cache/bin/varnishstat/varnishstat.c 2006-08-07 11:09:30 UTC (rev 712) +++ trunk/varnish-cache/bin/varnishstat/varnishstat.c 2006-08-07 12:35:50 UTC (rev 713) @@ -95,6 +95,13 @@ } } +static void +usage(void) +{ + fprintf(stderr, "usage: varnishstat [-cV]\n"); + exit(1); +} + int main(int argc, char **argv) { @@ -104,14 +111,16 @@ VSL_stats = VSL_OpenStats(); - while ((c = getopt(argc, argv, "c")) != -1) { + while ((c = getopt(argc, argv, "cV")) != -1) { switch (c) { case 'c': c_flag = 1; break; + case 'V': + varnish_version("varnishstat"); + exit(0); default: - fprintf(stderr, "Usage: varnishstat [-c]\n"); - exit (2); + usage(); } } Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-07 11:09:30 UTC (rev 712) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-07 12:35:50 UTC (rev 713) @@ -34,10 +34,10 @@ /*--------------------------------------------------------------------*/ static void -Usage(void) +usage(void) { - fprintf(stderr, "Usage: varnishtop\n"); - exit(2); + fprintf(stderr, "usage: varnishtop [-1V]\n"); + exit(1); } static void @@ -89,7 +89,7 @@ vd = VSL_New(); - while ((c = getopt(argc, argv, VSL_ARGS "1")) != -1) { + while ((c = getopt(argc, argv, VSL_ARGS "1V")) != -1) { i = VSL_Arg(vd, c, optarg); if (i < 0) exit (1); @@ -99,8 +99,11 @@ case '1': one_flag = 1; break; + case 'V': + varnish_version("varnishtop"); + exit(0); default: - Usage(); + usage(); } } Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2006-08-07 11:09:30 UTC (rev 712) +++ trunk/varnish-cache/include/libvarnish.h 2006-08-07 12:35:50 UTC (rev 713) @@ -12,5 +12,8 @@ time_t TIM_parse(const char *p); #endif +/* from libvarnish/version.c */ +void varnish_version(const char *); + /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0) Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnish/Makefile.am 2006-08-07 11:09:30 UTC (rev 712) +++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2006-08-07 12:35:50 UTC (rev 713) @@ -10,6 +10,7 @@ cli.c \ cli_common.c \ time.c \ + version.c \ vsb.c libvarnish_la_CFLAGS = -include config.h Added: trunk/varnish-cache/lib/libvarnish/version.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/version.c 2006-08-07 11:09:30 UTC (rev 712) +++ trunk/varnish-cache/lib/libvarnish/version.c 2006-08-07 12:35:50 UTC (rev 713) @@ -0,0 +1,17 @@ +/* + * $Id$ + * + * Display a standardized version message. + */ + +#include + +#include "libvarnish.h" + +void +varnish_version(const char *progname) +{ + fprintf(stderr, "%s (%s-%s)\n", progname, + PACKAGE_TARNAME, PACKAGE_VERSION); + fprintf(stderr, "Copyright (c) 2006 Linpro AS / Verdens Gang AS\n"); +} Property changes on: trunk/varnish-cache/lib/libvarnish/version.c ___________________________________________________________________ Name: svn:keywords + Id From des at projects.linpro.no Mon Aug 7 12:42:15 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 14:42:15 +0200 (CEST) Subject: r714 - trunk/varnish-cache/lib/libvarnish Message-ID: <20060807124215.78FD11EC5CC@projects.linpro.no> Author: des Date: 2006-08-07 14:42:15 +0200 (Mon, 07 Aug 2006) New Revision: 714 Modified: trunk/varnish-cache/lib/libvarnish/vsb.3 Log: Define str-Lb-libvarnish so ".Lb libvarnish" will work. This should be in a shared file somewhere with some soelim magic in the Makefile, but don't bother right now - the file isn't installed anyway. Modified: trunk/varnish-cache/lib/libvarnish/vsb.3 =================================================================== --- trunk/varnish-cache/lib/libvarnish/vsb.3 2006-08-07 12:35:50 UTC (rev 713) +++ trunk/varnish-cache/lib/libvarnish/vsb.3 2006-08-07 12:42:15 UTC (rev 714) @@ -26,6 +26,9 @@ .\" $Id$ .\" $FreeBSD: src/share/man/man9/vsb.9,v 1.25 2005/12/23 11:49:52 phk Exp $ .\" +.\" XXX +.ds str-Lb-libvarnish Varnish Library (libvarnish, \-lvarnish) +.\" XXX .Dd March 14, 2006 .Dt VSB 3 .Os From des at projects.linpro.no Mon Aug 7 14:52:42 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 16:52:42 +0200 (CEST) Subject: r715 - trunk/varnish-cache/lib/libvarnish Message-ID: <20060807145242.3A98F1EC5C1@projects.linpro.no> Author: des Date: 2006-08-07 16:52:42 +0200 (Mon, 07 Aug 2006) New Revision: 715 Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c Log: Sort includes, add for uintptr_t. Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-07 12:42:15 UTC (rev 714) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-07 14:52:42 UTC (rev 715) @@ -2,21 +2,21 @@ * $Id: cli_event.c 466 2006-07-12 23:30:49Z phk $ */ +#include + +#include +#include #include -#include #include +#include #include +#include #include -#include +#include #include -#include -#include +#include #include -#include -#include -#include - #include "vsb.h" #include "cli.h" From des at projects.linpro.no Mon Aug 7 14:55:51 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 16:55:51 +0200 (CEST) Subject: r716 - trunk/varnish-cache/lib/libvcl Message-ID: <20060807145551.AA9C11EC5D7@projects.linpro.no> Author: des Date: 2006-08-07 16:55:51 +0200 (Mon, 07 Aug 2006) New Revision: 716 Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c Log: Eliminate __unused. Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 14:52:42 UTC (rev 715) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 14:55:51 UTC (rev 716) @@ -401,12 +401,14 @@ /*--------------------------------------------------------------------*/ static struct var * -HeaderVar(struct tokenlist *tl __unused, struct token *t, struct var *vh) +HeaderVar(struct tokenlist *tl, struct token *t, struct var *vh) { char *p; struct var *v; int i; + (void)tl; + v = calloc(sizeof *v, 1); assert(v != NULL); i = t->e - t->b; @@ -1474,19 +1476,23 @@ /*--------------------------------------------------------------------*/ static int -VCC_T_render(FILE *f, const struct printf_info *info __unused, const void *const *args) +VCC_T_render(FILE *f, const struct printf_info *info, const void *const *args) { const struct token *t; + (void)info; + t = *((const struct token * const*) (args[0])); return (fprintf(f, "%*.*s", t->e - t->b, t->e - t->b, t->b)); } static int -VCC_T_arginfo(const struct printf_info *info __unused, size_t n, int *argtypes) +VCC_T_arginfo(const struct printf_info *info, size_t n, int *argtypes) { + (void)info; + if (n > 0) argtypes[0] = PA_POINTER; return 1; From des at projects.linpro.no Mon Aug 7 15:00:28 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 17:00:28 +0200 (CEST) Subject: r717 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807150028.482031EC5DA@projects.linpro.no> Author: des Date: 2006-08-07 17:00:28 +0200 (Mon, 07 Aug 2006) New Revision: 717 Modified: trunk/varnish-cache/bin/varnishd/cache.h Log: Sort includes, add for uint64_t. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-07 14:55:51 UTC (rev 716) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-07 15:00:28 UTC (rev 717) @@ -2,10 +2,12 @@ * $Id$ */ +#include +#include + #include #include -#include -#include +#include #include "queue.h" #include "vsb.h" From des at projects.linpro.no Mon Aug 7 15:00:55 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 17:00:55 +0200 (CEST) Subject: r718 - trunk/varnish-cache/include Message-ID: <20060807150055.B37F01EC5DD@projects.linpro.no> Author: des Date: 2006-08-07 17:00:55 +0200 (Mon, 07 Aug 2006) New Revision: 718 Modified: trunk/varnish-cache/include/libvarnish.h Log: TIM_{format,parse}() are used unconditionally, so declare them unconditionally. Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2006-08-07 15:00:28 UTC (rev 717) +++ trunk/varnish-cache/include/libvarnish.h 2006-08-07 15:00:55 UTC (rev 718) @@ -6,11 +6,9 @@ void FreeArgv(char **argv); char **ParseArgv(const char *s, int comment); -#ifdef CLOCK_MONOTONIC /* from libvarnish/time.c */ void TIM_format(time_t t, char *p); time_t TIM_parse(const char *p); -#endif /* from libvarnish/version.c */ void varnish_version(const char *); From des at projects.linpro.no Mon Aug 7 15:08:35 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 17:08:35 +0200 (CEST) Subject: r719 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807150835.67E2D1EC5DA@projects.linpro.no> Author: des Date: 2006-08-07 17:08:35 +0200 (Mon, 07 Aug 2006) New Revision: 719 Modified: trunk/varnish-cache/bin/varnishd/shmlog.c Log: Remove redundant definition of __assert(). Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-07 15:00:55 UTC (rev 718) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-07 15:08:35 UTC (rev 719) @@ -188,17 +188,3 @@ */ VSL_Init(); } - -/*--------------------------------------------------------------------*/ - -void -__assert(const char *func, const char *file, int line, const char *failedexpr) -{ - (void)fprintf(stderr, - "\r\nAssertion failed: (%s)\n" - " function %s, file %s, line %d.\n" - " errno %d = \"%s\"\n", - failedexpr, func, file, line, errno, strerror(errno)); - abort(); - /* NOTREACHED */ -} From des at projects.linpro.no Mon Aug 7 15:09:53 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 17:09:53 +0200 (CEST) Subject: r720 - trunk/varnish-cache/include Message-ID: <20060807150953.5122B1EC5DA@projects.linpro.no> Author: des Date: 2006-08-07 17:09:53 +0200 (Mon, 07 Aug 2006) New Revision: 720 Modified: trunk/varnish-cache/include/libvarnish.h Log: Relucantly include for time_t. We'll have to clean up our header files at some point. Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2006-08-07 15:08:35 UTC (rev 719) +++ trunk/varnish-cache/include/libvarnish.h 2006-08-07 15:09:53 UTC (rev 720) @@ -2,6 +2,8 @@ * $Id$ */ +#include + /* from libvarnish/argv.c */ void FreeArgv(char **argv); char **ParseArgv(const char *s, int comment); From phk at phk.freebsd.dk Mon Aug 7 15:18:59 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Mon, 07 Aug 2006 15:18:59 +0000 Subject: r719 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Mon, 07 Aug 2006 17:08:35 +0200." <20060807150835.67E2D1EC5DA@projects.linpro.no> Message-ID: <43401.1154963939@critter.freebsd.dk> In message <20060807150835.67E2D1EC5DA at projects.linpro.no>, des at projects.linpro .no writes: >Author: des >Date: 2006-08-07 17:08:35 +0200 (Mon, 07 Aug 2006) >New Revision: 719 > >Modified: > trunk/varnish-cache/bin/varnishd/shmlog.c >Log: >Remove redundant definition of __assert(). Redundant relative to what ? The default __assert() does not include errno >-/*--------------------------------------------------------------------*/ >- >-void >-__assert(const char *func, const char *file, int line, const char *failedexpr) >-{ >- (void)fprintf(stderr, >- "\r\nAssertion failed: (%s)\n" >- " function %s, file %s, line %d.\n" >- " errno %d = \"%s\"\n", >- failedexpr, func, file, line, errno, strerror(errno)); >- abort(); >- /* NOTREACHED */ >-} > >_______________________________________________ >varnish-commit mailing list >varnish-commit at projects.linpro.no >http://projects.linpro.no/mailman/listinfo/varnish-commit > -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at projects.linpro.no Mon Aug 7 15:24:24 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 17:24:24 +0200 (CEST) Subject: r721 - in trunk/varnish-cache: . include lib/libcompat Message-ID: <20060807152424.CF1331EC5E0@projects.linpro.no> Author: des Date: 2006-08-07 17:24:24 +0200 (Mon, 07 Aug 2006) New Revision: 721 Added: trunk/varnish-cache/lib/libcompat/asprintf.c trunk/varnish-cache/lib/libcompat/vasprintf.c Modified: trunk/varnish-cache/configure.ac trunk/varnish-cache/include/compat.h trunk/varnish-cache/lib/libcompat/Makefile.am trunk/varnish-cache/lib/libcompat/strlcat.c trunk/varnish-cache/lib/libcompat/strlcpy.c Log: Add implementations of asprintf(3) and vasprintf(3). Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-07 15:09:53 UTC (rev 720) +++ trunk/varnish-cache/configure.ac 2006-08-07 15:24:24 UTC (rev 721) @@ -61,6 +61,8 @@ AC_CHECK_FUNCS([strerror]) AC_FUNC_STRERROR_R AC_CHECK_FUNCS([socket]) +AC_CHECK_FUNCS([vasprintf]) +AC_CHECK_FUNCS([asprintf]) AC_CHECK_FUNCS([strlcat]) AC_CHECK_FUNCS([strlcpy]) Modified: trunk/varnish-cache/include/compat.h =================================================================== --- trunk/varnish-cache/include/compat.h 2006-08-07 15:09:53 UTC (rev 720) +++ trunk/varnish-cache/include/compat.h 2006-08-07 15:24:24 UTC (rev 721) @@ -5,6 +5,14 @@ #ifndef COMPAT_H_INCLUDED #define COMPAT_H_INCLUDED +#ifndef HAVE_VASPRINTF +int asprintf(char **strp, const char *fmt, va_list ap) +#endif + +#ifndef HAVE_ASPRINTF +int asprintf(char **strp, const char *fmt, ...) +#endif + #ifndef HAVE_STRLCPY size_t strlcpy(char *dst, const char *src, size_t size); #endif Modified: trunk/varnish-cache/lib/libcompat/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-07 15:09:53 UTC (rev 720) +++ trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-07 15:24:24 UTC (rev 721) @@ -5,6 +5,8 @@ lib_LIBRARIES = libcompat.a libcompat_a_SOURCES = \ + asprintf.c \ + vasprintf.c \ strlcat.c \ strlcpy.c Added: trunk/varnish-cache/lib/libcompat/asprintf.c =================================================================== --- trunk/varnish-cache/lib/libcompat/asprintf.c 2006-08-07 15:09:53 UTC (rev 720) +++ trunk/varnish-cache/lib/libcompat/asprintf.c 2006-08-07 15:24:24 UTC (rev 721) @@ -0,0 +1,23 @@ +/* + * $Id$ + * + */ + +#include +#include + +#include "compat.h" + +#ifndef HAVE_ASPRINTF +int +asprintf(char **strp, const char *fmt, ...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vasprintf(strp, fmt, ap); + va_end(ap); + return (ret); +} +#endif Property changes on: trunk/varnish-cache/lib/libcompat/asprintf.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/lib/libcompat/strlcat.c =================================================================== --- trunk/varnish-cache/lib/libcompat/strlcat.c 2006-08-07 15:09:53 UTC (rev 720) +++ trunk/varnish-cache/lib/libcompat/strlcat.c 2006-08-07 15:24:24 UTC (rev 721) @@ -20,7 +20,6 @@ #include #include -#include "config.h" #include "compat.h" #ifndef HAVE_STRLCAT Modified: trunk/varnish-cache/lib/libcompat/strlcpy.c =================================================================== --- trunk/varnish-cache/lib/libcompat/strlcpy.c 2006-08-07 15:09:53 UTC (rev 720) +++ trunk/varnish-cache/lib/libcompat/strlcpy.c 2006-08-07 15:24:24 UTC (rev 721) @@ -20,7 +20,6 @@ #include #include -#include "config.h" #include "compat.h" #ifndef HAVE_STRLCPY Added: trunk/varnish-cache/lib/libcompat/vasprintf.c =================================================================== --- trunk/varnish-cache/lib/libcompat/vasprintf.c 2006-08-07 15:09:53 UTC (rev 720) +++ trunk/varnish-cache/lib/libcompat/vasprintf.c 2006-08-07 15:24:24 UTC (rev 721) @@ -0,0 +1,26 @@ +/* + * $Id$ + * + */ + +#include +#include + +#include "compat.h" + +#ifndef HAVE_VASPRINTF +int +asprintf(char **strp, const char *fmt, va_list ap) +{ + va_list ap, aq; + int ret; + + va_copy(aq, ap); + ret = vsnprintf(NULL, 0, fmt, aq); + va_end(aq); + if ((*strp = malloc(ret + 1)) == NULL) + return (-1); + ret = vsnprintf(*strp, ret + 1, fmt, ap); + return (ret); +} +#endif Property changes on: trunk/varnish-cache/lib/libcompat/vasprintf.c ___________________________________________________________________ Name: svn:keywords + Id From des at projects.linpro.no Mon Aug 7 15:42:46 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 17:42:46 +0200 (CEST) Subject: r722 - trunk/varnish-cache/include Message-ID: <20060807154246.1AFA61EC5E0@projects.linpro.no> Author: des Date: 2006-08-07 17:42:46 +0200 (Mon, 07 Aug 2006) New Revision: 722 Modified: trunk/varnish-cache/include/compat.h Log: paste-o. Modified: trunk/varnish-cache/include/compat.h =================================================================== --- trunk/varnish-cache/include/compat.h 2006-08-07 15:24:24 UTC (rev 721) +++ trunk/varnish-cache/include/compat.h 2006-08-07 15:42:46 UTC (rev 722) @@ -6,7 +6,7 @@ #define COMPAT_H_INCLUDED #ifndef HAVE_VASPRINTF -int asprintf(char **strp, const char *fmt, va_list ap) +int vasprintf(char **strp, const char *fmt, va_list ap) #endif #ifndef HAVE_ASPRINTF From des at projects.linpro.no Mon Aug 7 15:47:40 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 17:47:40 +0200 (CEST) Subject: r723 - trunk/varnish-cache Message-ID: <20060807154740.14BB41EC5E1@projects.linpro.no> Author: des Date: 2006-08-07 17:47:39 +0200 (Mon, 07 Aug 2006) New Revision: 723 Modified: trunk/varnish-cache/configure.ac Log: Improve detection of the presence and usability of asprintf() / vasprintf(). Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-07 15:42:46 UTC (rev 722) +++ trunk/varnish-cache/configure.ac 2006-08-07 15:47:39 UTC (rev 723) @@ -61,11 +61,21 @@ AC_CHECK_FUNCS([strerror]) AC_FUNC_STRERROR_R AC_CHECK_FUNCS([socket]) -AC_CHECK_FUNCS([vasprintf]) -AC_CHECK_FUNCS([asprintf]) AC_CHECK_FUNCS([strlcat]) AC_CHECK_FUNCS([strlcpy]) +# asprintf() and vasprintf() are tricky, because on some systems, they +# are present in the C library, but their prototypes are hidden behind +# conditionals which we won't bother to unravel. +AC_CHECK_DECL([asprintf], + AC_DEFINE(HAVE_ASPRINTF,1,[Whether asprintf() is available]), + , + [stdio.h]) +AC_CHECK_DECL([vasprintf], + AC_DEFINE(HAVE_VASPRINTF,1,[Whether vasprintf() is available]), + , + [stdio.h]) + AC_CONFIG_FILES([ Makefile bin/Makefile From des at linpro.no Mon Aug 7 15:46:37 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Mon, 07 Aug 2006 17:46:37 +0200 Subject: r719 - trunk/varnish-cache/bin/varnishd References: <43401.1154963939@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > Dag-Erling Sm?rgrav writes: > > Log: > > Remove redundant definition of __assert(). > Redundant relative to what ? > > The default __assert() does not include errno You assume that the C library's assert(3) macro calls a function called __assert() with a specific argument list. That is not necessarily the case. If you want a non-standard assert(3), feel free to define one in the application namespace. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at projects.linpro.no Mon Aug 7 15:51:32 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 17:51:32 +0200 (CEST) Subject: r724 - in trunk/varnish-cache: include lib/libcompat Message-ID: <20060807155132.648BE1EC5E5@projects.linpro.no> Author: des Date: 2006-08-07 17:51:32 +0200 (Mon, 07 Aug 2006) New Revision: 724 Modified: trunk/varnish-cache/include/compat.h trunk/varnish-cache/lib/libcompat/vasprintf.c Log: My idiocy knows no bounds. Make sure this actually builds. Modified: trunk/varnish-cache/include/compat.h =================================================================== --- trunk/varnish-cache/include/compat.h 2006-08-07 15:47:39 UTC (rev 723) +++ trunk/varnish-cache/include/compat.h 2006-08-07 15:51:32 UTC (rev 724) @@ -6,11 +6,13 @@ #define COMPAT_H_INCLUDED #ifndef HAVE_VASPRINTF -int vasprintf(char **strp, const char *fmt, va_list ap) +#ifdef va_start /* make sure is in scope */ +int vasprintf(char **strp, const char *fmt, va_list ap); #endif +#endif #ifndef HAVE_ASPRINTF -int asprintf(char **strp, const char *fmt, ...) +int asprintf(char **strp, const char *fmt, ...); #endif #ifndef HAVE_STRLCPY Modified: trunk/varnish-cache/lib/libcompat/vasprintf.c =================================================================== --- trunk/varnish-cache/lib/libcompat/vasprintf.c 2006-08-07 15:47:39 UTC (rev 723) +++ trunk/varnish-cache/lib/libcompat/vasprintf.c 2006-08-07 15:51:32 UTC (rev 724) @@ -5,14 +5,15 @@ #include #include +#include #include "compat.h" #ifndef HAVE_VASPRINTF int -asprintf(char **strp, const char *fmt, va_list ap) +vasprintf(char **strp, const char *fmt, va_list ap) { - va_list ap, aq; + va_list aq; int ret; va_copy(aq, ap); From phk at phk.freebsd.dk Mon Aug 7 15:52:11 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Mon, 07 Aug 2006 15:52:11 +0000 Subject: r719 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Mon, 07 Aug 2006 17:46:37 +0200." Message-ID: <47721.1154965931@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >"Poul-Henning Kamp" writes: >> Dag-Erling Sm?rgrav writes: >> > Log: >> > Remove redundant definition of __assert(). >> Redundant relative to what ? >> >> The default __assert() does not include errno > >You assume that the C library's assert(3) macro calls a function >called __assert() with a specific argument list. That is not >necessarily the case. Ever seen a UNIX where it doesn't ? -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From phk at projects.linpro.no Mon Aug 7 15:54:34 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 17:54:34 +0200 (CEST) Subject: r725 - trunk/varnish-cache/lib/libvarnish Message-ID: <20060807155434.C348C1EC5E4@projects.linpro.no> Author: phk Date: 2006-08-07 17:54:34 +0200 (Mon, 07 Aug 2006) New Revision: 725 Modified: trunk/varnish-cache/lib/libvarnish/vsb.c Log: Quench warnings. Modified: trunk/varnish-cache/lib/libvarnish/vsb.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vsb.c 2006-08-07 15:51:32 UTC (rev 724) +++ trunk/varnish-cache/lib/libvarnish/vsb.c 2006-08-07 15:54:34 UTC (rev 725) @@ -70,6 +70,8 @@ static void _vsb_assert_integrity(const char *fun, struct vsb *s) { + (void)fun; + (void)s; KASSERT(s != NULL, ("%s called with a NULL vsb pointer", fun)); KASSERT(s->s_buf != NULL, @@ -81,6 +83,9 @@ static void _vsb_assert_state(const char *fun, struct vsb *s, int state) { + (void)fun; + (void)s; + (void)state; KASSERT((s->s_flags & VSB_FINISHED) == state, ("%s called with %sfinished or corrupt vsb", fun, (state ? "un" : ""))); From des at projects.linpro.no Mon Aug 7 15:54:51 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 17:54:51 +0200 (CEST) Subject: r726 - trunk/varnish-cache Message-ID: <20060807155451.EC60D1EC5E7@projects.linpro.no> Author: des Date: 2006-08-07 17:54:51 +0200 (Mon, 07 Aug 2006) New Revision: 726 Modified: trunk/varnish-cache/configure.ac Log: Improve descriptions of HAVE_ASPRINTF / HAVE_VASPRINTF. Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-07 15:54:34 UTC (rev 725) +++ trunk/varnish-cache/configure.ac 2006-08-07 15:54:51 UTC (rev 726) @@ -68,11 +68,11 @@ # are present in the C library, but their prototypes are hidden behind # conditionals which we won't bother to unravel. AC_CHECK_DECL([asprintf], - AC_DEFINE(HAVE_ASPRINTF,1,[Whether asprintf() is available]), + AC_DEFINE(HAVE_ASPRINTF,1,[Define to 1 if asprintf() is available]), , [stdio.h]) AC_CHECK_DECL([vasprintf], - AC_DEFINE(HAVE_VASPRINTF,1,[Whether vasprintf() is available]), + AC_DEFINE(HAVE_VASPRINTF,1,[Define to 1 if vasprintf() is available]), , [stdio.h]) From des at linpro.no Mon Aug 7 16:04:55 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Mon, 07 Aug 2006 18:04:55 +0200 Subject: r719 - trunk/varnish-cache/bin/varnishd References: <47721.1154965931@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > Dag-Erling Sm?rgrav writes: > > You assume that the C library's assert(3) macro calls a function > > called __assert() with a specific argument list. That is not > > necessarily the case. > Ever seen a UNIX where it doesn't ? Yes. This broke the build on Linux. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From phk at projects.linpro.no Mon Aug 7 16:05:21 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 18:05:21 +0200 (CEST) Subject: r727 - trunk/varnish-cache/lib/libvarnish Message-ID: <20060807160521.DCA011EC5EC@projects.linpro.no> Author: phk Date: 2006-08-07 18:05:21 +0200 (Mon, 07 Aug 2006) New Revision: 727 Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c Log: Handle read errors on the cli pipes. Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-07 15:54:51 UTC (rev 726) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-07 16:05:21 UTC (rev 727) @@ -73,9 +73,9 @@ } static int -read_tmo(int fd, void *ptr, unsigned len, double tmo) +read_tmo(int fd, char *ptr, unsigned len, double tmo) { - int i; + int i, j; struct pollfd pfd; pfd.fd = fd; @@ -85,7 +85,17 @@ errno = ETIMEDOUT; return (-1); } - return (read(fd, ptr, len)); + for (j = 0; len > 0; ) { + i = read(fd, ptr, len); + if (i < 0) + return (i); + if (i == 0) + break; + len -= i; + ptr += i; + j += i; + } + return (j); } int @@ -97,9 +107,12 @@ char *p; i = read_tmo(fd, res, CLI_LINE0_LEN, tmo); - if (i < 0) - return (i); - assert(i == CLI_LINE0_LEN); /* XXX: handle */ + if (i != CLI_LINE0_LEN) { + if (status != NULL) + *status = CLIS_COMMS; + return (1); + } + assert(i == CLI_LINE0_LEN); assert(res[3] == ' '); assert(res[CLI_LINE0_LEN - 1] == '\n'); j = sscanf(res, "%u %u\n", &u, &v); From des at linpro.no Mon Aug 7 16:05:39 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Mon, 07 Aug 2006 18:05:39 +0200 Subject: r725 - trunk/varnish-cache/lib/libvarnish References: <20060807155434.C348C1EC5E4@projects.linpro.no> Message-ID: phk at projects.linpro.no writes: > Log: > Quench warnings. Wrong fix. The correct fix is to define KASSERT to something sensible, which I was planning to do. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at projects.linpro.no Mon Aug 7 16:11:29 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:11:29 +0200 (CEST) Subject: r728 - in trunk/varnish-cache: . bin/varnishd Message-ID: <20060807161129.1E02C1EC5EE@projects.linpro.no> Author: des Date: 2006-08-07 18:11:29 +0200 (Mon, 07 Aug 2006) New Revision: 728 Modified: trunk/varnish-cache/bin/varnishd/tcp.c trunk/varnish-cache/configure.ac Log: Check whether we have accept filters before trying to use them. Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-07 16:05:21 UTC (rev 727) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-07 16:11:29 UTC (rev 728) @@ -2,13 +2,14 @@ * $Id$ */ -#include +#include +#include + #include -#include #include -#include -#include #include +#include +#include #include "heritage.h" #include "mgt.h" @@ -46,6 +47,7 @@ /*--------------------------------------------------------------------*/ +#ifdef HAVE_ACCEPT_FILTERS static void accept_filter(int fd) { @@ -61,6 +63,7 @@ printf("Acceptfilter(%d, httpready): %d %s\n", fd, i, strerror(errno)); } +#endif static void create_listen_socket(const char *addr, const char *port, int *sp, int nsp) @@ -120,11 +123,15 @@ for (u = 0; u < HERITAGE_NSOCKS; u++) { if (heritage.sock_local[u] >= 0) { AZ(listen(heritage.sock_local[u], 16)); +#ifdef HAVE_ACCEPT_FILTERS accept_filter(heritage.sock_local[u]); +#endif } if (heritage.sock_remote[u] >= 0) { AZ(listen(heritage.sock_remote[u], 16)); +#ifdef HAVE_ACCEPT_FILTERS accept_filter(heritage.sock_remote[u]); +#endif } } return (0); Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-07 16:05:21 UTC (rev 727) +++ trunk/varnish-cache/configure.ac 2006-08-07 16:11:29 UTC (rev 728) @@ -76,6 +76,11 @@ , [stdio.h]) +AC_CHECK_DECL([SO_ACCEPTFILER], + AC_DEFINE(HAVE_ACCEPT_FILTERS,1,[Define to 1 if you have accept filters]), + , + [sys/types.h, sys/socket.h]) + AC_CONFIG_FILES([ Makefile bin/Makefile From phk at projects.linpro.no Mon Aug 7 16:14:37 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 18:14:37 +0200 (CEST) Subject: r729 - in trunk/varnish-cache: include lib/libvarnish Message-ID: <20060807161437.D4E6E1EC5EE@projects.linpro.no> Author: phk Date: 2006-08-07 18:14:37 +0200 (Mon, 07 Aug 2006) New Revision: 729 Modified: trunk/varnish-cache/include/cli.h trunk/varnish-cache/lib/libvarnish/cli_common.c Log: Add CLIS_COMMS errno (400) and return an error text as well. Modified: trunk/varnish-cache/include/cli.h =================================================================== --- trunk/varnish-cache/include/cli.h 2006-08-07 16:11:29 UTC (rev 728) +++ trunk/varnish-cache/include/cli.h 2006-08-07 16:14:37 UTC (rev 729) @@ -179,7 +179,8 @@ CLIS_TOOMANY = 105, CLIS_PARAM = 106, CLIS_OK = 200, - CLIS_CANT = 300 + CLIS_CANT = 300, + CLIS_COMMS = 400 }; /* Length of first line of response */ Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-07 16:11:29 UTC (rev 728) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-07 16:14:37 UTC (rev 729) @@ -110,6 +110,8 @@ if (i != CLI_LINE0_LEN) { if (status != NULL) *status = CLIS_COMMS; + if (ptr != NULL) + *ptr = strdup("CLI communication error"); return (1); } assert(i == CLI_LINE0_LEN); From phk at projects.linpro.no Mon Aug 7 16:15:00 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 18:15:00 +0200 (CEST) Subject: r730 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807161500.884031EC5F0@projects.linpro.no> Author: phk Date: 2006-08-07 18:15:00 +0200 (Mon, 07 Aug 2006) New Revision: 730 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: Handle CLI trouble with the childproc Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 16:14:37 UTC (rev 729) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 16:15:00 UTC (rev 730) @@ -86,7 +86,6 @@ free(p); i = cli_readres(cli_i, &u, &p, 3.0); - assert(i == 0); cli_result(cli, u); cli_out(cli, "%s", p); free(p); @@ -174,7 +173,7 @@ mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) { char *p; - int i; + int i, j; va_list ap; unsigned u; @@ -186,9 +185,16 @@ if (i < 0) return (i); assert(p[i - 1] == '\n'); - i = write(cli_o, p, strlen(p)); - assert(i == strlen(p)); + j = write(cli_o, p, i); free(p); + if (j != i) { + free(p); + if (status != NULL) + *status = CLIS_COMMS; + if (resp != NULL) + *resp = strdup("CLI communication error"); + return (CLIS_COMMS); + } i = cli_readres(cli_i, &u, resp, 3.0); assert(i == 0); From phk at phk.freebsd.dk Mon Aug 7 16:16:07 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Mon, 07 Aug 2006 16:16:07 +0000 Subject: r725 - trunk/varnish-cache/lib/libvarnish In-Reply-To: Your message of "Mon, 07 Aug 2006 18:05:39 +0200." Message-ID: <68382.1154967367@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >phk at projects.linpro.no writes: >> Log: >> Quench warnings. > >Wrong fix. The correct fix is to define KASSERT to something >sensible, which I was planning to do. > Feel free to. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From phk at phk.freebsd.dk Mon Aug 7 16:16:31 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Mon, 07 Aug 2006 16:16:31 +0000 Subject: r719 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Mon, 07 Aug 2006 18:04:55 +0200." Message-ID: <68396.1154967391@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >"Poul-Henning Kamp" writes: >> Dag-Erling Sm?rgrav writes: >> > You assume that the C library's assert(3) macro calls a function >> > called __assert() with a specific argument list. That is not >> > necessarily the case. >> Ever seen a UNIX where it doesn't ? > >Yes. This broke the build on Linux. I guess I shouldn't have been surprised. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at projects.linpro.no Mon Aug 7 16:17:35 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:17:35 +0200 (CEST) Subject: r731 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807161735.D2EDD1EC5F4@projects.linpro.no> Author: des Date: 2006-08-07 18:17:35 +0200 (Mon, 07 Aug 2006) New Revision: 731 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: #include for asprintf(). Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 16:15:00 UTC (rev 730) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 16:17:35 UTC (rev 731) @@ -4,14 +4,16 @@ * The management process' CLI handling */ +#include + +#include +#include #include -#include #include #include #include -#include -#include +#include "compat.h" #include "cli_priv.h" #include "cli.h" #include "vsb.h" From des at projects.linpro.no Mon Aug 7 16:17:43 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:17:43 +0200 (CEST) Subject: r732 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807161743.EC7EB1EC5F6@projects.linpro.no> Author: des Date: 2006-08-07 18:17:43 +0200 (Mon, 07 Aug 2006) New Revision: 732 Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c Log: Define INFTIM if it isn't already. Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-07 16:17:35 UTC (rev 731) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-07 16:17:43 UTC (rev 732) @@ -15,6 +15,11 @@ #include "miniobj.h" #include "binary_heap.h" +/* INFTIM indicates an infinite timeout for poll(2) */ +#ifndef INFTIM +#define INFTIM -1 +#endif + struct evsig { struct evbase *evb; struct ev *ev; From des at projects.linpro.no Mon Aug 7 16:20:04 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:20:04 +0200 (CEST) Subject: r733 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807162004.E92121EC5F5@projects.linpro.no> Author: des Date: 2006-08-07 18:20:04 +0200 (Mon, 07 Aug 2006) New Revision: 733 Modified: trunk/varnish-cache/bin/varnishd/storage_file.c Log: Spell SIZE_MAX correctly. Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-07 16:17:43 UTC (rev 732) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-07 16:20:04 UTC (rev 733) @@ -453,7 +453,7 @@ if (*fail < (uintmax_t)sc->pagesize * MINPAGES) return; - if (sz > 0 && sz < *fail && sz < SIZE_T_MAX) { + if (sz > 0 && sz < *fail && sz < SIZE_MAX) { p = mmap(NULL, sz, PROT_READ|PROT_WRITE, MAP_NOCORE | MAP_NOSYNC | MAP_SHARED, sc->fd, off); if (p != MAP_FAILED) { @@ -467,8 +467,8 @@ *fail = sz; h = sz / 2; - if (h > SIZE_T_MAX) - h = SIZE_T_MAX; + if (h > SIZE_MAX) + h = SIZE_MAX; h -= (h % sc->pagesize); smf_open_chunk(sc, h, off, fail, sum); From des at linpro.no Mon Aug 7 16:16:14 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Mon, 07 Aug 2006 18:16:14 +0200 Subject: r727 - trunk/varnish-cache/lib/libvarnish References: <20060807160521.DCA011EC5EC@projects.linpro.no> Message-ID: phk at projects.linpro.no writes: > Log: > Handle read errors on the cli pipes. CLIS_COMMS is not defined anywhere. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at projects.linpro.no Mon Aug 7 16:20:16 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:20:16 +0200 (CEST) Subject: r734 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807162016.31FB31EC5FA@projects.linpro.no> Author: des Date: 2006-08-07 18:20:16 +0200 (Mon, 07 Aug 2006) New Revision: 734 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: Define INFTIM if it isn't already. Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 16:20:04 UTC (rev 733) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 16:20:16 UTC (rev 734) @@ -28,6 +28,11 @@ #include "heritage.h" #include "shmlog.h" +/* INFTIM indicates an infinite timeout for poll(2) */ +#ifndef INFTIM +#define INFTIM -1 +#endif + struct heritage heritage; /*--------------------------------------------------------------------*/ From des at projects.linpro.no Mon Aug 7 16:23:02 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:23:02 +0200 (CEST) Subject: r735 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807162302.BC8A61EC5F3@projects.linpro.no> Author: des Date: 2006-08-07 18:23:02 +0200 (Mon, 07 Aug 2006) New Revision: 735 Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: #include "compat.h" for asprintf(). Sort includes. Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-07 16:20:16 UTC (rev 734) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-07 16:23:02 UTC (rev 735) @@ -4,13 +4,15 @@ * VCL compiler stuff */ +#include + +#include +#include +#include #include #include -#include -#include -#include -#include +#include "compat.h" #include "vsb.h" #include "queue.h" From des at projects.linpro.no Mon Aug 7 16:23:16 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:23:16 +0200 (CEST) Subject: r736 - trunk/varnish-cache/bin/varnishtop Message-ID: <20060807162316.DEB1A1EC5F3@projects.linpro.no> Author: des Date: 2006-08-07 18:23:16 +0200 (Mon, 07 Aug 2006) New Revision: 736 Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c Log: #include "libvarnish.h" for varnish_version(). Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-07 16:23:02 UTC (rev 735) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-07 16:23:16 UTC (rev 736) @@ -15,6 +15,7 @@ #include #include +#include "libvarnish.h" #include "shmlog.h" #include "queue.h" #include "varnishapi.h" From des at projects.linpro.no Mon Aug 7 16:24:54 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:24:54 +0200 (CEST) Subject: r737 - in trunk/varnish-cache: bin/varnishlog bin/varnishncsa bin/varnishtop lib/libvcl Message-ID: <20060807162454.80ECB1EC5F3@projects.linpro.no> Author: des Date: 2006-08-07 18:24:54 +0200 (Mon, 07 Aug 2006) New Revision: 737 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c trunk/varnish-cache/bin/varnishncsa/varnishncsa.c trunk/varnish-cache/bin/varnishtop/varnishtop.c trunk/varnish-cache/lib/libvcl/vcc_acl.c trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_token.c Log: vsb.h is not a system header. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-07 16:23:16 UTC (rev 736) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-07 16:24:54 UTC (rev 737) @@ -10,9 +10,10 @@ #include #include #include -#include #include +#include "vsb.h" + #include "shmlog.h" #include "varnishapi.h" Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 16:23:16 UTC (rev 736) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 16:24:54 UTC (rev 737) @@ -18,10 +18,11 @@ #include #include #include -#include #include #include +#include "vsb.h" + #include "shmlog.h" #include "varnishapi.h" Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-07 16:23:16 UTC (rev 736) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-07 16:24:54 UTC (rev 737) @@ -12,9 +12,10 @@ #include #include #include -#include #include +#include "vsb.h" + #include "libvarnish.h" #include "shmlog.h" #include "queue.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2006-08-07 16:23:16 UTC (rev 736) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2006-08-07 16:24:54 UTC (rev 737) @@ -12,11 +12,12 @@ #include #include #include -#include #include #include #include +#include "vsb.h" + #include "vcc_priv.h" #include "vcc_compile.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 16:23:16 UTC (rev 736) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 16:24:54 UTC (rev 737) @@ -45,12 +45,13 @@ #include #include #include -#include #include #include #include #include +#include "vsb.h" + #include "vcc_priv.h" #include "vcc_compile.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-07 16:23:16 UTC (rev 736) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-07 16:24:54 UTC (rev 737) @@ -14,12 +14,13 @@ #include #include #include -#include #include #include #include #include +#include "vsb.h" + #include "vcc_priv.h" #include "vcl_returns.h" #include "vcc_compile.h" From des at projects.linpro.no Mon Aug 7 16:26:54 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:26:54 +0200 (CEST) Subject: r738 - in trunk/varnish-cache: bin/varnishd lib/libvcl Message-ID: <20060807162654.984801EC5F3@projects.linpro.no> Author: des Date: 2006-08-07 18:26:54 +0200 (Mon, 07 Aug 2006) New Revision: 738 Modified: trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/lib/libvcl/vcc_compile.c Log: #include "compat.h" for asprintf(). Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-07 16:24:54 UTC (rev 737) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-07 16:26:54 UTC (rev 738) @@ -4,20 +4,22 @@ * Storage method based on mmap'ed file */ -#include -#include +#include +#include +#include +#include +#include + +#include #include -#include +#include #include -#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include "compat.h" #include "libvarnish.h" #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 16:24:54 UTC (rev 737) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 16:26:54 UTC (rev 738) @@ -50,6 +50,7 @@ #include #include +#include "compat.h" #include "vsb.h" #include "vcc_priv.h" From des at projects.linpro.no Mon Aug 7 16:29:43 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:29:43 +0200 (CEST) Subject: r739 - in trunk/varnish-cache/bin: varnishlog varnishncsa Message-ID: <20060807162943.1DB231EC5F3@projects.linpro.no> Author: des Date: 2006-08-07 18:29:42 +0200 (Mon, 07 Aug 2006) New Revision: 739 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: #include "libvarnish.h" for varnish_version(). Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-07 16:26:54 UTC (rev 738) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-07 16:29:42 UTC (rev 739) @@ -14,6 +14,7 @@ #include "vsb.h" +#include "libvarnish.h" #include "shmlog.h" #include "varnishapi.h" Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 16:26:54 UTC (rev 738) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 16:29:42 UTC (rev 739) @@ -23,6 +23,7 @@ #include "vsb.h" +#include "libvarnish.h" #include "shmlog.h" #include "varnishapi.h" From phk at projects.linpro.no Mon Aug 7 16:42:11 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 18:42:11 +0200 (CEST) Subject: r740 - in trunk/varnish-cache: bin/varnishd bin/varnishlog bin/varnishncsa bin/varnishtester bin/varnishtop include lib/libvarnish Message-ID: <20060807164211.6E9AF1EC5E0@projects.linpro.no> Author: phk Date: 2006-08-07 18:42:11 +0200 (Mon, 07 Aug 2006) New Revision: 740 Added: trunk/varnish-cache/lib/libvarnish/assert.c Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_session.c trunk/varnish-cache/bin/varnishd/hash_classic.c trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_event.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/shmlog.c trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/bin/varnishd/tcp.c trunk/varnish-cache/bin/varnishd/varnishd.c trunk/varnish-cache/bin/varnishlog/varnishlog.c trunk/varnish-cache/bin/varnishncsa/varnishncsa.c trunk/varnish-cache/bin/varnishtester/varnishtester.c trunk/varnish-cache/bin/varnishtop/varnishtop.c trunk/varnish-cache/include/libvarnish.h trunk/varnish-cache/lib/libvarnish/Makefile.am trunk/varnish-cache/lib/libvarnish/argv.c Log: Add our own assert in libvarnish.h Include libvarnish.h from cache.h and mgt.h Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-07 16:42:11 UTC (rev 740) @@ -5,13 +5,14 @@ #include #include -#include #include #include #include "queue.h" #include "vsb.h" +#include "libvarnish.h" + #include "vcl_returns.h" #include "common.h" #include "miniobj.h" Modified: trunk/varnish-cache/bin/varnishd/cache_session.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-07 16:42:11 UTC (rev 740) @@ -17,7 +17,6 @@ #include #include -#include "libvarnish.h" #include "heritage.h" #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-07 16:42:11 UTC (rev 740) @@ -10,7 +10,6 @@ #include #include -#include #include /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-07 16:42:11 UTC (rev 740) @@ -5,6 +5,8 @@ #include "common.h" #include "miniobj.h" +#include "libvarnish.h" + extern struct evbase *mgt_evb; /* mgt_child.c */ Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-07 16:42:11 UTC (rev 740) @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -18,7 +17,6 @@ #include /* XXX */ -#include "libvarnish.h" #include "heritage.h" #include "mgt.h" #include "cli.h" Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 16:42:11 UTC (rev 740) @@ -6,7 +6,6 @@ #include -#include #include #include #include Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/mgt_event.c 2006-08-07 16:42:11 UTC (rev 740) @@ -3,7 +3,6 @@ */ #include -#include #include #include #include @@ -11,6 +10,7 @@ #include #include +#include "mgt.h" #include "mgt_event.h" #include "miniobj.h" #include "binary_heap.h" Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-07 16:42:11 UTC (rev 740) @@ -6,7 +6,6 @@ #include -#include #include #include #include @@ -16,7 +15,6 @@ #include "vsb.h" #include "queue.h" -#include "libvarnish.h" #include "libvcl.h" #include "cli.h" #include "cli_priv.h" Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-07 16:42:11 UTC (rev 740) @@ -11,7 +11,6 @@ #include #include -#include "libvarnish.h" #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-07 16:42:11 UTC (rev 740) @@ -20,7 +20,6 @@ #include #include "compat.h" -#include "libvarnish.h" #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-07 16:42:11 UTC (rev 740) @@ -5,7 +5,6 @@ #include #include -#include #include #include #include @@ -13,7 +12,6 @@ #include "heritage.h" #include "mgt.h" -#include "libvarnish.h" /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 16:42:11 UTC (rev 740) @@ -4,7 +4,6 @@ * The management process and CLI handling */ -#include #include #include #include @@ -19,7 +18,6 @@ #include "vsb.h" -#include "libvarnish.h" #include "cli.h" #include "cli_priv.h" #include "cli_common.h" Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-07 16:42:11 UTC (rev 740) @@ -9,7 +9,6 @@ #include #include #include -#include #include #include "vsb.h" Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 16:42:11 UTC (rev 740) @@ -17,7 +17,6 @@ #include #include #include -#include #include #include Modified: trunk/varnish-cache/bin/varnishtester/varnishtester.c =================================================================== --- trunk/varnish-cache/bin/varnishtester/varnishtester.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishtester/varnishtester.c 2006-08-07 16:42:11 UTC (rev 740) @@ -1,5 +1,4 @@ -#include #include #include #include Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-07 16:42:11 UTC (rev 740) @@ -10,7 +10,6 @@ #include #include #include -#include #include #include Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/include/libvarnish.h 2006-08-07 16:42:11 UTC (rev 740) @@ -2,6 +2,7 @@ * $Id$ */ +#include #include /* from libvarnish/argv.c */ @@ -15,5 +16,18 @@ /* from libvarnish/version.c */ void varnish_version(const char *); +/* from libvarnish/assert.c */ +#ifdef WITHOUT_ASSERTS +#define assert(e) ((void)0) +#else /* WITH_ASSERTS */ +#define assert(e) \ +do { \ + if (e) \ + __assert(__func__, __FILE__, __LINE__, #e, errno); \ +} while (0) +#endif + +void __assert(const char *, const char *, int, const char *, int); + /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0) Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvarnish/Makefile.am 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2006-08-07 16:42:11 UTC (rev 740) @@ -6,6 +6,7 @@ libvarnish_la_SOURCES = \ argv.c \ + assert.c \ binary_heap.c \ cli.c \ cli_common.c \ Modified: trunk/varnish-cache/lib/libvarnish/argv.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/argv.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/lib/libvarnish/argv.c 2006-08-07 16:42:11 UTC (rev 740) @@ -12,7 +12,6 @@ */ #include -#include #include #include #include Added: trunk/varnish-cache/lib/libvarnish/assert.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/assert.c 2006-08-07 16:29:42 UTC (rev 739) +++ trunk/varnish-cache/lib/libvarnish/assert.c 2006-08-07 16:42:11 UTC (rev 740) @@ -0,0 +1,21 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + + +void +__assert(const char *func, const char *file, int line, const char *cond, int err) +{ + + fprintf(stderr, + "Assert error in %s(), %s line %s:\n" + " Condition(%s) not true.\n" + " errno = %d (%s)\n", func, file, line, cond, err, strerror(err)); + abort(); +} + From des at linpro.no Mon Aug 7 16:44:28 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Mon, 07 Aug 2006 18:44:28 +0200 Subject: r740 - in trunk/varnish-cache: bin/varnishd bin/varnishlog bin/varnishncsa bin/varnishtester bin/varnishtop include lib/libvarnish References: <20060807164211.6E9AF1EC5E0@projects.linpro.no> Message-ID: phk at projects.linpro.no writes: > Log: > Add our own assert in libvarnish.h > > Include libvarnish.h from cache.h and mgt.h That's great, but you're not allowed to call anything __assert(); it's in a protected namespace. That's (part of) why I insisted on defining our own namespaces when we started. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at projects.linpro.no Mon Aug 7 16:45:28 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 7 Aug 2006 18:45:28 +0200 (CEST) Subject: r741 - trunk/varnish-cache Message-ID: <20060807164528.4A8AD1EC5F3@projects.linpro.no> Author: des Date: 2006-08-07 18:45:28 +0200 (Mon, 07 Aug 2006) New Revision: 741 Modified: trunk/varnish-cache/configure.ac Log: Don't trust the documentation - when it says "additional headers", it actually means "additional code to place before main() in the test program" Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-07 16:42:11 UTC (rev 740) +++ trunk/varnish-cache/configure.ac 2006-08-07 16:45:28 UTC (rev 741) @@ -70,11 +70,11 @@ AC_CHECK_DECL([asprintf], AC_DEFINE(HAVE_ASPRINTF,1,[Define to 1 if asprintf() is available]), , - [stdio.h]) + [#include ]) AC_CHECK_DECL([vasprintf], AC_DEFINE(HAVE_VASPRINTF,1,[Define to 1 if vasprintf() is available]), , - [stdio.h]) + [#include ]) AC_CHECK_DECL([SO_ACCEPTFILER], AC_DEFINE(HAVE_ACCEPT_FILTERS,1,[Define to 1 if you have accept filters]), From phk at projects.linpro.no Mon Aug 7 17:08:35 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 19:08:35 +0200 (CEST) Subject: r742 - in trunk/varnish-cache: bin/varnishd lib/libvarnish Message-ID: <20060807170835.A2E2F1EC5FF@projects.linpro.no> Author: phk Date: 2006-08-07 19:08:35 +0200 (Mon, 07 Aug 2006) New Revision: 742 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_expire.c trunk/varnish-cache/bin/varnishd/cache_fetch.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_pool.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/cache_vcl.c trunk/varnish-cache/bin/varnishd/hash_simple_list.c trunk/varnish-cache/bin/varnishd/rfc2616.c trunk/varnish-cache/lib/libvarnish/assert.c Log: quench warnings related to libvarnish.h Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-07 17:08:35 UTC (rev 742) @@ -19,7 +19,6 @@ #include #include -#include "libvarnish.h" #include "heritage.h" #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-07 17:08:35 UTC (rev 742) @@ -21,7 +21,6 @@ #include #include -#include "libvarnish.h" #include "heritage.h" #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-08-07 17:08:35 UTC (rev 742) @@ -15,7 +15,6 @@ #include #include -#include "libvarnish.h" #include "shmlog.h" #include "binary_heap.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-07 17:08:35 UTC (rev 742) @@ -15,7 +15,6 @@ #include #include "shmlog.h" -#include "libvarnish.h" #include "cache.h" /* Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-07 17:08:35 UTC (rev 742) @@ -32,7 +32,6 @@ #include #include -#include "libvarnish.h" #include "shmlog.h" #include "heritage.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-07 17:08:35 UTC (rev 742) @@ -10,7 +10,6 @@ #include #include -#include "libvarnish.h" #include "heritage.h" #include "shmlog.h" #include "vcl.h" Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-07 17:08:35 UTC (rev 742) @@ -7,7 +7,6 @@ #include #include -#include "libvarnish.h" #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-07 17:08:35 UTC (rev 742) @@ -17,7 +17,6 @@ #include "cli_priv.h" #include "shmlog.h" #include "vcl.h" -#include "libvarnish.h" #include "cache.h" struct vcls { Modified: trunk/varnish-cache/bin/varnishd/hash_simple_list.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_simple_list.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/bin/varnishd/hash_simple_list.c 2006-08-07 17:08:35 UTC (rev 742) @@ -8,7 +8,6 @@ #include #include -#include #include /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/rfc2616.c =================================================================== --- trunk/varnish-cache/bin/varnishd/rfc2616.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/bin/varnishd/rfc2616.c 2006-08-07 17:08:35 UTC (rev 742) @@ -8,7 +8,6 @@ #include "shmlog.h" #include "cache.h" -#include "libvarnish.h" #include "heritage.h" Modified: trunk/varnish-cache/lib/libvarnish/assert.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/assert.c 2006-08-07 16:45:28 UTC (rev 741) +++ trunk/varnish-cache/lib/libvarnish/assert.c 2006-08-07 17:08:35 UTC (rev 742) @@ -7,6 +7,7 @@ #include #include +#include "libvarnish.h" void __assert(const char *func, const char *file, int line, const char *cond, int err) From phk at projects.linpro.no Mon Aug 7 17:10:26 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 19:10:26 +0200 (CEST) Subject: r743 - in trunk/varnish-cache: include lib/libvarnish Message-ID: <20060807171026.A17261EC600@projects.linpro.no> Author: phk Date: 2006-08-07 19:10:26 +0200 (Mon, 07 Aug 2006) New Revision: 743 Modified: trunk/varnish-cache/include/libvarnish.h trunk/varnish-cache/lib/libvarnish/assert.c Log: Call __assert() lbv_assert() instead. Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2006-08-07 17:08:35 UTC (rev 742) +++ trunk/varnish-cache/include/libvarnish.h 2006-08-07 17:10:26 UTC (rev 743) @@ -23,11 +23,11 @@ #define assert(e) \ do { \ if (e) \ - __assert(__func__, __FILE__, __LINE__, #e, errno); \ + lbv_assert(__func__, __FILE__, __LINE__, #e, errno); \ } while (0) #endif -void __assert(const char *, const char *, int, const char *, int); +void lbv_assert(const char *, const char *, int, const char *, int); /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0) Modified: trunk/varnish-cache/lib/libvarnish/assert.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/assert.c 2006-08-07 17:08:35 UTC (rev 742) +++ trunk/varnish-cache/lib/libvarnish/assert.c 2006-08-07 17:10:26 UTC (rev 743) @@ -10,7 +10,7 @@ #include "libvarnish.h" void -__assert(const char *func, const char *file, int line, const char *cond, int err) +lbv_assert(const char *func, const char *file, int line, const char *cond, int err) { fprintf(stderr, From phk at projects.linpro.no Mon Aug 7 17:15:10 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 19:15:10 +0200 (CEST) Subject: r744 - trunk/varnish-cache/lib/libvcl Message-ID: <20060807171510.DFDEA1EC601@projects.linpro.no> Author: phk Date: 2006-08-07 19:15:10 +0200 (Mon, 07 Aug 2006) New Revision: 744 Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c Log: Clean up #includes Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-07 17:10:26 UTC (rev 743) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-07 17:15:10 UTC (rev 744) @@ -2,25 +2,15 @@ * $Id$ */ -#include -#include -#include - -#include #include -#include -#include -#include #include -#include -#include #include #include -#include -#include #include "vsb.h" +#include "queue.h" +#include "libvarnish.h" #include "vcc_priv.h" #include "vcl_returns.h" #include "vcc_compile.h" From phk at projects.linpro.no Mon Aug 7 17:18:42 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 19:18:42 +0200 (CEST) Subject: r745 - trunk/varnish-cache/include Message-ID: <20060807171842.6BD721EC602@projects.linpro.no> Author: phk Date: 2006-08-07 19:18:42 +0200 (Mon, 07 Aug 2006) New Revision: 745 Modified: trunk/varnish-cache/include/libvarnish.h Log: Make assert do the right thing Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2006-08-07 17:15:10 UTC (rev 744) +++ trunk/varnish-cache/include/libvarnish.h 2006-08-07 17:18:42 UTC (rev 745) @@ -22,7 +22,7 @@ #else /* WITH_ASSERTS */ #define assert(e) \ do { \ - if (e) \ + if (!(e)) \ lbv_assert(__func__, __FILE__, __LINE__, #e, errno); \ } while (0) #endif From phk at projects.linpro.no Mon Aug 7 17:18:58 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 19:18:58 +0200 (CEST) Subject: r746 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807171858.3E2D91EC601@projects.linpro.no> Author: phk Date: 2006-08-07 19:18:58 +0200 (Mon, 07 Aug 2006) New Revision: 746 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: Remove printf extensions used for development debugging Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 17:18:42 UTC (rev 745) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 17:18:58 UTC (rev 746) @@ -311,10 +311,6 @@ /*--------------------------------------------------------------------*/ - -/* for development purposes */ -#include - int main(int argc, char *argv[]) { @@ -326,8 +322,6 @@ const char *sflag = "file"; const char *hflag = "classic"; - (void)register_printf_render_std((const unsigned char *)"HVQ"); - setbuf(stdout, NULL); setbuf(stderr, NULL); From phk at projects.linpro.no Mon Aug 7 17:27:16 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 19:27:16 +0200 (CEST) Subject: r747 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20060807172716.51B721EC5DC@projects.linpro.no> Author: phk Date: 2006-08-07 19:27:16 +0200 (Mon, 07 Aug 2006) New Revision: 747 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/include/shmlog_tags.h Log: Rename SHMlog tags for consistency XID -> ReqStart ReqServTime -> ReqEnd Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-07 17:18:58 UTC (rev 746) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-07 17:27:16 UTC (rev 747) @@ -88,7 +88,7 @@ sp->step = STP_RECV; VSL_stats->client_req++; sp->xid = xids++; - VSL(SLT_XID, sp->fd, "%u", sp->xid); + VSL(SLT_ReqStart, sp->fd, "XID %u", sp->xid); WRK_QueueSession(sp); } Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-07 17:18:58 UTC (rev 746) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-07 17:27:16 UTC (rev 747) @@ -106,7 +106,7 @@ dh = cnt_dt(&sp->t_open, &sp->t_req); dp = cnt_dt(&sp->t_req, &sp->t_resp); da = cnt_dt(&sp->t_resp, &te); - VSL(SLT_ReqServTime, sp->id, "%u %ld.%09ld %.9f %.9f %.9f", + VSL(SLT_ReqEnd, sp->id, "%u %ld.%09ld %.9f %.9f %.9f", sp->xid, (long)sp->t_req.tv_sec, (long)sp->t_req.tv_nsec, dh, dp, da); Modified: trunk/varnish-cache/include/shmlog_tags.h =================================================================== --- trunk/varnish-cache/include/shmlog_tags.h 2006-08-07 17:18:58 UTC (rev 746) +++ trunk/varnish-cache/include/shmlog_tags.h 2006-08-07 17:27:16 UTC (rev 747) @@ -13,7 +13,7 @@ SLTM(CLI) SLTM(StatAddr) SLTM(StatSess) -SLTM(ReqServTime) +SLTM(ReqEnd) SLTM(SessionOpen) SLTM(SessionReuse) SLTM(SessionClose) @@ -56,7 +56,7 @@ SLTM(VCL_call) SLTM(VCL_trace) SLTM(VCL_return) -SLTM(XID) +SLTM(ReqStart) SLTM(Hit) SLTM(HitPass) SLTM(ExpBan) From phk at projects.linpro.no Mon Aug 7 18:33:01 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 20:33:01 +0200 (CEST) Subject: r748 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807183301.AE6DF1EC5E8@projects.linpro.no> Author: phk Date: 2006-08-07 20:33:01 +0200 (Mon, 07 Aug 2006) New Revision: 748 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: An assert to catch silly errors. Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 17:27:16 UTC (rev 747) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 18:33:01 UTC (rev 748) @@ -266,6 +266,7 @@ d_child = strtoul(buf, &p, 0); assert(p != NULL); printf("New Pid %d\n", d_child); + assert(d_child != 0); i = strlen(p); j = write(pipes[1][1], p, i); assert(j == i); From phk at projects.linpro.no Mon Aug 7 20:24:47 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 22:24:47 +0200 (CEST) Subject: r749 - trunk/varnish-cache/bin/varnishd Message-ID: <20060807202447.DE7141EC602@projects.linpro.no> Author: phk Date: 2006-08-07 22:24:47 +0200 (Mon, 07 Aug 2006) New Revision: 749 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: Improve the "-d" and "-d -d" facilities. When we close a CLI and it had fd# 0 and/or fd#1, reopen these as /dev/null so the will not be reused for the CLI pipe to the child on next restart, otherwise stdout/stderr output from the manager would get sent there and confuse the clients CLI reader. Don't double free a pointer to the CLI buffer. Accept non-zero results from cli_readres() errors are non-fatal. Use stderr more consistently for manager debugging. Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-07 18:33:01 UTC (rev 748) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-07 20:24:47 UTC (rev 749) @@ -67,7 +67,7 @@ return (1); } buf[i] = '\0'; - printf("Child said (%d, %d): <<%s>>\n", child_state, child_pid, buf); + fprintf(stderr, "Child said (%d, %d): <<%s>>\n", child_state, child_pid, buf); return (0); } @@ -128,7 +128,7 @@ exit (1); } - printf("start child pid %d\n", i); + fprintf(stderr, "start child pid %d\n", i); AZ(close(child_fds[1])); child_fds[1] = -1; @@ -183,7 +183,7 @@ } ev_poker = NULL; - printf("Clean child\n"); + fprintf(stderr, "Clean child\n"); mgt_cli_stop_child(); /* We tell the child to die gracefully by closing the CLI */ @@ -192,7 +192,7 @@ AZ(close(heritage.fds[3])); heritage.fds[3] = -1; - printf("Child stopping\n"); + fprintf(stderr, "Child stopping\n"); } /*--------------------------------------------------------------------*/ @@ -214,16 +214,16 @@ r = wait4(-1, &status, WNOHANG, NULL); if (r != child_pid) { - printf("Unknown child died pid=%d status=0x%x\n", + fprintf(stderr, "Unknown child died pid=%d status=0x%x\n", r, status); return (0); } - printf("Cache child died pid=%d status=0x%x\n", r, status); + fprintf(stderr, "Cache child died pid=%d status=0x%x\n", r, status); child_pid = -1; if (child_state == CH_RUNNING) { child_state = CH_DIED; - printf("Clean child\n"); + fprintf(stderr, "Clean child\n"); mgt_cli_stop_child(); /* We tell the child to die gracefully by closing the CLI */ @@ -241,7 +241,7 @@ AZ(close(child_fds[0])); child_fds[0] = -1; - printf("Child cleaned\n"); + fprintf(stderr, "Child cleaned\n"); if (child_state == CH_DIED) start_child(); @@ -258,7 +258,7 @@ (void)e; (void)what; - printf("Manager got SIGINT\n"); + fprintf(stderr, "Manager got SIGINT\n"); fflush(stdout); if (child_pid >= 0) stop_child(); @@ -276,6 +276,7 @@ { struct sigaction sac; struct ev *e; + int i; mgt_pid = getpid(); @@ -320,9 +321,10 @@ if (!dflag) start_child(); - ev_schedule(mgt_evb); + i = ev_schedule(mgt_evb); + fprintf(stderr, "ev_schedule = %d\n", i); - printf("manager dies\n"); + fprintf(stderr, "manager dies\n"); exit(2); } Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 18:33:01 UTC (rev 748) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-07 20:24:47 UTC (rev 749) @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -189,7 +190,6 @@ j = write(cli_o, p, i); free(p); if (j != i) { - free(p); if (status != NULL) *status = CLIS_COMMS; if (resp != NULL) @@ -198,7 +198,6 @@ } i = cli_readres(cli_i, &u, resp, 3.0); - assert(i == 0); if (status != NULL) *status = u; return (u == CLIS_OK ? 0 : u); @@ -281,7 +280,14 @@ vsb_delete(cp->cli->sb); free(cp->buf); close(cp->fdi); + if (cp->fdi == 0) + open("/dev/null", O_RDONLY); close(cp->fdo); + if (cp->fdo == 1) { + close(2); + open("/dev/null", O_WRONLY); + open("/dev/null", O_WRONLY); + } free(cp); return (1); } Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 18:33:01 UTC (rev 748) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 20:24:47 UTC (rev 749) @@ -403,10 +403,10 @@ if (dflag == 1) DebugStunt(); - if (dflag != 2) + if (dflag < 2) daemon(dflag, dflag); - if (dflag) - printf("%d\n%d\n%d\n", getpid(), getsid(0), getpgrp()); + if (dflag == 1) + printf("%d\n", getpid()); mgt_cli_init(); From phk at projects.linpro.no Mon Aug 7 20:47:17 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 22:47:17 +0200 (CEST) Subject: r750 - trunk/varnish-cache/lib/libvcl Message-ID: <20060807204717.0BBDA1EC5E0@projects.linpro.no> Author: phk Date: 2006-08-07 22:47:16 +0200 (Mon, 07 Aug 2006) New Revision: 750 Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_priv.h trunk/varnish-cache/lib/libvcl/vcc_token.c Log: Eliminate use of extensible printf Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2006-08-07 20:24:47 UTC (rev 749) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2006-08-07 20:47:16 UTC (rev 750) @@ -34,7 +34,8 @@ vcc_NextToken(tl); ExpectErr(tl, ID); AddRef(tl, tl->t, R_ACL); - Fc(tl, 1, "VRT_acl_match(sp, \"%T\", acl_%T)\n", tl->t, tl->t); + Fc(tl, 1, "VRT_acl_match(sp, \"%.*s\", acl_%.*s)\n", + PF(tl->t), PF(tl->t)); vcc_NextToken(tl); break; default: @@ -61,8 +62,8 @@ vcc_NextToken(tl); AddDef(tl, an, R_ACL); - Fh(tl, 0, "static struct vrt_acl acl_%T[];\n", an); - Fc(tl, 1, "static struct vrt_acl acl_%T[] = {\n", an); + Fh(tl, 0, "static struct vrt_acl acl_%.*s[];\n", PF(an)); + Fc(tl, 1, "static struct vrt_acl acl_%.*s[] = {\n", PF(an)); tl->indent += INDENT; @@ -92,7 +93,7 @@ ExpectErr(tl, CNUM); mask = UintVal(tl); } - Fc(tl, 1, "{ %u, %u, %u, %T, \"", not, mask, para, t); + Fc(tl, 1, "{ %u, %u, %u, %.*s, \"", not, mask, para, PF(t)); if (para) Fc(tl, 0, "("); if (not) @@ -120,6 +121,6 @@ ExpectErr(tl, '}'); vcc_NextToken(tl); - Fi(tl, 1, "\tVRT_acl_init(acl_%T);\n", an); - Ff(tl, 1, "\tVRT_acl_fini(acl_%T);\n", an); + Fi(tl, 1, "\tVRT_acl_init(acl_%.*s);\n", PF(an)); + Ff(tl, 1, "\tVRT_acl_fini(acl_%.*s);\n", PF(an)); } Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 20:24:47 UTC (rev 749) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 20:47:16 UTC (rev 750) @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -505,7 +504,7 @@ Fc(tl, 1, "VRT_re_match(%s, %s)\n", str, buf); Fh(tl, 0, "void *%s;\n", buf); - Fi(tl, 0, "\tVRT_re_init(&%s, %T);\n", buf, re); + Fi(tl, 0, "\tVRT_re_init(&%s, %.*s);\n", buf, PF(re)); Ff(tl, 0, "\tVRT_re_fini(%s);\n", buf); } @@ -529,7 +528,7 @@ tl->t->tok == T_EQ ? "!" : "", vp->rname); vcc_NextToken(tl); ExpectErr(tl, CSTR); - Fc(tl, 0, "%T)\n", tl->t); + Fc(tl, 0, "%.*s)\n", PF(tl->t)); vcc_NextToken(tl); break; default: @@ -550,7 +549,7 @@ case T_GEQ: case '>': case '<': - Fc(tl, 0, "%T ", tl->t); + Fc(tl, 0, "%.*s ", PF(tl->t)); vcc_NextToken(tl); switch(vp->fmt) { case TIME: @@ -558,7 +557,7 @@ break; case INT: ExpectErr(tl, CNUM); - Fc(tl, 0, "%T ", tl->t); + Fc(tl, 0, "%.*s ", PF(tl->t)); vcc_NextToken(tl); break; case SIZE: @@ -755,7 +754,7 @@ a = 0; Fc(tl, 1, "VRT_error(sp, %u, ", a); if (tl->t->tok == CSTR) { - Fc(tl, 0, "%T);\n", tl->t); + Fc(tl, 0, "%.*s);\n", PF(tl->t)); vcc_NextToken(tl); } else Fc(tl, 0, "(const char *)0);\n"); @@ -763,23 +762,23 @@ return; case T_SWITCH_CONFIG: ExpectErr(tl, ID); - Fc(tl, 1, "VCL_switch_config(\"%T\");\n", tl->t); + Fc(tl, 1, "VCL_switch_config(\"%.*s\");\n", PF(tl->t)); vcc_NextToken(tl); return; case T_CALL: ExpectErr(tl, ID); AddCall(tl, tl->t); AddRef(tl, tl->t, R_FUNC); - Fc(tl, 1, "if (VGC_function_%T(sp))\n", tl->t); + Fc(tl, 1, "if (VGC_function_%.*s(sp))\n", PF(tl->t)); Fc(tl, 1, "\treturn (1);\n"); vcc_NextToken(tl); return; case T_REWRITE: ExpectErr(tl, CSTR); - Fc(tl, 1, "VCL_rewrite(%T", tl->t); + Fc(tl, 1, "VCL_rewrite(%.*s", PF(tl->t)); vcc_NextToken(tl); ExpectErr(tl, CSTR); - Fc(tl, 0, ", %T);\n", tl->t); + Fc(tl, 0, ", %.*s);\n", PF(tl->t)); vcc_NextToken(tl); return; case T_SET: @@ -835,7 +834,7 @@ if (tl->t->tok == '=') { vcc_NextToken(tl); AddRef(tl, tl->t, R_BACKEND); - Fc(tl, 0, "= &VGC_backend_%T;\n", tl->t); + Fc(tl, 0, "= &VGC_backend_%.*s;\n", PF(tl->t)); vcc_NextToken(tl); break; } @@ -934,15 +933,15 @@ AddDef(tl, tl->t, R_BACKEND); if (tl->nbackend == 0) AddRef(tl, tl->t, R_BACKEND); - Fh(tl, 1, "#define VGC_backend_%T (VCL_conf.backend[%d])\n", - tl->t, tl->nbackend); + Fh(tl, 1, "#define VGC_backend_%.*s (VCL_conf.backend[%d])\n", + PF(tl->t), tl->nbackend); Fc(tl, 0, "\n"); Fc(tl, 0, "static void\n"); - Fc(tl, 1, "VGC_init_backend_%T (void)\n", tl->t); + Fc(tl, 1, "VGC_init_backend_%.*s (void)\n", PF(tl->t)); Fc(tl, 1, "{\n"); - Fc(tl, 1, "\tstruct backend *backend = VGC_backend_%T;\n", tl->t); + Fc(tl, 1, "\tstruct backend *backend = VGC_backend_%.*s;\n", PF(tl->t)); Fc(tl, 1, "\n"); - Fc(tl, 1, "\tVRT_set_backend_name(backend, \"%T\");\n", tl->t); + Fc(tl, 1, "\tVRT_set_backend_name(backend, \"%.*s\");\n", PF(tl->t)); vcc_NextToken(tl); ExpectErr(tl, '{'); vcc_NextToken(tl); @@ -962,13 +961,13 @@ case HOSTNAME: ExpectErr(tl, CSTR); t_host = tl->t; - Fc(tl, 1, "\t%s %T);\n", vp->lname, tl->t); + Fc(tl, 1, "\t%s %.*s);\n", vp->lname, PF(tl->t)); vcc_NextToken(tl); break; case PORTNAME: ExpectErr(tl, CSTR); t_port = tl->t; - Fc(tl, 1, "\t%s %T);\n", vp->lname, tl->t); + Fc(tl, 1, "\t%s %.*s);\n", vp->lname, PF(tl->t)); vcc_NextToken(tl); break; default: @@ -982,14 +981,15 @@ } ExpectErr(tl, '}'); if (t_host == NULL) { - vsb_printf(tl->sb, "Backend '%T' has no hostname\n", t_be); + vsb_printf(tl->sb, "Backend '%.*s' has no hostname\n", + PF(t_be)); vcc_ErrWhere(tl, tl->t); return; } host = EncString(t_host); ep = CheckHostPort(host, "80"); if (ep != NULL) { - vsb_printf(tl->sb, "Backend '%T': %s\n", t_be, ep); + vsb_printf(tl->sb, "Backend '%.*s': %s\n", PF(t_be), ep); vcc_ErrWhere(tl, t_host); return; } @@ -997,7 +997,7 @@ port = EncString(t_port); ep = CheckHostPort(host, port); if (ep != NULL) { - vsb_printf(tl->sb, "Backend '%T': %s\n", t_be, ep); + vsb_printf(tl->sb, "Backend '%.*s': %s\n", PF(t_be), ep); vcc_ErrWhere(tl, t_port); return; } @@ -1006,8 +1006,8 @@ vcc_NextToken(tl); Fc(tl, 1, "}\n"); Fc(tl, 0, "\n"); - Fi(tl, 0, "\tVGC_init_backend_%T();\n", t_be); - Ff(tl, 0, "\tVRT_fini_backend(VGC_backend_%T);\n", t_be); + Fi(tl, 0, "\tVGC_init_backend_%.*s();\n", PF(t_be)); + Ff(tl, 0, "\tVRT_fini_backend(VGC_backend_%.*s);\n", PF(t_be)); tl->nbackend++; } @@ -1024,15 +1024,16 @@ tl->curproc->exists++; tn = tl->t; AddDef(tl, tl->t, R_FUNC); - Fh(tl, 0, "static int VGC_function_%T (struct sess *sp);\n", tl->t); + Fh(tl, 0, "static int VGC_function_%.*s (struct sess *sp);\n", + PF(tl->t)); Fc(tl, 1, "static int\n"); - Fc(tl, 1, "VGC_function_%T (struct sess *sp)\n", tl->t); + Fc(tl, 1, "VGC_function_%.*s (struct sess *sp)\n", PF(tl->t)); vcc_NextToken(tl); tl->indent += INDENT; Fc(tl, 1, "{\n"); L(tl, Compound(tl)); if (IsMethod(tn) == 1) { - Fc(tl, 1, "VGC_function_default_%T(sp);\n", tn); + Fc(tl, 1, "VGC_function_default_%.*s(sp);\n", PF(tn)); } Fc(tl, 1, "}\n"); tl->indent -= INDENT; @@ -1124,7 +1125,8 @@ struct proccall *pc; if (!p->exists) { - vsb_printf(tl->sb, "Function %T does not exist\n", p->name); + vsb_printf(tl->sb, "Function %.*s does not exist\n", + PF(p->name)); return (1); } if (p->active) { @@ -1225,19 +1227,20 @@ } if (r->defcnt == 0 && r->name->tok == METHOD) { vsb_printf(tl->sb, - "No definition for method %T\n", r->name); + "No definition for method %.*s\n", PF(r->name)); continue; } if (r->defcnt == 0) { vsb_printf(tl->sb, - "Undefined %s %T, first reference:\n", - type, r->name); + "Undefined %s %.*s, first reference:\n", + type, PF(r->name)); vcc_ErrWhere(tl, r->name); continue; } - vsb_printf(tl->sb, "Unused %s %T, defined:\n", type, r->name); + vsb_printf(tl->sb, "Unused %s %.*s, defined:\n", + type, PF(r->name)); vcc_ErrWhere(tl, r->name); } return (nerr); @@ -1279,8 +1282,8 @@ pos++; } - Fc(tl, 0, " [%3u] = { %d, %4u, %3u, 0, \"%T\" },\n", - t->cnt, fil, lin, pos + 1, t); + Fc(tl, 0, " [%3u] = { %d, %4u, %3u, 0, \"%.*s\" },\n", + t->cnt, fil, lin, pos + 1, PF(t)); } Fc(tl, 0, "};\n"); } @@ -1477,31 +1480,6 @@ /*--------------------------------------------------------------------*/ -static int -VCC_T_render(FILE *f, const struct printf_info *info, const void *const *args) -{ - const struct token *t; - - (void)info; - - t = *((const struct token * const*) (args[0])); - return (fprintf(f, "%*.*s", - t->e - t->b, t->e - t->b, t->b)); -} - -static int -VCC_T_arginfo(const struct printf_info *info, size_t n, int *argtypes) -{ - - (void)info; - - if (n > 0) - argtypes[0] = PA_POINTER; - return 1; -} - -/*--------------------------------------------------------------------*/ - void VCC_InitCompile(const char *default_vcl) { @@ -1511,7 +1489,6 @@ vcc_default_vcl_e = strchr(default_vcl, '\0'); assert(vcc_default_vcl_e != NULL); - register_printf_function ('T', VCC_T_render, VCC_T_arginfo); vcl_init_tnames(); for (v = vcc_vars; v->name != NULL; v++) v->len = strlen(v->name); Modified: trunk/varnish-cache/lib/libvcl/vcc_priv.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_priv.h 2006-08-07 20:24:47 UTC (rev 749) +++ trunk/varnish-cache/lib/libvcl/vcc_priv.h 2006-08-07 20:47:16 UTC (rev 750) @@ -11,3 +11,5 @@ extern const char *vcl_tnames[256]; void vcl_init_tnames(void); void vcl_output_lang_h(FILE *f); + +#define PF(t) ((t)->e - (t)->b), (t)->b Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-07 20:24:47 UTC (rev 749) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-07 20:47:16 UTC (rev 750) @@ -26,7 +26,7 @@ if (t->tok == EOI) vsb_printf(tl->sb, "end of input"); else - vsb_printf(tl->sb, "'%T'", t); + vsb_printf(tl->sb, "'%.*s'", PF(t)); } void From phk at projects.linpro.no Mon Aug 7 20:50:06 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 22:50:06 +0200 (CEST) Subject: r751 - in trunk/varnish-cache: . bin/varnishncsa Message-ID: <20060807205006.303D11EC607@projects.linpro.no> Author: phk Date: 2006-08-07 22:50:05 +0200 (Mon, 07 Aug 2006) New Revision: 751 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c trunk/varnish-cache/configure.ac Log: Update to new shmlog tag Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 20:47:16 UTC (rev 750) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-07 20:50:05 UTC (rev 751) @@ -120,7 +120,7 @@ break; - case SLT_ReqServTime: + case SLT_ReqEnd: break; Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-07 20:47:16 UTC (rev 750) +++ trunk/varnish-cache/configure.ac 2006-08-07 20:50:05 UTC (rev 751) @@ -15,7 +15,7 @@ # Compiler flags (assume GCC). # This section *must* come before AC_PROG_CC / AC_PROG_CPP. CFLAGS="${CFLAGS:--O2 -pipe}" -DEVELOPER_CFLAGS="-Wall -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls" +DEVELOPER_CFLAGS="-Wall -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wformat" AC_ARG_ENABLE(developer-warnings, AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]), CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}") From phk at projects.linpro.no Mon Aug 7 21:01:09 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 23:01:09 +0200 (CEST) Subject: r752 - trunk/varnish-cache/lib/libvarnish Message-ID: <20060807210109.C3D471EC60A@projects.linpro.no> Author: phk Date: 2006-08-07 23:01:09 +0200 (Mon, 07 Aug 2006) New Revision: 752 Modified: trunk/varnish-cache/lib/libvarnish/assert.c Log: Fix printf format error Modified: trunk/varnish-cache/lib/libvarnish/assert.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/assert.c 2006-08-07 20:50:05 UTC (rev 751) +++ trunk/varnish-cache/lib/libvarnish/assert.c 2006-08-07 21:01:09 UTC (rev 752) @@ -14,7 +14,7 @@ { fprintf(stderr, - "Assert error in %s(), %s line %s:\n" + "Assert error in %s(), %s line %d:\n" " Condition(%s) not true.\n" " errno = %d (%s)\n", func, file, line, cond, err, strerror(err)); abort(); From phk at projects.linpro.no Mon Aug 7 21:01:41 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 23:01:41 +0200 (CEST) Subject: r753 - trunk/varnish-cache Message-ID: <20060807210141.0A1B91EC60D@projects.linpro.no> Author: phk Date: 2006-08-07 23:01:40 +0200 (Mon, 07 Aug 2006) New Revision: 753 Modified: trunk/varnish-cache/configure.ac Log: Add -Wformat and remove -fno-inline which disables it. Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-07 21:01:09 UTC (rev 752) +++ trunk/varnish-cache/configure.ac 2006-08-07 21:01:40 UTC (rev 753) @@ -21,7 +21,7 @@ CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}") AC_ARG_ENABLE(debugging-symbols, AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]), - CFLAGS="${CFLAGS} -O -g -fno-inline -fno-builtin") + CFLAGS="${CFLAGS} -O -g -fno-inline") AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]), CFLAGS="${CFLAGS} -Werror") From phk at projects.linpro.no Mon Aug 7 21:08:21 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 7 Aug 2006 23:08:21 +0200 (CEST) Subject: r754 - in trunk/varnish-cache: bin/varnishd lib/libvcl Message-ID: <20060807210821.0A7B41EC60F@projects.linpro.no> Author: phk Date: 2006-08-07 23:08:20 +0200 (Mon, 07 Aug 2006) New Revision: 754 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/varnishd.c trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_token.c Log: 64bit changes Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-07 21:01:40 UTC (rev 753) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-07 21:08:20 UTC (rev 754) @@ -6,8 +6,8 @@ * write the session pointer to a pipe which the event engine monitors. */ -#define ACCEPTOR_USE_POLL -#undef ACCEPTOR_USE_KQUEUE +#undef ACCEPTOR_USE_POLL +#define ACCEPTOR_USE_KQUEUE #include #include Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 21:01:40 UTC (rev 753) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-07 21:08:20 UTC (rev 754) @@ -63,8 +63,8 @@ } else if (!cmp_hash(&hsl_slinger, sflag, p)) { hp = &hsl_slinger; } else { - fprintf(stderr, "Unknown hash method \"%*.*s\"\n", - p - sflag, p - sflag, sflag); + fprintf(stderr, "Unknown hash method \"%.*s\"\n", + (int)(p - sflag), sflag); exit (2); } heritage.hash = hp; @@ -108,8 +108,8 @@ } else if (!cmp_storage(&smf_stevedore, sflag, p)) { stp = &smf_stevedore; } else { - fprintf(stderr, "Unknown storage method \"%*.*s\"\n", - p - sflag, p - sflag, sflag); + fprintf(stderr, "Unknown storage method \"%.*s\"\n", + (int)(p - sflag), sflag); exit (2); } heritage.stevedore = malloc(sizeof *heritage.stevedore); Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 21:01:40 UTC (rev 753) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-07 21:08:20 UTC (rev 754) @@ -420,7 +420,7 @@ v->name = p; v->fmt = STRING; asprintf(&p, "VRT_GetHdr(sp, \"\\%03o%s:\")", - strlen(v->name + vh->len) + 1, v->name + vh->len); + (unsigned)(strlen(v->name + vh->len) + 1), v->name + vh->len); assert(p != NULL); v->rname = p; return (v); Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-07 21:01:40 UTC (rev 753) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-07 21:08:20 UTC (rev 754) @@ -180,9 +180,8 @@ TAILQ_INSERT_TAIL(&tl->tokens, t, list); tl->t = t; if (0) { - fprintf(stderr, "[%s %*.*s] ", - vcl_tnames[tok], - e - b, e - b, b); + fprintf(stderr, "[%s %.*s] ", + vcl_tnames[tok],(int)(e - b), b); if (tok == EOI) fprintf(stderr, "\n"); } From des at linpro.no Tue Aug 8 05:52:05 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Tue, 08 Aug 2006 07:52:05 +0200 Subject: r753 - trunk/varnish-cache References: <20060807210141.0A1B91EC60D@projects.linpro.no> Message-ID: phk at projects.linpro.no writes: > Log: > Add -Wformat and remove -fno-inline which disables it. > > > Modified: trunk/varnish-cache/configure.ac > =================================================================== > --- trunk/varnish-cache/configure.ac 2006-08-07 21:01:09 UTC (rev 752) > +++ trunk/varnish-cache/configure.ac 2006-08-07 21:01:40 UTC (rev 753) > @@ -21,7 +21,7 @@ > CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}") > AC_ARG_ENABLE(debugging-symbols, > AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]), > - CFLAGS="${CFLAGS} -O -g -fno-inline -fno-builtin") > + CFLAGS="${CFLAGS} -O -g -fno-inline") > AC_ARG_ENABLE(werror, > AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]), > CFLAGS="${CFLAGS} -Werror") The log message and the patch don't seem to agree... DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From phk at phk.freebsd.dk Tue Aug 8 06:06:38 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Tue, 08 Aug 2006 06:06:38 +0000 Subject: r753 - trunk/varnish-cache In-Reply-To: Your message of "Tue, 08 Aug 2006 07:52:05 +0200." Message-ID: <32090.1155017198@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >phk at projects.linpro.no writes: >> Log: >> Add -Wformat and remove -fno-inline which disables it. >> >> >> Modified: trunk/varnish-cache/configure.ac >> =================================================================== >> --- trunk/varnish-cache/configure.ac 2006-08-07 21:01:09 UTC (rev 752) >> +++ trunk/varnish-cache/configure.ac 2006-08-07 21:01:40 UTC (rev 753) >> @@ -21,7 +21,7 @@ >> CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}") >> AC_ARG_ENABLE(debugging-symbols, >> AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]), >> - CFLAGS="${CFLAGS} -O -g -fno-inline -fno-builtin") >> + CFLAGS="${CFLAGS} -O -g -fno-inline") >> AC_ARG_ENABLE(werror, >> AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]), >> CFLAGS="${CFLAGS} -Werror") > >The log message and the patch don't seem to agree... Right, I meant -fno-builtin in the message too. Without built-ins it doesn't get to the code which checks printf args. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From phk at projects.linpro.no Tue Aug 8 06:37:27 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 8 Aug 2006 08:37:27 +0200 (CEST) Subject: r755 - trunk/varnish-cache/bin/varnishd Message-ID: <20060808063727.87E411EC616@projects.linpro.no> Author: phk Date: 2006-08-08 08:37:27 +0200 (Tue, 08 Aug 2006) New Revision: 755 Modified: trunk/varnish-cache/bin/varnishd/flint.lnt Log: lbv_assert never returns Modified: trunk/varnish-cache/bin/varnishd/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-07 21:08:20 UTC (rev 754) +++ trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-08 06:37:27 UTC (rev 755) @@ -5,6 +5,8 @@ // Fix strchr() semtics, it can only return NULL if arg2 != 0 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) +-sem(lbv_assert, r_no) + -ffc // No automatic custody -e763 // Redundant declaration for symbol '...' previously declared From phk at projects.linpro.no Tue Aug 8 06:38:45 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 8 Aug 2006 08:38:45 +0200 (CEST) Subject: r756 - trunk/varnish-cache/bin/varnishd Message-ID: <20060808063845.2D9CA1EC616@projects.linpro.no> Author: phk Date: 2006-08-08 08:38:45 +0200 (Tue, 08 Aug 2006) New Revision: 756 Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c Log: Use crc32 hash by default, MD5 is a compile time option Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-08 06:37:27 UTC (rev 755) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-08 06:38:45 UTC (rev 756) @@ -2,16 +2,21 @@ * $Id$ * * A classic bucketed hash + * + * The CRC32 implementation is in the public domain. */ #include #include #include #include -#include #include +#ifdef HASH_CLASSIC_MD5 +#include +#endif + /*--------------------------------------------------------------------*/ struct hcl_entry { @@ -33,6 +38,73 @@ static unsigned hcl_nmtx = 16; static pthread_mutex_t *hcl_mutex; +/*--------------------------------------------------------------------*/ + +#ifndef HASH_CLASSIC_MD5 +static uint32_t crc32bits[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +static uint32_t +crc32(const char *p1, const char *p2) +{ + const unsigned char *p; + uint32_t crc; + + crc = ~0U; + + for (p = (const unsigned char*)p1; *p != '\0'; p++) + crc = (crc >> 8) ^ crc32bits[(crc ^ *p++) & 0xff]; + for (p = (const unsigned char*)p2; *p != '\0'; p++) + crc = (crc >> 8) ^ crc32bits[(crc ^ *p++) & 0xff]; + + return crc ^ ~0U; +} + +#endif /* HASH_CLASSIC_MD5 */ + /*-------------------------------------------------------------------- * The ->init method allows the management process to pass arguments */ @@ -102,20 +174,28 @@ hcl_lookup(const char *key1, const char *key2, struct objhead *noh) { struct hcl_entry *he, *he2; + unsigned u1, u2; + int i; +#ifdef HASH_CLASSIC_MD5 MD5_CTX c; unsigned char md5[MD5_DIGEST_LENGTH]; - unsigned u1, u2; - int i; +#endif CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC); + +#ifdef HASH_CLASSIC_MD5 MD5Init(&c); MD5Update(&c, key1, strlen(key1)); MD5Update(&c, "", 1); MD5Update(&c, key2, strlen(key2)); MD5Final(md5, &c); memcpy(&u1, md5, sizeof u1); + memcpy(&u2, md5 + sizeof u1, sizeof u2); +#else + u1 = u2 = crc32(key1, key2); +#endif + u1 %= hcl_nhash; - memcpy(&u2, md5 + sizeof u1, sizeof u2); u2 %= hcl_nmtx; AZ(pthread_mutex_lock(&hcl_mutex[u2])); @@ -141,17 +221,21 @@ AZ(pthread_mutex_unlock(&hcl_mutex[u2])); return (NULL); } - he2 = calloc(sizeof *he2, 1); + i = sizeof *he2 + strlen(key1) + 1 + strlen(key2) + 1; + he2 = calloc(i, 1); assert(he2 != NULL); he2->magic = HCL_ENTRY_MAGIC; he2->oh = noh; he2->refcnt = 1; he2->hash = u1; he2->mtx = u2; - he2->key1 = strdup(key1); - assert(he2->key1 != NULL); - he2->key2 = strdup(key2); - assert(he2->key2 != NULL); + + he2->key1 = (void*)(he2 + 1); + strcpy(he2->key1, key1); + he2->key2 = strchr(he2->key1, '\0'); + he2->key2++; + strcpy(he2->key2, key2); + noh->hashpriv = he2; if (he != NULL) TAILQ_INSERT_BEFORE(he, he2, list); @@ -178,14 +262,13 @@ assert(he->hash < hcl_nhash); mtx = he->mtx; AZ(pthread_mutex_lock(&hcl_mutex[mtx])); - if (--he->refcnt > 0) { - AZ(pthread_mutex_unlock(&hcl_mutex[mtx])); + if (--he->refcnt == 0) + TAILQ_REMOVE(&hcl_head[he->hash], he, list); + else + he = NULL; + AZ(pthread_mutex_unlock(&hcl_mutex[mtx])); + if (he == NULL) return (1); - } - TAILQ_REMOVE(&hcl_head[he->hash], he, list); - AZ(pthread_mutex_unlock(&hcl_mutex[mtx])); - free(he->key1); - free(he->key2); free(he); return (0); } From phk at projects.linpro.no Tue Aug 8 06:39:52 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 8 Aug 2006 08:39:52 +0200 (CEST) Subject: r757 - trunk/varnish-cache/bin/varnishd Message-ID: <20060808063952.9C5D01EC616@projects.linpro.no> Author: phk Date: 2006-08-08 08:39:52 +0200 (Tue, 08 Aug 2006) New Revision: 757 Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c Log: Default to 4096 buckets and 256 mutexes Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-08 06:38:45 UTC (rev 756) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-08 06:39:52 UTC (rev 757) @@ -34,8 +34,8 @@ TAILQ_HEAD(hcl_head, hcl_entry); static struct hcl_head *hcl_head; -static unsigned hcl_nhash = 256; -static unsigned hcl_nmtx = 16; +static unsigned hcl_nhash = 4096; +static unsigned hcl_nmtx = 256; static pthread_mutex_t *hcl_mutex; /*--------------------------------------------------------------------*/ From phk at projects.linpro.no Tue Aug 8 07:01:28 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 8 Aug 2006 09:01:28 +0200 (CEST) Subject: r758 - trunk/varnish-cache/bin/varnishd Message-ID: <20060808070128.BC6AA1EC5E0@projects.linpro.no> Author: phk Date: 2006-08-08 09:01:28 +0200 (Tue, 08 Aug 2006) New Revision: 758 Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c Log: Fix braino Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-08 06:39:52 UTC (rev 757) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-08 07:01:28 UTC (rev 758) @@ -96,11 +96,11 @@ crc = ~0U; for (p = (const unsigned char*)p1; *p != '\0'; p++) - crc = (crc >> 8) ^ crc32bits[(crc ^ *p++) & 0xff]; + crc = (crc >> 8) ^ crc32bits[(crc ^ *p) & 0xff]; for (p = (const unsigned char*)p2; *p != '\0'; p++) - crc = (crc >> 8) ^ crc32bits[(crc ^ *p++) & 0xff]; + crc = (crc >> 8) ^ crc32bits[(crc ^ *p) & 0xff]; - return crc ^ ~0U; + return (crc ^ ~0U); } #endif /* HASH_CLASSIC_MD5 */ From des at projects.linpro.no Tue Aug 8 07:03:36 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 09:03:36 +0200 (CEST) Subject: r759 - in trunk/varnish-cache: . bin/varnishd Message-ID: <20060808070336.076F71EC618@projects.linpro.no> Author: des Date: 2006-08-08 09:03:35 +0200 (Tue, 08 Aug 2006) New Revision: 759 Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/hash_classic.c trunk/varnish-cache/configure.ac Log: Attempt to detect the availability of RSA's MD5 implementation, and the need to link against libmd to get it. Attempt to detect the need for linking against librt to get clock_gettime(). Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-08 07:01:28 UTC (rev 758) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-08 07:03:35 UTC (rev 759) @@ -58,5 +58,11 @@ $(top_builddir)/lib/libcompat/libcompat.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvcl/libvcl.la \ - -lpthread \ - -lmd + -lpthread + +if NEED_LIBMD +varnishd_LDADD += -lmd +endif +if NEED_LIBRT +varnishd_LDADD += -lrt +endif Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-08 07:01:28 UTC (rev 758) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-08 07:03:35 UTC (rev 759) @@ -13,6 +13,11 @@ #include +#if defined(HASH_CLASSIC_MD5) && !defined(HAVE_MD5) +/* MD5 is not available */ +#undef HASH_CLASSIC_MD5 +#endif + #ifdef HASH_CLASSIC_MD5 #include #endif Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-08 07:01:28 UTC (rev 758) +++ trunk/varnish-cache/configure.ac 2006-08-08 07:03:35 UTC (rev 759) @@ -81,6 +81,16 @@ , [sys/types.h, sys/socket.h]) +# On some systems, clock_gettime is in librt rather than libc +AC_CHECK_LIB(rt, clock_gettime, need_librt=yes) +AM_CONDITIONAL(NEED_LIBRT, test x$need_librt = xyes) + +AC_CHECK_HEADERS([md5.h]) +if test x$ac_cv_header_md5_h = xyes ; then + AC_CHECK_LIB(md, MD5Init, need_libmd=yes) +fi +AM_CONDITIONAL(NEED_LIBMD, test x$need_libmd = xyes) + AC_CONFIG_FILES([ Makefile bin/Makefile From phk at phk.freebsd.dk Tue Aug 8 07:05:39 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Tue, 08 Aug 2006 07:05:39 +0000 Subject: r759 - in trunk/varnish-cache: . bin/varnishd In-Reply-To: Your message of "Tue, 08 Aug 2006 09:03:36 +0200." <20060808070336.076F71EC618@projects.linpro.no> Message-ID: <42503.1155020739@critter.freebsd.dk> In message <20060808070336.076F71EC618 at projects.linpro.no>, des at projects.linpro .no writes: >Author: des >Date: 2006-08-08 09:03:35 +0200 (Tue, 08 Aug 2006) >New Revision: 759 > >Modified: > trunk/varnish-cache/bin/varnishd/Makefile.am > trunk/varnish-cache/bin/varnishd/hash_classic.c > trunk/varnish-cache/configure.ac >Log: >Attempt to detect the availability of RSA's MD5 implementation, and the >need to link against libmd to get it. >Attempt to detect the need for linking against librt to get clock_gettime(). Ohh, I just replaced md5 with a crc32... -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at linpro.no Tue Aug 8 07:08:02 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Tue, 08 Aug 2006 09:08:02 +0200 Subject: r759 - in trunk/varnish-cache: . bin/varnishd References: <42503.1155020739@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > Dag-Erling Sm?rgrav writes: > > Log: > > Attempt to detect the availability of RSA's MD5 implementation, and the > > need to link against libmd to get it. > > Attempt to detect the need for linking against librt to get clock_gettime(). > Ohh, I just replaced md5 with a crc32... I know, read the patch :) DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at projects.linpro.no Tue Aug 8 07:15:56 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 09:15:56 +0200 (CEST) Subject: r760 - in trunk/varnish-cache/bin: varnishncsa varnishstat Message-ID: <20060808071556.B30C41EC623@projects.linpro.no> Author: des Date: 2006-08-08 09:15:56 +0200 (Tue, 08 Aug 2006) New Revision: 760 Modified: trunk/varnish-cache/bin/varnishncsa/Makefile.am trunk/varnish-cache/bin/varnishstat/Makefile.am Log: varnish{ncsa,stat} also need librt. Modified: trunk/varnish-cache/bin/varnishncsa/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-08 07:03:35 UTC (rev 759) +++ trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-08 07:15:56 UTC (rev 760) @@ -12,5 +12,8 @@ varnishncsa_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ - $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la + +if NEED_LIBRT +varnishncsa_LDADD += -lrt +endif Modified: trunk/varnish-cache/bin/varnishstat/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishstat/Makefile.am 2006-08-08 07:03:35 UTC (rev 759) +++ trunk/varnish-cache/bin/varnishstat/Makefile.am 2006-08-08 07:15:56 UTC (rev 760) @@ -14,3 +14,7 @@ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ -lcurses + +if NEED_LIBRT +varnishstat_LDADD += -lrt +endif From des at projects.linpro.no Tue Aug 8 07:17:10 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 09:17:10 +0200 (CEST) Subject: r761 - in trunk/varnish-cache: bin/varnishd include include/compat lib/libcompat lib/libvcl Message-ID: <20060808071710.BAABF1EC622@projects.linpro.no> Author: des Date: 2006-08-08 09:17:10 +0200 (Tue, 08 Aug 2006) New Revision: 761 Added: trunk/varnish-cache/include/compat/ trunk/varnish-cache/include/compat/asprintf.h trunk/varnish-cache/include/compat/strlcat.h trunk/varnish-cache/include/compat/strlcpy.h trunk/varnish-cache/include/compat/vasprintf.h Removed: trunk/varnish-cache/include/compat.h Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/bin/varnishd/tcp.c trunk/varnish-cache/include/Makefile.am trunk/varnish-cache/lib/libcompat/asprintf.c trunk/varnish-cache/lib/libcompat/strlcat.c trunk/varnish-cache/lib/libcompat/strlcpy.c trunk/varnish-cache/lib/libcompat/vasprintf.c trunk/varnish-cache/lib/libvcl/vcc_compile.c Log: Split compat.h into one header per function to avoid issues with e.g. the vasprintf() prototype needing even when it isn't used. Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-08 07:17:10 UTC (rev 761) @@ -13,7 +13,7 @@ #include #include -#include "compat.h" +#include "compat/vasprintf.h" #include "cli_priv.h" #include "cli.h" #include "vsb.h" Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-08 07:17:10 UTC (rev 761) @@ -11,7 +11,7 @@ #include #include -#include "compat.h" +#include "compat/asprintf.h" #include "vsb.h" #include "queue.h" Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-08 07:17:10 UTC (rev 761) @@ -19,7 +19,7 @@ #include #include -#include "compat.h" +#include "compat/asprintf.h" #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-08 07:17:10 UTC (rev 761) @@ -10,6 +10,7 @@ #include #include +#include "compat/strlcpy.h" #include "heritage.h" #include "mgt.h" Modified: trunk/varnish-cache/include/Makefile.am =================================================================== --- trunk/varnish-cache/include/Makefile.am 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/include/Makefile.am 2006-08-08 07:17:10 UTC (rev 761) @@ -5,7 +5,10 @@ cli.h \ cli_common.h \ cli_priv.h \ - compat.h \ + compat/asprintf.h \ + compat/strlcat.h \ + compat/strlcpy.h \ + compat/vasprintf.h \ hash.h \ http_headers.h \ libvarnish.h \ Added: trunk/varnish-cache/include/compat/asprintf.h =================================================================== --- trunk/varnish-cache/include/compat/asprintf.h 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/include/compat/asprintf.h 2006-08-08 07:17:10 UTC (rev 761) @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_ASPRINTF_H_INCLUDED +#define COMPAT_ASPRINTF_H_INCLUDED + +#ifndef HAVE_ASPRINTF +int asprintf(char **strp, const char *fmt, ...); +#endif + +#endif Property changes on: trunk/varnish-cache/include/compat/asprintf.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/varnish-cache/include/compat/strlcat.h =================================================================== --- trunk/varnish-cache/include/compat/strlcat.h 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/include/compat/strlcat.h 2006-08-08 07:17:10 UTC (rev 761) @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_STRLCAT_H_INCLUDED +#define COMPAT_STRLCAT_H_INCLUDED + +#ifndef HAVE_STRLCAT +size_t strlcat(char *dst, const char *src, size_t size); +#endif + +#endif Property changes on: trunk/varnish-cache/include/compat/strlcat.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/varnish-cache/include/compat/strlcpy.h =================================================================== --- trunk/varnish-cache/include/compat/strlcpy.h 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/include/compat/strlcpy.h 2006-08-08 07:17:10 UTC (rev 761) @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_STRLCPY_H_INCLUDED +#define COMPAT_STRLCPY_H_INCLUDED + +#ifndef HAVE_STRLCPY +size_t strlcpy(char *dst, const char *src, size_t size); +#endif + +#endif Property changes on: trunk/varnish-cache/include/compat/strlcpy.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/varnish-cache/include/compat/vasprintf.h =================================================================== --- trunk/varnish-cache/include/compat/vasprintf.h 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/include/compat/vasprintf.h 2006-08-08 07:17:10 UTC (rev 761) @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_VASPRINTF_H_INCLUDED +#define COMPAT_VASPRINTF_H_INCLUDED + +#ifndef HAVE_VASPRINTF +int vasprintf(char **strp, const char *fmt, va_list ap); +#endif + +#endif Property changes on: trunk/varnish-cache/include/compat/vasprintf.h ___________________________________________________________________ Name: svn:keywords + Id Deleted: trunk/varnish-cache/include/compat.h =================================================================== --- trunk/varnish-cache/include/compat.h 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/include/compat.h 2006-08-08 07:17:10 UTC (rev 761) @@ -1,26 +0,0 @@ -/* - * $Id$ - */ - -#ifndef COMPAT_H_INCLUDED -#define COMPAT_H_INCLUDED - -#ifndef HAVE_VASPRINTF -#ifdef va_start /* make sure is in scope */ -int vasprintf(char **strp, const char *fmt, va_list ap); -#endif -#endif - -#ifndef HAVE_ASPRINTF -int asprintf(char **strp, const char *fmt, ...); -#endif - -#ifndef HAVE_STRLCPY -size_t strlcpy(char *dst, const char *src, size_t size); -#endif - -#ifndef HAVE_STRLCAT -size_t strlcat(char *dst, const char *src, size_t size); -#endif - -#endif Modified: trunk/varnish-cache/lib/libcompat/asprintf.c =================================================================== --- trunk/varnish-cache/lib/libcompat/asprintf.c 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/lib/libcompat/asprintf.c 2006-08-08 07:17:10 UTC (rev 761) @@ -3,12 +3,14 @@ * */ +#ifndef HAVE_ASPRINTF + #include #include -#include "compat.h" +#include "compat/asprintf.h" +#include "compat/vasprintf.h" -#ifndef HAVE_ASPRINTF int asprintf(char **strp, const char *fmt, ...) { Modified: trunk/varnish-cache/lib/libcompat/strlcat.c =================================================================== --- trunk/varnish-cache/lib/libcompat/strlcat.c 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/lib/libcompat/strlcat.c 2006-08-08 07:17:10 UTC (rev 761) @@ -17,12 +17,13 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef HAVE_STRLCAT + #include #include -#include "compat.h" +#include "compat/strlcat.h" -#ifndef HAVE_STRLCAT /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters Modified: trunk/varnish-cache/lib/libcompat/strlcpy.c =================================================================== --- trunk/varnish-cache/lib/libcompat/strlcpy.c 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/lib/libcompat/strlcpy.c 2006-08-08 07:17:10 UTC (rev 761) @@ -17,12 +17,13 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef HAVE_STRLCPY + #include #include -#include "compat.h" +#include "compat/strlcpy.h" -#ifndef HAVE_STRLCPY /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). Modified: trunk/varnish-cache/lib/libcompat/vasprintf.c =================================================================== --- trunk/varnish-cache/lib/libcompat/vasprintf.c 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/lib/libcompat/vasprintf.c 2006-08-08 07:17:10 UTC (rev 761) @@ -3,13 +3,14 @@ * */ +#ifndef HAVE_VASPRINTF + #include #include #include -#include "compat.h" +#include "compat/vasprintf.h" -#ifndef HAVE_VASPRINTF int vasprintf(char **strp, const char *fmt, va_list ap) { Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-08 07:15:56 UTC (rev 760) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-08 07:17:10 UTC (rev 761) @@ -49,7 +49,7 @@ #include #include -#include "compat.h" +#include "compat/asprintf.h" #include "vsb.h" #include "vcc_priv.h" From phk at projects.linpro.no Tue Aug 8 07:36:01 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 8 Aug 2006 09:36:01 +0200 (CEST) Subject: r762 - trunk/varnish-cache/bin/varnishd Message-ID: <20060808073601.053A41EC61F@projects.linpro.no> Author: phk Date: 2006-08-08 09:36:00 +0200 (Tue, 08 Aug 2006) New Revision: 762 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_pool.c trunk/varnish-cache/bin/varnishd/cache_response.c Log: Add back sendfile support (under #ifdef HAVE_SENDFILE) but don't engage it for small objects on the suspicion that it has highish setup cost. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-08 07:17:10 UTC (rev 761) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-08 07:36:00 UTC (rev 762) @@ -374,6 +374,9 @@ int WRK_Flush(struct worker *w); unsigned WRK_Write(struct worker *w, const void *ptr, int len); unsigned WRK_WriteH(struct worker *w, struct http_hdr *hh, const char *suf); +#ifdef HAVE_SENDFILE +void WRK_Sendfile(struct worker *w, int fd, off_t off, unsigned len); +#endif /* HAVE_SENDFILE */ /* cache_session.c [SES] */ void SES_Init(void); Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-08 07:17:10 UTC (rev 761) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-08 07:36:00 UTC (rev 762) @@ -8,6 +8,10 @@ #include #include #include +#ifdef HAVE_SENDFILE +#include +#include +#endif /* HAVE_SENDFILE */ #include #include "heritage.h" @@ -54,10 +58,8 @@ i = writev(*w->wfd, w->iov, w->niov); if (i != w->liov) w->werr++; - else { - w->liov = 0; - w->niov = 0; - } + w->liov = 0; + w->niov = 0; return (w->werr); } @@ -94,6 +96,30 @@ return (len); } +#ifdef HAVE_SENDFILE +void +WRK_Sendfile(struct worker *w, int fd, off_t off, unsigned len) +{ + struct sf_hdtr sfh; + int i; + + CHECK_OBJ_NOTNULL(w, WORKER_MAGIC); + assert(fd >= 0); + assert(len > 0); + + memset(&sfh, 0, sizeof sfh); + if (w->niov > 0) { + sfh.headers = w->iov; + sfh.hdr_cnt = w->niov; + } + i = sendfile(fd, *w->wfd, off, len, &sfh, NULL, 0); + if (i != 0) + w->werr++; + w->liov = 0; + w->niov = 0; +} +#endif /* HAVE_SENDFILE */ + /*--------------------------------------------------------------------*/ static void Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-08 07:17:10 UTC (rev 761) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-08 07:36:00 UTC (rev 762) @@ -161,6 +161,19 @@ assert(st->stevedore != NULL); u += st->len; sp->wrk->acct.bodybytes += st->len; +#ifdef HAVE_SENDFILE + /* + * XXX: the overhead of setting up senddile is not + * XXX: epsilon and maybe not even delta, so avoid + * XXX: engaging sendfile for small objects. + * XXX: Should use getpagesize() ? + */ + if (st->fd >= 0 && st->len >= 8192) { + WRK_Sendfile(sp->wrk, st->fd, + st->where, st->len); + continue; + } +#endif /* HAVE_SENDFILE */ WRK_Write(sp->wrk, st->ptr, st->len); } assert(u == sp->obj->len); From phk at phk.freebsd.dk Tue Aug 8 07:36:47 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Tue, 08 Aug 2006 07:36:47 +0000 Subject: r762 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Tue, 08 Aug 2006 09:36:01 +0200." <20060808073601.053A41EC61F@projects.linpro.no> Message-ID: <44297.1155022607@critter.freebsd.dk> In message <20060808073601.053A41EC61F at projects.linpro.no>, phk at projects.linpro .no writes: >Author: phk >Date: 2006-08-08 09:36:00 +0200 (Tue, 08 Aug 2006) >New Revision: 762 > >Modified: > trunk/varnish-cache/bin/varnishd/cache.h > trunk/varnish-cache/bin/varnishd/cache_pool.c > trunk/varnish-cache/bin/varnishd/cache_response.c >Log: >Add back sendfile support (under #ifdef HAVE_SENDFILE) [...] Tacitly assuming that a HAVE_SENDFILE test will fill in config.h at some point :-) -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at projects.linpro.no Tue Aug 8 07:47:12 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 09:47:12 +0200 (CEST) Subject: r763 - trunk/varnish-cache/bin/varnishstat Message-ID: <20060808074712.425E81EC5E0@projects.linpro.no> Author: des Date: 2006-08-08 09:47:12 +0200 (Tue, 08 Aug 2006) New Revision: 763 Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.c Log: #include "libvarnish.h" for varnish_version(). Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.c =================================================================== --- trunk/varnish-cache/bin/varnishstat/varnishstat.c 2006-08-08 07:36:00 UTC (rev 762) +++ trunk/varnish-cache/bin/varnishstat/varnishstat.c 2006-08-08 07:47:12 UTC (rev 763) @@ -12,6 +12,7 @@ #include #include +#include "libvarnish.h" #include "shmlog.h" #include "varnishapi.h" From des at projects.linpro.no Tue Aug 8 07:47:52 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 09:47:52 +0200 (CEST) Subject: r764 - in trunk/varnish-cache: . bin/varnishd Message-ID: <20060808074752.A388B1EC622@projects.linpro.no> Author: des Date: 2006-08-08 09:47:52 +0200 (Tue, 08 Aug 2006) New Revision: 764 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/configure.ac Log: Autodetect the availability of kqueue() and / or poll(). Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-08 07:47:12 UTC (rev 763) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-08 07:47:52 UTC (rev 764) @@ -6,9 +6,17 @@ * write the session pointer to a pipe which the event engine monitors. */ +#undef ACCEPTOR_USE_KQUEUE #undef ACCEPTOR_USE_POLL -#define ACCEPTOR_USE_KQUEUE +#if defined(HAVE_KQUEUE) +#define ACCEPTOR_USE_KQUEUE 1 +#elif defined(HAVE_POLL) +#define ACCEPTOR_USE_POLL 1 +#else +#error No usable acceptors detected. +#endif + #include #include #include @@ -95,7 +103,7 @@ /*====================================================================*/ #ifdef ACCEPTOR_USE_POLL -#include +#include static struct pollfd *pollfd; static unsigned npoll; @@ -262,6 +270,7 @@ #endif /* ACCEPTOR_USE_POLL */ /*====================================================================*/ #ifdef ACCEPTOR_USE_KQUEUE + #include static int kq = -1; Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-08 07:47:12 UTC (rev 763) +++ trunk/varnish-cache/configure.ac 2006-08-08 07:47:52 UTC (rev 764) @@ -85,12 +85,17 @@ AC_CHECK_LIB(rt, clock_gettime, need_librt=yes) AM_CONDITIONAL(NEED_LIBRT, test x$need_librt = xyes) +# Check for the presence of RSA's MD5 implementation (libmd on *BSD) AC_CHECK_HEADERS([md5.h]) if test x$ac_cv_header_md5_h = xyes ; then AC_CHECK_LIB(md, MD5Init, need_libmd=yes) fi AM_CONDITIONAL(NEED_LIBMD, test x$need_libmd = xyes) +# Check which mechanism to use for the acceptor +AC_CHECK_FUNCS([kqueue]) +AC_CHECK_FUNCS([poll]) + AC_CONFIG_FILES([ Makefile bin/Makefile From des at linpro.no Tue Aug 8 07:49:47 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Tue, 08 Aug 2006 09:49:47 +0200 Subject: r762 - trunk/varnish-cache/bin/varnishd References: <44297.1155022607@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > Tacitly assuming that a HAVE_SENDFILE test will fill in config.h > at some point :-) The problem is that FreeBSD and Linux both have sendfile(), but they are not compatible with eachother, so more elaborate checks and conditionals are required. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From phk at phk.freebsd.dk Tue Aug 8 07:55:18 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Tue, 08 Aug 2006 07:55:18 +0000 Subject: r762 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Tue, 08 Aug 2006 09:49:47 +0200." Message-ID: <53087.1155023718@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >"Poul-Henning Kamp" writes: >> Tacitly assuming that a HAVE_SENDFILE test will fill in config.h >> at some point :-) > >The problem is that FreeBSD and Linux both have sendfile(), but they >are not compatible with eachother, so more elaborate checks and >conditionals are required. Hmm. Can we do it such that "HAVE_SENDFILE" means "HAVE_SOME_KIND_OF_SENDFILE" and use that in cache_response.c and then handle the differences in cache_pool.c ? -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From phk at phk.freebsd.dk Tue Aug 8 07:56:17 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Tue, 08 Aug 2006 07:56:17 +0000 Subject: r764 - in trunk/varnish-cache: . bin/varnishd In-Reply-To: Your message of "Tue, 08 Aug 2006 09:47:52 +0200." <20060808074752.A388B1EC622@projects.linpro.no> Message-ID: <53096.1155023777@critter.freebsd.dk> In message <20060808074752.A388B1EC622 at projects.linpro.no>, des at projects.linpro .no writes: >Author: des >Date: 2006-08-08 09:47:52 +0200 (Tue, 08 Aug 2006) >New Revision: 764 > >Modified: > trunk/varnish-cache/bin/varnishd/cache_acceptor.c > trunk/varnish-cache/configure.ac >Log: >Autodetect the availability of kqueue() and / or poll(). poll(2) is mandatory, I really don't feel like adding a select(2) variant either, all moderately recent UNIX have a poll(2). -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at linpro.no Tue Aug 8 08:29:08 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Tue, 08 Aug 2006 10:29:08 +0200 Subject: r762 - trunk/varnish-cache/bin/varnishd References: <53087.1155023718@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > Can we do it such that "HAVE_SENDFILE" means "HAVE_SOME_KIND_OF_SENDFILE" > and use that in cache_response.c and then handle the differences > in cache_pool.c ? Sure. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at linpro.no Tue Aug 8 08:29:42 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Tue, 08 Aug 2006 10:29:42 +0200 Subject: r764 - in trunk/varnish-cache: . bin/varnishd References: <53096.1155023777@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > poll(2) is mandatory, I really don't feel like adding a select(2) > variant either, all moderately recent UNIX have a poll(2). I thought poll(2) was only used when kqueue(2) isn't available? DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From phk at phk.freebsd.dk Tue Aug 8 08:31:11 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Tue, 08 Aug 2006 08:31:11 +0000 Subject: r764 - in trunk/varnish-cache: . bin/varnishd In-Reply-To: Your message of "Tue, 08 Aug 2006 10:29:42 +0200." Message-ID: <53564.1155025871@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >"Poul-Henning Kamp" writes: >> poll(2) is mandatory, I really don't feel like adding a select(2) >> variant either, all moderately recent UNIX have a poll(2). > >I thought poll(2) was only used when kqueue(2) isn't available? No, it's also used to do reads and writes that time out. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at projects.linpro.no Tue Aug 8 09:15:18 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 11:15:18 +0200 (CEST) Subject: r765 - trunk/varnish-cache/bin/varnishd Message-ID: <20060808091518.C04571EC62D@projects.linpro.no> Author: des Date: 2006-08-08 11:15:18 +0200 (Tue, 08 Aug 2006) New Revision: 765 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: The correct header for poll() is , not like the Linux man page says (poll() is an XSI extension in SUSv[23]) Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-08 07:47:52 UTC (rev 764) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-08 09:15:18 UTC (rev 765) @@ -103,7 +103,7 @@ /*====================================================================*/ #ifdef ACCEPTOR_USE_POLL -#include +#include static struct pollfd *pollfd; static unsigned npoll; From des at projects.linpro.no Tue Aug 8 12:15:22 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 14:15:22 +0200 (CEST) Subject: r766 - in trunk/varnish-cache: . include include/compat lib/libcompat Message-ID: <20060808121522.C60DC1EC63A@projects.linpro.no> Author: des Date: 2006-08-08 14:15:22 +0200 (Tue, 08 Aug 2006) New Revision: 766 Added: trunk/varnish-cache/include/compat/srandomdev.h trunk/varnish-cache/lib/libcompat/srandomdev.c Modified: trunk/varnish-cache/configure.ac trunk/varnish-cache/include/Makefile.am trunk/varnish-cache/lib/libcompat/Makefile.am Log: Add a simple srandomdev() implementation inspired by the one in FreeBSD. Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-08 09:15:18 UTC (rev 765) +++ trunk/varnish-cache/configure.ac 2006-08-08 12:15:22 UTC (rev 766) @@ -61,6 +61,7 @@ AC_CHECK_FUNCS([strerror]) AC_FUNC_STRERROR_R AC_CHECK_FUNCS([socket]) +AC_CHECK_FUNCS([srandomdev]) AC_CHECK_FUNCS([strlcat]) AC_CHECK_FUNCS([strlcpy]) Modified: trunk/varnish-cache/include/Makefile.am =================================================================== --- trunk/varnish-cache/include/Makefile.am 2006-08-08 09:15:18 UTC (rev 765) +++ trunk/varnish-cache/include/Makefile.am 2006-08-08 12:15:22 UTC (rev 766) @@ -6,6 +6,7 @@ cli_common.h \ cli_priv.h \ compat/asprintf.h \ + compat/srandomdev.h \ compat/strlcat.h \ compat/strlcpy.h \ compat/vasprintf.h \ Added: trunk/varnish-cache/include/compat/srandomdev.h =================================================================== --- trunk/varnish-cache/include/compat/srandomdev.h 2006-08-08 09:15:18 UTC (rev 765) +++ trunk/varnish-cache/include/compat/srandomdev.h 2006-08-08 12:15:22 UTC (rev 766) @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_SRANDOMDEV_H_INCLUDED +#define COMPAT_SRANDOMDEV_H_INCLUDED + +#ifndef HAVE_SRANDOMDEV +void srandomdev(void); +#endif + +#endif Property changes on: trunk/varnish-cache/include/compat/srandomdev.h ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/lib/libcompat/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-08 09:15:18 UTC (rev 765) +++ trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-08 12:15:22 UTC (rev 766) @@ -7,6 +7,7 @@ libcompat_a_SOURCES = \ asprintf.c \ vasprintf.c \ + srandomdev.c \ strlcat.c \ strlcpy.c Added: trunk/varnish-cache/lib/libcompat/srandomdev.c =================================================================== --- trunk/varnish-cache/lib/libcompat/srandomdev.c 2006-08-08 09:15:18 UTC (rev 765) +++ trunk/varnish-cache/lib/libcompat/srandomdev.c 2006-08-08 12:15:22 UTC (rev 766) @@ -0,0 +1,33 @@ +/* + * $Id$ + */ + +#ifndef HAVE_SRANDOMDEV + +#include + +#include +#include +#include +#include + +#include "compat/srandomdev.h" + +void +srandomdev(void) +{ + struct timeval tv; + unsigned int seed; + int fd; + + if ((fd = open("/dev/random", O_RDONLY)) >= 0) { + read(fd, &seed, sizeof seed); + close(fd); + } else { + gettimeofday(&tv, NULL); + /* NOTE: intentional use of uninitialized variable */ + seed ^= (getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec; + } + srandom(seed); +} +#endif Property changes on: trunk/varnish-cache/lib/libcompat/srandomdev.c ___________________________________________________________________ Name: svn:keywords + Id From des at projects.linpro.no Tue Aug 8 12:31:19 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 14:31:19 +0200 (CEST) Subject: r767 - in trunk/varnish-cache: . bin/varnishlog bin/varnishncsa bin/varnishstat bin/varnishtop include include/compat lib/libcompat Message-ID: <20060808123119.3B8D81EC639@projects.linpro.no> Author: des Date: 2006-08-08 14:31:19 +0200 (Tue, 08 Aug 2006) New Revision: 767 Added: trunk/varnish-cache/include/compat/vis.h trunk/varnish-cache/lib/libcompat/vis.c Modified: trunk/varnish-cache/bin/varnishlog/Makefile.am trunk/varnish-cache/bin/varnishlog/varnishlog.c trunk/varnish-cache/bin/varnishncsa/Makefile.am trunk/varnish-cache/bin/varnishncsa/varnishncsa.c trunk/varnish-cache/bin/varnishstat/Makefile.am trunk/varnish-cache/bin/varnishtop/Makefile.am trunk/varnish-cache/bin/varnishtop/varnishtop.c trunk/varnish-cache/configure.ac trunk/varnish-cache/include/Makefile.am trunk/varnish-cache/lib/libcompat/Makefile.am Log: Bring in FreeBSD's version of vis(3), strvis(3) and strvisx(3). Modified: trunk/varnish-cache/bin/varnishlog/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishlog/Makefile.am 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/bin/varnishlog/Makefile.am 2006-08-08 12:31:19 UTC (rev 767) @@ -11,5 +11,6 @@ varnishlog_CFLAGS = -include config.h varnishlog_LDADD = \ + $(top_builddir)/lib/libcompat/libcompat.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-08 12:31:19 UTC (rev 767) @@ -9,8 +9,9 @@ #include #include #include -#include +#include "compat/vis.h" + #include "vsb.h" #include "libvarnish.h" Modified: trunk/varnish-cache/bin/varnishncsa/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/bin/varnishncsa/Makefile.am 2006-08-08 12:31:19 UTC (rev 767) @@ -11,6 +11,7 @@ varnishncsa_CFLAGS = -include config.h varnishncsa_LDADD = \ + $(top_builddir)/lib/libcompat/libcompat.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-08 12:31:19 UTC (rev 767) @@ -17,9 +17,10 @@ #include #include #include -#include #include +#include "compat/vis.h" + #include "vsb.h" #include "libvarnish.h" Modified: trunk/varnish-cache/bin/varnishstat/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishstat/Makefile.am 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/bin/varnishstat/Makefile.am 2006-08-08 12:31:19 UTC (rev 767) @@ -11,6 +11,7 @@ varnishstat_CFLAGS = -include config.h varnishstat_LDADD = \ + $(top_builddir)/lib/libcompat/libcompat.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ -lcurses Modified: trunk/varnish-cache/bin/varnishtop/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishtop/Makefile.am 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/bin/varnishtop/Makefile.am 2006-08-08 12:31:19 UTC (rev 767) @@ -11,6 +11,7 @@ varnishtop_CFLAGS = -include config.h varnishtop_LDADD = \ + $(top_builddir)/lib/libcompat/libcompat.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ -lcurses Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-08 12:31:19 UTC (rev 767) @@ -4,15 +4,16 @@ * Log tailer for Varnish */ -#include #include +#include #include +#include +#include #include -#include #include -#include -#include +#include "compat/vis.h" + #include "vsb.h" #include "libvarnish.h" Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/configure.ac 2006-08-08 12:31:19 UTC (rev 767) @@ -61,9 +61,12 @@ AC_CHECK_FUNCS([strerror]) AC_FUNC_STRERROR_R AC_CHECK_FUNCS([socket]) + +# These functions are provided by libcompat on platforms where they +# are not available AC_CHECK_FUNCS([srandomdev]) -AC_CHECK_FUNCS([strlcat]) -AC_CHECK_FUNCS([strlcpy]) +AC_CHECK_FUNCS([strlcat strlcpy]) +AC_CHECK_FUNCS([vis strvis strvisx]) # asprintf() and vasprintf() are tricky, because on some systems, they # are present in the C library, but their prototypes are hidden behind Modified: trunk/varnish-cache/include/Makefile.am =================================================================== --- trunk/varnish-cache/include/Makefile.am 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/include/Makefile.am 2006-08-08 12:31:19 UTC (rev 767) @@ -10,6 +10,7 @@ compat/strlcat.h \ compat/strlcpy.h \ compat/vasprintf.h \ + compat/vis.h \ hash.h \ http_headers.h \ libvarnish.h \ Added: trunk/varnish-cache/include/compat/vis.h =================================================================== --- trunk/varnish-cache/include/compat/vis.h 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/include/compat/vis.h 2006-08-08 12:31:19 UTC (rev 767) @@ -0,0 +1,89 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)vis.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/vis.h,v 1.11 2003/10/30 10:40:49 phk Exp $ + * $Id$ + */ + +#ifndef _VIS_H_ +#define _VIS_H_ + +/* + * to select alternate encoding format + */ +#define VIS_OCTAL 0x01 /* use octal \ddd format */ +#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropriate */ + +/* + * to alter set of characters encoded (default is to encode all + * non-graphic except space, tab, and newline). + */ +#define VIS_SP 0x04 /* also encode space */ +#define VIS_TAB 0x08 /* also encode tab */ +#define VIS_NL 0x10 /* also encode newline */ +#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL) +#define VIS_SAFE 0x20 /* only encode "unsafe" characters */ + +/* + * other + */ +#define VIS_NOSLASH 0x40 /* inhibit printing '\' */ +#define VIS_HTTPSTYLE 0x80 /* http-style escape % HEX HEX */ +#define VIS_GLOB 0x100 /* encode glob(3) magics */ + +/* + * unvis return codes + */ +#define UNVIS_VALID 1 /* character valid */ +#define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */ +#define UNVIS_NOCHAR 3 /* valid sequence, no character produced */ +#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */ +#define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */ + +/* + * unvis flags + */ +#define UNVIS_END 1 /* no more characters */ + +#include + +__BEGIN_DECLS +char *vis(char *, int, int, int); +int strvis(char *, const char *, int); +int strvisx(char *, const char *, size_t, int); +int strunvis(char *, const char *); +int strunvisx(char *, const char *, int); +int unvis(char *, int, int *, int); +__END_DECLS + +#endif /* !_VIS_H_ */ Modified: trunk/varnish-cache/lib/libcompat/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-08 12:31:19 UTC (rev 767) @@ -9,6 +9,7 @@ vasprintf.c \ srandomdev.c \ strlcat.c \ - strlcpy.c + strlcpy.c \ + vis.c libcompat_a_CFLAGS = -include config.h Added: trunk/varnish-cache/lib/libcompat/vis.c =================================================================== --- trunk/varnish-cache/lib/libcompat/vis.c 2006-08-08 12:15:22 UTC (rev 766) +++ trunk/varnish-cache/lib/libcompat/vis.c 2006-08-08 12:31:19 UTC (rev 767) @@ -0,0 +1,214 @@ +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)vis.c 8.1 (Berkeley) 7/19/93 + * $FreeBSD: src/lib/libc/gen/vis.c,v 1.13 2003/10/30 12:41:50 phk Exp $ + * $Id$ + */ + +#if !defined(HAVE_VIS) || !defined(HAVE_STRVIS) || !defined(HAVE_STRVISX) + +#include +#include +#include +#include + +#include "compat/vis.h" + +#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7') + +/* + * vis - visually encode characters + */ +#ifndef HAVE_VIS +char * +vis(dst, c, flag, nextc) + char *dst; + int c, nextc; + int flag; +{ + c = (unsigned char)c; + + if (flag & VIS_HTTPSTYLE) { + /* Described in RFC 1808 */ + if (!(isalnum(c) /* alpha-numeric */ + /* safe */ + || c == '$' || c == '-' || c == '_' || c == '.' || c == '+' + /* extra */ + || c == '!' || c == '*' || c == '\'' || c == '(' + || c == ')' || c == ',')) { + *dst++ = '%'; + snprintf(dst, 4, (c < 16 ? "0%X" : "%X"), c); + dst += 2; + goto done; + } + } + + if ((flag & VIS_GLOB) && + (c == '*' || c == '?' || c == '[' || c == '#')) + ; + else if (isgraph(c) || + ((flag & VIS_SP) == 0 && c == ' ') || + ((flag & VIS_TAB) == 0 && c == '\t') || + ((flag & VIS_NL) == 0 && c == '\n') || + ((flag & VIS_SAFE) && (c == '\b' || c == '\007' || c == '\r'))) { + *dst++ = c; + if (c == '\\' && (flag & VIS_NOSLASH) == 0) + *dst++ = '\\'; + *dst = '\0'; + return (dst); + } + + if (flag & VIS_CSTYLE) { + switch(c) { + case '\n': + *dst++ = '\\'; + *dst++ = 'n'; + goto done; + case '\r': + *dst++ = '\\'; + *dst++ = 'r'; + goto done; + case '\b': + *dst++ = '\\'; + *dst++ = 'b'; + goto done; + case '\a': + *dst++ = '\\'; + *dst++ = 'a'; + goto done; + case '\v': + *dst++ = '\\'; + *dst++ = 'v'; + goto done; + case '\t': + *dst++ = '\\'; + *dst++ = 't'; + goto done; + case '\f': + *dst++ = '\\'; + *dst++ = 'f'; + goto done; + case ' ': + *dst++ = '\\'; + *dst++ = 's'; + goto done; + case '\0': + *dst++ = '\\'; + *dst++ = '0'; + if (isoctal(nextc)) { + *dst++ = '0'; + *dst++ = '0'; + } + goto done; + } + } + if (((c & 0177) == ' ') || isgraph(c) || (flag & VIS_OCTAL)) { + *dst++ = '\\'; + *dst++ = ((u_char)c >> 6 & 07) + '0'; + *dst++ = ((u_char)c >> 3 & 07) + '0'; + *dst++ = ((u_char)c & 07) + '0'; + goto done; + } + if ((flag & VIS_NOSLASH) == 0) + *dst++ = '\\'; + if (c & 0200) { + c &= 0177; + *dst++ = 'M'; + } + if (iscntrl(c)) { + *dst++ = '^'; + if (c == 0177) + *dst++ = '?'; + else + *dst++ = c + '@'; + } else { + *dst++ = '-'; + *dst++ = c; + } +done: + *dst = '\0'; + return (dst); +} +#endif + +/* + * strvis, strvisx - visually encode characters from src into dst + * + * Dst must be 4 times the size of src to account for possible + * expansion. The length of dst, not including the trailing NUL, + * is returned. + * + * Strvisx encodes exactly len bytes from src into dst. + * This is useful for encoding a block of data. + */ +#ifndef HAVE_STRVIS +int +strvis(dst, src, flag) + char *dst; + const char *src; + int flag; +{ + char c; + char *start; + + for (start = dst; (c = *src); ) + dst = vis(dst, c, flag, *++src); + *dst = '\0'; + return (dst - start); +} +#endif + +#ifndef HAVE_STRVISX +int +strvisx(dst, src, len, flag) + char *dst; + const char *src; + size_t len; + int flag; +{ + int c; + char *start; + + for (start = dst; len > 1; len--) { + c = *src; + dst = vis(dst, c, flag, *++src); + } + if (len) + dst = vis(dst, *src, flag, '\0'); + *dst = '\0'; + + return (dst - start); +} +#endif + +#endif From des at projects.linpro.no Tue Aug 8 12:42:49 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 14:42:49 +0200 (CEST) Subject: r768 - trunk/varnish-cache Message-ID: <20060808124249.95A801EC63C@projects.linpro.no> Author: des Date: 2006-08-08 14:42:49 +0200 (Tue, 08 Aug 2006) New Revision: 768 Modified: trunk/varnish-cache/configure.ac Log: Defining _GNU_SOURCE gives us native asprintf() and strptime() on glibc systems, and has no effect on FreeBSD. Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-08 12:31:19 UTC (rev 767) +++ trunk/varnish-cache/configure.ac 2006-08-08 12:42:49 UTC (rev 768) @@ -27,6 +27,7 @@ CFLAGS="${CFLAGS} -Werror") # Checks for programs. +AC_GNU_SOURCE AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL @@ -61,6 +62,7 @@ AC_CHECK_FUNCS([strerror]) AC_FUNC_STRERROR_R AC_CHECK_FUNCS([socket]) +AC_CHECK_FUNCS([strptime]) # These functions are provided by libcompat on platforms where they # are not available From des at projects.linpro.no Tue Aug 8 12:45:02 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 14:45:02 +0200 (CEST) Subject: r769 - trunk/varnish-cache Message-ID: <20060808124502.2C8EF1EC63D@projects.linpro.no> Author: des Date: 2006-08-08 14:45:02 +0200 (Tue, 08 Aug 2006) New Revision: 769 Modified: trunk/varnish-cache/configure.ac Log: Now that we define _GNU_SOURCE, the asprintf() / vasprintf() hack is no longer required. Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-08 12:42:49 UTC (rev 768) +++ trunk/varnish-cache/configure.ac 2006-08-08 12:45:02 UTC (rev 769) @@ -66,27 +66,11 @@ # These functions are provided by libcompat on platforms where they # are not available +AC_CHECK_FUNCS([asprintf vasprintf]) AC_CHECK_FUNCS([srandomdev]) AC_CHECK_FUNCS([strlcat strlcpy]) AC_CHECK_FUNCS([vis strvis strvisx]) -# asprintf() and vasprintf() are tricky, because on some systems, they -# are present in the C library, but their prototypes are hidden behind -# conditionals which we won't bother to unravel. -AC_CHECK_DECL([asprintf], - AC_DEFINE(HAVE_ASPRINTF,1,[Define to 1 if asprintf() is available]), - , - [#include ]) -AC_CHECK_DECL([vasprintf], - AC_DEFINE(HAVE_VASPRINTF,1,[Define to 1 if vasprintf() is available]), - , - [#include ]) - -AC_CHECK_DECL([SO_ACCEPTFILER], - AC_DEFINE(HAVE_ACCEPT_FILTERS,1,[Define to 1 if you have accept filters]), - , - [sys/types.h, sys/socket.h]) - # On some systems, clock_gettime is in librt rather than libc AC_CHECK_LIB(rt, clock_gettime, need_librt=yes) AM_CONDITIONAL(NEED_LIBRT, test x$need_librt = xyes) From des at projects.linpro.no Tue Aug 8 12:46:57 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 14:46:57 +0200 (CEST) Subject: r770 - in trunk/varnish-cache: . bin/varnishd Message-ID: <20060808124657.59A491EC63E@projects.linpro.no> Author: des Date: 2006-08-08 14:46:57 +0200 (Tue, 08 Aug 2006) New Revision: 770 Modified: trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/configure.ac Log: #include for fstatfs if it is available. Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-08 12:45:02 UTC (rev 769) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-08 12:46:57 UTC (rev 770) @@ -10,6 +10,10 @@ #include #include +#ifdef HAVE_SYS_VFS_H +#include +#endif + #include #include #include Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-08 12:45:02 UTC (rev 769) +++ trunk/varnish-cache/configure.ac 2006-08-08 12:46:57 UTC (rev 770) @@ -41,6 +41,7 @@ AC_HEADER_SYS_WAIT AC_HEADER_TIME AC_CHECK_HEADERS([sys/socket.h]) +AC_CHECK_HEADERS([sys/vfs.h]) AC_CHECK_HEADERS([netinet/in.h]) AC_CHECK_HEADERS([stddef.h]) AC_CHECK_HEADERS([stdlib.h]) From des at projects.linpro.no Tue Aug 8 12:55:37 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 14:55:37 +0200 (CEST) Subject: r771 - in trunk/varnish-cache: include/compat lib/libcompat Message-ID: <20060808125537.167C71EC63D@projects.linpro.no> Author: des Date: 2006-08-08 14:55:36 +0200 (Tue, 08 Aug 2006) New Revision: 771 Modified: trunk/varnish-cache/include/compat/vis.h trunk/varnish-cache/lib/libcompat/vis.c Log: Expand keywords. Property changes on: trunk/varnish-cache/include/compat/vis.h ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libcompat/vis.c ___________________________________________________________________ Name: svn:keywords + Id From des at projects.linpro.no Tue Aug 8 12:57:25 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 14:57:25 +0200 (CEST) Subject: r772 - trunk/varnish-cache/bin/varnishd Message-ID: <20060808125725.BE15F1EC640@projects.linpro.no> Author: des Date: 2006-08-08 14:57:25 +0200 (Tue, 08 Aug 2006) New Revision: 772 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: #include "compat/srandomdev.h" for srandomdev() Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-08 12:55:36 UTC (rev 771) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-08 12:57:25 UTC (rev 772) @@ -27,6 +27,8 @@ #include #include +#include "compat/srandomdev.h" + #include "heritage.h" #include "shmlog.h" #include "cache.h" From des at projects.linpro.no Tue Aug 8 12:57:53 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 14:57:53 +0200 (CEST) Subject: r773 - in trunk/varnish-cache: . bin/varnishd include include/compat lib/libcompat Message-ID: <20060808125753.B6AF81EC640@projects.linpro.no> Author: des Date: 2006-08-08 14:57:53 +0200 (Tue, 08 Aug 2006) New Revision: 773 Added: trunk/varnish-cache/include/compat/setproctitle.h trunk/varnish-cache/lib/libcompat/setproctitle.c Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/configure.ac trunk/varnish-cache/include/Makefile.am trunk/varnish-cache/lib/libcompat/Makefile.am Log: Add a setproctitle() stub to libcompat. Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-08 12:57:25 UTC (rev 772) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-08 12:57:53 UTC (rev 773) @@ -17,6 +17,8 @@ #include /* XXX */ +#include "compat/setproctitle.h" + #include "heritage.h" #include "mgt.h" #include "cli.h" Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-08 12:57:25 UTC (rev 772) +++ trunk/varnish-cache/configure.ac 2006-08-08 12:57:53 UTC (rev 773) @@ -68,6 +68,7 @@ # These functions are provided by libcompat on platforms where they # are not available AC_CHECK_FUNCS([asprintf vasprintf]) +AC_CHECK_FUNCS([setproctitle]) AC_CHECK_FUNCS([srandomdev]) AC_CHECK_FUNCS([strlcat strlcpy]) AC_CHECK_FUNCS([vis strvis strvisx]) Modified: trunk/varnish-cache/include/Makefile.am =================================================================== --- trunk/varnish-cache/include/Makefile.am 2006-08-08 12:57:25 UTC (rev 772) +++ trunk/varnish-cache/include/Makefile.am 2006-08-08 12:57:53 UTC (rev 773) @@ -6,6 +6,7 @@ cli_common.h \ cli_priv.h \ compat/asprintf.h \ + compat/setproctitle.h \ compat/srandomdev.h \ compat/strlcat.h \ compat/strlcpy.h \ Added: trunk/varnish-cache/include/compat/setproctitle.h =================================================================== --- trunk/varnish-cache/include/compat/setproctitle.h 2006-08-08 12:57:25 UTC (rev 772) +++ trunk/varnish-cache/include/compat/setproctitle.h 2006-08-08 12:57:53 UTC (rev 773) @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_SETPROCTITLE_H_INCLUDED +#define COMPAT_SETPROCTITLE_H_INCLUDED + +#ifndef HAVE_SETPROCTITLE +void setproctitle(const char *fmt, ...); +#endif + +#endif Property changes on: trunk/varnish-cache/include/compat/setproctitle.h ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/lib/libcompat/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-08 12:57:25 UTC (rev 772) +++ trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-08 12:57:53 UTC (rev 773) @@ -7,6 +7,7 @@ libcompat_a_SOURCES = \ asprintf.c \ vasprintf.c \ + setproctitle.c \ srandomdev.c \ strlcat.c \ strlcpy.c \ Added: trunk/varnish-cache/lib/libcompat/setproctitle.c =================================================================== --- trunk/varnish-cache/lib/libcompat/setproctitle.c 2006-08-08 12:57:25 UTC (rev 772) +++ trunk/varnish-cache/lib/libcompat/setproctitle.c 2006-08-08 12:57:53 UTC (rev 773) @@ -0,0 +1,20 @@ +/* + * $Id$ + */ + +#ifndef HAVE_SETPROCTITLE + +#include + +#include "compat/setproctitle.h" + +void +setproctitle(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + /* XXX */ + va_end(ap); +} +#endif Property changes on: trunk/varnish-cache/lib/libcompat/setproctitle.c ___________________________________________________________________ Name: svn:keywords + Id From des at projects.linpro.no Tue Aug 8 14:00:28 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 16:00:28 +0200 (CEST) Subject: r774 - in trunk/varnish-cache: . bin/varnishd Message-ID: <20060808140028.B02021EC641@projects.linpro.no> Author: des Date: 2006-08-08 16:00:28 +0200 (Tue, 08 Aug 2006) New Revision: 774 Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/configure.ac Log: Autodetect the need to link against libdl for dlopen(). Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-08 12:57:53 UTC (rev 773) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-08 14:00:28 UTC (rev 774) @@ -52,7 +52,7 @@ varnishd_CFLAGS = -include config.h -varnishd_LDFLAGS = -export-dynamic +varnishd_LDFLAGS = -export-dynamic varnishd_LDADD = \ $(top_builddir)/lib/libcompat/libcompat.a \ @@ -60,9 +60,14 @@ $(top_builddir)/lib/libvcl/libvcl.la \ -lpthread +if NEED_LIBDL +varnishd_LDADD += -ldl +endif + if NEED_LIBMD varnishd_LDADD += -lmd endif + if NEED_LIBRT varnishd_LDADD += -lrt endif Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-08 12:57:53 UTC (rev 773) +++ trunk/varnish-cache/configure.ac 2006-08-08 14:00:28 UTC (rev 774) @@ -77,6 +77,10 @@ AC_CHECK_LIB(rt, clock_gettime, need_librt=yes) AM_CONDITIONAL(NEED_LIBRT, test x$need_librt = xyes) +# Check if dlopen() requires libdl +AC_CHECK_LIB(dl, dlopen, need_libdl=yes) +AM_CONDITIONAL(NEED_LIBDL, test x$need_libdl = xyes) + # Check for the presence of RSA's MD5 implementation (libmd on *BSD) AC_CHECK_HEADERS([md5.h]) if test x$ac_cv_header_md5_h = xyes ; then From des at projects.linpro.no Tue Aug 8 14:52:14 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 8 Aug 2006 16:52:14 +0200 (CEST) Subject: r775 - trunk/varnish-cache/lib/libvarnishapi Message-ID: <20060808145214.9011B1EC643@projects.linpro.no> Author: des Date: 2006-08-08 16:52:14 +0200 (Tue, 08 Aug 2006) New Revision: 775 Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c Log: While FreeBSD defaults to MAP_SHARED, Linux requires either MAP_SHARED or MAP_PRIVATE to be specified. Do so. Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-08 14:00:28 UTC (rev 774) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-08 14:52:14 UTC (rev 775) @@ -85,7 +85,7 @@ } vsl_lh = mmap(NULL, slh.size + sizeof slh, - PROT_READ, MAP_HASSEMAPHORE, vsl_fd, 0); + PROT_READ, MAP_SHARED|MAP_HASSEMAPHORE, vsl_fd, 0); if (vsl_lh == MAP_FAILED) { fprintf(stderr, "Cannot mmap %s: %s\n", SHMLOG_FILENAME, strerror(errno)); From des at projects.linpro.no Wed Aug 9 09:36:29 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 9 Aug 2006 11:36:29 +0200 (CEST) Subject: r776 - trunk/varnish-cache/bin/varnishd Message-ID: <20060809093629.736C41EC61D@projects.linpro.no> Author: des Date: 2006-08-09 11:36:29 +0200 (Wed, 09 Aug 2006) New Revision: 776 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/tcp.c Log: Rewrite open_tcp(): use only one listening socket. Try for a combined IPv6 / IPv4 socket; if IPv6 is not available, fall back to an IPv4 socket. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-08 14:52:14 UTC (rev 775) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-09 09:36:29 UTC (rev 776) @@ -194,12 +194,8 @@ AZ(pipe(pipes)); vca_poll(pipes[0]); - for (u = 0; u < HERITAGE_NSOCKS; u++) { - if (heritage.sock_local[u] >= 0) - vca_poll(heritage.sock_local[u]); - if (heritage.sock_remote[u] >= 0) - vca_poll(heritage.sock_remote[u]); - } + if (heritage.socket >= 0) + vca_poll(heritage.socket); while (1) { v = poll(pollfd, npoll, 5000); @@ -213,17 +209,10 @@ else vca_rcvhdev(sp); } - for (u = 0; v && u < HERITAGE_NSOCKS; u++) { - if (heritage.sock_local[u] >= 0 && - pollfd[heritage.sock_local[u]].revents) { - accept_f(heritage.sock_local[u]); - v--; - } - if (heritage.sock_remote[u] >= 0 && - pollfd[heritage.sock_remote[u]].revents) { - accept_f(heritage.sock_remote[u]); - v--; - } + if (heritage.socket >= 0 && + pollfd[heritage.socket].revents) { + accept_f(heritage.socket); + v--; } clock_gettime(CLOCK_MONOTONIC, &t); TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { @@ -322,19 +311,11 @@ assert(kq >= 0); - for (u = 0; u < HERITAGE_NSOCKS; u++) { - if (heritage.sock_local[u] >= 0) { - memset(&ke, 0, sizeof ke); - EV_SET(&ke, heritage.sock_local[u], - EVFILT_READ, EV_ADD, 0, 0, accept_f); - AZ(kevent(kq, &ke, 1, NULL, 0, NULL)); - } - if (heritage.sock_remote[u] >= 0) { - memset(&ke, 0, sizeof ke); - EV_SET(&ke, heritage.sock_remote[u], - EVFILT_READ, EV_ADD, 0, 0, accept_f); - AZ(kevent(kq, &ke, 1, NULL, 0, NULL)); - } + if (heritage.socket >= 0) { + memset(&ke, 0, sizeof ke); + EV_SET(&ke, heritage.socket, + EVFILT_READ, EV_ADD, 0, 0, accept_f); + AZ(kevent(kq, &ke, 1, NULL, 0, NULL)); } while (1) { Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-08 14:52:14 UTC (rev 775) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-09 09:36:29 UTC (rev 776) @@ -12,14 +12,8 @@ */ int fds[4]; - /* - * Two sockets from which to accept connections, one bound to - * loopback only and one bound for wildcard (or possibly a specific - * interface IP number). - */ -#define HERITAGE_NSOCKS 2 /* IPv4 + IPv6 */ - int sock_local[HERITAGE_NSOCKS]; - int sock_remote[HERITAGE_NSOCKS]; + /* Socket from which to accept connections */ + int socket; /* Share memory log fd and size (incl header) */ int vsl_fd; Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-08 14:52:14 UTC (rev 775) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-09 09:36:29 UTC (rev 776) @@ -9,6 +9,7 @@ #include #include #include +#include #include "compat/strlcpy.h" #include "heritage.h" @@ -64,74 +65,66 @@ } #endif -static void -create_listen_socket(const char *addr, const char *port, int *sp, int nsp) +int +open_tcp(const char *port) { - struct addrinfo ai, *r0, *r1; - int i, j, s; + struct addrinfo hints, *res; + int ret, sd, val; - memset(&ai, 0, sizeof ai); - ai.ai_family = PF_UNSPEC; - ai.ai_socktype = SOCK_STREAM; - ai.ai_flags = AI_PASSIVE; - i = getaddrinfo(addr, port, &ai, &r0); - - if (i) { - fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(i)); - return; + memset(&hints, 0, sizeof hints); + hints.ai_family = AF_INET6; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + if ((ret = getaddrinfo(NULL, port, &hints, &res)) != 0) { + fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret)); + return (-1); } - for (r1 = r0; r1 != NULL && nsp > 0; r1 = r1->ai_next) { - s = socket(r1->ai_family, r1->ai_socktype, r1->ai_protocol); - if (s < 0) - continue; - j = 1; - i = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &j, sizeof j); - assert(i == 0); - - i = bind(s, r1->ai_addr, r1->ai_addrlen); - if (i != 0) { - perror("bind"); - continue; + sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (sd < 0 && errno == EPROTONOSUPPORT) { + freeaddrinfo(res); + hints.ai_family = AF_INET; + if ((ret = getaddrinfo(NULL, port, &hints, &res)) != 0) { + fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret)); + return (-1); } - assert(i == 0); - *sp = s; - sp++; - nsp--; + sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); } - - freeaddrinfo(r0); -} - -int -open_tcp(const char *port) -{ - unsigned u; - - for (u = 0; u < HERITAGE_NSOCKS; u++) { - heritage.sock_local[u] = -1; - heritage.sock_remote[u] = -1; + if (sd < 0) { + perror("socket()"); + freeaddrinfo(res); + return (-1); } - - create_listen_socket("localhost", port, - &heritage.sock_local[0], HERITAGE_NSOCKS); - - create_listen_socket(NULL, port, - &heritage.sock_remote[0], HERITAGE_NSOCKS); - - for (u = 0; u < HERITAGE_NSOCKS; u++) { - if (heritage.sock_local[u] >= 0) { - AZ(listen(heritage.sock_local[u], 16)); + val = 1; + if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof val) != 0) { + perror("setsockopt(SO_REUSEADDR, 1)"); + freeaddrinfo(res); + close(sd); + return (-1); + } + val = 0; + if (res->ai_family == AF_INET6 && + setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof val) != 0) { + perror("setsockopt(IPV6_V6ONLY, 0)"); + freeaddrinfo(res); + close(sd); + return (-1); + } + if (bind(sd, res->ai_addr, res->ai_addrlen) != 0) { + perror("bind()"); + freeaddrinfo(res); + close(sd); + return (-1); + } + if (listen(sd, 16) != 0) { + perror("listen()"); + freeaddrinfo(res); + close(sd); + return (-1); + } #ifdef HAVE_ACCEPT_FILTERS - accept_filter(heritage.sock_local[u]); + accept_filter(sd); #endif - } - if (heritage.sock_remote[u] >= 0) { - AZ(listen(heritage.sock_remote[u], 16)); -#ifdef HAVE_ACCEPT_FILTERS - accept_filter(heritage.sock_remote[u]); -#endif - } - } + heritage.socket = sd; return (0); } From des at projects.linpro.no Wed Aug 9 11:22:55 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 9 Aug 2006 13:22:55 +0200 (CEST) Subject: r777 - trunk/varnish-cache/bin/varnishd Message-ID: <20060809112255.88E6A1EC63C@projects.linpro.no> Author: des Date: 2006-08-09 13:22:55 +0200 (Wed, 09 Aug 2006) New Revision: 777 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_http.c Log: Cosmetic: redefine HTTP_HDR_* as an enum and rename MAX_HTTP_HDRS to HTTP_HDR_MAX. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-09 09:36:29 UTC (rev 776) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-09 11:22:55 UTC (rev 777) @@ -17,17 +17,19 @@ #include "common.h" #include "miniobj.h" -#define MAX_HTTP_HDRS 32 +enum { + HTTP_HDR_REQ, + HTTP_HDR_URL, + HTTP_HDR_PROTO, + HTTP_HDR_STATUS, + HTTP_HDR_RESPONSE, + /* add more here */ + HTTP_HDR_FIRST, + HTTP_HDR_MAX = 32 +}; -#define MAX_IOVS (MAX_HTTP_HDRS * 2) +#define MAX_IOVS (HTTP_HDR_MAX * 2) -#define HTTP_HDR_REQ 0 -#define HTTP_HDR_URL 1 -#define HTTP_HDR_PROTO 2 -#define HTTP_HDR_STATUS 3 -#define HTTP_HDR_RESPONSE 4 -#define HTTP_HDR_FIRST 5 - struct cli; struct vsb; struct sess; @@ -70,7 +72,7 @@ HTTP_Obj } logtag; - struct http_hdr hd[MAX_HTTP_HDRS]; + struct http_hdr hd[HTTP_HDR_MAX]; unsigned nhd; }; Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-09 09:36:29 UTC (rev 776) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-09 11:22:55 UTC (rev 777) @@ -274,7 +274,7 @@ p[2] == '-') hp->conds = 1; - if (hp->nhd < MAX_HTTP_HDRS) { + if (hp->nhd < HTTP_HDR_MAX) { hp->hd[hp->nhd].b = p; hp->hd[hp->nhd].e = q; VSLH(HTTP_T_Header, fd, hp, hp->nhd); @@ -573,7 +573,7 @@ static void http_seth(int fd, struct http *to, unsigned n, enum httptag tag, const char *fm) { - assert(n < MAX_HTTP_HDRS); + assert(n < HTTP_HDR_MAX); assert(fm != NULL); to->hd[n].b = (void*)(uintptr_t)fm; to->hd[n].e = (void*)(uintptr_t)strchr(fm, '\0'); @@ -584,7 +584,7 @@ http_copyh(int fd, struct http *to, struct http *fm, unsigned n, enum httptag tag) { - assert(n < MAX_HTTP_HDRS); + assert(n < HTTP_HDR_MAX); assert(fm->hd[n].b != NULL); to->hd[n].b = fm->hd[n].b; to->hd[n].e = fm->hd[n].e; @@ -640,9 +640,9 @@ CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); - assert(n < MAX_HTTP_HDRS); + assert(n < HTTP_HDR_MAX); assert(fm->hd[n].b != NULL); - if (to->nhd < MAX_HTTP_HDRS) { + if (to->nhd < HTTP_HDR_MAX) { to->hd[to->nhd].b = fm->hd[n].b; to->hd[to->nhd].e = fm->hd[n].e; VSLH(HTTP_T_Header, fd, to, to->nhd); @@ -692,7 +692,7 @@ { CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); - if (to->nhd >= MAX_HTTP_HDRS) { + if (to->nhd >= HTTP_HDR_MAX) { VSL_stats->losthdr++; VSL(T(to, HTTP_T_LostHeader), fd, "%s", hdr); return; @@ -712,7 +712,7 @@ va_start(ap, fmt); l = to->e - to->f; n = vsnprintf(to->f, l, fmt, ap); - if (n + 1 > l || to->nhd >= MAX_HTTP_HDRS) { + if (n + 1 > l || to->nhd >= HTTP_HDR_MAX) { VSL_stats->losthdr++; VSL(T(to, HTTP_T_LostHeader), fd, "%s", to->f); } else { From des at projects.linpro.no Wed Aug 9 11:24:39 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 9 Aug 2006 13:24:39 +0200 (CEST) Subject: r778 - in trunk/varnish-cache: bin/varnishd include lib/libvcl Message-ID: <20060809112439.2C2711EC670@projects.linpro.no> Author: des Date: 2006-08-09 13:24:39 +0200 (Wed, 09 Aug 2006) New Revision: 778 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/include/vcl_returns.h trunk/varnish-cache/include/vrt_obj.h trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl trunk/varnish-cache/lib/libvcl/vcc_obj.c Log: Add support for using separate backends for separate virtual hosts: - remove the obj.backend variable, which is not connected to anything. - define a req.backend variable and implement l/r functions for it - complete / correct support for setting / comparing backend values Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-09 11:22:55 UTC (rev 777) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-09 11:24:39 UTC (rev 778) @@ -178,6 +178,22 @@ /*--------------------------------------------------------------------*/ +void +VRT_l_req_backend(struct sess *sp, struct backend *be) +{ + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + sp->backend = be; +} + +struct backend * +VRT_r_req_backend(struct sess *sp) +{ + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + return (sp->backend); +} + +/*--------------------------------------------------------------------*/ + #define VREQ(n1, n2) \ const char * \ VRT_r_req_##n1(struct sess *sp) \ Modified: trunk/varnish-cache/include/vcl_returns.h =================================================================== --- trunk/varnish-cache/include/vcl_returns.h 2006-08-09 11:22:55 UTC (rev 777) +++ trunk/varnish-cache/include/vcl_returns.h 2006-08-09 11:24:39 UTC (rev 778) @@ -1,5 +1,5 @@ /* - * $Id: vcc_gen_fixed_token.tcl 638 2006-08-04 10:54:30Z phk $ + * $Id: /mirror/varnish/trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 30751 2006-08-04T10:54:30.556113Z phk $ * * NB: This file is machine generated, DO NOT EDIT! * Modified: trunk/varnish-cache/include/vrt_obj.h =================================================================== --- trunk/varnish-cache/include/vrt_obj.h 2006-08-09 11:22:55 UTC (rev 777) +++ trunk/varnish-cache/include/vrt_obj.h 2006-08-09 11:24:39 UTC (rev 778) @@ -1,5 +1,5 @@ /* - * $Id: vcc_gen_obj.tcl 555 2006-07-22 08:02:47Z phk $ + * $Id: /mirror/varnish/trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 30495 2006-07-22T08:02:47.026287Z phk $ * * NB: This file is machine generated, DO NOT EDIT! * @@ -14,16 +14,18 @@ void VRT_l_client_ip(struct sess *, const unsigned char *); const char * VRT_r_req_request(struct sess *); void VRT_l_req_request(struct sess *, const char *); +const char * VRT_r_req_host(struct sess *); +void VRT_l_req_host(struct sess *, const char *); const char * VRT_r_req_url(struct sess *); void VRT_l_req_url(struct sess *, const char *); const char * VRT_r_req_proto(struct sess *); void VRT_l_req_proto(struct sess *, const char *); +struct backend * VRT_r_req_backend(struct sess *); +void VRT_l_req_backend(struct sess *, struct backend *); double VRT_r_obj_valid(struct sess *); void VRT_l_obj_valid(struct sess *, double); double VRT_r_obj_cacheable(struct sess *); void VRT_l_obj_cacheable(struct sess *, double); -struct backend * VRT_r_obj_backend(struct sess *); -void VRT_l_obj_backend(struct sess *, struct backend *); double VRT_r_obj_ttl(struct sess *); void VRT_l_obj_ttl(struct sess *, double); const char * VRT_r_req_http_(struct sess *); Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-09 11:22:55 UTC (rev 777) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-09 11:24:39 UTC (rev 778) @@ -591,6 +591,13 @@ } static void +Cond_Backend(struct var *vp, struct tokenlist *tl) +{ + + Fc(tl, 1, "%s\n", vp->rname); +} + +static void Cond_2(struct tokenlist *tl) { struct var *vp; @@ -619,7 +626,7 @@ case IP: L(tl, vcc_Cond_Ip(vp, tl)); break; case STRING: L(tl, Cond_String(vp, tl)); break; case TIME: L(tl, Cond_Int(vp, tl)); break; - /* XXX backend == */ + case BACKEND: L(tl, Cond_Backend(vp, tl)); break; default: vsb_printf(tl->sb, "Variable '%s'" @@ -834,8 +841,9 @@ if (tl->t->tok == '=') { vcc_NextToken(tl); AddRef(tl, tl->t, R_BACKEND); - Fc(tl, 0, "= &VGC_backend_%.*s;\n", PF(tl->t)); + Fc(tl, 0, "VGC_backend_%.*s", PF(tl->t)); vcc_NextToken(tl); + Fc(tl, 0, ");\n"); break; } vsb_printf(tl->sb, "Illegal assignment operator "); Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2006-08-09 11:22:55 UTC (rev 777) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2006-08-09 11:24:39 UTC (rev 778) @@ -14,11 +14,12 @@ set spobj { { client.ip IP } { req.request STRING } + { req.host STRING } { req.url STRING } { req.proto STRING } + { req.backend BACKEND } { obj.valid BOOL } { obj.cacheable BOOL } - { obj.backend BACKEND } { obj.ttl TIME } { req.http. HEADER } } Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_obj.c 2006-08-09 11:22:55 UTC (rev 777) +++ trunk/varnish-cache/lib/libvcl/vcc_obj.c 2006-08-09 11:24:39 UTC (rev 778) @@ -30,6 +30,10 @@ "VRT_r_req_request(sp)", "VRT_l_req_request(sp, ", }, + { "req.host", STRING, 8, + "VRT_r_req_host(sp)", + "VRT_l_req_host(sp, ", + }, { "req.url", STRING, 7, "VRT_r_req_url(sp)", "VRT_l_req_url(sp, ", @@ -38,6 +42,10 @@ "VRT_r_req_proto(sp)", "VRT_l_req_proto(sp, ", }, + { "req.backend", BACKEND, 11, + "VRT_r_req_backend(sp)", + "VRT_l_req_backend(sp, ", + }, { "obj.valid", BOOL, 9, "VRT_r_obj_valid(sp)", "VRT_l_obj_valid(sp, ", @@ -46,10 +54,6 @@ "VRT_r_obj_cacheable(sp)", "VRT_l_obj_cacheable(sp, ", }, - { "obj.backend", BACKEND, 11, - "VRT_r_obj_backend(sp)", - "VRT_l_obj_backend(sp, ", - }, { "obj.ttl", TIME, 7, "VRT_r_obj_ttl(sp)", "VRT_l_obj_ttl(sp, ", @@ -78,16 +82,18 @@ "void VRT_l_client_ip(struct sess *, const unsigned char *);\n" "const char * VRT_r_req_request(struct sess *);\n" "void VRT_l_req_request(struct sess *, const char *);\n" + "const char * VRT_r_req_host(struct sess *);\n" + "void VRT_l_req_host(struct sess *, const char *);\n" "const char * VRT_r_req_url(struct sess *);\n" "void VRT_l_req_url(struct sess *, const char *);\n" "const char * VRT_r_req_proto(struct sess *);\n" "void VRT_l_req_proto(struct sess *, const char *);\n" + "struct backend * VRT_r_req_backend(struct sess *);\n" + "void VRT_l_req_backend(struct sess *, struct backend *);\n" "double VRT_r_obj_valid(struct sess *);\n" "void VRT_l_obj_valid(struct sess *, double);\n" "double VRT_r_obj_cacheable(struct sess *);\n" "void VRT_l_obj_cacheable(struct sess *, double);\n" - "struct backend * VRT_r_obj_backend(struct sess *);\n" - "void VRT_l_obj_backend(struct sess *, struct backend *);\n" "double VRT_r_obj_ttl(struct sess *);\n" "void VRT_l_obj_ttl(struct sess *, double);\n" "const char * VRT_r_req_http_(struct sess *);\n" From phk at phk.freebsd.dk Wed Aug 9 11:31:37 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Wed, 09 Aug 2006 11:31:37 +0000 Subject: r778 - in trunk/varnish-cache: bin/varnishd include lib/libvcl In-Reply-To: Your message of "Wed, 09 Aug 2006 13:24:39 +0200." <20060809112439.2C2711EC670@projects.linpro.no> Message-ID: <12375.1155123097@critter.freebsd.dk> In message <20060809112439.2C2711EC670 at projects.linpro.no>, des at projects.linpro.no writes: >Author: des >Date: 2006-08-09 13:24:39 +0200 (Wed, 09 Aug 2006) >New Revision: 778 > >Modified: > trunk/varnish-cache/bin/varnishd/cache_vrt.c > trunk/varnish-cache/include/vcl_returns.h > trunk/varnish-cache/include/vrt_obj.h > trunk/varnish-cache/lib/libvcl/vcc_compile.c > trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl > trunk/varnish-cache/lib/libvcl/vcc_obj.c >Log: >Add support for using separate backends for separate virtual hosts: > > - remove the obj.backend variable, which is not connected to anything. This was intended for the prefetcher I suspect, but I guess we can do a backend determination based on the objects stored headers. It's troublesome any however, because we might have changed VCL in the meantime, so I guess it was due to be removed anyway. > - define a req.backend variable and implement l/r functions for it > - complete / correct support for setting / comparing backend values >+void >+VRT_l_req_backend(struct sess *sp, struct backend *be) >+{ >+ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); >+ sp->backend = be; >+} This is only good while you hold a VCL reference, so please clear the field when we hit state DONE in cache_center.c at the same time we let go of the VCL reference. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at linpro.no Wed Aug 9 11:38:57 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Wed, 09 Aug 2006 13:38:57 +0200 Subject: r778 - in trunk/varnish-cache: bin/varnishd include lib/libvcl References: <12375.1155123097@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > Dag-Erling Sm?rgrav writes: > > void > > VRT_l_req_backend(struct sess *sp, struct backend *be) > > { > > CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); > > sp->backend = be; > > } > This is only good while you hold a VCL reference, so please > clear the field when we hit state DONE in cache_center.c at the > same time we let go of the VCL reference. Can you explain that in a little more detail please? DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From phk at phk.freebsd.dk Wed Aug 9 11:47:33 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Wed, 09 Aug 2006 11:47:33 +0000 Subject: r778 - in trunk/varnish-cache: bin/varnishd include lib/libvcl In-Reply-To: Your message of "Wed, 09 Aug 2006 13:38:57 +0200." Message-ID: <12462.1155124053@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= writes: >"Poul-Henning Kamp" writes: >> Dag-Erling Sm?rgrav writes: >> > void >> > VRT_l_req_backend(struct sess *sp, struct backend *be) >> > { >> > CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); >> > sp->backend = be; >> > } >> This is only good while you hold a VCL reference, so please >> clear the field when we hit state DONE in cache_center.c at the >> same time we let go of the VCL reference. > >Can you explain that in a little more detail please? The backend structure belongs to the VCL code, when you unload a VCL program, the backend will also disappear. While we process a request, the session hold a refcount on the VCL program so you cannot unload it while the VCL program is being used. I have generally tried to take care to NULL pointers that could risk dangling, and I'd like this also in this case so what's needed is: static int cnt_done(struct sess *sp) { double dh, dp, da; struct timespec te; assert(sp->obj == NULL); assert(sp->vbc == NULL); if (sp->fd >= 0 && sp->doclose != NULL) vca_close_session(sp, sp->doclose); >>> sp->backend = NULL; VCL_Rel(sp->vcl); sp->vcl = NULL; -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at projects.linpro.no Wed Aug 9 12:38:11 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 9 Aug 2006 14:38:11 +0200 (CEST) Subject: r779 - trunk/varnish-cache/bin/varnishd Message-ID: <20060809123811.03BCB1EC674@projects.linpro.no> Author: des Date: 2006-08-09 14:38:11 +0200 (Wed, 09 Aug 2006) New Revision: 779 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: Clear reference to backend when we release our VCL reference. Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-09 11:24:39 UTC (rev 778) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-09 12:38:11 UTC (rev 779) @@ -99,6 +99,7 @@ assert(sp->vbc == NULL); if (sp->fd >= 0 && sp->doclose != NULL) vca_close_session(sp, sp->doclose); + sp->backend = NULL; VCL_Rel(sp->vcl); sp->vcl = NULL; From des at projects.linpro.no Wed Aug 9 14:49:49 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 9 Aug 2006 16:49:49 +0200 (CEST) Subject: r780 - in trunk/varnish-cache: . bin/varnishd Message-ID: <20060809144949.317071EC67B@projects.linpro.no> Author: des Date: 2006-08-09 16:49:49 +0200 (Wed, 09 Aug 2006) New Revision: 780 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/configure.ac Log: Add an epoll()-based acceptor for Linux 2.6. Simple empirical tests indicate that epoll() performs significantly better than poll() (less CPU usage). Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-09 12:38:11 UTC (rev 779) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-09 14:49:49 UTC (rev 780) @@ -7,10 +7,13 @@ */ #undef ACCEPTOR_USE_KQUEUE +#undef ACCEPTOR_USE_EPOLL #undef ACCEPTOR_USE_POLL #if defined(HAVE_KQUEUE) #define ACCEPTOR_USE_KQUEUE 1 +#elif defined(HAVE_EPOLL_CTL) +#define ACCEPTOR_USE_EPOLL 1 #elif defined(HAVE_POLL) #define ACCEPTOR_USE_POLL 1 #else @@ -260,6 +263,125 @@ #endif /* ACCEPTOR_USE_POLL */ /*====================================================================*/ +#ifdef ACCEPTOR_USE_EPOLL + +#include + +static int epfd = -1; +static int pipes[2]; + +static TAILQ_HEAD(,sess) sesshead = TAILQ_HEAD_INITIALIZER(sesshead); + +static void +vca_add(int fd, void *data) +{ + struct epoll_event ev = { EPOLLIN | EPOLLPRI, { data } }; + AZ(epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &ev)); +} + +static void +vca_del(int fd) +{ + AZ(epoll_ctl(epfd, EPOLL_CTL_DEL, fd, NULL)); +} + +static void +vca_rcvhdev(struct sess *sp) +{ + + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); + TAILQ_INSERT_TAIL(&sesshead, sp, list); + vca_add(sp->fd, sp); +} + +static void +accept_f(int fd) +{ + struct sess *sp; + + sp = vca_accept_sess(fd); + if (sp == NULL) + return; + http_RecvPrep(sp->http); + vca_rcvhdev(sp); +} + +static void * +vca_main(void *arg) +{ + struct epoll_event ev; + struct timespec t; + struct sess *sp, *sp2; + int i; + + (void)arg; + + epfd = epoll_create(16); + assert(epfd >= 0); + + AZ(pipe(pipes)); + vca_add(pipes[0], pipes); + + if (heritage.socket >= 0) + vca_add(heritage.socket, accept_f); + + while (1) { + if (epoll_wait(epfd, &ev, 1, 5000) > 0) { + if (ev.data.ptr == pipes) { + i = read(pipes[0], &sp, sizeof sp); + assert(i == sizeof sp); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (http_RecvPrepAgain(sp->http)) + vca_handover(sp, 0); + else + vca_rcvhdev(sp); + } else if (ev.data.ptr == accept_f) { + accept_f(heritage.socket); + } else { + CAST_OBJ_NOTNULL(sp, ev.data.ptr, SESS_MAGIC); + i = http_RecvSome(sp->fd, sp->http); + if (i != -1) { + TAILQ_REMOVE(&sesshead, sp, list); + vca_del(sp->fd); + vca_handover(sp, i); + } + } + } + /* check for timeouts */ + clock_gettime(CLOCK_MONOTONIC, &t); + TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (sp->t_idle.tv_sec + 5 < t.tv_sec) { + TAILQ_REMOVE(&sesshead, sp, list); + vca_del(sp->fd); + vca_close_session(sp, "timeout"); + vca_return_session(sp); + continue; + } + } + } + + INCOMPL(); +} + +/*--------------------------------------------------------------------*/ + +void +vca_return_session(struct sess *sp) +{ + + if (sp->fd < 0) { + SES_Delete(sp); + return; + } + (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); + VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); + assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); +} + +#endif /* ACCEPTOR_USE_EPOLL */ +/*====================================================================*/ #ifdef ACCEPTOR_USE_KQUEUE #include Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-09 12:38:11 UTC (rev 779) +++ trunk/varnish-cache/configure.ac 2006-08-09 14:49:49 UTC (rev 780) @@ -90,6 +90,7 @@ # Check which mechanism to use for the acceptor AC_CHECK_FUNCS([kqueue]) +AC_CHECK_FUNCS([epoll_ctl]) AC_CHECK_FUNCS([poll]) AC_CONFIG_FILES([ From phk at phk.freebsd.dk Wed Aug 9 15:39:29 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Wed, 09 Aug 2006 15:39:29 +0000 Subject: r780 - in trunk/varnish-cache: . bin/varnishd In-Reply-To: Your message of "Wed, 09 Aug 2006 16:49:49 +0200." <20060809144949.317071EC67B@projects.linpro.no> Message-ID: <13321.1155137969@critter.freebsd.dk> In message <20060809144949.317071EC67B at projects.linpro.no>, des at projects.linpro .no writes: >Author: des >Date: 2006-08-09 16:49:49 +0200 (Wed, 09 Aug 2006) >New Revision: 780 > >Modified: > trunk/varnish-cache/bin/varnishd/cache_acceptor.c > trunk/varnish-cache/configure.ac >Log: >Add an epoll()-based acceptor for Linux 2.6. Simple empirical tests indicate >that epoll() performs significantly better than poll() (less CPU usage). Would it make more sense to break these out into separate files now that we have three ? -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at linpro.no Wed Aug 9 20:44:00 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Wed, 09 Aug 2006 22:44:00 +0200 Subject: r780 - in trunk/varnish-cache: . bin/varnishd References: <13321.1155137969@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > Would it make more sense to break these out into separate files now > that we have three ? It would, but there's bigger fish to fry right now. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From andersb at projects.linpro.no Thu Aug 10 07:38:47 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Thu, 10 Aug 2006 09:38:47 +0200 (CEST) Subject: r781 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060810073847.C9F981EC676@projects.linpro.no> Author: andersb Date: 2006-08-10 09:38:47 +0200 (Thu, 10 Aug 2006) New Revision: 781 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Added some more meat to the program. Loads of debug code still on. Next step is to add the correct time. It's a bit tricky, and I haven't gotten it right just yet. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-09 14:49:49 UTC (rev 780) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-10 07:38:47 UTC (rev 781) @@ -37,8 +37,11 @@ struct logline { char df_h[4 * (3 + 1)]; // Datafield for %h (IP adress) + int df_hfini; // Set to 1 when a SessionClose is seen. unsigned char *df_r; // Datafield for %r (Request) - + int df_rfini; // Set to 1 when a ReqServTime has come. + unsigned char *df_s; // Datafield for %s, Status + unsigned char *df_b; // Datafield for %b, Bytes }; /* We make a array of pointers to vsb's. Sbuf is a string buffer. @@ -88,6 +91,8 @@ v = 0; w = 0; + ll[u].df_rfini = 0; + ll[u].df_hfini = 0; switch (p[0]) { @@ -101,53 +106,105 @@ j = strlen(p + 4) - strlen(tmpPtr); // length of IP strncpy(ll[u].df_h, p + 4, j); ll[u].df_h[j] = '\0'; // put on a NULL at end of buffer. - //printf("New session [%d]: %s \n",u, ll[u].df_h); + printf("New session [%d]: %s \n",u, ll[u].df_h); break; - case SLT_RxRequest: + case SLT_XID: + // We use XID to catch that a new request is comming inn. + break; + case SLT_RxRequest: + + sbuf_clear(ob[u]); + + if (p[1] >= 4 && !strncasecmp((void *)&p[4], "HEAD",4)){ + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + //printf("Got a HEAD\n"); + } + + else if (p[1] >= 4 && !strncasecmp((void *)&p[4], "POST",4)){ + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + //printf("Got a POST\n"); + } + + else if (p[1] >= 3 && !strncasecmp((void *)&p[4], "GET",3)){ + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + //printf("Got a GET\n"); + } + + else { + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + //printf("Got something other than HEAD, POST, GET\n"); + } + + break; + case SLT_RxURL: - + + sbuf_cat(ob[u], " "); + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + break; case SLT_RxProtocol: + sbuf_cat(ob[u], " "); + sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + break; + case SLT_TxStatus: + + ll[u].df_s = strdup(p + 4); + + break; + case SLT_RxHeader: break; + case SLT_ReqEnd: + // We use ReqServTime to find how the time the request was delivered + // also to define that a request is finished. + + ll[u].df_rfini = 1; + printf("ReqServTime [%d]\n", u); + break; - case SLT_TxStatus: - - break; - case SLT_Length: + // XXX ask DES or PHK about this one. Am I overflowing? + + ll[u].df_b = strdup(p + 4); + if (!atoi(ll[u].df_b)){ + ll[u].df_b[0] = '-'; + ll[u].df_b[1] = '\0'; + } + + break; case SLT_SessionClose: // Session is closed, we clean up things. But do not write. - //printf("Session close [%d]\n", u); + printf("Session close [%d]\n", u); - v = 1; + ll[u].df_hfini = 1; - break; case SLT_SessionReuse: - // It's in SessionReuse we wrap things up. - // SessionClose is not suited to use for a write, but to clean up. + // We use SessionReuse to catch the IP adress of a session that has already + // started with a SessionOpen that we did not catch. + // Other than that it is not used. // Catch IP if not already done. @@ -161,10 +218,8 @@ printf("Got IP from Reuse [%d] : %s\n", u, ll[u].df_h); } - //printf("Session reuse [%d]\n", u); + printf("Session reuse [%d]\n", u); - w = 1; - break; default: @@ -172,20 +227,44 @@ break; } - if (v) { - // We have a SessionClose. Lets clean. - // - // Clean IP adress - ll[u].df_h[0] = '\0'; - - } - if (w) { - // We have a SessionReuse. Lets print the logline - // + if (ll[u].df_rfini) { + // We have a ReqServTime. Lets print the logline + // and clear variables that are different for each request. - printf("%s ", ll[u].df_h); + printf("[%d] %s ", u, ll[u].df_h ); + sbuf_finish(ob[u]); + printf("\"%s\"", sbuf_data(ob[u])); + printf(" %s %s ", ll[u].df_s, ll[u].df_b); printf("\n"); + sbuf_clear(ob[u]); + + ll[u].df_rfini = 0; + + // Clear the TxStaus + + if (ll[u].df_s != NULL){ + free(ll[u].df_s); + printf("Freed df_s\n"); + } + + if (ll[u].df_b != NULL){ + free(ll[u].df_b); + printf("Freed df_b\n"); + } + + if (ll[u].df_hfini) { + // We have a SessionClose. Lets clean data. + // + // Clean IP adress + ll[u].df_h[0] = '\0'; + printf("Clearer [%d]\n", u); + + } + + + + } From des at projects.linpro.no Thu Aug 10 08:56:42 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Thu, 10 Aug 2006 10:56:42 +0200 (CEST) Subject: r782 - trunk/varnish-cache/bin/varnishd Message-ID: <20060810085642.D626F1EC690@projects.linpro.no> Author: des Date: 2006-08-10 10:56:42 +0200 (Thu, 10 Aug 2006) New Revision: 782 Modified: trunk/varnish-cache/bin/varnishd/tcp.c Log: FreeBSD needs for IPPROTO_IPV6 and IPV6_V6ONLY. Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-10 07:38:47 UTC (rev 781) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-10 08:56:42 UTC (rev 782) @@ -5,6 +5,8 @@ #include #include +#include + #include #include #include From des at linpro.no Thu Aug 10 08:57:12 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Thu, 10 Aug 2006 10:57:12 +0200 Subject: r781 - trunk/varnish-cache/bin/varnishncsa References: <20060810073847.C9F981EC676@projects.linpro.no> Message-ID: andersb at projects.linpro.no writes: > Log: > Added some more meat to the program. Loads of debug code still on. > > Next step is to add the correct time. It's a bit tricky, and I > haven't gotten it right just yet. > [...] > + sbuf_clear(ob[u]); Please don't commit code that doesn't compile. If Subversion tells you your working copy is out of date, you need to update *and test everything* before you commit. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From andersb at projects.linpro.no Thu Aug 10 11:10:16 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Thu, 10 Aug 2006 13:10:16 +0200 (CEST) Subject: r783 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060810111016.1B0071EC645@projects.linpro.no> Author: andersb Date: 2006-08-10 13:10:16 +0200 (Thu, 10 Aug 2006) New Revision: 783 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Updated to work with new inner workings (ReqStart, ReqEnd, sbuf replacement etc). Code now compiles. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-10 08:56:42 UTC (rev 782) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-10 11:10:16 UTC (rev 783) @@ -110,7 +110,7 @@ break; - case SLT_XID: + case SLT_ReqStart: // We use XID to catch that a new request is comming inn. @@ -118,25 +118,25 @@ case SLT_RxRequest: - sbuf_clear(ob[u]); + vsb_clear(ob[u]); if (p[1] >= 4 && !strncasecmp((void *)&p[4], "HEAD",4)){ - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + vsb_bcat(ob[u], p + 4, strlen(p + 4)); //printf("Got a HEAD\n"); } else if (p[1] >= 4 && !strncasecmp((void *)&p[4], "POST",4)){ - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + vsb_bcat(ob[u], p + 4, strlen(p + 4)); //printf("Got a POST\n"); } else if (p[1] >= 3 && !strncasecmp((void *)&p[4], "GET",3)){ - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + vsb_bcat(ob[u], p + 4, strlen(p + 4)); //printf("Got a GET\n"); } else { - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + vsb_bcat(ob[u], p + 4, strlen(p + 4)); //printf("Got something other than HEAD, POST, GET\n"); } @@ -144,15 +144,15 @@ case SLT_RxURL: - sbuf_cat(ob[u], " "); - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + vsb_cat(ob[u], " "); + vsb_bcat(ob[u], p + 4, strlen(p + 4)); break; case SLT_RxProtocol: - sbuf_cat(ob[u], " "); - sbuf_bcat(ob[u], p + 4, strlen(p + 4)); + vsb_cat(ob[u], " "); + vsb_bcat(ob[u], p + 4, strlen(p + 4)); break; @@ -233,11 +233,11 @@ // and clear variables that are different for each request. printf("[%d] %s ", u, ll[u].df_h ); - sbuf_finish(ob[u]); - printf("\"%s\"", sbuf_data(ob[u])); + vsb_finish(ob[u]); + printf("\"%s\"", vsb_data(ob[u])); printf(" %s %s ", ll[u].df_s, ll[u].df_b); printf("\n"); - sbuf_clear(ob[u]); + vsb_clear(ob[u]); ll[u].df_rfini = 0; From andersb at projects.linpro.no Thu Aug 10 11:48:24 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Thu, 10 Aug 2006 13:48:24 +0200 (CEST) Subject: r784 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060810114824.5CA8F1EC690@projects.linpro.no> Author: andersb Date: 2006-08-10 13:48:24 +0200 (Thu, 10 Aug 2006) New Revision: 784 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Got the requesttime right this time. I am noticing free()'s that are freeing empty variables/pointers. Have to find where is happens. Also noticing IP adresses not set correctly. Still load of debugcode. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-10 11:10:16 UTC (rev 783) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-10 11:48:24 UTC (rev 784) @@ -42,6 +42,7 @@ int df_rfini; // Set to 1 when a ReqServTime has come. unsigned char *df_s; // Datafield for %s, Status unsigned char *df_b; // Datafield for %b, Bytes + struct tm *logline_time; // Datafield for %t }; /* We make a array of pointers to vsb's. Sbuf is a string buffer. @@ -83,6 +84,15 @@ unsigned char *tmpPtr; int j; + // Used for requesttime. + char *tmpPtra; + char *tmpPtrb; + char *tmpPtrc; + int timesec = 0; // Where we store the utime for request as int. + char temp_time[27]; // Where we store the string we take from the log + time_t req_time; // Timeobject used for making the requesttime. + int i; + u = (p[2] << 8) | p[3]; if (ob[u] == NULL) { ob[u] = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); @@ -91,6 +101,8 @@ v = 0; w = 0; + i = 0; + j = 0; ll[u].df_rfini = 0; ll[u].df_hfini = 0; @@ -172,6 +184,30 @@ // We use ReqServTime to find how the time the request was delivered // also to define that a request is finished. + tmpPtra = strdup(p + 4); + temp_time[0] = '\0'; + + for ( tmpPtrb = strtok(tmpPtra," "); tmpPtrb != NULL; tmpPtrb = strtok(NULL, " ")){ + if (i == 1){ + // We have the right time + free(tmpPtra); + tmpPtra = tmpPtrb; + } + //printf("ReqServTime number %d: %s\n", i, tmpPtrb); + + i++; + } + tmpPtrc = strchr(tmpPtra, '.'); + j = strlen(tmpPtrc); // length of timestamp + //printf("j=%d\n", j); + strncpy(temp_time, tmpPtra, j); + temp_time[j] = '\0'; + //printf("inten: %s\n",temp_time); + timesec = atoi(temp_time); + req_time = timesec; + ll[u].logline_time = localtime(&req_time); + strftime (temp_time, 50, "[%d/%b/%Y:%X %z] ", ll[u].logline_time); + ll[u].df_rfini = 1; printf("ReqServTime [%d]\n", u); @@ -224,6 +260,8 @@ default: + // printf("DEBUG: %s\n", p+4); + break; } @@ -232,7 +270,7 @@ // We have a ReqServTime. Lets print the logline // and clear variables that are different for each request. - printf("[%d] %s ", u, ll[u].df_h ); + printf("[%d] %s - - %s ", u, ll[u].df_h, temp_time ); vsb_finish(ob[u]); printf("\"%s\"", vsb_data(ob[u])); printf(" %s %s ", ll[u].df_s, ll[u].df_b); From des at projects.linpro.no Thu Aug 10 13:03:10 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Thu, 10 Aug 2006 15:03:10 +0200 (CEST) Subject: r785 - trunk/varnish-cache/bin/varnishd Message-ID: <20060810130310.2FA213BC075@projects.linpro.no> Author: des Date: 2006-08-10 15:03:09 +0200 (Thu, 10 Aug 2006) New Revision: 785 Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c Log: Rewrite pass_chunked(). Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-10 11:48:24 UTC (rev 784) +++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-10 13:03:09 UTC (rev 785) @@ -61,8 +61,7 @@ pass_chunked(struct sess *sp, int fd, struct http *hp) { int i, j; - char *b, *q, *e; - char *p; + char *p, *q; unsigned u; char buf[PASS_BUFSIZ]; char *bp, *be; @@ -76,62 +75,64 @@ p = buf; while (1) { i = http_Read(hp, fd, bp, be - bp); - i = read(fd, bp, be - bp); - assert(i > 0); + assert(i >= 0); + if (i == 0 && p == bp) + break; bp += i; /* buffer valid from p to bp */ + assert(bp >= p); + /* chunk starts with f("%x\r\n", len) */ u = strtoul(p, &q, 16); - if (q == NULL || (*q != '\n' && *q != '\r')) { - INCOMPL(); - /* XXX: move bp to buf start, get more */ + while (q && q < bp && *q == ' ') + /* shouldn't happen - but sometimes it does */ + q++; + if (q == NULL || q > bp - 2 /* want \r\n in same buffer */) { + /* short - move to start of buffer and extend */ + memmove(buf, p, bp - p); + bp -= p - buf; + p = buf; + continue; } - if (*q == '\r') - q++; + assert(*q == '\r'); + q++; assert(*q == '\n'); q++; - if (u == 0) + + /* we just received the final zero-length chunk */ + if (u == 0) { + sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, p, q - p); break; + } - sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, p, q - p); + /* include chunk header */ + u += q - p; - p = q; + /* include trailing \r\n with chunk */ + u += 2; - while (u > 0) { + for (;;) { j = u; - if (bp == p) { - bp = p = buf; - break; - } if (bp - p < j) j = bp - p; sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, p, j); + WRK_Flush(sp->wrk); p += j; u -= j; - } - while (u > 0) { - if (http_GetTail(hp, u, &b, &e)) { - j = e - b; - sp->wrk->acct.bodybytes += - WRK_Write(sp->wrk, q, j); - u -= j; - } else + assert(u >= 0); + if (u == 0) break; - } - if (WRK_Flush(sp->wrk)) - vca_close_session(sp, "remote closed"); - while (u > 0) { + p = bp = buf; j = u; - if (j > sizeof buf) - j = sizeof buf; - i = read(fd, buf, j); + if (j > be - bp) + j = be - bp; + i = http_Read(hp, fd, bp, j); assert(i > 0); - sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, buf, i); - u -= i; - if (WRK_Flush(sp->wrk)) - vca_close_session(sp, "remote closed"); + bp += i; } } + if (WRK_Flush(sp->wrk)) + vca_close_session(sp, "remote closed"); return (0); } @@ -155,6 +156,9 @@ http_CopyResp(sp->fd, sp->http, vc->http); http_FilterHeader(sp->fd, sp->http, vc->http, HTTPH_A_PASS); http_PrintfHeader(sp->fd, sp->http, "X-Varnish: %u", sp->xid); + /* XXX */ + if (http_HdrIs(vc->http, H_Transfer_Encoding, "chunked")) + http_PrintfHeader(sp->fd, sp->http, "Transfer-Encoding: chunked"); WRK_Reset(sp->wrk, &sp->fd); sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1); From des at projects.linpro.no Thu Aug 10 14:04:35 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Thu, 10 Aug 2006 16:04:35 +0200 (CEST) Subject: r786 - in branches: . 0.9/varnish-cache Message-ID: <20060810140435.C2EFE1EC650@projects.linpro.no> Author: des Date: 2006-08-10 16:04:35 +0200 (Thu, 10 Aug 2006) New Revision: 786 Added: branches/0.9/ Modified: branches/0.9/varnish-cache/configure.ac Log: Fork 0.9. Copied: branches/0.9 (from rev 785, trunk) Modified: branches/0.9/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-10 13:03:09 UTC (rev 785) +++ branches/0.9/varnish-cache/configure.ac 2006-08-10 14:04:35 UTC (rev 786) @@ -3,7 +3,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [trunk], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [0.9], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) From des at projects.linpro.no Thu Aug 10 14:06:50 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Thu, 10 Aug 2006 16:06:50 +0200 (CEST) Subject: r787 - branches/0.9/varnish-cache Message-ID: <20060810140650.E7C121EC65C@projects.linpro.no> Author: des Date: 2006-08-10 16:06:50 +0200 (Thu, 10 Aug 2006) New Revision: 787 Added: branches/0.9/varnish-cache/ChangeLog Log: Regenerate Added: branches/0.9/varnish-cache/ChangeLog =================================================================== --- branches/0.9/varnish-cache/ChangeLog 2006-08-10 14:04:35 UTC (rev 786) +++ branches/0.9/varnish-cache/ChangeLog 2006-08-10 14:06:50 UTC (rev 787) @@ -0,0 +1,6012 @@ +2006-08-10 14:04 des + + * branches/0.9, branches/0.9/varnish-cache/configure.ac: Fork 0.9. + +2006-08-10 13:03 des + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: Rewrite + pass_chunked(). + +2006-08-10 11:48 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Got the + requesttime right this time. + + I am noticing free()'s that are freeing empty + variables/pointers. Have to find where is happens. + Also noticing IP adresses not set correctly. + + Still load of debugcode. + +2006-08-10 11:10 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Updated to + work with new inner workings (ReqStart, ReqEnd, sbuf replacement + etc). + + Code now compiles. + +2006-08-10 08:56 des + + * trunk/varnish-cache/bin/varnishd/tcp.c: FreeBSD needs + for IPPROTO_IPV6 and IPV6_V6ONLY. + +2006-08-10 07:38 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Added some + more meat to the program. Loads of debug code still on. + + Next step is to add the correct time. It's a bit tricky, and I + haven't gotten it right just yet. + +2006-08-09 14:49 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/configure.ac: Add an epoll()-based acceptor + for Linux 2.6. Simple empirical tests indicate + that epoll() performs significantly better than poll() (less CPU + usage). + +2006-08-09 12:38 des + + * trunk/varnish-cache/bin/varnishd/cache_center.c: Clear reference + to backend when we release our VCL reference. + +2006-08-09 11:24 des + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: Add support for using + separate backends for separate virtual hosts: + + - remove the obj.backend variable, which is not connected to + anything. + - define a req.backend variable and implement l/r functions for + it + - complete / correct support for setting / comparing backend + values + +2006-08-09 11:22 des + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c: Cosmetic: + redefine HTTP_HDR_* as an enum and rename MAX_HTTP_HDRS to + HTTP_HDR_MAX. + +2006-08-09 09:36 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/tcp.c: Rewrite open_tcp(): use + only one listening socket. Try for a combined + IPv6 / IPv4 socket; if IPv6 is not available, fall back to an + IPv4 socket. + +2006-08-08 14:52 des + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: While FreeBSD + defaults to MAP_SHARED, Linux requires either MAP_SHARED or + MAP_PRIVATE to be specified. Do so. + +2006-08-08 14:00 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/configure.ac: Autodetect the need to link + against libdl for dlopen(). + +2006-08-08 12:57 des + + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat/setproctitle.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/setproctitle.c: Add a + setproctitle() stub to libcompat. + +2006-08-08 12:57 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: #include + "compat/srandomdev.h" for srandomdev() + +2006-08-08 12:55 des + + * trunk/varnish-cache/include/compat/vis.h, + trunk/varnish-cache/lib/libcompat/vis.c: Expand keywords. + +2006-08-08 12:46 des + + * trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/configure.ac: #include for + fstatfs if it is available. + +2006-08-08 12:45 des + + * trunk/varnish-cache/configure.ac: Now that we define + _GNU_SOURCE, the asprintf() / vasprintf() hack is no + longer required. + +2006-08-08 12:42 des + + * trunk/varnish-cache/configure.ac: Defining _GNU_SOURCE gives us + native asprintf() and strptime() on glibc + systems, and has no effect on FreeBSD. + +2006-08-08 12:31 des + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat/vis.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/vis.c: Bring in FreeBSD's + version of vis(3), strvis(3) and strvisx(3). + +2006-08-08 12:15 des + + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat/srandomdev.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/srandomdev.c: Add a simple + srandomdev() implementation inspired by the one in FreeBSD. + +2006-08-08 09:15 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: The correct + header for poll() is , not like the Linux + man page says (poll() is an XSI extension in SUSv[23]) + +2006-08-08 07:47 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/configure.ac: Autodetect the availability of + kqueue() and / or poll(). + +2006-08-08 07:47 des + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: #include + "libvarnish.h" for varnish_version(). + +2006-08-08 07:36 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: Add back + sendfile support (under #ifdef HAVE_SENDFILE) but don't engage + it for small objects on the suspicion that it has highish setup + cost. + +2006-08-08 07:17 des + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat, + trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/include/compat/asprintf.h, + trunk/varnish-cache/include/compat/strlcat.h, + trunk/varnish-cache/include/compat/strlcpy.h, + trunk/varnish-cache/include/compat/vasprintf.h, + trunk/varnish-cache/lib/libcompat/asprintf.c, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c, + trunk/varnish-cache/lib/libcompat/vasprintf.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c: Split compat.h + into one header per function to avoid issues with e.g. the + vasprintf() prototype needing even when it isn't used. + +2006-08-08 07:15 des + + * trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishstat/Makefile.am: + varnish{ncsa,stat} also need librt. + +2006-08-08 07:03 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/configure.ac: Attempt to detect the + availability of RSA's MD5 implementation, and the + need to link against libmd to get it. + Attempt to detect the need for linking against librt to get + clock_gettime(). + +2006-08-08 07:01 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: Fix braino + +2006-08-08 06:39 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: Default to 4096 + buckets and 256 mutexes + +2006-08-08 06:38 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: Use crc32 hash + by default, MD5 is a compile time option + +2006-08-08 06:37 phk + + * trunk/varnish-cache/bin/varnishd/flint.lnt: lbv_assert never + returns + +2006-08-07 21:08 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: 64bit changes + +2006-08-07 21:01 phk + + * trunk/varnish-cache/configure.ac: Add -Wformat and remove + -fno-inline which disables it. + +2006-08-07 21:01 phk + + * trunk/varnish-cache/lib/libvarnish/assert.c: Fix printf format + error + +2006-08-07 20:50 phk + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/configure.ac: Update to new shmlog tag + +2006-08-07 20:47 phk + + * trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_priv.h, + trunk/varnish-cache/lib/libvcl/vcc_token.c: Eliminate use of + extensible printf + +2006-08-07 20:24 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Improve the "-d" + and "-d -d" facilities. + + When we close a CLI and it had fd# 0 and/or fd#1, reopen these + as /dev/null so the will not be reused for the CLI pipe to the + child on next restart, otherwise stdout/stderr output from the + manager would get sent there and confuse the clients CLI reader. + + Don't double free a pointer to the CLI buffer. + + Accept non-zero results from cli_readres() errors are non-fatal. + + Use stderr more consistently for manager debugging. + +2006-08-07 18:33 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: An assert to catch + silly errors. + +2006-08-07 17:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/include/shmlog_tags.h: Rename SHMlog tags + for consistency + XID -> ReqStart + ReqServTime -> ReqEnd + +2006-08-07 17:18 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Remove printf + extensions used for development debugging + +2006-08-07 17:18 phk + + * trunk/varnish-cache/include/libvarnish.h: Make assert do the + right thing + +2006-08-07 17:15 phk + + * trunk/varnish-cache/lib/libvcl/vcc_token.c: Clean up #includes + +2006-08-07 17:10 phk + + * trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/assert.c: Call __assert() + lbv_assert() instead. + +2006-08-07 17:08 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/lib/libvarnish/assert.c: quench warnings + related to libvarnish.h + +2006-08-07 16:45 des + + * trunk/varnish-cache/configure.ac: Don't trust the documentation + - when it says "additional headers", it + actually means "additional code to place before main() in the + test program" + +2006-08-07 16:42 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishtester/varnishtester.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/assert.c: Add our own assert + in libvarnish.h + + Include libvarnish.h from cache.h and mgt.h + +2006-08-07 16:29 des + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: #include + "libvarnish.h" for varnish_version(). + +2006-08-07 16:26 des + + * trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c: #include + "compat.h" for asprintf(). + +2006-08-07 16:24 des + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: vsb.h is not a + system header. + +2006-08-07 16:23 des + + * trunk/varnish-cache/bin/varnishtop/varnishtop.c: #include + "libvarnish.h" for varnish_version(). + +2006-08-07 16:23 des + + * trunk/varnish-cache/bin/varnishd/mgt_vcc.c: #include "compat.h" + for asprintf(). Sort includes. + +2006-08-07 16:20 des + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Define INFTIM if it + isn't already. + +2006-08-07 16:20 des + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Spell SIZE_MAX + correctly. + +2006-08-07 16:17 des + + * trunk/varnish-cache/bin/varnishd/mgt_event.c: Define INFTIM if + it isn't already. + +2006-08-07 16:17 des + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: #include + for asprintf(). + +2006-08-07 16:15 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: Handle CLI trouble + with the childproc + +2006-08-07 16:14 phk + + * trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/lib/libvarnish/cli_common.c: Add CLIS_COMMS + errno (400) and return an error text as well. + +2006-08-07 16:11 des + + * trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/configure.ac: Check whether we have accept + filters before trying to use them. + +2006-08-07 16:05 phk + + * trunk/varnish-cache/lib/libvarnish/cli_common.c: Handle read + errors on the cli pipes. + +2006-08-07 15:54 des + + * trunk/varnish-cache/configure.ac: Improve descriptions of + HAVE_ASPRINTF / HAVE_VASPRINTF. + +2006-08-07 15:54 phk + + * trunk/varnish-cache/lib/libvarnish/vsb.c: Quench warnings. + +2006-08-07 15:51 des + + * trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/lib/libcompat/vasprintf.c: My idiocy knows + no bounds. Make sure this actually builds. + +2006-08-07 15:47 des + + * trunk/varnish-cache/configure.ac: Improve detection of the + presence and usability of asprintf() / vasprintf(). + +2006-08-07 15:42 des + + * trunk/varnish-cache/include/compat.h: paste-o. + +2006-08-07 15:24 des + + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/asprintf.c, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c, + trunk/varnish-cache/lib/libcompat/vasprintf.c: Add + implementations of asprintf(3) and vasprintf(3). + +2006-08-07 15:09 des + + * trunk/varnish-cache/include/libvarnish.h: Relucantly include + for time_t. We'll have to clean up our header + files at some point. + +2006-08-07 15:08 des + + * trunk/varnish-cache/bin/varnishd/shmlog.c: Remove redundant + definition of __assert(). + +2006-08-07 15:00 des + + * trunk/varnish-cache/include/libvarnish.h: TIM_{format,parse}() + are used unconditionally, so declare them unconditionally. + +2006-08-07 15:00 des + + * trunk/varnish-cache/bin/varnishd/cache.h: Sort includes, add + for uint64_t. + +2006-08-07 14:55 des + + * trunk/varnish-cache/lib/libvcl/vcc_compile.c: Eliminate __unused. + +2006-08-07 14:52 des + + * trunk/varnish-cache/lib/libvarnish/cli_common.c: Sort includes, + add for uintptr_t. + +2006-08-07 12:42 des + + * trunk/varnish-cache/lib/libvarnish/vsb.3: Define + str-Lb-libvarnish so ".Lb libvarnish" will work. This should be + in + a shared file somewhere with some soelim magic in the Makefile, + but don't + bother right now - the file isn't installed anyway. + +2006-08-07 12:35 des + + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/version.c: Add a -V option + (display version and exit) to all programs. + +2006-08-07 11:09 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_re.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/cli_common.h, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/include/sbuf.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/include/vsb.h, + trunk/varnish-cache/lib/Makefile.am, + trunk/varnish-cache/lib/libsbuf, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/cli_common.c, + trunk/varnish-cache/lib/libvarnish/vsb.3, + trunk/varnish-cache/lib/libvarnish/vsb.c, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: Fold libsbuf into + libvarnish, with s/sbuf/vsb/g. + +2006-08-07 10:46 phk + + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: Timeout pipe + connections after 600 seconds. + +2006-08-07 10:40 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Use a 600 + second timeout, 120 second is too little. + +2006-08-07 09:21 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Set + SO_SNDTIMEO to 120 seconds + +2006-08-07 08:42 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: First step of + slow client handling: Lose the stevedore function + for sending and instead record the fd+off_t in the storage + object. + + This eliminates sendfile from storage_file.c, next step is to put + it back in the generic code in cache_response.c + +2006-08-07 05:52 des + + * trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvarnish/cli_common.c: Update #include + directives. + +2006-08-07 05:49 des + + * trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/include/binary_heap.h, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/miniobj.h, + trunk/varnish-cache/include/stats.h, + trunk/varnish-cache/include/varnish/assert.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/binary_heap.c, + trunk/varnish-cache/lib/libvarnish/cli.c, + trunk/varnish-cache/lib/libvarnish/time.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_log.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_util.c: Expand + keywords. + +2006-08-07 05:49 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/cli_common.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/cli_common.c: Move + common_cli.[ch] out of varnishd, and rename them to + cli_common.[ch]. + +2006-08-07 05:47 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am: List headers in + noinst_HEADERS instead of SOURCES. + +2006-08-07 00:21 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Fresh start + after study of output from varnishlog -o. + + First off is IP adress logging and clearing. + +2006-08-06 17:00 des + + * trunk/varnish-cache: Add compile to svn:ignore. + +2006-08-06 16:55 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Make + -w - + work as expected. + +2006-08-06 15:02 des + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishtester/Makefile.am, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libsbuf/Makefile.am, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am, + trunk/varnish-cache/lib/libvcl/Makefile.am: Systematically + include config.h. + +2006-08-06 14:33 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am: Forcibly include + config.h. + +2006-08-06 13:51 des + + * trunk/varnish-cache/configure.ac: Change version to "trunk" + until I can figure out a way to have it reflect + the current date. + +2006-08-06 13:49 des + + * trunk/varnish-cache/configure.ac: Include -pipe in CFLAGS. + Reduce optimization level to -O when debugging. + +2006-08-06 12:51 des + + * trunk/varnish-cache: Adjust directory properties. + +2006-08-06 12:49 des + + * trunk/varnish-cache/bin/varnishlog, + trunk/varnish-cache/bin/varnishncsa, + trunk/varnish-cache/bin/varnishstat, + trunk/varnish-cache/bin/varnishtester, + trunk/varnish-cache/bin/varnishtop, + trunk/varnish-cache/lib/libcompat, + trunk/varnish-cache/lib/libsbuf, trunk/varnish-cache/lib/libvcl: + Adjust directory properties. + +2006-08-06 12:26 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishstat/Makefile.am: Add missing + headers and man pages. + +2006-08-06 12:26 des + + * trunk/varnish-cache/autogen.sh: We no longer have any + CONFIG_SUBDIRS. + +2006-08-06 12:25 des + + * trunk/varnish-cache/include/Makefile.am: Add missing headers. + +2006-08-06 12:23 des + + * trunk/varnish-cache/Makefile.am: Umm, *really* retire libevent. + +2006-08-06 12:23 des + + * trunk/varnish-cache/Makefile.am, + trunk/varnish-cache/configure.ac, trunk/varnish-cache/contrib: + Retire libevent. + +2006-08-06 12:20 des + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/configure.ac: Fully disconnect varnishtester. + +2006-08-06 00:44 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: I have + realized that I have major structure problems. I will have to + study varnishlog output a bit more to understand it better. + + May wanna start clean again, and use hardearned knowledge to + make better and more robust structure. + +2006-08-05 22:43 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Checks show + that my IP adress checker is very restrictive and probably + deletes other loglines. We still bleeds null lines also. + + This will have to be cleaned up. + +2006-08-05 22:12 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Loglines with + no IP should no longer appear. That also cleared all lines + containing a null. Not sure if my check for IP is to harsly + implemented and cleans to much. + +2006-08-05 21:35 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Centralized + the stringwriting at last, also started memory cleanup. + +2006-08-05 21:11 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Added user, + loginname, statuscode (200, 304 etc.), byte and referer to make + a logline compliant. User and loginname is hardcoded. Referer + and User-agen is unclean. Timecode is not working. This version + leaks memory bigtime, and is not ready for alpha yet. + +2006-08-05 20:52 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: For + consistency: Go to deliver state instead of delivering locally. + +2006-08-05 18:11 phk + + * trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: Make vcl + methods call their defaults as a last resort. + + Fix the location table so it knows about the default code too. + +2006-08-05 17:30 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: And that is not a + good idea either. + +2006-08-05 17:30 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: This was not a + valid test. + +2006-08-05 17:04 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Add some + undocumented code to look for something that worries me. + +2006-08-05 16:41 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: Issue error + message for CLI::start and CLI::stop if child is + not in a legal state for command. + +2006-08-05 16:32 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: Also trap SIGTERM + +2006-08-05 16:31 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: More work on the + debug stunt + +2006-08-05 15:55 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: Plug memory leaks + related to starting/stopping child. + +2006-08-05 15:40 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: Replace + client_should_run with a 5 state enum to avoid races if multiple + CLI sources yell at the same time. + +2006-08-05 15:38 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: Bail if the cli pipe + is not ready + +2006-08-05 15:38 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Polish the + debugstunt and make it possible to avoid it. + +2006-08-05 15:35 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c: We don't disturb + ourselves. + +2006-08-05 14:24 phk + + * trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: More defensive + coding and a couple of bugs less. + +2006-08-05 14:22 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: More defensive + coding. + +2006-08-05 12:45 phk + + * trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_cli.c: Add a timeout to + reads from the child CLI pipe so we don't hang + for ever. + +2006-08-05 12:24 phk + + * trunk/varnish-cache/bin/varnishd/flint.lnt: Improve. + +2006-08-05 12:24 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: Style cleanup. + + remove two unused variables. + +2006-08-05 12:24 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: Remove unused include + + Fix function arg type + +2006-08-05 12:23 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: Make sanity + check of binheap permanent and fix style accordingly. + +2006-08-05 12:23 phk + + * trunk/varnish-cache/bin/varnishd/common_cli.c: Remove unused + include + + free buffer on error. + +2006-08-05 12:22 phk + + * trunk/varnish-cache/bin/varnishd/cache_cli.c: Make sure we don't + overflow the line buffer + + Remove unused #include + +2006-08-05 12:20 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: Remove unused "ip" + from backend. + + Make VCL_Load static, and give it a NULL check. + +2006-08-05 12:19 phk + + * trunk/varnish-cache/bin/varnishd/common_cli.h: Cleanup unused + stuff + +2006-08-05 12:19 phk + + * trunk/varnish-cache/bin/varnishd/mgt.h: Remove prototypes for no + longer existing functions + +2006-08-05 12:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: Remove unused + includes + +2006-08-05 12:17 phk + + * trunk/varnish-cache/bin/varnishd/flint.sh: don't search libevent + for includes + +2006-08-05 12:17 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c: style fix + +2006-08-05 12:16 phk + + * trunk/varnish-cache/bin/varnishd/mgt_vcc.c: Rename struct vcls + to vclprog + +2006-08-05 11:44 phk + + * trunk/varnish-cache/bin/varnishd/cli_common.c: remove old file + +2006-08-05 11:16 phk + + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: Change manager to + use mgt_event.h instead of threads to be lazy thread + developer compatible. + + POSIX, no surprise, doesn't really tell what should happen to a + threaded + process which forks and consequently implemenations vary + somewhat, + from Solaris which seems to Do The Right Thing, via Linux where + it + works "most of the time" and to FreeBSD which more or less + actively + sabotages any such attempt. + + Grin and live with it... + +2006-08-05 11:13 phk + + * trunk/varnish-cache/bin/varnishd/cache_cli.c: Remove pthread.h + include, it's included in cache.h + +2006-08-05 11:12 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c: Remove debugging + printfs + +2006-08-05 11:08 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c: More bugfixes + +2006-08-05 11:07 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: Add assert + +2006-08-05 10:31 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: bugfixes + +2006-08-05 09:27 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: Add signal support. + +2006-08-05 08:49 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: bugfixes + +2006-08-05 08:19 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: Add a miniature + event engine based on poll(2). + + It's general enough to find other uses, but right now it's only + for + the manager process. + +2006-08-05 01:17 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Got the IP, + Request and User-Agent sorted out. Working on the time + +2006-08-04 20:03 phk + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Initialize all + directions to "opposite" for -b and -c to avoid + spurious first entries. + +2006-08-04 19:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: Use id for + printing + +2006-08-04 19:36 phk + + * trunk/varnish-cache/include/stat_field.h: Stats field changes + +2006-08-04 19:36 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_session.c: More + comprehensive performance stats and a few asserts, just in case. + +2006-08-04 11:10 phk + + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: Now that we keep + track of loaded VCLs in the manager, we might + as well allow their manipulation also when the child is not + running. + +2006-08-04 10:54 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl: Redo VCL + program handling. + + Keep track of all loaded VCL programs in the manager and tell the + child to load them via VCL. + + Don't start he acceptor thread until a "start" command cones down + the CLI. + + XXX: Right now we leak stuff when a VCL program is dicarded + +2006-08-04 10:23 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Redo our management + of compiled VCL programs: + + Take default_vcl out of heritage. + + Keep track of all compiled VCL files and delete them at + exit. + + After starting child, use CLI to load all vcl programs + and then issue "start" via the CLI. + + In the cacher, don't start the acceptor until we get + a start command. + +2006-08-04 09:19 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Move VCL compiler + related stuff to mgt_vcc.c + +2006-08-04 09:06 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Remove old cli + related stuff, it now lives elsewhere + +2006-08-04 09:06 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: reimplement CLI stats + +2006-08-04 07:21 phk + + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c: Implement CLI ping + in manager, this is a "per hop" command. + + Add mgt_cli_askchild() function to poke the CLI interface to + the child. + + Use it to ping the child every second. + +2006-08-04 07:20 phk + + * trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h: Move + cli_func_ping to common_cli + +2006-08-04 07:19 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c: SIGCHLD has + already been taken care of earlier. + +2006-08-04 06:53 phk + + * trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/include/cli.h: Change the CLI protocol in a + subtle but useful way: + + The first line of the response has a fixed format ("%-3d %-8u\n") + and consequently fixed length (CLI_LINE0_LEN == 13). + + This makes parsing responses more efficient. Add a function + in common_cli to do so. + +2006-08-04 06:23 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: (Re)Implement + passthru of cli commands, we can now talk with the + cache process again. + +2006-08-04 06:21 phk + + * trunk/varnish-cache/include/cli.h: Add CLIS_CANT status code for + when something is valid but currently + impossible. + +2006-08-04 06:21 phk + + * trunk/varnish-cache/bin/varnishd/cache_cli.c: Typo: write cli + result to correct pipe. + +2006-08-03 23:42 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Placed a new + sbuf_clear at a more strategic place. It got cluttered when a + host left without SessionClose of SessionReuse. + +2006-08-03 22:01 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Got a + workaround for IP adress fetching. If we connect logger while + Varnish is running, we won't catch the IP from SessionOpen since + it's already done that. Workaround is to catch the IP from + SessionReuse if IP of session is NULL + +2006-08-03 19:21 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Fix copy&paste + bug in fetch_chunked. + +2006-08-03 19:20 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Sanitycheck that + the length of an object adds up, right when we + fetch it. + +2006-08-03 11:46 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: Imlement stopping + and restarting of child process. + + Not as useful as it will be yet, see ticket 22 + +2006-08-03 11:45 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Make the pipe-stunt + debug process smarter. + +2006-08-03 10:37 phk + + * trunk/varnish-cache/bin/Makefile.am: Take varnishtester out of + the loop until it can be de-libevented + +2006-08-03 10:37 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: Add stop command as + well. + +2006-08-03 10:16 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Think I have + found a program structure that works. Filling in bits to build + logline. + +2006-08-03 09:45 phk + + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/bin/varnishtester/Makefile.am: Remove + libevent from the picture. + +2006-08-03 09:45 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_common.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Rip out the old CLI + handling and start over, more or less. + + Still bits missing. + +2006-08-03 06:45 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.h: Rework the cache + process CLI handling: + + We are only accepting CLI from the pipes in heritage, so simply + run a loop reading those, dispatching lines as we see them. + + Export CLI_cmds[] so that the management process can see it, + we might as well take advantage of the shared binary where we + can. + +2006-08-02 22:53 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Added + SessionReuse so I now write a logline for SessionClose and + SessionReuse. + +2006-08-02 22:33 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Starting to + get the structure right (I think). Thx for the NULL on each + string Poul-Hennning :) + +2006-08-02 20:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: Add an assert, + just in case. + +2006-08-02 20:54 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: Fix a bug when + deleting items in the binheap + +2006-08-02 19:12 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: log StatAddr + with fd=0 to avoid out-of-order confusion + +2006-08-02 18:17 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Allow ENOENT + on removing kqueue events, a close will have drained + them already. + +2006-08-02 18:12 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Tell daemon(3) to + not chdir in debugging mode so we can find our core dumps. + +2006-08-02 17:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: Enter pass mode + through the front door. + +2006-08-02 17:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: More asserts, + sp->vbc this time. + +2006-08-02 15:55 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: Remember to clear + sp->vbc + +2006-08-02 13:28 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Don my plumbers + outfit and twist a lot of pipes into shape: + + When -d(ebug) is specified we fork before calling daemon. + + The parent process becomes a miniature cat(1) program which + connects + stdin/stdout with the management process stdin/stdout. + + It also knows that SIGINT should be passed on to the management + process + in order to make it DTRT. + + Any other cause of death for this "debugger" process will (once I + teach the CLI about it) not affect the running varnish and + therefore + it will be possible to start varnish in debugging mode, tweak + things + a bit and CTRL-D and leave it running in the properly + daemon(3)'ed + background. + + The reason for this rather complicated bit of pipework is that we + can not call daemon(3) once we have started any threads (only the + calling thread survives) and we would loose our parent + relationship + to the cache process also. + +2006-08-02 12:05 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Typo: Also + monitor remote sockets with the poll based acceptor. + +2006-08-02 11:58 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c: Remove the + libevent from the backend pool manager. + + Simplify the logic here while we're at it. + +2006-08-02 11:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Add + include + +2006-08-02 11:17 phk + + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: Remove unused + struct. + +2006-08-02 10:53 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c: Simplify + backend connection memory management. + +2006-08-02 10:40 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Replace + libevent based acceptor with poll(2) based acceptor. + +2006-08-02 09:34 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c: Bite the bullet + and write an alternate acceptor which uses kqueue + directly instead of libevent. + + Degeneralize the header reading code in cache_http.c which seems + to + be cleaner anyway. + + An #ifdef at the top of cache_acceptor.c selects which + implementation + you want: libevent or kqueue. + +2006-08-02 07:23 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Convert pipe to + use poll(2) on the two filedescriptors it cares about + and eliminate the per-workerthread event engine entirely. + +2006-08-02 07:07 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c: I have nothing + but circumstantial evidence that libevent is involved + in the current stack corruption I see, but we might as well avoid + using it where we can: + + Don't engage the eventengine when we talk to the backend, just + call + read(2) directly. + +2006-08-02 04:57 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c: More miniobj + paranoia + +2006-08-01 19:48 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: More miniobj + checks + +2006-08-01 17:54 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: More miniobj + checks + +2006-08-01 16:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/flint.lnt: More miniobj checks + +2006-08-01 16:26 phk + + * trunk/varnish-cache/bin/varnishd/cache_response.c: more miniobj + checks + +2006-08-01 15:09 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_re.c: Flinting. + +2006-08-01 15:08 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Make 32bit + limitation work better. + +2006-08-01 15:08 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: Fixx off by one + error. + +2006-08-01 14:53 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/storage_file.c: Add miniobj + checks om SMF and STORAGE + +2006-08-01 12:38 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c: This is getting + too longhaired: Give backend connections another + http header which we can use to build the object headers in. + +2006-08-01 12:04 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Experiment: + don't use req's workspace to build object http header. + +2006-08-01 09:39 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/include/shmlog_tags.h: Record timestamp when + we have received completed HTTP request header, + and define this as the "start of request timestamp". + + Define "end of request timestamp" as when we are ready to + transmit + HTTP header back. + + SHMlog the start and difference between start and stop with + ReqServTime + tag. + + Keep track of idle sessions using CLOCK_MONOTONIC to avoid + trouble + here should our clock get stepped. + +2006-07-31 22:21 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Added some + more toying with the data. All is still a mess, and I am not + sure of structure yet. PHK is also doing changes in areas that + will be needed. + +2006-07-31 22:09 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Always NUL + terminate shmlog entries. + +2006-07-31 21:49 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h: Create three groups + of seven SHMlog tags: + + {Rx,Tx,Obj}{Request,Response,Status,URL,Protocol,Header,LostHeader} + + And log http header munching accordingly. + +2006-07-31 21:46 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: Remove unused + variable + +2006-07-31 21:37 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: addr might be + NULL if we are called from the prefetcher. + +2006-07-31 21:04 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: Add + http_ClrHeader() and cure an unintended bug-oid its use exposes: + we checked if the request is a GET long after we should have. + +2006-07-31 20:38 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: Add a + http_SetResp() function for constructing HTTP responses (like + 304). + + Eliminate the header index from http_SetHeader() which is no + unused. + +2006-07-31 20:27 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/include/shmlog_tags.h: Log the headers we + store in the object under ObjHeader so that + we don't get two confusing batches of TxHeader in the sessions + logentries. + +2006-07-31 19:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: Fix the + dot-graph + +2006-07-31 14:50 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Initial + commit of real structure. This code will print the User-Agent. + +2006-07-31 07:26 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: Introduce + http_SetHeader() for setting a http header to a const string, + no need to waste time printf'ing in this case, and no need to + waste workspace. + +2006-07-31 07:13 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Don't fill more + than half the workspace with received data, we need to + have space for composing the reply as well. + + Without this fix, the entire workspace could be filled with + pipelined + requests and we would have no space to compose the reply. + +2006-07-31 06:36 des + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishncsa, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.1, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/configure.ac: Clone varnishncsa off of + varnishlog. Anders will hack on it to produce + NCSA-style (common / combined) logs. + +2006-07-31 06:24 des + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: Unbreak build. + +2006-07-28 13:41 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: "HEAD" has 4 + characters. + +2006-07-24 10:13 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: remove this file + (again) + +2006-07-22 22:01 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: reorg a little + bit. + +2006-07-22 21:20 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: Eliminate + redundant args from stevedore->send() + + Have WRK_Write() and friends return number of bytes (we can't use + WRK_Flush() as that may act on both header and body). + + Collect more stats. + +2006-07-22 20:57 phk + + * 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_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: Add per address, per + session and total statistics. + + We (will) collect data in unlocked per workerthread accumulators + and whenever the workerthread leaves the session, we charge the + bill to the srcaddr (issuing a StatAddr shmrecord), to the + session + and to the global counters in the stats struct. + + When sessions die we issue a StatSess shmrecord. + + StatAddr and StatSess has the same format: + address + port (always zero for StatAddr) + duration (seconds) + #sessions + #requests + #pipe + #pass + #fetch + #hdrbytes + #bodybytes + +2006-07-22 16:55 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Make sure there + always is a Host: header in fetch requests. + + We fill it in with backend.hostname, but this may not be optimal + (direct IP# etc etc) so VCL should be able to override it. + +2006-07-22 16:26 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: Action pass + from vcl_hit() needs to go to STP_PASS + +2006-07-22 16:15 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c: Always use GET + and HTTP/1.1 against the backend for fetch + +2006-07-22 13:58 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: exit after error + +2006-07-22 12:00 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_vrt_re.c, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: Implement + regexp matching of strings in VCL. + + For now we default to REG_EXTENDED, but it might make sense + to let the user control this flag and the case sensitivity. + + Another concern is the stringification of regexps, it may lead + to backslash madness. Maybe we should define '...' string types + also and do no backslash substitution in those at all. + +2006-07-22 10:41 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: Change the acl + syntax slightly: the ( ... ) should enclose all of + the rule (ie: also ! and /mask if present). + + Implement matching for IPv4. + + Acl tests are shmlogged as follows (doc candidate): + + shmlog tag: VCL_actl + + "NO_MATCH $acl" + client did not match access list $acl + "FAIL $acl $rule" + getaddrinfo(3) failed on $rule which had a '!' + "MATCH $acl $rule" + client matched $rule + "NEG_MATCH $acl $rule" + client matched negated (!) $rule + +2006-07-22 10:35 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_session.c: Store the + socket address in the session + +2006-07-22 09:38 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl: VCL + compiler: + add two sbufs for "init" and "fini" actions. + + VCL ACLs: Change syntax and implementation as follows. + + ACL Syntax now works the following way: + + acl $name { + ! ( "myhost.com" ) ; + "10.0.0.1" /8 ; + } + + The '!' means not. If the address matches the rest of the rule + the address does NOT match the acl and the search terminates + here. + + Enclosing the string in paranthesis means that the rule will be + ignored + if the string cannot be converted to an address (with + getaddrinfo). + + When a string can not be looked up, and is not enclosed in a + paranthesis, a positive rule (ie: without !) will not match and a + negative rule (with !) will match. + + A mask can always be supplied, no matter the style of the string + given, so it is possible to do things like: + + { "fw.ourcompany.dom" / 24 } + + Which means "any host on the same /24 subnet as + fw.ourcompany.dom". + + + Unfortunately getaddrinfo() does not return a TTL for the + results, + in the future we may want to use some kind of timeout to refresh + the lookups. + +2006-07-22 08:02 phk + + * trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/Makefile.am, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: Split IP/ACL + compilation into vcc_acl.c + +2006-07-21 22:12 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/storage_file.c: Unless the user + specifies an explicit size, don't use more than 2GB + on 32 bit architectures to avoid running out of address room + + Make FlexeLint happy. + +2006-07-21 21:57 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcc_token.c: Make FlexeLint + happier + +2006-07-21 21:42 phk + + * trunk/varnish-cache/autogen.phk: Drop this one now. + +2006-07-21 21:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: Implement TTL + adjustment from VCL + + Log in shmem where the TTL came from (doc-candidate): + + 696613561 RFC 900 1153517009 1153517014 1153517914 900 0 + | | | | | | | | + | | | | | | | + age + | | | | | | + max-age + | | | | | Expires: header + | | | | Date: header + | | | "now" + | | TTL relative to "now" + | who set the TTL + xid of object + + or + + 696613561 VCL 20 1153517009 + | | | | + | | | "now" + | | TTL relative to "now" + | who set the TTL + xid of object + +2006-07-21 21:13 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: More VRT work. + + Use macros for trivial objects which are just a field in a + struct. + +2006-07-21 21:01 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vrt.h: Update VRT to minimal + functional level again + +2006-07-21 20:51 phk + + * trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: Use const char* for + safety + +2006-07-21 20:45 phk + + * trunk/varnish-cache/include/binary_heap.h, + trunk/varnish-cache/include/miniobj.h, + trunk/varnish-cache/include/stat_field.h, + trunk/varnish-cache/include/stats.h, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h: Update + +2006-07-21 20:44 phk + + * trunk/varnish-cache/include/vrt_obj.h: This file is generated. + +2006-07-21 20:43 phk + + * trunk/varnish-cache/lib/libvcl/Makefile.am, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: Automate generation + of tables and prototypes for the objects which + VCL programs can manipulate. + +2006-07-21 18:12 phk + + * trunk/varnish-cache/lib/libvcl/Makefile.am, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c, + trunk/varnish-cache/lib/libvcl/vcc_priv.h, + trunk/varnish-cache/lib/libvcl/vcc_token.c, + trunk/varnish-cache/lib/libvcl/vcc_token_defs.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_priv.h, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Move things + over to the correct "VCC" prefix. + + Split some stuff into separate files while we're at it. + +2006-07-21 16:25 phk + + * trunk/varnish-cache/include/http_headers.h: update comment + +2006-07-21 16:15 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/include/shmlog_tags.h: Properly log TTL + calculation to shmem + +2006-07-21 16:06 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Fix formatting of + responses. + +2006-07-21 16:05 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: Log TTL calculation + on the right fd + +2006-07-21 15:25 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Work on + logtailer api a bit: + + By default, start at the last entry in shared memory. To dump + the + entire segment from the start, specify '-d' option. + + Terminate programs when '-r $file' reaches EOF + +2006-07-21 12:18 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/flint.lnt: Cleanup + +2006-07-21 12:08 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: Magic check on + struct vbe + +2006-07-21 12:06 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: Better name + +2006-07-21 11:55 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/stat_field.h: Convert fetch, insert + and deliver to use new HTTP header munging code. + + Remove sbuf from workerthread, it is only used in the Error + handling + now and it will probably not even survive that in the long run. + +2006-07-21 10:44 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Make pipe use the + new http manipulation. + +2006-07-21 09:32 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + 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_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/http_headers.h: HTTP header munging + part (N of M) + + NB: Only pass mode (lightly) tested right now. + + Give up on the three element array per header and use a two + element struct + instead, it reduces obfuscation and removes risk of pointer + fandango. + + Introduce #defined filtercontrol in http_headers.h, use them in + a new + field. Only Pass is there for now. + + Use the http-workspace for building headers instead of sbuf. + + Move uiovec handling to cache_pool.c where it more naturally + belongs + and so we can use it on both backends and sessions. + + Add http header munging functiosn for copying, printf'ing, + filtering and + writing headers. + +2006-07-21 07:18 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/shmlog_tags.h: Rename shmlog tags + for headers to RxHeader and TxHeader that's more + logical. + + Rename http_Init() to http_Setup() to avoid clash with + HTTP_Init(). + + Remove unused variable + +2006-07-20 22:08 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: Yet another + refinement to the way we store and deal with HTTP headers. + + Record a triplet of {start, data, end} for all HTTP data items. + + This represents a regrettable uglification of the sourcecode, but + most of it compiles out to constants and the runtime benefits + will + be worth it. + + Generate H_FOO magic strings for all the headers we know about. + These strings have a length as first char and always ends in ':'. + + Also genereate H_FOO format strings in VCL compiler. + + Mandate (with assert) that header references happen using H_FOO + strings. + + Make number of allowed HTTP headers a compile time constant (32) + but make the workspace a run-time variable (4096). + + Introduce new SHM tag for dumping aborted HTTP protocol requests. + +2006-07-20 15:10 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: Add XXX comment + +2006-07-20 14:46 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/include/stat_field.h: Keep an eye on deathrow + +2006-07-20 14:40 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: More asserts + +2006-07-20 14:23 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: We need to check + the TTL here also, if a (sequence of) slow client(s) + manages to hold the document referenced, the prefetcher may never + get lucky with it and it will linger here much past last sell + date. + +2006-07-20 13:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Only reference + srcaddr on first request on session + +2006-07-20 13:39 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: Be more + paranoid about srcaddr + +2006-07-20 13:33 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: upd + +2006-07-20 13:29 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/include/stat_field.h: Keep track of active + source addresses + +2006-07-20 12:03 phk + + * trunk/varnish-cache/bin/varnishtop/varnishtop.c: Add -1 option + that stops comparison after first field. + + Useful with commands like: + + varnishtop -i header -1 + varnishtop -i srcaddr -1 + + where the variable part of the entry is less relevant. + +2006-07-20 10:10 phk + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: Show also + average since start + +2006-07-20 09:58 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Hmm, that was a + bad idea. + +2006-07-20 09:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Loop till we have + everything. + +2006-07-20 09:29 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: Implement + "If-Modified-Since" conditional queries + +2006-07-20 08:29 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: Remove + explicit worker thread arguments. + +2006-07-20 08:25 phk + + * 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_pass.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: Move the + delivery functions from acceptor to response + +2006-07-19 21:16 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: Rework the worker + thread pool logic slightly, we were leaking + threads before. + +2006-07-19 21:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/include/stats.h: Include a "start_time" + timestamp in the stats and teach varnishstats + to print it in curses mode. + + Some polishing and cleanup. + +2006-07-19 20:07 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Use insert_pass in + vcl_fetch() so we cache the uncacheability. + +2006-07-19 20:06 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Don't explode + on trim's to zero size. + + Real fix should (maybe) be to callers + +2006-07-19 19:49 phk + + * trunk/varnish-cache/bin/varnishtop/varnishtop.c: Update only + once per second. + +2006-07-19 19:48 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Make sure width and + precision arguments to printf %*.*s are ints. + +2006-07-19 19:47 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: Don't panic on + NULL srcaddr, but revisit later when we know the + details. Is it the Prefetcher ? + +2006-07-19 19:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: Delete the + right list item. + +2006-07-19 19:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: Don't bother + determining if we should close if we already have done so. + Also: we may not have valid headers if cache_http.c threw a 400. + +2006-07-19 19:43 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Make sure hp->v + is NUL terminated. + +2006-07-19 12:37 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c: Use miniobj.h + to catch pointer trouble + +2006-07-19 12:36 phk + + * trunk/varnish-cache/include/miniobj.h: Add miniobj.h for + debugging + +2006-07-19 11:53 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: Avoid the Error path + for now. + +2006-07-19 11:11 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: handle 302 for now. + +2006-07-19 08:33 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: Properly zero the + worker structure when we start a thread. + +2006-07-18 13:47 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: eliminate + debugging + +2006-07-18 13:19 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: Delete binheap + root by it's index. + + Expect a refcount of one (the one holding the object in the hash) + +2006-07-18 13:18 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: Fix the Parent + calculation + +2006-07-18 12:46 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: Set the index + of deleted elements to zero + +2006-07-18 12:40 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: Move the root + index from zero to one + +2006-07-18 12:29 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Remove the + deref/unbusy stuff from FetchBody() it's done in central.c + +2006-07-18 12:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: Assert that + object is busy when we call unbusy + +2006-07-18 12:27 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c: Use a void * for + http_Read()'s buffer + +2006-07-18 10:48 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: Braino this time. + +2006-07-18 10:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: typo + +2006-07-18 10:45 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: Add http_Read() + which reads from a socket but soaks up any prefeched + tail first and use it all the places where this logic was + explicit + before. + + Fix Refcounting on objects when we insert/deliver + +2006-07-18 10:32 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: Use bigger + buffersizes for pass mode + + Terminate the sbuf with the reply headers properly. + +2006-07-18 09:02 phk + + * 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: Retire the + http_GetReq(), http_GetURL() and http_GetProto() accessor + functions now that struct http is out of the closet. + +2006-07-18 08:52 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: polish + +2006-07-18 08:51 phk + + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: zero means 'all' + to http_GetTail() + +2006-07-14 13:54 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: use space + to separate host and port in -b + +2006-07-14 13:52 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Use space to + separate host and port in backend spec. + + Polish usage message a bit. + +2006-07-14 13:33 phk + + * 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_pool.c, + trunk/varnish-cache/bin/varnishd/steps.h: When during a lookup + we encounter a busy object, queue the session on + the objects waitinglist and disembark the worker thread so it + can do + something sensible in the mean time. + + This feature is unimportant in normal operation, but crucial to + resource management if a popular URL suddenly takes a long time + to + reply from the backend. + + Without this bit if semi-nasty code, we would tie up one worker + thread per client while waiting for the backend to come to it's + senses. + +2006-07-14 12:47 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_center.c: Have the + acceptor launch the session into STP_RECV + +2006-07-14 12:45 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Use the fact that + we have the worker thread in struct sess now. + + Move initial and final processing into cnt_recv() and cnt_done() + +2006-07-14 12:30 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: Have the states + tell us if we are done yet with their return value, + so that we can implement disembarking the worker thread of the + object + is busy. + +2006-07-14 12:22 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/include/shmlog.h: Put a starttime in shmem + so varnishstat can show average rates. + +2006-07-14 12:12 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c: Flexelint'ing, found + a spurious ';' + +2006-07-14 12:05 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/include/shmlog.h: More SHM creation polishing + +2006-07-14 11:44 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c: Better and more + paranoid SHMEM creation logic + +2006-07-14 11:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: propset Id + +2006-07-14 11:20 phk + + * 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_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: Change "client" to + "srcaddr", it's more descriptive. + + Add srcaddr management and start charging bytes to the srcaddr. + +2006-07-14 10:34 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/tcp.c: Rework the way we do + ascii representations of addresses + +2006-07-14 10:16 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + 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_main.c, + trunk/varnish-cache/bin/varnishd/cache_session.c: Move session + management to new file (cache_session, SES prefix) in + preparation of adding client tracking. + + Move the iovec's from the session to the worker and give the + session + a pointer to the worker so we can avoid passing it around as + argument. + +2006-07-12 23:30 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/flint.sh, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: More Flexelinting + +2006-07-12 22:52 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/mgt_child.c: More flexelinting. + + No bugs so far. + +2006-07-12 22:07 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: Flexelint + harder. + +2006-07-12 22:01 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/varnishd.c: Give this file a + flexelinting + +2006-07-12 22:01 phk + + * trunk/varnish-cache/bin/varnishd/cache.h: Improve the INCOMPL() + macro. + +2006-07-12 20:21 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: More polishing. + +2006-07-12 19:28 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: Move sessmtx to + cache_vcl.c and call it vcl_mtx. + + Clean up naming for consistency while here. + +2006-07-12 15:07 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: Implement + "insert_pass" mode where we cache that an entity must be passed. + +2006-07-12 14:13 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: Make Pass + possible from vcl_hit() + +2006-07-12 13:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_slinger.h, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/steps.h, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c: Enable Id + keyword + +2006-07-12 13:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: First stab at + implementing pass in vcl_miss() + +2006-07-12 13:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: Add explanation + for locking, some minor polishing. + +2006-07-12 12:04 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/hash_slinger.h: Hash on both + URL and Host header. If no host header, hash on URL twice. + +2006-07-12 11:48 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c: Make Pass work + again + +2006-07-12 11:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: Make pipe work + again + +2006-07-12 08:56 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: Fix CLI + "config.load" + +2006-07-12 08:44 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Always + insert a backend when vcl is compiled. + + Respect '#' comments in script file. + +2006-07-12 08:34 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: Teach the VCL + compiler about default functions, so that users will + not have to copy&paste the default methods if they have no + special + requirements for a particular method. + + No such facility exists for backends, so a backend description is + now the minumum VCL program. + + When we initialize the VCL compiler we hand it a piece of source + code + with the "default code", this must include definitions of all + methods + named with a "default_" prefix (ie: "default_vcl_recv" etc). + + During compilation we always compile this piece of source code + in (after + the user supplied VCL source). + + If the user did not provide a particular method, the default + method is + used instead. The user can also call the default method + directly, + for instance by: + + sub vcl_recv { + if (req.http.Expect) { + error; + } + call default_vcl_recv; + } + + Later on, this could be expanded to allow other subroutines to be + included in the default VCL for the users calling convenience. + +2006-07-12 07:45 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Pause + after 'vcl' command + +2006-07-11 21:35 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: EOF + detection in libevent is buggy ?? Add exit cmd. + + Pause after cli until we see "OK" + +2006-07-11 21:30 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: add a req + command, various adjustments + +2006-07-11 21:04 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Add + Pause() and Resume() to pace script execution + +2006-07-11 21:01 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c: Add a printf when + cached is ready for the benefit of varnishtester + +2006-07-11 20:49 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: open and + close commands + +2006-07-11 20:37 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: A vcl + keyword for loading a new config + +2006-07-11 19:29 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Add "cli" + to tell varnishd things + +2006-07-11 19:16 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: If the + first char of the serve string is '!', close connection after + sending string. + +2006-07-11 19:10 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Add a + server facility to act as backend for varnish + +2006-07-11 18:21 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Minimal + ability to start and stop a varnishd + +2006-07-11 18:16 phk + + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Give 'exit' CLI + command some bite. we may want to be more careful + later on. + +2006-07-11 17:53 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Unbuffer + stdout/stderr + +2006-07-11 17:23 phk + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishtester, + trunk/varnish-cache/bin/varnishtester/Makefile.am, + trunk/varnish-cache/bin/varnishtester/varnishtester.c, + trunk/varnish-cache/configure.ac: Add stub varnishtester program + +2006-07-11 16:31 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Start the cache + process automatically, I've gotten tired of typing "start" :-) + +2006-07-11 16:25 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Allow backend to be + specified as "host:port" to -b + +2006-07-11 16:17 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: add short + descriptive comments to each state + +2006-07-11 16:10 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c: Distribute code + from FetchSession almost correctly + +2006-07-11 16:03 phk + + * trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Add + "insert_pass" action in VCL + +2006-07-11 15:54 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: Make things + work again by stuffing the old functions into the new + state engine. + +2006-07-11 15:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: This commit + breaks warnish temporarily: + + Insert the new master state engine. + + A dot(1) graph is embedded in the source code and can be + extracted + with: + + sed -n '/^DOT/s///p' cache_center.c | dot -Tps > /tmp/_.ps + +2006-07-11 13:31 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/steps.h: Add enum for major + procesing steps + +2006-07-11 12:31 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Start + centralizing the flow of requests through varnish so we get + one source file with the highest level of policy. + +2006-07-11 12:30 phk + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Make -b and -c + less nonsensical when not specified + +2006-07-11 12:00 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Pipe requests which + come with an Expect header. + + XXX: document that + error 417 "expectation failed" + might be a more sensible policy. + +2006-07-11 11:41 des + + * trunk/varnish-cache/bin/varnishlog/varnishlog.1: Document -b and + -c, and bump date. + +2006-07-11 11:36 phk + + * trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Add -b[ackend] + and -c[lient] generic options to logtailers + +2006-07-11 07:38 phk + + * trunk/varnish-cache/bin/varnishd/cache_response.c: Add 500 + messages. + +2006-07-11 07:30 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: Split http_Dissect() + into http_DissectRequest() and http_DissectResponse() + +2006-07-11 06:30 des + + * trunk/varnish-cache/bin/varnishd/varnishd.1: Add + cross-references and a commented-out STANDARDS section. + +2006-07-11 06:28 des + + * trunk/varnish-cache/include/shmlog_tags.h: Add a note to update + varnishlog(1) whenever this list changes. + +2006-07-11 06:27 des + + * trunk/varnish-cache/bin/varnishstat/varnishstat.1: Add + cross-references. + +2006-07-11 06:26 des + + * trunk/varnish-cache/bin/varnishlog/varnishlog.1: Document the + -C, -I, -X, -i, -x options. + Add a list of log entry tags. + Add cross-references to varnishd(1) and varnishstat(1). + +2006-07-10 21:54 phk + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishtop, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/configure.ac: Add varnishtop log-tailer. + + + Try these: + + varnishtop -i url + + varhishtop -i header -C -I '^user-agent:' + + varhishtop -i header -C -I '^user-agent:' -X MSIE + + varhishtop -i header -C -I '^user-agent:.*MSIE' + + varhishtop -i header -C -I '^user-agent:.*java' + + You can also run them on the logfiles from the live test: + + zcat _vlog21.gz | varnishtop -r - -i header ... + + + +2006-07-10 21:49 phk + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Fix so that both + -I and -X can be specified + +2006-07-10 20:49 phk + + * trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Implement -C, -I + and -X generic options + +2006-07-10 20:27 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Add tag names + array to libvarnishapi, everybody is going to need it. + + Implement -i tag[,tag ...] and -x tag[,tag ...] generic + arguments. + +2006-07-10 19:54 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Improve + libvarnishapi interface to shared memory: + + Add function VSL_OpenStats() which directly returns a pointer + to the varnish_stats structure. + + Add opaque VSL_data structure as handle to the log-tailer + functions. + + Add generic argument parsing function for all log-tailers. + + Add support for generic "-r " option. + +2006-07-10 15:02 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: More statistics about + worker threads. + +2006-07-10 14:52 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: Rewrite the worker + thread pool code. + + Assign prefix WRK to the worker pool. + + Introduce a struct workreq since the prefetcher (when it + happens) will + not have a session to pass in. + + The worker threads get a cond_var each and are hung from a list + in + most recently used order. + + When a request is queued and the worker thread list is not empty, + tickle the cond_var of the first one. + + If no threads were availble the max number of threads is not + reached, + try to start another worker thread. + + If the max was reached or the start filed (likely due to out of + memory) + indicate overflow and let the existing pool deal with it. + + Create only the minimum requested number of threads initially. + + Allow specification of the timeout before a dynamic worker + thread commits + suicide to be specified with -w. + + Default parameters are -w1,UINT_MAX,10 {min, max, timeout} + +2006-07-10 13:59 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: use explicit + eventbase. + +2006-07-10 13:58 phk + + * trunk/varnish-cache/contrib/libevent/event.c: Don't ever set + current_base in our version of libevent in order to flush + out any bugs it might cause. + +2006-07-10 13:48 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c: Dump errno and + strerror in assert + +2006-07-10 12:00 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c: Rework the + "connect to backend logic". + + Avoid calling getaddrinfo() for every connect by catching the + result + in the backend structure. + + Minimize number of socket/connect calls by caching the last good + address in the backend structure. + + If all addresses in the cached getaddrinfo() result fails, call + getaddrinfo() again (to catch DNS changes) and try the list + again. + +2006-07-10 11:24 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/tcp.c: Move sockaddr->ascii + conversion to tcp.c + + shmlog both ends of backend connections. + +2006-07-10 10:56 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.h, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/shmlog.c: Be more consistent. + + cache_shmlog.c contains stuff for both cache and mgt, so remove + the + cache_ prefix. + + Rename cache_shmlog.h to common.h and put joint stuff there. + +2006-07-10 10:31 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: put backend + session linkage in shmemlog for pipe and pass + +2006-07-10 10:06 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Polish HTTP + reception a little bit + +2006-07-10 10:05 phk + + * trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: Drop the max length + of first line, it's too expensive to enforce. + +2006-07-10 09:52 phk + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Fix cosmetic + warning + +2006-07-10 09:51 phk + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: Silence + cosmetic warning. + +2006-07-10 09:48 phk + + * trunk/varnish-cache/lib/libvarnish/time.c, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: Fix cosmetic + warnings + +2006-07-10 09:47 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.h, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Fix a bunch + warnings, all cosmetic. + + I'm using __unused for now, if we need to use something different + we can do a find/replace. + +2006-07-10 09:28 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Silence some + warnings + +2006-07-10 09:07 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/include/stat_field.h: Allocate struct http + as part of the session allocation. + + Remove http_New() and http_Delete() + +2006-07-10 08:41 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: Add + heritage.mem_http_headers which is the maximum number of headers + we recognize. + + Add http_Init() which initializes struct http given sufficient + space. + + Respect heritage mem_* values in http_New() (while we still have + it) + + Allocate backend connections (vbe_conn) with super allocation + with + space for http and workspace. + +2006-07-10 08:10 phk + + * trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: Put three memory + allocation hints into heritage: + + mem_http_1_line (512) + Maximum length of the reqeust/response line of a HTTP message + There is no point in filling the entire buffer with junk if + we get a preposterously long first line. + mem_http_header (4096) + Maximum length of entire HTTP header. If we overflow this + we return 400. + mem_workspace (currently 0) + In the future this will be the space we use for constructing + headers to send and edits done from VCL. + +2006-07-10 07:54 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: Take the vbe_conn + (backend connection) structure out of the closet. + +2006-07-10 07:07 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Turn a comment + into english + +2006-07-10 07:04 phk + + * trunk/varnish-cache/bin/varnishd/cache.h: More sensible order of + pointers + +2006-07-09 21:21 phk + + * trunk/varnish-cache/include/http_headers.h: Don't pass + cache-control through. + +2006-07-09 21:01 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Add a -h opt + which modifies -o to remove "trivial" entries. + + Trivial are + {GET,HEAD} which gets a hit and returns 200 + {GET,HEAD} which gets a miss, fetches, inserts and returns 200 + +2006-07-09 09:16 des + + * trunk/varnish-cache/configure.ac: Don't use braces where they + aren't needed. + Let automake know about config.h. + Bump version number to mark that we have passed the first live + test. + +2006-07-09 07:13 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/lib/libvcl/Makefile.am: List header files so + they are included in the distribution tarball. + +2006-07-09 06:35 des + + * trunk/varnish-cache/configure.ac: Use the modern version of + AM_INIT_AUTOMAKE, allowing automake to deduce the + correct distribution name. + +2006-07-08 20:29 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c: A few edits for + FlexeLint + +2006-07-08 20:19 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: Sanitize + #includes a bit in the cache process by moving fundamental + #includes to cache.h + +2006-07-08 20:18 phk + + * trunk/varnish-cache/bin/varnishd/flint.lnt: Silence a bogus + warning + +2006-07-08 19:54 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c: 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 + +2006-07-08 19:46 des + + * trunk/varnish-cache/configure.ac: Add --enable-debugging-symbols + which enables debugging sysmbols and disables + inlining and builtins. + +2006-07-08 19:27 des + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Fix "set + backend.port". + +2006-07-08 19:25 des + + * trunk/varnish-cache/autogen.des: My version. + +2006-07-08 19:25 des + + * trunk/varnish-cache/autogen.phk: Expand keywords. + +2006-07-07 08:40 phk + + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: Close gracefully + in pipe mode + +2006-07-07 07:48 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Set SO_LINGER + to zero + +2006-07-07 07:25 phk + + * trunk/varnish-cache/bin/varnishd/tcp.c: Tell why bind(2) fails + +2006-07-07 07:22 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Pipe anything + different from HEAD & GET + +2006-07-07 07:22 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Don't filter + headers in Pipe mode + +2006-07-07 07:22 phk + + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: Fix pipe mode + +2006-07-07 07:22 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Remove + debugging printf + +2006-07-07 07:15 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Time idle TCP + connections out after 30 seconds + +2006-07-07 06:29 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Dump our buffer + as Debug if we have HTTP header trouble. + + Issue 400 for HTTP header buffer overflow. + +2006-07-07 06:27 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Strvis(3) debug + data. + +2006-07-06 22:33 phk + + * trunk/varnish-cache/include/http_headers.h: Filter out + Content-Range headers. + +2006-07-06 21:57 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Always log + the numeric code as "Status" + +2006-07-06 21:57 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: Log the found + objects XID when we have a hash-hit. + +2006-07-06 21:56 phk + + * trunk/varnish-cache/include/shmlog_tags.h: Add shmem tag for Hits + +2006-07-06 21:47 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: Refuse all + requests without a protocol field with a 400 + + Implement a function to say "400" with. + +2006-07-06 21:04 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_response.c: Add + cache_response for yelling at clients + +2006-07-06 21:03 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Also flush + ordered after the long timeout. + +2006-07-06 21:00 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Strengthen HTTP + parsing + +2006-07-06 20:29 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: Make sure the + grim reaper doesn't touch busy objects either. + +2006-07-06 20:26 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: The grim reaper + needs to wait for objects refcount to drop to zero. + +2006-07-06 20:23 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Improvements to + flush things at timeout and at the end etc. + +2006-07-06 13:40 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Silence typical + broken client connection messages and move the + interesting ones to shmem + +2006-07-06 13:33 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: Fix braino in + Pass handling + +2006-07-06 13:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Skip space before + request/response + +2006-07-06 13:02 des + + * trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.1: Add a + rudimentary man page. + +2006-07-06 11:18 phk + + * trunk/varnish-cache/autogen.phk: My version. + +2006-07-06 10:18 phk + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: Add + exponential hitrate displays (with -c) + +2006-07-06 09:31 des + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.1: Add a + rudimentary man page. + +2006-07-06 09:31 des + + * trunk/varnish-cache/bin/varnishd/varnishd.1: Expand keywords + +2006-07-06 09:13 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/varnishd.1: Add a rudimentary + man page. + +2006-07-06 09:08 phk + + * trunk/varnish-cache/bin/varnishd/tcp.c: Only complain if + accept_filters fail + +2006-07-06 09:06 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Remove debugging + code. + +2006-07-06 09:00 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Add -r file and + -w file options. + + These read/write from/to a binary file. + +2006-07-06 08:45 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Increas shmem size + to 8M + +2006-07-06 08:45 phk + + * trunk/varnish-cache/bin/varnishd/tcp.c: Add accept filters + +2006-07-06 08:43 des + + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Portability: + don't use non-portable mmap(2) flags. + +2006-07-06 08:43 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Portability: + Linux does not have SO_NOSIGPIPE. + +2006-07-06 08:41 des + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvarnish/argv.c: Portability: cast + unused parameters to void instead of marking them __unused. + +2006-07-06 08:32 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: 404 handling + +2006-07-06 08:07 des + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: Use + instead of to get both the prototype + for + ioctl(2) and the definition of FIONREAD. + +2006-07-05 14:40 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Fix off by one + +2006-07-05 14:40 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: printf format + +2006-07-05 13:54 phk + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: Calculate + rate as signed. + +2006-07-05 13:44 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Assert non-null + first + +2006-07-05 13:19 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Send + "Connection: close" if not HTTP/1.1 + +2006-07-05 13:13 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/include/stat_field.h: Add more stats + +2006-07-05 13:09 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Some asserts to + guard against trouble. + +2006-07-05 12:17 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Another pipeline + fix: don't clobber a pipelined partial header + +2006-07-05 11:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Don't lead http + header + +2006-07-05 11:09 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Free the + session memory correctly + +2006-07-05 10:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: Free the right + header. + +2006-07-05 10:55 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: Don't leak + objects headers + +2006-07-05 10:01 phk + + * trunk/varnish-cache/include/http_headers.h: Suppress + Accept-Ranges for now. + +2006-07-05 09:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Create an + X-Varnish header and put the XID there. + +2006-07-05 09:56 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c: Send headers + with sendfile + +2006-07-05 09:44 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: Add Age and Via + header to responses. + + Change arguments to vca_write_obj() (It should really be + "send_repsonse()" ?) + Store received age and time entered into cache in object. + Generate Age: and Via: headers as part of response. + +2006-07-05 09:32 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Unify logging in + the response handling + +2006-07-05 09:11 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: log responsecode + and length + +2006-07-05 09:10 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: Log reponse code and + object length + +2006-07-05 09:08 phk + + * trunk/varnish-cache/include/shmlog_tags.h: Add Length tag + +2006-07-05 08:08 phk + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: Show also + rate in curses display + +2006-07-05 07:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: Be more + conservative about wraparound and take them up front in all + cases. + +2006-07-04 22:08 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: Implement our TTL + calculation. + + A first quick check against the weird timestamps from the VG + frontend + squids indicates sensible behaviour. + +2006-07-04 21:34 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: Long comment + describing how TTL calculation will be done. + + Review encouraged. + +2006-07-04 20:00 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c: Fix HEAD + requests: + + Make modes to http_BuildSbuf descriptive enums. + Send GET to backend also for HEAD requests. + Don't return body for HEAD requests. + +2006-07-04 19:36 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Fix pipelining. + + A braino in http_Dissect() resulted in an off-by-one error + (protected with assert now) + + Move any remaning bytes in buffer to front and check for + a complete header before arming the eventloop on the + session. + +2006-07-04 14:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Make room for + protective terminating NUL + +2006-07-04 14:19 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: retry backend + open, log diagnostics + +2006-07-04 14:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c: load VCL earlier + +2006-07-04 14:18 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Lock with a + mutex + +2006-07-04 13:45 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Shorter sleeps: + 1s -> 50msec + +2006-07-04 13:44 phk + + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: Fix off by one + error during wraparound. + +2006-07-04 09:28 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Close non + HTTP/1.1 request connections + +2006-07-04 09:21 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Add missing '%' + +2006-07-03 19:45 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: My workaround + for the missing OFF_T_MAX definition was not safe, + use a hardcoded "1<<30" which is. + +2006-07-03 19:35 phk + + * trunk/varnish-cache/contrib/libevent/event.c: I have grumbled + about the evilness of "current_base" before, and this just + proves the point: If two threads call event_init() at the same + time, + they will both stomp on the same memory via current_base, and in + all + likelyhood, neither of them will manage to get the job done + properly. + + Instead work on a local variable and don't assign to current_base + until the setup is complete. + + This should be submitted to Niels Provos + +2006-07-03 18:35 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Handle IPv6 + address -> string conversion too + +2006-07-03 18:03 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: Close race + condition + +2006-07-03 17:59 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: Better arg + checking + +2006-07-03 15:01 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: more asserts + +2006-07-03 14:39 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: avoid const + poison + +2006-07-03 14:39 phk + + * trunk/varnish-cache/bin/varnishd/cache_ban.c: Include pthread.h + +2006-07-03 14:37 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + s/unsigned/size_t/ + +2006-07-03 14:36 phk + + * trunk/varnish-cache/bin/varnishd/hash_simple_list.c: + s/init/start/ + +2006-07-03 12:41 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/hash_slinger.h, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Add another + hash-method with better real-world survival chances: A classic + bucketed hash table of lists. Hash is MD5. Number of buckets + and number + of mutexes can be configured at command line. + +2006-07-03 08:30 des + + * trunk/varnish-cache/configure.ac: Replace --enable-wall and + --enable-pedantic with --enable-developer-warnings, + which is roughly equivalent to FreeBSD's WARNS level 5 or 6. + +2006-07-01 05:44 phk + + * trunk/varnish-cache/include/http_headers.h: Mark more headers as + not end-to-end + +2006-06-30 20:22 phk + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Forgot to add + shmlog.c (reminded by des@) + +2006-06-30 20:21 phk + + * trunk/varnish-cache/include/queue.h: Add TAILQ_FOREACH_SAFE() + +2006-06-30 20:17 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: move all policy to + rfc2616.c + +2006-06-30 13:44 des + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c, + trunk/varnish-cache/include/stats.h: Consistently use our own + copy of queue.h. + +2006-06-30 11:20 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Fix object + length double accounting in chunked fetch + +2006-06-30 09:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: Delete compiled + VCL file after we tried to load it. + +2006-06-29 19:19 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/include/shmlog_tags.h: Log objects banned to + shmlog + +2006-06-29 19:06 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c: Track objects + heap-position + +2006-06-29 17:09 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_main.c: Add the ability + to instantly ban/purge all cached objects matching + a given regexp. + +2006-06-29 15:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h: Improve shm-logging + of VCL activity + +2006-06-29 14:37 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/include/shmlog_tags.h: Tag objects with + their origin session xid and log it when we clean up. + +2006-06-29 13:04 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/shmlog_tags.h: Add a unique + transaction-ID to each request, and register it in the + shmlog so we can match backend transactions with client + transactions. + +2006-06-28 21:38 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Convince + flexelint that we know what we do with some asserts + +2006-06-28 21:33 phk + + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: Put a mutex + around the shmlog writes, I've seen my first race. + +2006-06-28 21:18 phk + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c: Add a -o + argument which sorts the log into transactions before output, + this is a fair bit easier to chew through than the raw log (the + default) + +2006-06-28 21:03 phk + + * trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c: Use shmlog + api from libvarnishapi + +2006-06-28 20:58 phk + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c: Use SHMLOG api + in libvarnishapi + +2006-06-28 20:58 phk + + * trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am: Add SHMLOG + opening and walking functions to libvarnishapi + +2006-06-28 17:46 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Be more + consistent about which headers we send back. + + Start 5 threads in the worker pool. + +2006-06-28 16:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Construct our + own Content-length header, no matter which of the + three (straight, chunked, eof) modes we used to fetch the object. + +2006-06-28 16:58 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Don't finish the + sbuf in mode 3 + +2006-06-28 16:57 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Assert that + the lengths of the storage for the object add up. + +2006-06-28 16:57 phk + + * trunk/varnish-cache/include/http_headers.h: Don't pass + Content-Lenght through, we build it ourselves + +2006-06-28 16:20 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: Pass fd to + shmemlog + +2006-06-28 16:19 phk + + * trunk/varnish-cache/include/shmlog_tags.h: add tag for generated + headers + +2006-06-28 16:19 phk + + * trunk/varnish-cache/include/http_headers.h: Don't pass If-* + headers to backend + +2006-06-28 16:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c: Apply correct fd + in Shmemlog + +2006-06-28 16:04 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Fix buglets, + include test-driver. + +2006-06-28 11:29 phk + + * trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c: Give + varnishstat a "-c" option to use curses to continously refresh + +2006-06-28 11:21 phk + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishstat, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/configure.ac: Add varnishstat program + +2006-06-28 10:31 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: 304's don't have + a body + +2006-06-28 10:30 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Implement + ->trim() + +2006-06-28 09:39 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: More stats counters + +2006-06-28 09:21 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/shmlog.h, + trunk/varnish-cache/include/stat_field.h, + trunk/varnish-cache/include/stats.h: Add statistics counter + support. + + stat_field.h defines the counter fields with name, type, + (printf)format + and description. + + stats.h defines a structure with these fields. + + shmlog.h makes the structure part of the shared memory logs + header. + + Implent the "stats" CLI word in the management process. + +2006-06-26 19:25 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c: Call VCL to + decide discard/prefetch for near-expiry objects. + + Put discard objects on deathrow where they will be culled from + in sequence. + + (prefetch not implemented yet) + +2006-06-26 19:24 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: A temporary hack to + deal with very old Date: headers until we figure + out what's going on. + +2006-06-26 19:23 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Implement + HTTP/1.0 style fetching. + +2006-06-26 17:06 phk + + * trunk/varnish-cache/bin/varnishd/storage_malloc.c: Another + little tweak + +2006-06-26 16:31 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: Dump numeric + handling also, until we figure out trouble. + +2006-06-26 16:30 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: typo + +2006-06-26 16:19 phk + + * trunk/varnish-cache/bin/varnishd/storage_malloc.c: Make this + work again: record the stevedore in the storage object. + +2006-06-26 14:33 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c: Start + releasing objects when they expire + +2006-06-26 14:00 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c: Move a bit + more responsibility into the hash-slinger to get a cleaner + interface. + +2006-06-26 08:58 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c: Now that we + approach the time where objects have to be destroyed again, + we need to move the data structures into the right shape. + + Push hashing into cache_hash.c + + Add objhead structure to hold the various hits for "Vary:" + headers. + +2006-06-24 22:11 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: A little bit + more work on the expiry/prefetch thing. + +2006-06-24 21:54 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: Use ttl=0 as a + "invalid TTL" flag. + + Mark objects with ttl=0 uncachable. + + Add cacheable objects to the expiry heap + + Start an expiry thread which polls the root element once per + second + +2006-06-24 21:42 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: Truncate TTLs in the + past to now. + +2006-06-24 21:09 phk + + * trunk/varnish-cache/bin/varnishd/cache.h: Autogenerate + prototypes for method calling functions + +2006-06-24 21:07 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Add a "timeout" + method to VCL, it can return "fetch" or "discard". + +2006-06-24 20:50 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Add a token + type "METHOD", we use it for reference counting. + + Add a reference to the first backend {} we encounter, it is the + default. + Add a reference to all backends assigned explicitly. + Add a reference to all methods. + + Enable reference check, complain if: backend, function or acl is + defined + but not used, or used but not defined. + +2006-06-24 20:12 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Collapse multiline + Fc and Fh calls where they fit + +2006-06-24 20:09 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: More printf + sanitation: Create to convenience functions for output to the + fh and fc sbufs. + +2006-06-24 19:50 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Cave in and use + printf format extensions for printing tokens. + Both Linux and FreeBSD supports them anyway. + +2006-06-24 19:41 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add more + shmemlog tags: + one for each VCL method to record the return + one for errors + one for linking a client session to a backend connection + Use them sensibly. + Put VCL name of backend into struct backend to improve log + messages + +2006-06-22 16:17 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Improve the VCL + compiler in various ways: + + Generate the methods and their legal returns with the tcl script. + + Add consistency checks to make sure methods don't use illegal + returns, + and also check called subrourtines. + + Add consistency check to complain about recursive subroutine + calls. + + Add consistency check to complain about unused or undefined + subroutines. + +2006-06-21 10:28 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_main.c: Add (empty) + source file for expiry/pretech code + +2006-06-21 10:21 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: Start to respect TTL + +2006-06-21 10:13 phk + + * trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: Add "-t + default_ttl" option. 120 seconds by default. + +2006-06-21 09:58 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Quench some + debugging + +2006-06-21 08:09 phk + + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/binary_heap.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/binary_heap.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add a binary + heap implementation for keeping track of objects expiry time. + +2006-06-20 19:49 phk + + * trunk/varnish-cache/include/vrt.h: typo + +2006-06-20 19:38 phk + + * trunk/varnish-cache/lib/libvcl/flint.lnt, + trunk/varnish-cache/lib/libvcl/flint.sh: FlexeLint files + +2006-06-20 19:37 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: FlexeLint cleanups + +2006-06-20 19:31 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Polish things to + silence FlexeLint a bit + +2006-06-20 11:39 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: Rename + vcl_lang.h to vcl.h and include practically nowhere. + + Remove #include bogohandling in vcl_gen_fixed_token.tcl + +2006-06-20 10:31 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: At the expense + of some complexity and a small runtime overhead, + isolate the compiled code from the internal structures of the + cache + process through of VRT functions. + +2006-06-20 09:41 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Work towards + making struct sess opaque to the generated code. + +2006-06-20 09:28 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: Rename the VCL + compilers public functions to VCC prefix + +2006-06-20 09:25 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Get rid of + VCL_FARGS and VCL_PASS_ARGS macros. + + Generate VGC prefixes instead of VCL. + +2006-06-20 09:15 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: Start + putting some structure in the sources relating to VCL handling: + + Split the runtime support for compiled varnish programs out and + give it the + prefix "VRT". + + Start using the prefix "VGC" for generated code. + + Prefix "VCC" will be for the compiler and "VCL" for calling the + compiled and + loaded functions. + +2006-06-18 10:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Output + line+pos for counts. + +2006-06-18 10:19 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Insert a + count-point after each conditional. + +2006-06-18 10:16 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Get the sense of + string compares right. + +2006-06-18 10:12 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: debug printf for + max-age + +2006-06-18 10:10 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Implement + req.request properly + +2006-06-18 10:04 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Pass if we spot an + Authenticate or Cookie header + +2006-06-18 10:03 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: Add VCL function + for getting HTTP header + +2006-06-18 10:02 phk + + * trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add support + for investigating random HTTP headers. + +2006-06-18 09:16 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: Add wrappers + around VCL methos so logging and checking of returned handling + can be centralized. + + Remove old handling callbacks. + + Call hit/miss methods instead of lookup method. + +2006-06-18 09:14 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: add explicit + "lookup" to recv method + +2006-06-18 09:11 phk + + * trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Correctly + handle \ sequences in .h files in vcl_gen_fixed_token.tcl + + Make handling a named enum, and use it as a bitmap. + + Add "lookup" reserved word + + Add VCL_done() macro to use in compiled code to set handling and + drop + the per-handling callbacks (apart from VCL_error()) + +2006-06-18 07:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Add "deliver" + keyword to VCL compiler. + + Split vcl_lookup() in vcl_hit() and vcl_miss() + +2006-06-16 10:22 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Initial + http_GetHdrField() function. + + Improve chunked encoding, allocate big storage chunks and trim + the + last one at the end, instead of one storage chunk for each chunk + the remote server sends. + + Call RFC2616 policy code. + + Store headers from backend in cache and return to client. + +2006-06-16 10:20 phk + + * trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add header + field to object + +2006-06-16 10:19 phk + + * trunk/varnish-cache/include/http_headers.h: Supress + Transfer-Encoding + +2006-06-16 10:18 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/rfc2616.c: The beginnings of + rfc2616 policy implemenation. + +2006-06-16 10:17 phk + + * trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: Add trim + method to storage backends so chunked encoding can be + stored efficiently. + +2006-06-16 10:16 phk + + * trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/time.c: Add time parse/format + functions to libvarnish + +2006-06-15 08:04 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: less noise + +2006-06-15 08:04 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c: Less noise + +2006-06-14 09:57 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: start examining + HTTP status codes from backend + +2006-06-14 09:39 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Add + vca_write_obj() which writes an sbuf (as) HTTP header and the + object from the sessions to the client. + +2006-06-14 09:25 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Clean up session + messages a bit + +2006-06-14 09:23 phk + + * trunk/varnish-cache/include/shmlog_tags.h: Add HttpError tag + +2006-06-14 09:03 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Sanitize + close/recycle session logic a bit. + +2006-06-14 08:53 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_main.c: Initialize the + cache_acceptor.c/VCA in the same manner as other parts. + +2006-06-14 07:21 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c: Give storage + backends a "send" method. + + Let storage_file use sendfile(2) for it. + +2006-06-14 06:58 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Complete the + storage_file method. + +2006-06-13 20:09 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Default to "file" + stevedore from now on. + +2006-06-13 20:06 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Be more + aggressive about mmap'ing memory. The size_t thing is a bogus + constraint in FreeBSD and we shouldn't really listen to it. + + On my laptop I can mmap 2422MB file this way. + + This may be so aggressive that it leaves insufficient address + space for + malloc/threadstacks and other issues. + + If we find a way to pick up a platform/architecture specific + limit, we + can enforce that along the way. + + For now people can just specify a saner and smaller "-sfile" + size. + +2006-06-13 13:47 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: mmap as much as + the file as we are able to when the cache process opens + the stevedore. + + This should probably be (fine-)tuned later on as it might be too + aggressive + when faced with user errors. + + Also, might it be possible to mmap() more than MAX_SIZE_T bytes + if + it is done in multiple calls ? + +2006-06-13 13:14 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: Calculate the + size of the backing store file. + + A size can be specified in absolute terms (suffix: k, m, g, t + supported), + but also as a percentage of the filesystems free space (suffix + '%'). + + If the specified size is larger than an off_t can cope, we + bisect + repeatedly until it can. + + If the size exceeds the available space of the filesystem, we + truncate + to 80% of the free space. + + Then round down to an integral number of blocks, sized by the + larger + of the filesystem blocksize and the pagesize. + + This was tricker than I'd expected... + +2006-06-13 13:10 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Clone the stevedore + before calling its init function and be more precise + about any optional arguments. + +2006-06-13 08:05 phk + + * trunk/varnish-cache/bin/varnishd/_stevedore.h, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/stevedore.h: After having a + strong cup of tea: don't name files with leading underscore + even though that's how FreeBSD's kernel does it. In my private + world + a leading underscore means "junk file, remove at your pleasure". + +2006-06-13 08:02 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Clone the malloc + stevedore to the file stevedore + +2006-06-13 07:59 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Remember to tell + getopt about -s + +2006-06-13 07:57 phk + + * trunk/varnish-cache/bin/varnishd/_stevedore.h, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/storage_malloc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Put more meat on + the stevedore (storage backend) interface: + + Pull the struct definition into _stevedore.h and include this + from + cache.h and mgt.h, they both need to be able to see it. + + Add the stevedore pointer as an argument to the stevedore alloc + function + so multiple stevedores is possible later on. + + Add the stevedore pointer to the storage object, so freeing it + again is + possible. + + Add -s argument processing to select a given stevedore, call + it's ->init + method and pass the stevedore in the heritage. + + In the cache process pick stevedore out from heritage, call its + open method. + +2006-06-13 07:26 phk + + * trunk/varnish-cache/bin/varnishd/storage_malloc.c: Use NULL init + method + +2006-06-13 07:25 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c: Allow for NULL + init methods for hash and stevedore + +2006-05-01 12:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: Use + vca_write/vca_flush + +2006-05-01 12:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Use + vca_write/vca_flush + +2006-05-01 12:51 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: Use + vca_write/vca_flush + +2006-05-01 12:45 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Add + vca_write() and vca_flush(), two functions which will attempt to + use writev() if possible. + + vca_flush() must be called before any memory previosly given to + vca_write is overwritten, and after the last call to vca_write() + +2006-05-01 12:28 phk + + * trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/flint.sh: Add FlexeLint files + +2006-05-01 12:27 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: bandaid for + name-clash + +2006-05-01 12:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: Keep track of + how many connections we have open + +2006-05-01 12:27 phk + + * trunk/varnish-cache/bin/varnishd/cache.h: add missing extern + +2006-05-01 10:55 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Add INCOMPL() + macro to mark missing code. + + Add http_HdrIs() to check if we have a given header and if we do + if it has a given value. + + Use it. + + Ignore SIGPIPE since SO_NOSIGPIPE doesn't work reliably, (but set + it on accepted TCP connections anyway). + + Update passing to match fetching, including a chunked encoding + method. + +2006-05-01 07:54 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: Add yet + another thread with an event engine to monitor idle backend + connections and clean them out if the backend closes. + +2006-05-01 07:53 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Centralize + "Connection: close" handling from the backend. + + Loop until we have the entire chunk in chunked encoding + +2006-04-25 09:32 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c: test backend + connections at allocation time. + + General bush-wacking in the fetch code. + +2006-04-25 09:31 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: Fix argument to + http_BuildSbuf + +2006-04-25 09:30 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: Keep alive often + enough + +2006-04-25 08:17 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Make width + colum wider and decimal + +2006-04-25 08:17 phk + + * trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add new shmlog + tags and handling states + +2006-04-25 08:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Implement a + rudimentary chunked Transfer-Encoding + +2006-04-25 07:10 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: reset header + count before we dissect + +2006-04-25 07:04 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c: Track backend + connections in shmem log + +2006-04-25 06:52 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: Add an end + pointer so allocation size can be changed on the fly + +2006-04-25 06:48 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Move shmlog + entry, remove debugging + +2006-04-25 06:16 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Redo http + header storage and processing + +2006-04-24 19:10 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Add an indecisive + comment + +2006-04-24 19:09 phk + + * trunk/varnish-cache/include/http_headers.h: Sort and annotate + +2006-04-19 06:38 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Loop until we + have read it all + +2006-04-19 06:34 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Implement + enough of FetchSession and DeliverSession that we can actually + deliver a cached object. + +2006-04-18 08:23 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add busyflag + and strorage link to objects. + + Initialize default hasher and stevedore. + + Give each workerthread an object pointer to be kept populated + with + a template object for when lookups miss and need to insert one. + + Add libmd to get MD5, (choice of hash-algorithm to be revisited + later) + + Implement lookup, begin on fetch. + +2006-04-18 07:34 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: Add trivial + malloc backed storage backend. + +2006-04-12 08:58 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/include/shmlog.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_priv.h, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Implement the + three function VCL model in the compiler. + +2006-04-12 08:56 phk + + * trunk/varnish-cache/include/http_headers.h: Add ETag: header + +2006-04-11 08:28 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/tcp.c: Beginnings of the object + lookup stuff: A simple list based + implementation to get things moving. + +2006-04-06 10:01 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: Close or recycle + backend connections as appropriate + +2006-04-06 10:00 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c: Add + VBE_RecycleFd() function to recycle backend connections + +2006-04-06 09:59 phk + + * trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Pass + Content-Encoding header + +2006-04-06 09:38 phk + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c: Output the fd + in decimal instead of hex. + + Do Id Keyword + +2006-04-06 09:33 phk + + * trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Rename hdr_end + to a more sensible rcv_ptr which points to the first + unaccounted for character in the buffer. + + Do Id Keyword + +2006-04-06 09:30 phk + + * trunk/varnish-cache/include/shmlog_tags.h: Add shmlog tags for + pipe and pass handling + +2006-04-06 09:11 phk + + * trunk/varnish-cache/include/shmlog_tags.h: Log tag for session + reuse. + + Do Id Keyword + +2006-04-06 09:10 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: Recycle sessions + instead of retiring them. + +2006-04-06 09:09 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: Prune the bits we + used from the input buffer before we recycle the + session. + +2006-04-06 09:09 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Add a + vca_recycle_session() function which sticks a session back into + the acceptors event engine. + + Do Id keyword + +2006-04-06 09:08 phk + + * trunk/varnish-cache/bin/varnishd/cache_httpd.c: Don't log the + terminating NUL on response proto field. + +2006-04-06 08:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_httpd.c: Add an assert, + remove debugging. + +2006-04-06 08:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: Respect VCL + choice of handling + + Do Id keyword + +2006-04-06 08:16 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: Don't attempt to + restart child process (yet). + + Add Id Keyword handling + +2006-04-06 08:15 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: It's cheaper to + pipe than to pass, so if the client indicates + "Connection: close", pipe instead of passing. + +2006-04-06 07:50 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: Use + HttpdBuildSbuf() + + Enable Id keyword + +2006-04-06 07:50 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c: Add a function + to (re)build a HTTP request or response into an sbuf. + + Enable Id keyword + +2006-04-05 10:33 phk + + * trunk/varnish-cache/autogen.sh: Eliminate leaked developer hacks. + +2006-04-05 09:40 phk + + * trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: Account for the + last byte of the header. + +2006-04-04 10:35 des + + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c: I can't get + AM_CONDITIONAL to work properly, so use a bigger hammer. + +2006-04-04 10:09 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/mgt_child.c: More portability + changes: include config.h and compat.h, get rid of __unused. + +2006-04-04 10:08 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am: Link in libcompat, + and libsbuf is now static. + +2006-04-04 10:08 des + + * trunk/varnish-cache/lib/libsbuf/Makefile.am: Make libsbuf static. + +2006-04-04 10:07 des + + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/lib/Makefile.am, + trunk/varnish-cache/lib/libcompat, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c: Add a libcompat + with strlcat() and strlcpy() from OpenBSD. + +2006-04-04 09:05 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Get + pass-through working for the first request. + + Now we can start to play with multi-request sessions and all + that. + +2006-04-04 08:20 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add HTTP + response headers and processing. + +2006-04-04 07:46 phk + + * trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/cli.c: Reverse constification + of Argv functions. After cascading through all + the CLI functions we hit the fact that the evbuffer functions in + libevent + are not properly constified. + + It's better to deconst the error messages and just "let it be + known" that + argv[0] is const (or NULL). + +2006-04-04 07:30 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Get "Pass" + mode moving + +2006-04-04 07:29 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c: Make the + "receive a HTTP protocol header" code generic + +2006-04-04 07:27 phk + + * trunk/varnish-cache/include/vcl_lang.h: Add a session callback + pointer to struct sess. + +2006-04-04 07:26 phk + + * trunk/varnish-cache/bin/varnishd/cli_event.c: Use + bufferevent_base_set() from libevent + +2006-04-04 07:24 phk + + * trunk/varnish-cache/contrib/libevent/event.h: Add a missing + prototype until libevent people catch up. + +2006-04-04 07:24 phk + + * trunk/varnish-cache/include/shmlog_tags.h: Add a Debug shmemlog + tag. + +2006-04-04 07:24 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/cli.c, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: Portability + tweaks: use our own sbuf.h and queue.h; get rid of __DECONST; get + rid of digittoint() (which is pointless since ISO C guarantees + that digits + are consecutive in the execution character set); get rid of + __unused. + + Also fix a buglet in argv.c's BackSlash() (parsing of octal + numbers), and + constify the array passed around by ParseArgv() and FreeArgv(). + +2006-04-03 14:41 phk + + * trunk/varnish-cache/bin/varnishd/cache_httpd.c: Move memset + further up. + +2006-04-03 14:20 des + + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/configure.ac, + trunk/varnish-cache/contrib/Makefile.am: Hook up libevent to the + build. Note that this should be made conditional at + some later date. + +2006-04-03 14:04 des + + * trunk/varnish-cache/contrib/libevent/WIN32-Code/provos at badschwartau.provos.org.12766: + GC + +2006-04-03 12:05 des + + * trunk/varnish-cache/contrib/libevent/sample/Makefile.in, + trunk/varnish-cache/contrib/libevent/test/Makefile.in: Remove + generated files which were committed by mistake. + +2006-04-03 11:59 des + + * trunk/varnish-cache/contrib/libevent/Makefile.am, + trunk/varnish-cache/contrib/libevent/README, + trunk/varnish-cache/contrib/libevent/WIN32-Code/win32.c, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsp, + trunk/varnish-cache/contrib/libevent/buffer.c, + trunk/varnish-cache/contrib/libevent/configure.in, + trunk/varnish-cache/contrib/libevent/devpoll.c, + trunk/varnish-cache/contrib/libevent/epoll.c, + trunk/varnish-cache/contrib/libevent/evbuffer.c, + trunk/varnish-cache/contrib/libevent/event.3, + trunk/varnish-cache/contrib/libevent/event.c, + trunk/varnish-cache/contrib/libevent/event.h, + trunk/varnish-cache/contrib/libevent/event_rpcgen.py, + trunk/varnish-cache/contrib/libevent/event_tagging.c, + trunk/varnish-cache/contrib/libevent/http.c, + trunk/varnish-cache/contrib/libevent/http.h, + trunk/varnish-cache/contrib/libevent/kqueue.c, + trunk/varnish-cache/contrib/libevent/log.h, + trunk/varnish-cache/contrib/libevent/poll.c, + trunk/varnish-cache/contrib/libevent/rtsig.c, + trunk/varnish-cache/contrib/libevent/select.c, + trunk/varnish-cache/contrib/libevent/signal.c, + trunk/varnish-cache/contrib/libevent/strlcpy.c, + trunk/varnish-cache/contrib/libevent/test/Makefile.am, + trunk/varnish-cache/contrib/libevent/test/regress.c, + trunk/varnish-cache/contrib/libevent/test/regress.h, + trunk/varnish-cache/contrib/libevent/test/regress.rpc, + trunk/varnish-cache/contrib/libevent/test/regress_http.c, + trunk/varnish-cache/contrib/libevent/test/test-weof.c, + trunk/varnish-cache/contrib/libevent/test/test.sh: Update from + libevent CVS trunk. + +2006-04-03 11:05 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Segregate http + header fields into a separate structure, we will + reuse them a few places by the looks of it. + + Add VCA_UNKNOWNHDR (=10) fields for unknown HTTP headers. + If more headers arrive than that, they're lost (and logged as + such). + +2006-04-03 11:03 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: How I wish people + would think more ahead when writing libraries like + libevent. The entire "implicit event engine" api assumption + stinks. + + Deal with it better. + +2006-04-03 09:02 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: A little step + for humanity but a big step for varnish: + + Implement pipe-through mode and see the first web-pages actually + pass through varnish. + +2006-04-03 07:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: Call the init + function when the VCL code is loaded. + We may want to postpone this to use time later on. + +2006-04-03 07:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add 5 dummy + fields to the http headers, we will need them subsequently. + +2006-03-31 08:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: Use + http_headers.h to define session fields for headers and to parse + them out of the header. + +2006-03-31 08:26 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: Add missing + pthread.h includes + +2006-03-31 08:25 phk + + * trunk/varnish-cache/include/shmlog_tags.h: Use http_headers.h to + define HTTP header tags for logging + +2006-03-31 08:24 phk + + * trunk/varnish-cache/include/http_headers.h: Reusable macro + definition of HTTP headers. We will need these + several different places in the sources. + +2006-03-30 11:16 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: get us closer to a + connection to the backend + +2006-03-30 10:56 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Rework the + compilation of backend specifications in order to be able + to check the provided hostname/portname at compile time. + +2006-03-30 09:26 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add the + beginning of a backend connection pool + +2006-03-30 08:05 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Promote the + poll mutex to be a session mutex so that we can use it + for the VCL reference as well, this saves locking operations. + + Call the atual VCL code when we get the request. + +2006-03-30 07:05 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Integrate the + VCL code closer in the cache process: The passed + argument will be the session structure. + + Add the pool of worker threads (cache_pool). With a unitary + nature + of the VCL code, the HTTP parsing can be postponed to the worker + thread. + + This actually helps us with CPU cache locality as it will reduce + the + amount of memory allocated on one CPU but freed on another. + +2006-03-27 14:12 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Add config.load, + config.inline and config.use commands. + +2006-03-27 14:11 phk + + * trunk/varnish-cache/include/libvcl.h: Forgot to add this one. + Prototypes for the VCL compiler. + +2006-03-27 14:10 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Add + VCL_CompileFile() function. + +2006-03-27 13:59 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: Just return if + there is nothing to wait for. We get SIGCHLD'ed on + the popen child process. + +2006-03-27 13:57 phk + + * trunk/varnish-cache/include/cli_priv.h: Add a macro which we can + #ifdef + +2006-03-27 12:27 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: Build default VCL + from "-b backend_IP" option and pass it to client + via heritage. + +2006-03-27 11:51 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: edge closer + towards being a nice member of society + +2006-03-27 11:22 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Experimentally pull + in VCL program + +2006-03-27 11:21 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_priv.h: Actually generate a + shared object + +2006-03-27 11:21 phk + + * trunk/varnish-cache/include/vcl_lang.h: Stuff VCL programs needs + to know about. + +2006-03-27 09:02 phk + + * trunk/varnish-cache/configure.ac: add libvcl + +2006-03-27 09:01 phk + + * trunk/varnish-cache/lib/libvcl/Makefile, + trunk/varnish-cache/lib/libvcl/Makefile.am: Put under control of + auto* tools + +2006-03-27 09:01 phk + + * trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Newly + generated code + +2006-03-27 09:00 phk + + * trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: Don't + generate sparse array code. + +2006-03-24 10:46 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/include/shmlog_tags.h: More complete HTTP + parsing and logging. + +2006-03-24 10:23 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c: Change session + memory management to avoid pollution + + Add fledling httpd parsing + +2006-03-24 10:22 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c: Add a VSLR() + variant which logs a byte range without spending time in + sprintf + +2006-03-24 09:45 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/include/shmlog_tags.h: Log remote IP#:port + on session open + +2006-03-24 09:14 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: put symbolic + names on the tags + +2006-03-24 09:05 phk + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog, + trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/configure.ac: Add a minimal log tailer. + +2006-03-24 08:43 phk + + * trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/include/shmlog.h, + trunk/varnish-cache/include/shmlog_tags.h: Move the SHM tags + into a resuable .h file. + + Minor nits + +2006-03-23 15:31 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: Add shared memory + log setup and stuffer function in the child process. + + Log whenever we get a CLI ping + +2006-03-23 12:20 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Now we're starting + to get somewhere: Accept connections and assemble + a HTTP request. + +2006-03-23 08:45 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Open TCP sockets + +2006-03-17 13:41 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Make it possible to + suspend and resume a cli connection while we wait + for response from the child (or otherwise). + + Add a generic "pass-through" handler for cli requests we just + pass on + to the child. + +2006-03-17 10:03 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: Add multiplexing + for the mgt->child cli connection and get ping/pong + working across it. + + The management process will now keep the child process watchdog + from + expiring. + +2006-03-16 12:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/cli.c: cleanup + +2006-03-16 10:48 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: Expand the empty + shell a bit. + + Add CLI handler on stdin (for now, in production only if + debug is specified). + + Implement help, verbos, ping and start. + + start forks the child process, sets up listeners on its + stdout/stderr + (where nothing should arrive in production). + + Add SIGCHLD handler to reap and restart the child. + + Add shell "main" for the child: Set up a CLI handler on the + pipes + passed as heritage. + + Add ping command and keepalive timeout. + +2006-03-16 10:46 phk + + * trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h: Functions to + handle the CLI with event(3)'s buffer events. + + This may eventually belong in a library for wider use. + +2006-03-16 09:02 phk + + * trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/cli.c, + trunk/varnish-cache/lib/libvcl/Makefile: Generic and public + stuff for CLI protocol handling. + +2006-03-16 08:30 phk + + * trunk/varnish-cache/include/cli.h: add min+max argument counts + +2006-03-15 20:34 phk + + * trunk/varnish-cache/include/cli.h: Add definitions pertaining to + the ascii-protocol which will be used + multiple different places in the varnish architecture. + +2006-03-14 12:54 des + + * trunk/varnish-cache/contrib, + trunk/varnish-cache/contrib/libevent, + trunk/varnish-cache/contrib/libevent/Makefile.am, + trunk/varnish-cache/contrib/libevent/README, + trunk/varnish-cache/contrib/libevent/WIN32-Code, + trunk/varnish-cache/contrib/libevent/WIN32-Code/config.h, + trunk/varnish-cache/contrib/libevent/WIN32-Code/misc.c, + trunk/varnish-cache/contrib/libevent/WIN32-Code/misc.h, + trunk/varnish-cache/contrib/libevent/WIN32-Code/provos at badschwartau.provos.org.12766, + trunk/varnish-cache/contrib/libevent/WIN32-Code/win32.c, + trunk/varnish-cache/contrib/libevent/WIN32-Prj, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test/event_test.dsp, + + trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test/test.txt, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsp, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsw, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/signal_test, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/signal_test/signal_test.dsp, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/time_test, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/time_test/time_test.dsp, + trunk/varnish-cache/contrib/libevent/acconfig.h, + trunk/varnish-cache/contrib/libevent/buffer.c, + trunk/varnish-cache/contrib/libevent/compat, + trunk/varnish-cache/contrib/libevent/compat/sys, + trunk/varnish-cache/contrib/libevent/compat/sys/_time.h, + trunk/varnish-cache/contrib/libevent/compat/sys/queue.h, + trunk/varnish-cache/contrib/libevent/compat/sys/tree.h, + trunk/varnish-cache/contrib/libevent/configure.in, + trunk/varnish-cache/contrib/libevent/devpoll.c, + trunk/varnish-cache/contrib/libevent/epoll.c, + trunk/varnish-cache/contrib/libevent/epoll_sub.c, + trunk/varnish-cache/contrib/libevent/evbuffer.c, + trunk/varnish-cache/contrib/libevent/event-internal.h, + trunk/varnish-cache/contrib/libevent/event.3, + trunk/varnish-cache/contrib/libevent/event.c, + trunk/varnish-cache/contrib/libevent/event.h, + trunk/varnish-cache/contrib/libevent/evsignal.h, + trunk/varnish-cache/contrib/libevent/kqueue.c, + trunk/varnish-cache/contrib/libevent/log.c, + trunk/varnish-cache/contrib/libevent/log.h, + trunk/varnish-cache/contrib/libevent/poll.c, + trunk/varnish-cache/contrib/libevent/rtsig.c, + trunk/varnish-cache/contrib/libevent/sample, + trunk/varnish-cache/contrib/libevent/sample/Makefile.am, + trunk/varnish-cache/contrib/libevent/sample/Makefile.in, + trunk/varnish-cache/contrib/libevent/sample/event-test.c, + trunk/varnish-cache/contrib/libevent/sample/signal-test.c, + trunk/varnish-cache/contrib/libevent/sample/time-test.c, + trunk/varnish-cache/contrib/libevent/select.c, + trunk/varnish-cache/contrib/libevent/signal.c, + trunk/varnish-cache/contrib/libevent/test, + trunk/varnish-cache/contrib/libevent/test/Makefile.am, + trunk/varnish-cache/contrib/libevent/test/Makefile.in, + trunk/varnish-cache/contrib/libevent/test/bench.c, + trunk/varnish-cache/contrib/libevent/test/regress.c, + trunk/varnish-cache/contrib/libevent/test/test-eof.c, + trunk/varnish-cache/contrib/libevent/test/test-init.c, + trunk/varnish-cache/contrib/libevent/test/test-time.c, + trunk/varnish-cache/contrib/libevent/test/test-weof.c, + trunk/varnish-cache/contrib/libevent/test/test.sh: Add Niels + Provos's libevent 1.1a. + +2006-03-14 12:00 des + + * trunk/varnish-cache/include/hash.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/include/queue.h, + trunk/varnish-cache/include/sbuf.h, + trunk/varnish-cache/include/tree.h: Set the correct property + (svn:keywords, not svn:keyword) + +2006-03-14 11:57 des + + * trunk/varnish-cache/lib/libsbuf/Makefile.am, + trunk/varnish-cache/lib/libsbuf/sbuf.3, + trunk/varnish-cache/lib/libsbuf/sbuf.c: Add a man page, and set + the correct property (svn:keywords, not svn:keyword) + +2006-03-14 09:31 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: Add some trivial + bits while I think about the hard ones + +2006-03-14 09:15 phk + + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/argv.c: Add a function to + break a command line like string into an argv[]. + This will be useful for the various text based protocols etc. + +2006-03-13 14:23 des + + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/hash.h, + trunk/varnish-cache/include/queue.h, + trunk/varnish-cache/include/tree.h: Add hash.h, queue.h and + tree.h from NetBSD-CURRENT. + +2006-03-13 14:14 des + + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/sbuf.h, + trunk/varnish-cache/lib/Makefile.am, + trunk/varnish-cache/lib/libsbuf, + trunk/varnish-cache/lib/libsbuf/Makefile.am, + trunk/varnish-cache/lib/libsbuf/sbuf.c: Add libsbuf, based on + the latest sbuf code from FreeBSD-CURRENT. + +2006-03-13 13:30 phk + + * trunk/varnish-cache/autogen.sh: Pick up the gnu-autotools binary + directory if we spot one. This + makes life on FreeBSD somewhat easier. + +2006-03-13 12:37 phk + + * trunk/varnish-cache/lib/Makefile.am, + trunk/varnish-cache/lib/libvcl, + trunk/varnish-cache/lib/libvcl/Makefile, + trunk/varnish-cache/lib/libvcl/sample.vcl, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_priv.h, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Add first cut + of VCL compiler to the tree. + + The Makefile is a temporary shim until I get the auto* stuff + working. + + The sample.vcl is a small mock-up to test the compiler. + + Some of the .h files needs to move other places in the fullness + of time. + + But other than that... + +2006-03-02 10:32 des + + * trunk/varnish-cache: Ignore generated files; generated with the + following command: + + svk propset svn:ignore "$(svk status | awk '/^\?/ { print $2 + }')" . + +2006-03-02 10:31 des + + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/varnish, + trunk/varnish-cache/include/varnish/assert.h, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_log.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_util.c: Untested & + undocumented login code. I don't have time to continue working + on it right now, but I want it in the tree so phk doesn't start + duplicating + my effort. + +2006-03-02 10:29 des + + * trunk/varnish-cache/bin/varnishd: Add varnishd to ignore list. + +2006-02-27 14:21 des + + * trunk/varnish-cache/include: Ignore generated files. + +2006-02-27 14:21 des + + * trunk/varnish-cache/lib, trunk/varnish-cache/lib/libvarnish, + trunk/varnish-cache/lib/libvarnishapi: Ignore generated files. + +2006-02-27 14:21 des + + * trunk/varnish-cache/bin, trunk/varnish-cache/bin/varnishd: + Ignore generated files. + +2006-02-27 11:10 des + + * trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am: Correct + libtool idiom: run libtoolize after aclocal, and use LTLIBRARIES + instead of LIBRARIES. + +2006-02-27 09:55 des + + * trunk/varnish-cache/LICENSE: Don't forget the license! + +2006-02-24 14:35 des + + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/bin, trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishd, + trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/configure.ac, trunk/varnish-cache/include, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib, trunk/varnish-cache/lib/Makefile.am, + trunk/varnish-cache/lib/libvarnish, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am: Source tree + structure as agreed. + +2006-02-22 14:31 des + + * trunk/varnish-cache, trunk/varnish-doc, trunk/varnish-proto, + trunk/varnish-tools: Additional subdivisions. + From des at projects.linpro.no Fri Aug 11 06:26:41 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 08:26:41 +0200 (CEST) Subject: r788 - tags Message-ID: <20060811062641.C24C71EC696@projects.linpro.no> Author: des Date: 2006-08-11 08:26:41 +0200 (Fri, 11 Aug 2006) New Revision: 788 Added: tags/varnish-0.9/ Log: This is what was released as varnish-0.9. Copied: tags/varnish-0.9 (from rev 787, branches/0.9/varnish-cache) From phk at projects.linpro.no Fri Aug 11 07:01:14 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 09:01:14 +0200 (CEST) Subject: r789 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811070114.051211EC7EC@projects.linpro.no> Author: phk Date: 2006-08-11 09:01:13 +0200 (Fri, 11 Aug 2006) New Revision: 789 Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c Log: Fix an assert so it actually has a chance of firing: (an unsigned is always >= 0) Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-11 06:26:41 UTC (rev 788) +++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-11 07:01:13 UTC (rev 789) @@ -118,8 +118,8 @@ sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, p, j); WRK_Flush(sp->wrk); p += j; + assert(u >= j); u -= j; - assert(u >= 0); if (u == 0) break; p = bp = buf; From phk at projects.linpro.no Fri Aug 11 07:01:40 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 09:01:40 +0200 (CEST) Subject: r790 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811070140.1F8701EC7E9@projects.linpro.no> Author: phk Date: 2006-08-11 09:01:40 +0200 (Fri, 11 Aug 2006) New Revision: 790 Modified: trunk/varnish-cache/bin/varnishd/flint.sh Log: Point at KQUEUE version of acceptor by default. Modified: trunk/varnish-cache/bin/varnishd/flint.sh =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.sh 2006-08-11 07:01:13 UTC (rev 789) +++ trunk/varnish-cache/bin/varnishd/flint.sh 2006-08-11 07:01:40 UTC (rev 790) @@ -5,6 +5,7 @@ -I/usr/include \ -I. \ -I../../include \ + -DHAVE_KQUEUE \ flint.lnt \ *.c > $T 2>&1 From phk at projects.linpro.no Fri Aug 11 07:02:05 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 09:02:05 +0200 (CEST) Subject: r791 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811070205.5A34D3BC13D@projects.linpro.no> Author: phk Date: 2006-08-11 09:02:05 +0200 (Fri, 11 Aug 2006) New Revision: 791 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Remove unused variable. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-11 07:01:40 UTC (rev 790) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-11 07:02:05 UTC (rev 791) @@ -422,7 +422,6 @@ static void * vca_main(void *arg) { - unsigned u; struct kevent ke; int i; struct sess *sp; From phk at projects.linpro.no Fri Aug 11 07:03:19 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 09:03:19 +0200 (CEST) Subject: r792 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811070319.8BE771EC7F0@projects.linpro.no> Author: phk Date: 2006-08-11 09:03:19 +0200 (Fri, 11 Aug 2006) New Revision: 792 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: Fix indentation Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-11 07:02:05 UTC (rev 791) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-11 07:03:19 UTC (rev 792) @@ -263,7 +263,7 @@ if (p == NULL) return (0); *p = '\0'; -fprintf(stderr, "CLI <%s>\n", cp->buf); + fprintf(stderr, "CLI <%s>\n", cp->buf); vsb_clear(cp->cli->sb); cli_dispatch(cp->cli, cli_proto, cp->buf); vsb_finish(cp->cli->sb); From phk at projects.linpro.no Fri Aug 11 07:11:32 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 09:11:32 +0200 (CEST) Subject: r793 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811071132.BA0471EC7F0@projects.linpro.no> Author: phk Date: 2006-08-11 09:11:32 +0200 (Fri, 11 Aug 2006) New Revision: 793 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/flint.lnt trunk/varnish-cache/bin/varnishd/flint.sh trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/bin/varnishd/tcp.c Log: Pull in ../../config.h when running flexelint. Only include compat headers if we need them. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-11 07:03:19 UTC (rev 792) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-11 07:11:32 UTC (rev 793) @@ -30,7 +30,9 @@ #include #include +#ifndef HAVE_SRANDOMDEV #include "compat/srandomdev.h" +#endif #include "heritage.h" #include "shmlog.h" Modified: trunk/varnish-cache/bin/varnishd/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-11 07:03:19 UTC (rev 792) +++ trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-11 07:11:32 UTC (rev 793) @@ -2,6 +2,8 @@ +libh mgt_event.h +-header(../../config.h) + // Fix strchr() semtics, it can only return NULL if arg2 != 0 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) Modified: trunk/varnish-cache/bin/varnishd/flint.sh =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.sh 2006-08-11 07:03:19 UTC (rev 792) +++ trunk/varnish-cache/bin/varnishd/flint.sh 2006-08-11 07:11:32 UTC (rev 793) @@ -5,7 +5,6 @@ -I/usr/include \ -I. \ -I../../include \ - -DHAVE_KQUEUE \ flint.lnt \ *.c > $T 2>&1 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-11 07:03:19 UTC (rev 792) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-11 07:11:32 UTC (rev 793) @@ -17,7 +17,9 @@ #include /* XXX */ +#ifndef HAVE_SETPROCTITLE #include "compat/setproctitle.h" +#endif #include "heritage.h" #include "mgt.h" Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-11 07:03:19 UTC (rev 792) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-11 07:11:32 UTC (rev 793) @@ -13,7 +13,10 @@ #include #include +#ifndef HAVE_VASPRINTF #include "compat/vasprintf.h" +#endif + #include "cli_priv.h" #include "cli.h" #include "vsb.h" Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-11 07:03:19 UTC (rev 792) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-11 07:11:32 UTC (rev 793) @@ -23,7 +23,9 @@ #include #include +#ifndef HAVE_ASPRINTF #include "compat/asprintf.h" +#endif #include "shmlog.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-11 07:03:19 UTC (rev 792) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-11 07:11:32 UTC (rev 793) @@ -13,7 +13,9 @@ #include #include +#ifndef HAVE_STRLCPY #include "compat/strlcpy.h" +#endif #include "heritage.h" #include "mgt.h" From phk at projects.linpro.no Fri Aug 11 07:12:24 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 09:12:24 +0200 (CEST) Subject: r794 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811071224.973001EC7F2@projects.linpro.no> Author: phk Date: 2006-08-11 09:12:24 +0200 (Fri, 11 Aug 2006) New Revision: 794 Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: Missed one: Only include compat headers if necessary Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-11 07:11:32 UTC (rev 793) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-11 07:12:24 UTC (rev 794) @@ -11,7 +11,9 @@ #include #include +#ifndef HAVE_ASPRINTF #include "compat/asprintf.h" +#endif #include "vsb.h" #include "queue.h" From des at linpro.no Fri Aug 11 07:17:47 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Fri, 11 Aug 2006 09:17:47 +0200 Subject: r793 - trunk/varnish-cache/bin/varnishd References: <20060811071132.BA0471EC7F0@projects.linpro.no> Message-ID: phk at projects.linpro.no writes: > Only include compat headers if we need them. Why? The compat headers already contain the necessary #ifdefs. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From phk at projects.linpro.no Fri Aug 11 07:33:59 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 09:33:59 +0200 (CEST) Subject: r795 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811073359.D4F571EC7EC@projects.linpro.no> Author: phk Date: 2006-08-11 09:33:59 +0200 (Fri, 11 Aug 2006) New Revision: 795 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: Bail if we don't get a listening socket. Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-11 07:12:24 UTC (rev 794) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-11 07:33:59 UTC (rev 795) @@ -397,7 +397,8 @@ * but do not answer. That, on the other hand, would eliminate the * possibility of doing a "no-glitch" restart of the child process. */ - open_tcp(portnumber); + if (open_tcp(portnumber)) + exit (2); VSL_MgtInit(SHMLOG_FILENAME, 8*1024*1024); From phk at projects.linpro.no Fri Aug 11 07:35:09 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 09:35:09 +0200 (CEST) Subject: r796 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811073509.BDAAB1EC7EF@projects.linpro.no> Author: phk Date: 2006-08-11 09:35:09 +0200 (Fri, 11 Aug 2006) New Revision: 796 Modified: trunk/varnish-cache/bin/varnishd/tcp.c Log: Fix protocol family selection logic to also work on a FreeBSD machine with now IPv6. Remember to also free the addrinfo in case of success. Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-11 07:33:59 UTC (rev 795) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-11 07:35:09 UTC (rev 796) @@ -69,34 +69,38 @@ } #endif -int -open_tcp(const char *port) +static int +try_sock(int family, const char *port, struct addrinfo **resp) { struct addrinfo hints, *res; - int ret, sd, val; + int ret, sd; memset(&hints, 0, sizeof hints); - hints.ai_family = AF_INET6; + hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; - if ((ret = getaddrinfo(NULL, port, &hints, &res)) != 0) { - fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret)); + ret = getaddrinfo(NULL, port, &hints, &res); + if (ret != 0) return (-1); - } - sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (sd < 0 && errno == EPROTONOSUPPORT) { + if (sd < 0) freeaddrinfo(res); - hints.ai_family = AF_INET; - if ((ret = getaddrinfo(NULL, port, &hints, &res)) != 0) { - fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret)); - return (-1); - } - sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - } + else + *resp = res; + return (sd); +} + +int +open_tcp(const char *port) +{ + int sd, val; + struct addrinfo *res; + + sd = try_sock(AF_INET6, port, &res); + if (sd < 0) + sd = try_sock(AF_INET, port, &res); if (sd < 0) { - perror("socket()"); - freeaddrinfo(res); + fprintf(stderr, "Failed to get listening socket\n"); return (-1); } val = 1; @@ -129,6 +133,7 @@ #ifdef HAVE_ACCEPT_FILTERS accept_filter(sd); #endif + freeaddrinfo(res); heritage.socket = sd; return (0); } From phk at projects.linpro.no Fri Aug 11 07:35:33 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 09:35:33 +0200 (CEST) Subject: r797 - trunk/varnish-cache/include Message-ID: <20060811073533.9E7111EC7F3@projects.linpro.no> Author: phk Date: 2006-08-11 09:35:33 +0200 (Fri, 11 Aug 2006) New Revision: 797 Modified: trunk/varnish-cache/include/http_headers.h Log: Don't filter Cache-Control out in replies from backend. Modified: trunk/varnish-cache/include/http_headers.h =================================================================== --- trunk/varnish-cache/include/http_headers.h 2006-08-11 07:35:09 UTC (rev 796) +++ trunk/varnish-cache/include/http_headers.h 2006-08-11 07:35:33 UTC (rev 797) @@ -34,7 +34,7 @@ HTTPH("Age", H_Age, 2, 0, 0, 0, 0) /* RFC2616 14.6 */ HTTPH("Allow", H_Allow, 2, 0, 0, 0, 0) /* RFC2616 14.7 */ HTTPH("Authorization", H_Authorization, 1, 0, 0, 0, 0) /* RFC2616 14.8 */ -HTTPH("Cache-Control", H_Cache_Control, 3, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.9 */ +HTTPH("Cache-Control", H_Cache_Control, 3, 3, HTTPH_R_PASS|HTTPH_R_FETCH, 0, 0) /* RFC2616 14.9 */ HTTPH("Connection", H_Connection, 3, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.10 */ HTTPH("Content-Encoding", H_Content_Encoding, 2, 0, 0, 0, 0) /* RFC2616 14.11 */ HTTPH("Content-Langugae", H_Content_Language, 2, 0, 0, 0, 0) /* RFC2616 14.12 */ From phk at phk.freebsd.dk Fri Aug 11 07:41:56 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Fri, 11 Aug 2006 07:41:56 +0000 Subject: r793 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Fri, 11 Aug 2006 09:17:47 +0200." Message-ID: <38292.1155282116@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >phk at projects.linpro.no writes: >> Only include compat headers if we need them. > >Why? The compat headers already contain the necessary #ifdefs. It clutters up my FlexeLint output because it figures out that the headers are unused. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at linpro.no Fri Aug 11 07:42:54 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Fri, 11 Aug 2006 09:42:54 +0200 Subject: r796 - trunk/varnish-cache/bin/varnishd References: <20060811073509.BDAAB1EC7EF@projects.linpro.no> Message-ID: phk at projects.linpro.no writes: > Log: > Fix protocol family selection logic to also work on > a FreeBSD machine with now IPv6. It already worked on FreeBSD machines with no IPv6. Perhaps you'd like to tell me what the problem is before you rip out my code? DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at linpro.no Fri Aug 11 07:43:53 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Fri, 11 Aug 2006 09:43:53 +0200 Subject: r793 - trunk/varnish-cache/bin/varnishd References: <38292.1155282116@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > It clutters up my FlexeLint output because it figures out that > the headers are unused. Then perhaps this should be fixed in the Flexelint configuration. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From phk at phk.freebsd.dk Fri Aug 11 07:51:56 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Fri, 11 Aug 2006 07:51:56 +0000 Subject: r796 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Fri, 11 Aug 2006 09:42:54 +0200." Message-ID: <38333.1155282716@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >phk at projects.linpro.no writes: >> Log: >> Fix protocol family selection logic to also work on >> a FreeBSD machine with now IPv6. > >It already worked on FreeBSD machines with no IPv6. Perhaps you'd >like to tell me what the problem is before you rip out my code? It didn't work here. It failed in the first getaddrinfo() so it never got the chance to fall back and try the second one. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From phk at phk.freebsd.dk Fri Aug 11 07:52:58 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Fri, 11 Aug 2006 07:52:58 +0000 Subject: r793 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Fri, 11 Aug 2006 09:43:53 +0200." Message-ID: <38346.1155282778@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >"Poul-Henning Kamp" writes: >> It clutters up my FlexeLint output because it figures out that >> the headers are unused. > >Then perhaps this should be fixed in the Flexelint configuration. That doesn't make any sense to me. Why should we waste time opening a source file we know we will not need anything in ? -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at projects.linpro.no Fri Aug 11 08:24:47 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 10:24:47 +0200 (CEST) Subject: r798 - trunk/varnish-cache Message-ID: <20060811082447.8B7401EC69C@projects.linpro.no> Author: des Date: 2006-08-11 10:24:47 +0200 (Fri, 11 Aug 2006) New Revision: 798 Added: trunk/varnish-cache/INSTALL trunk/varnish-cache/README Log: Add a README and installation instructions. Added: trunk/varnish-cache/INSTALL =================================================================== --- trunk/varnish-cache/INSTALL 2006-08-11 07:35:33 UTC (rev 797) +++ trunk/varnish-cache/INSTALL 2006-08-11 08:24:47 UTC (rev 798) @@ -0,0 +1,13 @@ + Installation Instructions + +Varnish uses the GNU autotools. To build and install Varnish, simply +run the 'configure' script in the top-level directory, then run 'make' +and 'make install'. + +Additional 'configure' options of interest: + + --enable-developer-warnings + enable strict warnings (default is NO) + --enable-debugging-symbols + enable debugging symbols (default is NO) + --enable-werror use -Werror (default is NO) Added: trunk/varnish-cache/README =================================================================== --- trunk/varnish-cache/README 2006-08-11 07:35:33 UTC (rev 797) +++ trunk/varnish-cache/README 2006-08-11 08:24:47 UTC (rev 798) @@ -0,0 +1,13 @@ +This is an alpha release of the Varnish high-performance HTTP +accelerator. + +Please read the following web page before trying out Varnish: + + http://varnish.projects.linpro.no/wiki/AlphaReadme + +Technical questions about Varnish and this release should be addressed +to . + +For more information about the project, see: + + http://varnish.projects.linpro.no/wiki From des at projects.linpro.no Fri Aug 11 08:25:04 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 10:25:04 +0200 (CEST) Subject: r799 - trunk/varnish-cache/lib/libcompat Message-ID: <20060811082504.F3C151EC69C@projects.linpro.no> Author: des Date: 2006-08-11 10:25:04 +0200 (Fri, 11 Aug 2006) New Revision: 799 Modified: trunk/varnish-cache/lib/libcompat/Makefile.am Log: Don't install libcompat.a. Modified: trunk/varnish-cache/lib/libcompat/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-11 08:24:47 UTC (rev 798) +++ trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-11 08:25:04 UTC (rev 799) @@ -2,7 +2,7 @@ INCLUDES = -I$(top_srcdir)/include -lib_LIBRARIES = libcompat.a +noinst_LIBRARIES = libcompat.a libcompat_a_SOURCES = \ asprintf.c \ From des at projects.linpro.no Fri Aug 11 08:25:20 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 10:25:20 +0200 (CEST) Subject: r800 - trunk/varnish-cache Message-ID: <20060811082520.B72283BC125@projects.linpro.no> Author: des Date: 2006-08-11 10:25:20 +0200 (Fri, 11 Aug 2006) New Revision: 800 Modified: trunk/varnish-cache/Makefile.am Log: Include LICENSE and autogen.sh in the dist tarball. Modified: trunk/varnish-cache/Makefile.am =================================================================== --- trunk/varnish-cache/Makefile.am 2006-08-11 08:25:04 UTC (rev 799) +++ trunk/varnish-cache/Makefile.am 2006-08-11 08:25:20 UTC (rev 800) @@ -1,3 +1,5 @@ # $Id$ SUBDIRS = include lib bin + +EXTRA_DIST = LICENSE autogen.sh From des at projects.linpro.no Fri Aug 11 08:34:43 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 10:34:43 +0200 (CEST) Subject: r801 - trunk/varnish-cache Message-ID: <20060811083443.B47E83BC125@projects.linpro.no> Author: des Date: 2006-08-11 10:34:43 +0200 (Fri, 11 Aug 2006) New Revision: 801 Added: trunk/varnish-cache/svn2cl.xsl Log: This is the XSL stylesheet used to generate the ChangeLog. Added: trunk/varnish-cache/svn2cl.xsl =================================================================== --- trunk/varnish-cache/svn2cl.xsl 2006-08-11 08:25:20 UTC (rev 800) +++ trunk/varnish-cache/svn2cl.xsl 2006-08-11 08:34:43 UTC (rev 801) @@ -0,0 +1,403 @@ + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &newl; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &newl; + + + + + &space;&space; + + + + &newl; + &newl; + + + + + + + &newl; + + + + + &space;&space; + + + + &newl;&newl; + + + + + + :&space; + + + + + [r + + ]&space; + + + + + + + &newl; + + + + + + + &newl; + + &tab;*&space; + + + + + + + + + + + + + + &space; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ,&space; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + &tab;&space;&space; + + + + + + + + + + &newl; + + + + + + + + + + + + + + + + + + + &newl;&tab;&space;&space; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &newl;&newl; + + + + + + + + + + + + + + + + + From des at projects.linpro.no Fri Aug 11 08:35:22 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 10:35:22 +0200 (CEST) Subject: r802 - trunk/varnish-cache Message-ID: <20060811083522.914861EC7FF@projects.linpro.no> Author: des Date: 2006-08-11 10:35:22 +0200 (Fri, 11 Aug 2006) New Revision: 802 Modified: trunk/varnish-cache/svn2cl.xsl Log: Print the message separately from the paths to avoid strange wrapping. Modified: trunk/varnish-cache/svn2cl.xsl =================================================================== --- trunk/varnish-cache/svn2cl.xsl 2006-08-11 08:34:43 UTC (rev 801) +++ trunk/varnish-cache/svn2cl.xsl 2006-08-11 08:35:22 UTC (rev 802) @@ -188,8 +188,12 @@ &tab;*&space; - + + &tab;&space;&space; + + + From des at projects.linpro.no Fri Aug 11 08:40:25 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 10:40:25 +0200 (CEST) Subject: r803 - trunk/varnish-cache Message-ID: <20060811084025.A719C1EC7FE@projects.linpro.no> Author: des Date: 2006-08-11 10:40:25 +0200 (Fri, 11 Aug 2006) New Revision: 803 Modified: trunk/varnish-cache/svn2cl.xsl Log: Widen left and right margins, and add a blank line between the paths and the message. Modified: trunk/varnish-cache/svn2cl.xsl =================================================================== --- trunk/varnish-cache/svn2cl.xsl 2006-08-11 08:35:22 UTC (rev 802) +++ trunk/varnish-cache/svn2cl.xsl 2006-08-11 08:40:25 UTC (rev 803) @@ -75,7 +75,7 @@ - + @@ -185,12 +185,12 @@ &newl; - &tab;*&space; + &space;*&space; - &tab;&space;&space; + &newl;&space;&space;&space; @@ -312,14 +312,13 @@ - - &tab;&space;&space; + &space;&space;&space; - + @@ -327,7 +326,7 @@ - + @@ -340,9 +339,8 @@ - - &newl;&tab;&space;&space; + &newl;&space;&space;&space; From des at projects.linpro.no Fri Aug 11 08:41:23 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 10:41:23 +0200 (CEST) Subject: r804 - trunk/varnish-cache Message-ID: <20060811084123.3517F3BC125@projects.linpro.no> Author: des Date: 2006-08-11 10:41:23 +0200 (Fri, 11 Aug 2006) New Revision: 804 Added: trunk/varnish-cache/ChangeLog Log: Regenerate. Added: trunk/varnish-cache/ChangeLog =================================================================== --- trunk/varnish-cache/ChangeLog 2006-08-11 08:40:25 UTC (rev 803) +++ trunk/varnish-cache/ChangeLog 2006-08-11 08:41:23 UTC (rev 804) @@ -0,0 +1,6806 @@ +2006-08-11 08:40 des + + * trunk/varnish-cache/svn2cl.xsl: + + Widen left and right margins, and add a blank line between the paths and + the message. + +2006-08-11 08:35 des + + * trunk/varnish-cache/svn2cl.xsl: + + Print the message separately from the paths to avoid strange wrapping. + +2006-08-11 08:34 des + + * trunk/varnish-cache/svn2cl.xsl: + + This is the XSL stylesheet used to generate the ChangeLog. + +2006-08-11 08:25 des + + * trunk/varnish-cache/Makefile.am: + + Include LICENSE and autogen.sh in the dist tarball. + +2006-08-11 08:25 des + + * trunk/varnish-cache/lib/libcompat/Makefile.am: + + Don't install libcompat.a. + +2006-08-11 08:24 des + + * trunk/varnish-cache/INSTALL, trunk/varnish-cache/README: + + Add a README and installation instructions. + +2006-08-11 07:35 phk + + * trunk/varnish-cache/include/http_headers.h: + + Don't filter Cache-Control out in replies from backend. + +2006-08-11 07:35 phk + + * trunk/varnish-cache/bin/varnishd/tcp.c: + + Fix protocol family selection logic to also work on + a FreeBSD machine with now IPv6. + + Remember to also free the addrinfo in case of success. + +2006-08-11 07:33 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Bail if we don't get a listening socket. + +2006-08-11 07:12 phk + + * trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + + Missed one: Only include compat headers if necessary + +2006-08-11 07:11 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/flint.sh, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/tcp.c: + + Pull in ../../config.h when running flexelint. + + Only include compat headers if we need them. + +2006-08-11 07:03 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + Fix indentation + +2006-08-11 07:02 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Remove unused variable. + +2006-08-11 07:01 phk + + * trunk/varnish-cache/bin/varnishd/flint.sh: + + Point at KQUEUE version of acceptor by default. + +2006-08-11 07:01 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Fix an assert so it actually has a chance of firing: (an unsigned is + always >= 0) + +2006-08-10 13:03 des + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Rewrite pass_chunked(). + +2006-08-10 11:48 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Got the requesttime right this time. + + I am noticing free()'s that are freeing empty variables/pointers. Have + to find where is happens. + Also noticing IP adresses not set correctly. + + Still load of debugcode. + +2006-08-10 11:10 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Updated to work with new inner workings (ReqStart, ReqEnd, sbuf + replacement etc). + + Code now compiles. + +2006-08-10 08:56 des + + * trunk/varnish-cache/bin/varnishd/tcp.c: + + FreeBSD needs for IPPROTO_IPV6 and IPV6_V6ONLY. + +2006-08-10 07:38 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Added some more meat to the program. Loads of debug code still on. + + Next step is to add the correct time. It's a bit tricky, and I haven't + gotten it right just yet. + +2006-08-09 14:49 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/configure.ac: + + Add an epoll()-based acceptor for Linux 2.6. Simple empirical tests + indicate + that epoll() performs significantly better than poll() (less CPU usage). + +2006-08-09 12:38 des + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + Clear reference to backend when we release our VCL reference. + +2006-08-09 11:24 des + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: + + Add support for using separate backends for separate virtual hosts: + + - remove the obj.backend variable, which is not connected to anything. + - define a req.backend variable and implement l/r functions for it + - complete / correct support for setting / comparing backend values + +2006-08-09 11:22 des + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c: + + Cosmetic: redefine HTTP_HDR_* as an enum and rename MAX_HTTP_HDRS to + HTTP_HDR_MAX. + +2006-08-09 09:36 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/tcp.c: + + Rewrite open_tcp(): use only one listening socket. Try for a combined + IPv6 / IPv4 socket; if IPv6 is not available, fall back to an IPv4 socket. + +2006-08-08 14:52 des + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + While FreeBSD defaults to MAP_SHARED, Linux requires either MAP_SHARED or + MAP_PRIVATE to be specified. Do so. + +2006-08-08 14:00 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/configure.ac: + + Autodetect the need to link against libdl for dlopen(). + +2006-08-08 12:57 des + + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat/setproctitle.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/setproctitle.c: + + Add a setproctitle() stub to libcompat. + +2006-08-08 12:57 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + #include "compat/srandomdev.h" for srandomdev() + +2006-08-08 12:55 des + + * trunk/varnish-cache/include/compat/vis.h, + trunk/varnish-cache/lib/libcompat/vis.c: + + Expand keywords. + +2006-08-08 12:46 des + + * trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/configure.ac: + + #include for fstatfs if it is available. + +2006-08-08 12:45 des + + * trunk/varnish-cache/configure.ac: + + Now that we define _GNU_SOURCE, the asprintf() / vasprintf() hack is no + longer required. + +2006-08-08 12:42 des + + * trunk/varnish-cache/configure.ac: + + Defining _GNU_SOURCE gives us native asprintf() and strptime() on glibc + systems, and has no effect on FreeBSD. + +2006-08-08 12:31 des + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat/vis.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/vis.c: + + Bring in FreeBSD's version of vis(3), strvis(3) and strvisx(3). + +2006-08-08 12:15 des + + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat/srandomdev.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/srandomdev.c: + + Add a simple srandomdev() implementation inspired by the one in FreeBSD. + +2006-08-08 09:15 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + The correct header for poll() is , not like the Linux + man page says (poll() is an XSI extension in SUSv[23]) + +2006-08-08 07:47 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/configure.ac: + + Autodetect the availability of kqueue() and / or poll(). + +2006-08-08 07:47 des + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + + #include "libvarnish.h" for varnish_version(). + +2006-08-08 07:36 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + + Add back sendfile support (under #ifdef HAVE_SENDFILE) but don't engage + it for small objects on the suspicion that it has highish setup cost. + +2006-08-08 07:17 des + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat, + trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/include/compat/asprintf.h, + trunk/varnish-cache/include/compat/strlcat.h, + trunk/varnish-cache/include/compat/strlcpy.h, + trunk/varnish-cache/include/compat/vasprintf.h, + trunk/varnish-cache/lib/libcompat/asprintf.c, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c, + trunk/varnish-cache/lib/libcompat/vasprintf.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c: + + Split compat.h into one header per function to avoid issues with e.g. the + vasprintf() prototype needing even when it isn't used. + +2006-08-08 07:15 des + + * trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishstat/Makefile.am: + + varnish{ncsa,stat} also need librt. + +2006-08-08 07:03 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/configure.ac: + + Attempt to detect the availability of RSA's MD5 implementation, and the + need to link against libmd to get it. + Attempt to detect the need for linking against librt to get + clock_gettime(). + +2006-08-08 07:01 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + + Fix braino + +2006-08-08 06:39 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + + Default to 4096 buckets and 256 mutexes + +2006-08-08 06:38 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + + Use crc32 hash by default, MD5 is a compile time option + +2006-08-08 06:37 phk + + * trunk/varnish-cache/bin/varnishd/flint.lnt: + + lbv_assert never returns + +2006-08-07 21:08 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + + 64bit changes + +2006-08-07 21:01 phk + + * trunk/varnish-cache/configure.ac: + + Add -Wformat and remove -fno-inline which disables it. + +2006-08-07 21:01 phk + + * trunk/varnish-cache/lib/libvarnish/assert.c: + + Fix printf format error + +2006-08-07 20:50 phk + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/configure.ac: + + Update to new shmlog tag + +2006-08-07 20:47 phk + + * trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_priv.h, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + + Eliminate use of extensible printf + +2006-08-07 20:24 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Improve the "-d" and "-d -d" facilities. + + When we close a CLI and it had fd# 0 and/or fd#1, reopen these + as /dev/null so the will not be reused for the CLI pipe to the + child on next restart, otherwise stdout/stderr output from the + manager would get sent there and confuse the clients CLI reader. + + Don't double free a pointer to the CLI buffer. + + Accept non-zero results from cli_readres() errors are non-fatal. + + Use stderr more consistently for manager debugging. + +2006-08-07 18:33 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + An assert to catch silly errors. + +2006-08-07 17:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Rename SHMlog tags for consistency + XID -> ReqStart + ReqServTime -> ReqEnd + +2006-08-07 17:18 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Remove printf extensions used for development debugging + +2006-08-07 17:18 phk + + * trunk/varnish-cache/include/libvarnish.h: + + Make assert do the right thing + +2006-08-07 17:15 phk + + * trunk/varnish-cache/lib/libvcl/vcc_token.c: + + Clean up #includes + +2006-08-07 17:10 phk + + * trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/assert.c: + + Call __assert() lbv_assert() instead. + +2006-08-07 17:08 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/lib/libvarnish/assert.c: + + quench warnings related to libvarnish.h + +2006-08-07 16:45 des + + * trunk/varnish-cache/configure.ac: + + Don't trust the documentation - when it says "additional headers", it + actually means "additional code to place before main() in the test program" + +2006-08-07 16:42 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishtester/varnishtester.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/assert.c: + + Add our own assert in libvarnish.h + + Include libvarnish.h from cache.h and mgt.h + +2006-08-07 16:29 des + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + #include "libvarnish.h" for varnish_version(). + +2006-08-07 16:26 des + + * trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c: + + #include "compat.h" for asprintf(). + +2006-08-07 16:24 des + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + + vsb.h is not a system header. + +2006-08-07 16:23 des + + * trunk/varnish-cache/bin/varnishtop/varnishtop.c: + + #include "libvarnish.h" for varnish_version(). + +2006-08-07 16:23 des + + * trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + + #include "compat.h" for asprintf(). Sort includes. + +2006-08-07 16:20 des + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Define INFTIM if it isn't already. + +2006-08-07 16:20 des + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Spell SIZE_MAX correctly. + +2006-08-07 16:17 des + + * trunk/varnish-cache/bin/varnishd/mgt_event.c: + + Define INFTIM if it isn't already. + +2006-08-07 16:17 des + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + #include for asprintf(). + +2006-08-07 16:15 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + Handle CLI trouble with the childproc + +2006-08-07 16:14 phk + + * trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/lib/libvarnish/cli_common.c: + + Add CLIS_COMMS errno (400) and return an error text as well. + +2006-08-07 16:11 des + + * trunk/varnish-cache/bin/varnishd/tcp.c, trunk/varnish-cache/configure.ac: + + Check whether we have accept filters before trying to use them. + +2006-08-07 16:05 phk + + * trunk/varnish-cache/lib/libvarnish/cli_common.c: + + Handle read errors on the cli pipes. + +2006-08-07 15:54 des + + * trunk/varnish-cache/configure.ac: + + Improve descriptions of HAVE_ASPRINTF / HAVE_VASPRINTF. + +2006-08-07 15:54 phk + + * trunk/varnish-cache/lib/libvarnish/vsb.c: + + Quench warnings. + +2006-08-07 15:51 des + + * trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/lib/libcompat/vasprintf.c: + + My idiocy knows no bounds. Make sure this actually builds. + +2006-08-07 15:47 des + + * trunk/varnish-cache/configure.ac: + + Improve detection of the presence and usability of asprintf() / + vasprintf(). + +2006-08-07 15:42 des + + * trunk/varnish-cache/include/compat.h: + + paste-o. + +2006-08-07 15:24 des + + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/asprintf.c, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c, + trunk/varnish-cache/lib/libcompat/vasprintf.c: + + Add implementations of asprintf(3) and vasprintf(3). + +2006-08-07 15:09 des + + * trunk/varnish-cache/include/libvarnish.h: + + Relucantly include for time_t. We'll have to clean up our header + files at some point. + +2006-08-07 15:08 des + + * trunk/varnish-cache/bin/varnishd/shmlog.c: + + Remove redundant definition of __assert(). + +2006-08-07 15:00 des + + * trunk/varnish-cache/include/libvarnish.h: + + TIM_{format,parse}() are used unconditionally, so declare them + unconditionally. + +2006-08-07 15:00 des + + * trunk/varnish-cache/bin/varnishd/cache.h: + + Sort includes, add for uint64_t. + +2006-08-07 14:55 des + + * trunk/varnish-cache/lib/libvcl/vcc_compile.c: + + Eliminate __unused. + +2006-08-07 14:52 des + + * trunk/varnish-cache/lib/libvarnish/cli_common.c: + + Sort includes, add for uintptr_t. + +2006-08-07 12:42 des + + * trunk/varnish-cache/lib/libvarnish/vsb.3: + + Define str-Lb-libvarnish so ".Lb libvarnish" will work. This should be in + a shared file somewhere with some soelim magic in the Makefile, but don't + bother right now - the file isn't installed anyway. + +2006-08-07 12:35 des + + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/version.c: + + Add a -V option (display version and exit) to all programs. + +2006-08-07 11:09 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_re.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/cli_common.h, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/include/sbuf.h, trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/include/vsb.h, + trunk/varnish-cache/lib/Makefile.am, trunk/varnish-cache/lib/libsbuf, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/cli_common.c, + trunk/varnish-cache/lib/libvarnish/vsb.3, + trunk/varnish-cache/lib/libvarnish/vsb.c, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + + Fold libsbuf into libvarnish, with s/sbuf/vsb/g. + +2006-08-07 10:46 phk + + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + Timeout pipe connections after 600 seconds. + +2006-08-07 10:40 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Use a 600 second timeout, 120 second is too little. + +2006-08-07 09:21 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Set SO_SNDTIMEO to 120 seconds + +2006-08-07 08:42 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + + First step of slow client handling: Lose the stevedore function + for sending and instead record the fd+off_t in the storage object. + + This eliminates sendfile from storage_file.c, next step is to put + it back in the generic code in cache_response.c + +2006-08-07 05:52 des + + * trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvarnish/cli_common.c: + + Update #include directives. + +2006-08-07 05:49 des + + * trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/include/binary_heap.h, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/miniobj.h, + trunk/varnish-cache/include/stats.h, + trunk/varnish-cache/include/varnish/assert.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/binary_heap.c, + trunk/varnish-cache/lib/libvarnish/cli.c, + trunk/varnish-cache/lib/libvarnish/time.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_log.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_util.c: + + Expand keywords. + +2006-08-07 05:49 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/cli_common.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/cli_common.c: + + Move common_cli.[ch] out of varnishd, and rename them to cli_common.[ch]. + +2006-08-07 05:47 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am: + + List headers in noinst_HEADERS instead of SOURCES. + +2006-08-07 00:21 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Fresh start after study of output from varnishlog -o. + + First off is IP adress logging and clearing. + +2006-08-06 17:00 des + + * trunk/varnish-cache: + + Add compile to svn:ignore. + +2006-08-06 16:55 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Make + -w - + work as expected. + +2006-08-06 15:02 des + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishtester/Makefile.am, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libsbuf/Makefile.am, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am, + trunk/varnish-cache/lib/libvcl/Makefile.am: + + Systematically include config.h. + +2006-08-06 14:33 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am: + + Forcibly include config.h. + +2006-08-06 13:51 des + + * trunk/varnish-cache/configure.ac: + + Change version to "trunk" until I can figure out a way to have it reflect + the current date. + +2006-08-06 13:49 des + + * trunk/varnish-cache/configure.ac: + + Include -pipe in CFLAGS. + Reduce optimization level to -O when debugging. + +2006-08-06 12:51 des + + * trunk/varnish-cache: + + Adjust directory properties. + +2006-08-06 12:49 des + + * trunk/varnish-cache/bin/varnishlog, + trunk/varnish-cache/bin/varnishncsa, + trunk/varnish-cache/bin/varnishstat, + trunk/varnish-cache/bin/varnishtester, + trunk/varnish-cache/bin/varnishtop, trunk/varnish-cache/lib/libcompat, + trunk/varnish-cache/lib/libsbuf, trunk/varnish-cache/lib/libvcl: + + Adjust directory properties. + +2006-08-06 12:26 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishstat/Makefile.am: + + Add missing headers and man pages. + +2006-08-06 12:26 des + + * trunk/varnish-cache/autogen.sh: + + We no longer have any CONFIG_SUBDIRS. + +2006-08-06 12:25 des + + * trunk/varnish-cache/include/Makefile.am: + + Add missing headers. + +2006-08-06 12:23 des + + * trunk/varnish-cache/Makefile.am: + + Umm, *really* retire libevent. + +2006-08-06 12:23 des + + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/configure.ac, + trunk/varnish-cache/contrib: + + Retire libevent. + +2006-08-06 12:20 des + + * trunk/varnish-cache/bin/Makefile.am, trunk/varnish-cache/configure.ac: + + Fully disconnect varnishtester. + +2006-08-06 00:44 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + I have realized that I have major structure problems. I will have to + study varnishlog output a bit more to understand it better. + + May wanna start clean again, and use hardearned knowledge to make + better and more robust structure. + +2006-08-05 22:43 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Checks show that my IP adress checker is very restrictive and probably + deletes other loglines. We still bleeds null lines also. + + This will have to be cleaned up. + +2006-08-05 22:12 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Loglines with no IP should no longer appear. That also cleared all + lines containing a null. Not sure if my check for IP is to harsly + implemented and cleans to much. + +2006-08-05 21:35 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Centralized the stringwriting at last, also started memory cleanup. + +2006-08-05 21:11 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Added user, loginname, statuscode (200, 304 etc.), byte and referer to + make a logline compliant. User and loginname is hardcoded. Referer and + User-agen is unclean. Timecode is not working. This version leaks + memory bigtime, and is not ready for alpha yet. + +2006-08-05 20:52 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + For consistency: Go to deliver state instead of delivering locally. + +2006-08-05 18:11 phk + + * trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: + + Make vcl methods call their defaults as a last resort. + + Fix the location table so it knows about the default code too. + +2006-08-05 17:30 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + + And that is not a good idea either. + +2006-08-05 17:30 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + + This was not a valid test. + +2006-08-05 17:04 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Add some undocumented code to look for something that worries me. + +2006-08-05 16:41 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + + Issue error message for CLI::start and CLI::stop if child is + not in a legal state for command. + +2006-08-05 16:32 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + + Also trap SIGTERM + +2006-08-05 16:31 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + More work on the debug stunt + +2006-08-05 15:55 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + + Plug memory leaks related to starting/stopping child. + +2006-08-05 15:40 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + + Replace client_should_run with a 5 state enum to avoid races if multiple + CLI sources yell at the same time. + +2006-08-05 15:38 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + Bail if the cli pipe is not ready + +2006-08-05 15:38 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Polish the debugstunt and make it possible to avoid it. + +2006-08-05 15:35 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c: + + We don't disturb ourselves. + +2006-08-05 14:24 phk + + * trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + + More defensive coding and a couple of bugs less. + +2006-08-05 14:22 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + + More defensive coding. + +2006-08-05 12:45 phk + + * trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + Add a timeout to reads from the child CLI pipe so we don't hang + for ever. + +2006-08-05 12:24 phk + + * trunk/varnish-cache/bin/varnishd/flint.lnt: + + Improve. + +2006-08-05 12:24 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + + Style cleanup. + + remove two unused variables. + +2006-08-05 12:24 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + Remove unused include + + Fix function arg type + +2006-08-05 12:23 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + + Make sanity check of binheap permanent and fix style accordingly. + +2006-08-05 12:23 phk + + * trunk/varnish-cache/bin/varnishd/common_cli.c: + + Remove unused include + + free buffer on error. + +2006-08-05 12:22 phk + + * trunk/varnish-cache/bin/varnishd/cache_cli.c: + + Make sure we don't overflow the line buffer + + Remove unused #include + +2006-08-05 12:20 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + Remove unused "ip" from backend. + + Make VCL_Load static, and give it a NULL check. + +2006-08-05 12:19 phk + + * trunk/varnish-cache/bin/varnishd/common_cli.h: + + Cleanup unused stuff + +2006-08-05 12:19 phk + + * trunk/varnish-cache/bin/varnishd/mgt.h: + + Remove prototypes for no longer existing functions + +2006-08-05 12:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + Remove unused includes + +2006-08-05 12:17 phk + + * trunk/varnish-cache/bin/varnishd/flint.sh: + + don't search libevent for includes + +2006-08-05 12:17 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c: + + style fix + +2006-08-05 12:16 phk + + * trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + + Rename struct vcls to vclprog + +2006-08-05 11:44 phk + + * trunk/varnish-cache/bin/varnishd/cli_common.c: + + remove old file + +2006-08-05 11:16 phk + + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + + Change manager to use mgt_event.h instead of threads to be lazy thread + developer compatible. + + POSIX, no surprise, doesn't really tell what should happen to a threaded + process which forks and consequently implemenations vary somewhat, + from Solaris which seems to Do The Right Thing, via Linux where it + works "most of the time" and to FreeBSD which more or less actively + sabotages any such attempt. + + Grin and live with it... + +2006-08-05 11:13 phk + + * trunk/varnish-cache/bin/varnishd/cache_cli.c: + + Remove pthread.h include, it's included in cache.h + +2006-08-05 11:12 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c: + + Remove debugging printfs + +2006-08-05 11:08 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c: + + More bugfixes + +2006-08-05 11:07 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + + Add assert + +2006-08-05 10:31 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: + + bugfixes + +2006-08-05 09:27 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: + + Add signal support. + +2006-08-05 08:49 phk + + * trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: + + bugfixes + +2006-08-05 08:19 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: + + Add a miniature event engine based on poll(2). + + It's general enough to find other uses, but right now it's only for + the manager process. + +2006-08-05 01:17 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Got the IP, Request and User-Agent sorted out. Working on the time + +2006-08-04 20:03 phk + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Initialize all directions to "opposite" for -b and -c to avoid + spurious first entries. + +2006-08-04 19:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + Use id for printing + +2006-08-04 19:36 phk + + * trunk/varnish-cache/include/stat_field.h: + + Stats field changes + +2006-08-04 19:36 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_session.c: + + More comprehensive performance stats and a few asserts, just in case. + +2006-08-04 11:10 phk + + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + + Now that we keep track of loaded VCLs in the manager, we might + as well allow their manipulation also when the child is not + running. + +2006-08-04 10:54 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/include/cli.h, trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl: + + Redo VCL program handling. + + Keep track of all loaded VCL programs in the manager and tell the + child to load them via VCL. + + Don't start he acceptor thread until a "start" command cones down + the CLI. + + XXX: Right now we leak stuff when a VCL program is dicarded + +2006-08-04 10:23 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Redo our management of compiled VCL programs: + + Take default_vcl out of heritage. + + Keep track of all compiled VCL files and delete them at + exit. + + After starting child, use CLI to load all vcl programs + and then issue "start" via the CLI. + + In the cacher, don't start the acceptor until we get + a start command. + +2006-08-04 09:19 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Move VCL compiler related stuff to mgt_vcc.c + +2006-08-04 09:06 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Remove old cli related stuff, it now lives elsewhere + +2006-08-04 09:06 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + reimplement CLI stats + +2006-08-04 07:21 phk + + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + Implement CLI ping in manager, this is a "per hop" command. + + Add mgt_cli_askchild() function to poke the CLI interface to + the child. + + Use it to ping the child every second. + +2006-08-04 07:20 phk + + * trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h: + + Move cli_func_ping to common_cli + +2006-08-04 07:19 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c: + + SIGCHLD has already been taken care of earlier. + +2006-08-04 06:53 phk + + * trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/include/cli.h: + + Change the CLI protocol in a subtle but useful way: + + The first line of the response has a fixed format ("%-3d %-8u\n") + and consequently fixed length (CLI_LINE0_LEN == 13). + + This makes parsing responses more efficient. Add a function + in common_cli to do so. + +2006-08-04 06:23 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + (Re)Implement passthru of cli commands, we can now talk with the + cache process again. + +2006-08-04 06:21 phk + + * trunk/varnish-cache/include/cli.h: + + Add CLIS_CANT status code for when something is valid but currently + impossible. + +2006-08-04 06:21 phk + + * trunk/varnish-cache/bin/varnishd/cache_cli.c: + + Typo: write cli result to correct pipe. + +2006-08-03 23:42 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Placed a new sbuf_clear at a more strategic place. It got cluttered + when a host left without SessionClose of SessionReuse. + +2006-08-03 22:01 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Got a workaround for IP adress fetching. If we connect logger while + Varnish is running, we won't catch the IP from SessionOpen since it's + already done that. Workaround is to catch the IP from SessionReuse if + IP of session is NULL + +2006-08-03 19:21 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Fix copy&paste bug in fetch_chunked. + +2006-08-03 19:20 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Sanitycheck that the length of an object adds up, right when we + fetch it. + +2006-08-03 11:46 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + + Imlement stopping and restarting of child process. + + Not as useful as it will be yet, see ticket 22 + +2006-08-03 11:45 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Make the pipe-stunt debug process smarter. + +2006-08-03 10:37 phk + + * trunk/varnish-cache/bin/Makefile.am: + + Take varnishtester out of the loop until it can be de-libevented + +2006-08-03 10:37 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + Add stop command as well. + +2006-08-03 10:16 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Think I have found a program structure that works. Filling in bits to + build logline. + +2006-08-03 09:45 phk + + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/bin/varnishtester/Makefile.am: + + Remove libevent from the picture. + +2006-08-03 09:45 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_common.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Rip out the old CLI handling and start over, more or less. + + Still bits missing. + +2006-08-03 06:45 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.h: + + Rework the cache process CLI handling: + + We are only accepting CLI from the pipes in heritage, so simply + run a loop reading those, dispatching lines as we see them. + + Export CLI_cmds[] so that the management process can see it, + we might as well take advantage of the shared binary where we can. + +2006-08-02 22:53 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Added SessionReuse so I now write a logline for SessionClose and + SessionReuse. + +2006-08-02 22:33 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Starting to get the structure right (I think). Thx for the NULL on + each string Poul-Hennning :) + +2006-08-02 20:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + + Add an assert, just in case. + +2006-08-02 20:54 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + + Fix a bug when deleting items in the binheap + +2006-08-02 19:12 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: + + log StatAddr with fd=0 to avoid out-of-order confusion + +2006-08-02 18:17 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Allow ENOENT on removing kqueue events, a close will have drained + them already. + +2006-08-02 18:12 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Tell daemon(3) to not chdir in debugging mode so we can find our core + dumps. + +2006-08-02 17:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + Enter pass mode through the front door. + +2006-08-02 17:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + More asserts, sp->vbc this time. + +2006-08-02 15:55 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Remember to clear sp->vbc + +2006-08-02 13:28 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Don my plumbers outfit and twist a lot of pipes into shape: + + When -d(ebug) is specified we fork before calling daemon. + + The parent process becomes a miniature cat(1) program which connects + stdin/stdout with the management process stdin/stdout. + + It also knows that SIGINT should be passed on to the management process + in order to make it DTRT. + + Any other cause of death for this "debugger" process will (once I + teach the CLI about it) not affect the running varnish and therefore + it will be possible to start varnish in debugging mode, tweak things + a bit and CTRL-D and leave it running in the properly daemon(3)'ed + background. + + The reason for this rather complicated bit of pipework is that we + can not call daemon(3) once we have started any threads (only the + calling thread survives) and we would loose our parent relationship + to the cache process also. + +2006-08-02 12:05 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Typo: Also monitor remote sockets with the poll based acceptor. + +2006-08-02 11:58 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c: + + Remove the libevent from the backend pool manager. + + Simplify the logic here while we're at it. + +2006-08-02 11:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Add include + +2006-08-02 11:17 phk + + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + Remove unused struct. + +2006-08-02 10:53 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c: + + Simplify backend connection memory management. + +2006-08-02 10:40 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Replace libevent based acceptor with poll(2) based acceptor. + +2006-08-02 09:34 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c: + + Bite the bullet and write an alternate acceptor which uses kqueue + directly instead of libevent. + + Degeneralize the header reading code in cache_http.c which seems to + be cleaner anyway. + + An #ifdef at the top of cache_acceptor.c selects which implementation + you want: libevent or kqueue. + +2006-08-02 07:23 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Convert pipe to use poll(2) on the two filedescriptors it cares about + and eliminate the per-workerthread event engine entirely. + +2006-08-02 07:07 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c: + + I have nothing but circumstantial evidence that libevent is involved + in the current stack corruption I see, but we might as well avoid + using it where we can: + + Don't engage the eventengine when we talk to the backend, just call + read(2) directly. + +2006-08-02 04:57 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c: + + More miniobj paranoia + +2006-08-01 19:48 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + More miniobj checks + +2006-08-01 17:54 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + More miniobj checks + +2006-08-01 16:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/flint.lnt: + + More miniobj checks + +2006-08-01 16:26 phk + + * trunk/varnish-cache/bin/varnishd/cache_response.c: + + more miniobj checks + +2006-08-01 15:09 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_re.c: + + Flinting. + +2006-08-01 15:08 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Make 32bit limitation work better. + +2006-08-01 15:08 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + + Fixx off by one error. + +2006-08-01 14:53 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/storage_file.c: + + Add miniobj checks om SMF and STORAGE + +2006-08-01 12:38 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + This is getting too longhaired: Give backend connections another + http header which we can use to build the object headers in. + +2006-08-01 12:04 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Experiment: don't use req's workspace to build object http header. + +2006-08-01 09:39 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Record timestamp when we have received completed HTTP request header, + and define this as the "start of request timestamp". + + Define "end of request timestamp" as when we are ready to transmit + HTTP header back. + + SHMlog the start and difference between start and stop with ReqServTime + tag. + + Keep track of idle sessions using CLOCK_MONOTONIC to avoid trouble + here should our clock get stepped. + +2006-07-31 22:21 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Added some more toying with the data. All is still a mess, and I am + not sure of structure yet. PHK is also doing changes in areas that + will be needed. + +2006-07-31 22:09 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Always NUL terminate shmlog entries. + +2006-07-31 21:49 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Create three groups of seven SHMlog tags: + + {Rx,Tx,Obj}{Request,Response,Status,URL,Protocol,Header,LostHeader} + + And log http header munching accordingly. + +2006-07-31 21:46 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + + Remove unused variable + +2006-07-31 21:37 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: + + addr might be NULL if we are called from the prefetcher. + +2006-07-31 21:04 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + + Add http_ClrHeader() and cure an unintended bug-oid its use exposes: + we checked if the request is a GET long after we should have. + +2006-07-31 20:38 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + + Add a http_SetResp() function for constructing HTTP responses (like 304). + + Eliminate the header index from http_SetHeader() which is no unused. + +2006-07-31 20:27 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Log the headers we store in the object under ObjHeader so that + we don't get two confusing batches of TxHeader in the sessions logentries. + +2006-07-31 19:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + Fix the dot-graph + +2006-07-31 14:50 andersb + + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + + Initial commit of real structure. This code will print the User-Agent. + +2006-07-31 07:26 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + + Introduce http_SetHeader() for setting a http header to a const string, + no need to waste time printf'ing in this case, and no need to waste + workspace. + +2006-07-31 07:13 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Don't fill more than half the workspace with received data, we need to + have space for composing the reply as well. + + Without this fix, the entire workspace could be filled with pipelined + requests and we would have no space to compose the reply. + +2006-07-31 06:36 des + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishncsa, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.1, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/configure.ac: + + Clone varnishncsa off of varnishlog. Anders will hack on it to produce + NCSA-style (common / combined) logs. + +2006-07-31 06:24 des + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + + Unbreak build. + +2006-07-28 13:41 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + "HEAD" has 4 characters. + +2006-07-24 10:13 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + remove this file (again) + +2006-07-22 22:01 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + + reorg a little bit. + +2006-07-22 21:20 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + + Eliminate redundant args from stevedore->send() + + Have WRK_Write() and friends return number of bytes (we can't use + WRK_Flush() as that may act on both header and body). + + Collect more stats. + +2006-07-22 20:57 phk + + * 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_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: + + Add per address, per session and total statistics. + + We (will) collect data in unlocked per workerthread accumulators + and whenever the workerthread leaves the session, we charge the + bill to the srcaddr (issuing a StatAddr shmrecord), to the session + and to the global counters in the stats struct. + + When sessions die we issue a StatSess shmrecord. + + StatAddr and StatSess has the same format: + address + port (always zero for StatAddr) + duration (seconds) + #sessions + #requests + #pipe + #pass + #fetch + #hdrbytes + #bodybytes + +2006-07-22 16:55 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Make sure there always is a Host: header in fetch requests. + + We fill it in with backend.hostname, but this may not be optimal + (direct IP# etc etc) so VCL should be able to override it. + +2006-07-22 16:26 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + Action pass from vcl_hit() needs to go to STP_PASS + +2006-07-22 16:15 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c: + + Always use GET and HTTP/1.1 against the backend for fetch + +2006-07-22 13:58 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + exit after error + +2006-07-22 12:00 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_vrt_re.c, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: + + Implement regexp matching of strings in VCL. + + For now we default to REG_EXTENDED, but it might make sense + to let the user control this flag and the case sensitivity. + + Another concern is the stringification of regexps, it may lead + to backslash madness. Maybe we should define '...' string types + also and do no backslash substitution in those at all. + +2006-07-22 10:41 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: + + Change the acl syntax slightly: the ( ... ) should enclose all of + the rule (ie: also ! and /mask if present). + + Implement matching for IPv4. + + Acl tests are shmlogged as follows (doc candidate): + + shmlog tag: VCL_actl + + "NO_MATCH $acl" + client did not match access list $acl + "FAIL $acl $rule" + getaddrinfo(3) failed on $rule which had a '!' + "MATCH $acl $rule" + client matched $rule + "NEG_MATCH $acl $rule" + client matched negated (!) $rule + +2006-07-22 10:35 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_session.c: + + Store the socket address in the session + +2006-07-22 09:38 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl: + + VCL compiler: + add two sbufs for "init" and "fini" actions. + + VCL ACLs: Change syntax and implementation as follows. + + ACL Syntax now works the following way: + + acl $name { + ! ( "myhost.com" ) ; + "10.0.0.1" /8 ; + } + + The '!' means not. If the address matches the rest of the rule + the address does NOT match the acl and the search terminates here. + + Enclosing the string in paranthesis means that the rule will be ignored + if the string cannot be converted to an address (with getaddrinfo). + + When a string can not be looked up, and is not enclosed in a + paranthesis, a positive rule (ie: without !) will not match and a + negative rule (with !) will match. + + A mask can always be supplied, no matter the style of the string + given, so it is possible to do things like: + + { "fw.ourcompany.dom" / 24 } + + Which means "any host on the same /24 subnet as fw.ourcompany.dom". + + + Unfortunately getaddrinfo() does not return a TTL for the results, + in the future we may want to use some kind of timeout to refresh + the lookups. + +2006-07-22 08:02 phk + + * trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/Makefile.am, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: + + Split IP/ACL compilation into vcc_acl.c + +2006-07-21 22:12 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/storage_file.c: + + Unless the user specifies an explicit size, don't use more than 2GB + on 32 bit architectures to avoid running out of address room + + Make FlexeLint happy. + +2006-07-21 21:57 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + + Make FlexeLint happier + +2006-07-21 21:42 phk + + * trunk/varnish-cache/autogen.phk: + + Drop this one now. + +2006-07-21 21:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + + Implement TTL adjustment from VCL + + Log in shmem where the TTL came from (doc-candidate): + + 696613561 RFC 900 1153517009 1153517014 1153517914 900 0 + | | | | | | | | + | | | | | | | age + | | | | | | max-age + | | | | | Expires: header + | | | | Date: header + | | | "now" + | | TTL relative to "now" + | who set the TTL + xid of object + + or + + 696613561 VCL 20 1153517009 + | | | | + | | | "now" + | | TTL relative to "now" + | who set the TTL + xid of object + +2006-07-21 21:13 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: + + More VRT work. + + Use macros for trivial objects which are just a field in a struct. + +2006-07-21 21:01 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vrt.h: + + Update VRT to minimal functional level again + +2006-07-21 20:51 phk + + * trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: + + Use const char* for safety + +2006-07-21 20:45 phk + + * trunk/varnish-cache/include/binary_heap.h, + trunk/varnish-cache/include/miniobj.h, + trunk/varnish-cache/include/stat_field.h, + trunk/varnish-cache/include/stats.h, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h: + + Update + +2006-07-21 20:44 phk + + * trunk/varnish-cache/include/vrt_obj.h: + + This file is generated. + +2006-07-21 20:43 phk + + * trunk/varnish-cache/lib/libvcl/Makefile.am, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + + Automate generation of tables and prototypes for the objects which + VCL programs can manipulate. + +2006-07-21 18:12 phk + + * trunk/varnish-cache/lib/libvcl/Makefile.am, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c, + trunk/varnish-cache/lib/libvcl/vcc_priv.h, + trunk/varnish-cache/lib/libvcl/vcc_token.c, + trunk/varnish-cache/lib/libvcl/vcc_token_defs.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_priv.h, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + + Move things over to the correct "VCC" prefix. + + Split some stuff into separate files while we're at it. + +2006-07-21 16:25 phk + + * trunk/varnish-cache/include/http_headers.h: + + update comment + +2006-07-21 16:15 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Properly log TTL calculation to shmem + +2006-07-21 16:06 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Fix formatting of responses. + +2006-07-21 16:05 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + + Log TTL calculation on the right fd + +2006-07-21 15:25 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Work on logtailer api a bit: + + By default, start at the last entry in shared memory. To dump the + entire segment from the start, specify '-d' option. + + Terminate programs when '-r $file' reaches EOF + +2006-07-21 12:18 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/flint.lnt: + + Cleanup + +2006-07-21 12:08 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + + Magic check on struct vbe + +2006-07-21 12:06 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + + Better name + +2006-07-21 11:55 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/stat_field.h: + + Convert fetch, insert and deliver to use new HTTP header munging code. + + Remove sbuf from workerthread, it is only used in the Error handling + now and it will probably not even survive that in the long run. + +2006-07-21 10:44 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Make pipe use the new http manipulation. + +2006-07-21 09:32 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + 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_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/http_headers.h: + + HTTP header munging part (N of M) + + NB: Only pass mode (lightly) tested right now. + + Give up on the three element array per header and use a two element struct + instead, it reduces obfuscation and removes risk of pointer fandango. + + Introduce #defined filtercontrol in http_headers.h, use them in a new + field. Only Pass is there for now. + + Use the http-workspace for building headers instead of sbuf. + + Move uiovec handling to cache_pool.c where it more naturally belongs + and so we can use it on both backends and sessions. + + Add http header munging functiosn for copying, printf'ing, filtering and + writing headers. + +2006-07-21 07:18 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Rename shmlog tags for headers to RxHeader and TxHeader that's more + logical. + + Rename http_Init() to http_Setup() to avoid clash with HTTP_Init(). + + Remove unused variable + +2006-07-20 22:08 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Yet another refinement to the way we store and deal with HTTP headers. + + Record a triplet of {start, data, end} for all HTTP data items. + + This represents a regrettable uglification of the sourcecode, but + most of it compiles out to constants and the runtime benefits will + be worth it. + + Generate H_FOO magic strings for all the headers we know about. + These strings have a length as first char and always ends in ':'. + + Also genereate H_FOO format strings in VCL compiler. + + Mandate (with assert) that header references happen using H_FOO strings. + + Make number of allowed HTTP headers a compile time constant (32) + but make the workspace a run-time variable (4096). + + Introduce new SHM tag for dumping aborted HTTP protocol requests. + +2006-07-20 15:10 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + + Add XXX comment + +2006-07-20 14:46 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/include/stat_field.h: + + Keep an eye on deathrow + +2006-07-20 14:40 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + + More asserts + +2006-07-20 14:23 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + + We need to check the TTL here also, if a (sequence of) slow client(s) + manages to hold the document referenced, the prefetcher may never + get lucky with it and it will linger here much past last sell date. + +2006-07-20 13:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Only reference srcaddr on first request on session + +2006-07-20 13:39 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: + + Be more paranoid about srcaddr + +2006-07-20 13:33 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: + + upd + +2006-07-20 13:29 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/include/stat_field.h: + + Keep track of active source addresses + +2006-07-20 12:03 phk + + * trunk/varnish-cache/bin/varnishtop/varnishtop.c: + + Add -1 option that stops comparison after first field. + + Useful with commands like: + + varnishtop -i header -1 + varnishtop -i srcaddr -1 + + where the variable part of the entry is less relevant. + +2006-07-20 10:10 phk + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + + Show also average since start + +2006-07-20 09:58 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Hmm, that was a bad idea. + +2006-07-20 09:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Loop till we have everything. + +2006-07-20 09:29 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + + Implement "If-Modified-Since" conditional queries + +2006-07-20 08:29 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + + Remove explicit worker thread arguments. + +2006-07-20 08:25 phk + + * 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_pass.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + + Move the delivery functions from acceptor to response + +2006-07-19 21:16 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: + + Rework the worker thread pool logic slightly, we were leaking + threads before. + +2006-07-19 21:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/include/stats.h: + + Include a "start_time" timestamp in the stats and teach varnishstats + to print it in curses mode. + + Some polishing and cleanup. + +2006-07-19 20:07 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Use insert_pass in vcl_fetch() so we cache the uncacheability. + +2006-07-19 20:06 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Don't explode on trim's to zero size. + + Real fix should (maybe) be to callers + +2006-07-19 19:49 phk + + * trunk/varnish-cache/bin/varnishtop/varnishtop.c: + + Update only once per second. + +2006-07-19 19:48 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Make sure width and precision arguments to printf %*.*s are ints. + +2006-07-19 19:47 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: + + Don't panic on NULL srcaddr, but revisit later when we know the + details. Is it the Prefetcher ? + +2006-07-19 19:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: + + Delete the right list item. + +2006-07-19 19:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + Don't bother determining if we should close if we already have done so. + Also: we may not have valid headers if cache_http.c threw a 400. + +2006-07-19 19:43 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Make sure hp->v is NUL terminated. + +2006-07-19 12:37 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c: + + Use miniobj.h to catch pointer trouble + +2006-07-19 12:36 phk + + * trunk/varnish-cache/include/miniobj.h: + + Add miniobj.h for debugging + +2006-07-19 11:53 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + + Avoid the Error path for now. + +2006-07-19 11:11 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + + handle 302 for now. + +2006-07-19 08:33 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Properly zero the worker structure when we start a thread. + +2006-07-18 13:47 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: + + eliminate debugging + +2006-07-18 13:19 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + + Delete binheap root by it's index. + + Expect a refcount of one (the one holding the object in the hash) + +2006-07-18 13:18 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + + Fix the Parent calculation + +2006-07-18 12:46 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + + Set the index of deleted elements to zero + +2006-07-18 12:40 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + + Move the root index from zero to one + +2006-07-18 12:29 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Remove the deref/unbusy stuff from FetchBody() it's done in central.c + +2006-07-18 12:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + + Assert that object is busy when we call unbusy + +2006-07-18 12:27 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c: + + Use a void * for http_Read()'s buffer + +2006-07-18 10:48 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Braino this time. + +2006-07-18 10:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + typo + +2006-07-18 10:45 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + Add http_Read() which reads from a socket but soaks up any prefeched + tail first and use it all the places where this logic was explicit + before. + + Fix Refcounting on objects when we insert/deliver + +2006-07-18 10:32 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Use bigger buffersizes for pass mode + + Terminate the sbuf with the reply headers properly. + +2006-07-18 09:02 phk + + * 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: + + Retire the http_GetReq(), http_GetURL() and http_GetProto() accessor + functions now that struct http is out of the closet. + +2006-07-18 08:52 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + polish + +2006-07-18 08:51 phk + + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + zero means 'all' to http_GetTail() + +2006-07-14 13:54 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + use space to separate host and port in -b + +2006-07-14 13:52 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Use space to separate host and port in backend spec. + + Polish usage message a bit. + +2006-07-14 13:33 phk + + * 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_pool.c, + trunk/varnish-cache/bin/varnishd/steps.h: + + When during a lookup we encounter a busy object, queue the session on + the objects waitinglist and disembark the worker thread so it can do + something sensible in the mean time. + + This feature is unimportant in normal operation, but crucial to + resource management if a popular URL suddenly takes a long time to + reply from the backend. + + Without this bit if semi-nasty code, we would tie up one worker + thread per client while waiting for the backend to come to it's + senses. + +2006-07-14 12:47 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_center.c: + + Have the acceptor launch the session into STP_RECV + +2006-07-14 12:45 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Use the fact that we have the worker thread in struct sess now. + + Move initial and final processing into cnt_recv() and cnt_done() + +2006-07-14 12:30 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + Have the states tell us if we are done yet with their return value, + so that we can implement disembarking the worker thread of the object + is busy. + +2006-07-14 12:22 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/include/shmlog.h: + + Put a starttime in shmem so varnishstat can show average rates. + +2006-07-14 12:12 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c: + + Flexelint'ing, found a spurious ';' + +2006-07-14 12:05 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/include/shmlog.h: + + More SHM creation polishing + +2006-07-14 11:44 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c: + + Better and more paranoid SHMEM creation logic + +2006-07-14 11:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_session.c: + + propset Id + +2006-07-14 11:20 phk + + * 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_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: + + Change "client" to "srcaddr", it's more descriptive. + + Add srcaddr management and start charging bytes to the srcaddr. + +2006-07-14 10:34 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/tcp.c: + + Rework the way we do ascii representations of addresses + +2006-07-14 10:16 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + 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_main.c, + trunk/varnish-cache/bin/varnishd/cache_session.c: + + Move session management to new file (cache_session, SES prefix) in + preparation of adding client tracking. + + Move the iovec's from the session to the worker and give the session + a pointer to the worker so we can avoid passing it around as argument. + +2006-07-12 23:30 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/flint.sh, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + More Flexelinting + +2006-07-12 22:52 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/mgt_child.c: + + More flexelinting. + + No bugs so far. + +2006-07-12 22:07 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + + Flexelint harder. + +2006-07-12 22:01 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Give this file a flexelinting + +2006-07-12 22:01 phk + + * trunk/varnish-cache/bin/varnishd/cache.h: + + Improve the INCOMPL() macro. + +2006-07-12 20:21 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + More polishing. + +2006-07-12 19:28 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + Move sessmtx to cache_vcl.c and call it vcl_mtx. + + Clean up naming for consistency while here. + +2006-07-12 15:07 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: + + Implement "insert_pass" mode where we cache that an entity must be passed. + +2006-07-12 14:13 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + Make Pass possible from vcl_hit() + +2006-07-12 13:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_slinger.h, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/steps.h, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c: + + Enable Id keyword + +2006-07-12 13:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + First stab at implementing pass in vcl_miss() + +2006-07-12 13:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + + Add explanation for locking, some minor polishing. + +2006-07-12 12:04 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/hash_slinger.h: + + Hash on both URL and Host header. If no host header, hash on URL twice. + +2006-07-12 11:48 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Make Pass work again + +2006-07-12 11:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + Make pipe work again + +2006-07-12 08:56 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + Fix CLI "config.load" + +2006-07-12 08:44 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + Always insert a backend when vcl is compiled. + + Respect '#' comments in script file. + +2006-07-12 08:34 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Teach the VCL compiler about default functions, so that users will + not have to copy&paste the default methods if they have no special + requirements for a particular method. + + No such facility exists for backends, so a backend description is + now the minumum VCL program. + + When we initialize the VCL compiler we hand it a piece of source code + with the "default code", this must include definitions of all methods + named with a "default_" prefix (ie: "default_vcl_recv" etc). + + During compilation we always compile this piece of source code in (after + the user supplied VCL source). + + If the user did not provide a particular method, the default method is + used instead. The user can also call the default method directly, + for instance by: + + sub vcl_recv { + if (req.http.Expect) { + error; + } + call default_vcl_recv; + } + + Later on, this could be expanded to allow other subroutines to be + included in the default VCL for the users calling convenience. + +2006-07-12 07:45 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + Pause after 'vcl' command + +2006-07-11 21:35 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + EOF detection in libevent is buggy ?? Add exit cmd. + + Pause after cli until we see "OK" + +2006-07-11 21:30 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + add a req command, various adjustments + +2006-07-11 21:04 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + Add Pause() and Resume() to pace script execution + +2006-07-11 21:01 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c: + + Add a printf when cached is ready for the benefit of varnishtester + +2006-07-11 20:49 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + open and close commands + +2006-07-11 20:37 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + A vcl keyword for loading a new config + +2006-07-11 19:29 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + Add "cli" to tell varnishd things + +2006-07-11 19:16 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + If the first char of the serve string is '!', close connection after + sending string. + +2006-07-11 19:10 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + Add a server facility to act as backend for varnish + +2006-07-11 18:21 phk + + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + + Minimal ability to start and stop a varnishd + +2006-07-11 18:16 phk + + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Give 'exit' CLI command some bite. we may want to be more careful + later on. + +2006-07-11 17:53 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Unbuffer stdout/stderr + +2006-07-11 17:23 phk + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishtester, + trunk/varnish-cache/bin/varnishtester/Makefile.am, + trunk/varnish-cache/bin/varnishtester/varnishtester.c, + trunk/varnish-cache/configure.ac: + + Add stub varnishtester program + +2006-07-11 16:31 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Start the cache process automatically, I've gotten tired of typing + "start" :-) + +2006-07-11 16:25 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Allow backend to be specified as "host:port" to -b + +2006-07-11 16:17 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + add short descriptive comments to each state + +2006-07-11 16:10 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Distribute code from FetchSession almost correctly + +2006-07-11 16:03 phk + + * trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + + Add "insert_pass" action in VCL + +2006-07-11 15:54 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + Make things work again by stuffing the old functions into the new + state engine. + +2006-07-11 15:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_center.c: + + This commit breaks warnish temporarily: + + Insert the new master state engine. + + A dot(1) graph is embedded in the source code and can be extracted + with: + + sed -n '/^DOT/s///p' cache_center.c | dot -Tps > /tmp/_.ps + +2006-07-11 13:31 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/steps.h: + + Add enum for major procesing steps + +2006-07-11 12:31 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Start centralizing the flow of requests through varnish so we get + one source file with the highest level of policy. + +2006-07-11 12:30 phk + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Make -b and -c less nonsensical when not specified + +2006-07-11 12:00 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Pipe requests which come with an Expect header. + + XXX: document that + error 417 "expectation failed" + might be a more sensible policy. + +2006-07-11 11:41 des + + * trunk/varnish-cache/bin/varnishlog/varnishlog.1: + + Document -b and -c, and bump date. + +2006-07-11 11:36 phk + + * trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Add -b[ackend] and -c[lient] generic options to logtailers + +2006-07-11 07:38 phk + + * trunk/varnish-cache/bin/varnishd/cache_response.c: + + Add 500 messages. + +2006-07-11 07:30 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: + + Split http_Dissect() into http_DissectRequest() and http_DissectResponse() + +2006-07-11 06:30 des + + * trunk/varnish-cache/bin/varnishd/varnishd.1: + + Add cross-references and a commented-out STANDARDS section. + +2006-07-11 06:28 des + + * trunk/varnish-cache/include/shmlog_tags.h: + + Add a note to update varnishlog(1) whenever this list changes. + +2006-07-11 06:27 des + + * trunk/varnish-cache/bin/varnishstat/varnishstat.1: + + Add cross-references. + +2006-07-11 06:26 des + + * trunk/varnish-cache/bin/varnishlog/varnishlog.1: + + Document the -C, -I, -X, -i, -x options. + Add a list of log entry tags. + Add cross-references to varnishd(1) and varnishstat(1). + +2006-07-10 21:54 phk + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishtop, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/configure.ac: + + Add varnishtop log-tailer. + + + Try these: + + varnishtop -i url + + varhishtop -i header -C -I '^user-agent:' + + varhishtop -i header -C -I '^user-agent:' -X MSIE + + varhishtop -i header -C -I '^user-agent:.*MSIE' + + varhishtop -i header -C -I '^user-agent:.*java' + + You can also run them on the logfiles from the live test: + + zcat _vlog21.gz | varnishtop -r - -i header ... + + + +2006-07-10 21:49 phk + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Fix so that both -I and -X can be specified + +2006-07-10 20:49 phk + + * trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Implement -C, -I and -X generic options + +2006-07-10 20:27 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Add tag names array to libvarnishapi, everybody is going to need it. + + Implement -i tag[,tag ...] and -x tag[,tag ...] generic arguments. + +2006-07-10 19:54 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Improve libvarnishapi interface to shared memory: + + Add function VSL_OpenStats() which directly returns a pointer + to the varnish_stats structure. + + Add opaque VSL_data structure as handle to the log-tailer functions. + + Add generic argument parsing function for all log-tailers. + + Add support for generic "-r " option. + +2006-07-10 15:02 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: + + More statistics about worker threads. + +2006-07-10 14:52 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: + + Rewrite the worker thread pool code. + + Assign prefix WRK to the worker pool. + + Introduce a struct workreq since the prefetcher (when it happens) will + not have a session to pass in. + + The worker threads get a cond_var each and are hung from a list in + most recently used order. + + When a request is queued and the worker thread list is not empty, + tickle the cond_var of the first one. + + If no threads were availble the max number of threads is not reached, + try to start another worker thread. + + If the max was reached or the start filed (likely due to out of memory) + indicate overflow and let the existing pool deal with it. + + Create only the minimum requested number of threads initially. + + Allow specification of the timeout before a dynamic worker thread commits + suicide to be specified with -w. + + Default parameters are -w1,UINT_MAX,10 {min, max, timeout} + +2006-07-10 13:59 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + use explicit eventbase. + +2006-07-10 13:58 phk + + * trunk/varnish-cache/contrib/libevent/event.c: + + Don't ever set current_base in our version of libevent in order to flush + out any bugs it might cause. + +2006-07-10 13:48 phk + + * trunk/varnish-cache/bin/varnishd/shmlog.c: + + Dump errno and strerror in assert + +2006-07-10 12:00 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c: + + Rework the "connect to backend logic". + + Avoid calling getaddrinfo() for every connect by catching the result + in the backend structure. + + Minimize number of socket/connect calls by caching the last good + address in the backend structure. + + If all addresses in the cached getaddrinfo() result fails, call + getaddrinfo() again (to catch DNS changes) and try the list again. + +2006-07-10 11:24 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/tcp.c: + + Move sockaddr->ascii conversion to tcp.c + + shmlog both ends of backend connections. + +2006-07-10 10:56 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.h, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/shmlog.c: + + Be more consistent. + + cache_shmlog.c contains stuff for both cache and mgt, so remove the + cache_ prefix. + + Rename cache_shmlog.h to common.h and put joint stuff there. + +2006-07-10 10:31 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + put backend session linkage in shmemlog for pipe and pass + +2006-07-10 10:06 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Polish HTTP reception a little bit + +2006-07-10 10:05 phk + + * trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Drop the max length of first line, it's too expensive to enforce. + +2006-07-10 09:52 phk + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Fix cosmetic warning + +2006-07-10 09:51 phk + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + + Silence cosmetic warning. + +2006-07-10 09:48 phk + + * trunk/varnish-cache/lib/libvarnish/time.c, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Fix cosmetic warnings + +2006-07-10 09:47 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.h, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Fix a bunch warnings, all cosmetic. + + I'm using __unused for now, if we need to use something different + we can do a find/replace. + +2006-07-10 09:28 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Silence some warnings + +2006-07-10 09:07 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/include/stat_field.h: + + Allocate struct http as part of the session allocation. + + Remove http_New() and http_Delete() + +2006-07-10 08:41 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Add heritage.mem_http_headers which is the maximum number of headers + we recognize. + + Add http_Init() which initializes struct http given sufficient space. + + Respect heritage mem_* values in http_New() (while we still have it) + + Allocate backend connections (vbe_conn) with super allocation with + space for http and workspace. + +2006-07-10 08:10 phk + + * trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Put three memory allocation hints into heritage: + + mem_http_1_line (512) + Maximum length of the reqeust/response line of a HTTP message + There is no point in filling the entire buffer with junk if + we get a preposterously long first line. + mem_http_header (4096) + Maximum length of entire HTTP header. If we overflow this + we return 400. + mem_workspace (currently 0) + In the future this will be the space we use for constructing + headers to send and edits done from VCL. + +2006-07-10 07:54 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + Take the vbe_conn (backend connection) structure out of the closet. + +2006-07-10 07:07 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Turn a comment into english + +2006-07-10 07:04 phk + + * trunk/varnish-cache/bin/varnishd/cache.h: + + More sensible order of pointers + +2006-07-09 21:21 phk + + * trunk/varnish-cache/include/http_headers.h: + + Don't pass cache-control through. + +2006-07-09 21:01 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Add a -h opt which modifies -o to remove "trivial" entries. + + Trivial are + {GET,HEAD} which gets a hit and returns 200 + {GET,HEAD} which gets a miss, fetches, inserts and returns 200 + +2006-07-09 09:16 des + + * trunk/varnish-cache/configure.ac: + + Don't use braces where they aren't needed. + Let automake know about config.h. + Bump version number to mark that we have passed the first live test. + +2006-07-09 07:13 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/lib/libvcl/Makefile.am: + + List header files so they are included in the distribution tarball. + +2006-07-09 06:35 des + + * trunk/varnish-cache/configure.ac: + + Use the modern version of AM_INIT_AUTOMAKE, allowing automake to deduce the + correct distribution name. + +2006-07-08 20:29 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + + A few edits for FlexeLint + +2006-07-08 20:19 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + + Sanitize #includes a bit in the cache process by moving fundamental + #includes to cache.h + +2006-07-08 20:18 phk + + * trunk/varnish-cache/bin/varnishd/flint.lnt: + + Silence a bogus warning + +2006-07-08 19:54 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c: + + 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 + +2006-07-08 19:46 des + + * trunk/varnish-cache/configure.ac: + + Add --enable-debugging-symbols which enables debugging sysmbols and + disables + inlining and builtins. + +2006-07-08 19:27 des + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Fix "set backend.port". + +2006-07-08 19:25 des + + * trunk/varnish-cache/autogen.des: + + My version. + +2006-07-08 19:25 des + + * trunk/varnish-cache/autogen.phk: + + Expand keywords. + +2006-07-07 08:40 phk + + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + Close gracefully in pipe mode + +2006-07-07 07:48 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Set SO_LINGER to zero + +2006-07-07 07:25 phk + + * trunk/varnish-cache/bin/varnishd/tcp.c: + + Tell why bind(2) fails + +2006-07-07 07:22 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Pipe anything different from HEAD & GET + +2006-07-07 07:22 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Don't filter headers in Pipe mode + +2006-07-07 07:22 phk + + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + Fix pipe mode + +2006-07-07 07:22 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Remove debugging printf + +2006-07-07 07:15 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Time idle TCP connections out after 30 seconds + +2006-07-07 06:29 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Dump our buffer as Debug if we have HTTP header trouble. + + Issue 400 for HTTP header buffer overflow. + +2006-07-07 06:27 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Strvis(3) debug data. + +2006-07-06 22:33 phk + + * trunk/varnish-cache/include/http_headers.h: + + Filter out Content-Range headers. + +2006-07-06 21:57 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Always log the numeric code as "Status" + +2006-07-06 21:57 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Log the found objects XID when we have a hash-hit. + +2006-07-06 21:56 phk + + * trunk/varnish-cache/include/shmlog_tags.h: + + Add shmem tag for Hits + +2006-07-06 21:47 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + + Refuse all requests without a protocol field with a 400 + + Implement a function to say "400" with. + +2006-07-06 21:04 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_response.c: + + Add cache_response for yelling at clients + +2006-07-06 21:03 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Also flush ordered after the long timeout. + +2006-07-06 21:00 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Strengthen HTTP parsing + +2006-07-06 20:29 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + + Make sure the grim reaper doesn't touch busy objects either. + +2006-07-06 20:26 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + + The grim reaper needs to wait for objects refcount to drop to zero. + +2006-07-06 20:23 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Improvements to flush things at timeout and at the end etc. + +2006-07-06 13:40 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Silence typical broken client connection messages and move the + interesting ones to shmem + +2006-07-06 13:33 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Fix braino in Pass handling + +2006-07-06 13:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Skip space before request/response + +2006-07-06 13:02 des + + * trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.1: + + Add a rudimentary man page. + +2006-07-06 11:18 phk + + * trunk/varnish-cache/autogen.phk: + + My version. + +2006-07-06 10:18 phk + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + + Add exponential hitrate displays (with -c) + +2006-07-06 09:31 des + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.1: + + Add a rudimentary man page. + +2006-07-06 09:31 des + + * trunk/varnish-cache/bin/varnishd/varnishd.1: + + Expand keywords + +2006-07-06 09:13 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/varnishd.1: + + Add a rudimentary man page. + +2006-07-06 09:08 phk + + * trunk/varnish-cache/bin/varnishd/tcp.c: + + Only complain if accept_filters fail + +2006-07-06 09:06 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Remove debugging code. + +2006-07-06 09:00 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Add -r file and -w file options. + + These read/write from/to a binary file. + +2006-07-06 08:45 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Increas shmem size to 8M + +2006-07-06 08:45 phk + + * trunk/varnish-cache/bin/varnishd/tcp.c: + + Add accept filters + +2006-07-06 08:43 des + + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Portability: don't use non-portable mmap(2) flags. + +2006-07-06 08:43 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Portability: Linux does not have SO_NOSIGPIPE. + +2006-07-06 08:41 des + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvarnish/argv.c: + + Portability: cast unused parameters to void instead of marking them + __unused. + +2006-07-06 08:32 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + + 404 handling + +2006-07-06 08:07 des + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + + Use instead of to get both the prototype for + ioctl(2) and the definition of FIONREAD. + +2006-07-05 14:40 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Fix off by one + +2006-07-05 14:40 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + printf format + +2006-07-05 13:54 phk + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + + Calculate rate as signed. + +2006-07-05 13:44 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Assert non-null first + +2006-07-05 13:19 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Send "Connection: close" if not HTTP/1.1 + +2006-07-05 13:13 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/include/stat_field.h: + + Add more stats + +2006-07-05 13:09 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Some asserts to guard against trouble. + +2006-07-05 12:17 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Another pipeline fix: don't clobber a pipelined partial header + +2006-07-05 11:42 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Don't lead http header + +2006-07-05 11:09 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Free the session memory correctly + +2006-07-05 10:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + + Free the right header. + +2006-07-05 10:55 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + + Don't leak objects headers + +2006-07-05 10:01 phk + + * trunk/varnish-cache/include/http_headers.h: + + Suppress Accept-Ranges for now. + +2006-07-05 09:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Create an X-Varnish header and put the XID there. + +2006-07-05 09:56 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c: + + Send headers with sendfile + +2006-07-05 09:44 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + + Add Age and Via header to responses. + + Change arguments to vca_write_obj() (It should really be + "send_repsonse()" ?) + Store received age and time entered into cache in object. + Generate Age: and Via: headers as part of response. + +2006-07-05 09:32 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Unify logging in the response handling + +2006-07-05 09:11 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + + log responsecode and length + +2006-07-05 09:10 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + + Log reponse code and object length + +2006-07-05 09:08 phk + + * trunk/varnish-cache/include/shmlog_tags.h: + + Add Length tag + +2006-07-05 08:08 phk + + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + + Show also rate in curses display + +2006-07-05 07:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + + Be more conservative about wraparound and take them up front in all cases. + +2006-07-04 22:08 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + + Implement our TTL calculation. + + A first quick check against the weird timestamps from the VG frontend + squids indicates sensible behaviour. + +2006-07-04 21:34 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + + Long comment describing how TTL calculation will be done. + + Review encouraged. + +2006-07-04 20:00 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + + Fix HEAD requests: + + Make modes to http_BuildSbuf descriptive enums. + Send GET to backend also for HEAD requests. + Don't return body for HEAD requests. + +2006-07-04 19:36 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Fix pipelining. + + A braino in http_Dissect() resulted in an off-by-one error + (protected with assert now) + + Move any remaning bytes in buffer to front and check for + a complete header before arming the eventloop on the + session. + +2006-07-04 14:45 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Make room for protective terminating NUL + +2006-07-04 14:19 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + + retry backend open, log diagnostics + +2006-07-04 14:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c: + + load VCL earlier + +2006-07-04 14:18 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Lock with a mutex + +2006-07-04 13:45 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Shorter sleeps: 1s -> 50msec + +2006-07-04 13:44 phk + + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + + Fix off by one error during wraparound. + +2006-07-04 09:28 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Close non HTTP/1.1 request connections + +2006-07-04 09:21 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Add missing '%' + +2006-07-03 19:45 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + My workaround for the missing OFF_T_MAX definition was not safe, + use a hardcoded "1<<30" which is. + +2006-07-03 19:35 phk + + * trunk/varnish-cache/contrib/libevent/event.c: + + I have grumbled about the evilness of "current_base" before, and this just + proves the point: If two threads call event_init() at the same time, + they will both stomp on the same memory via current_base, and in all + likelyhood, neither of them will manage to get the job done properly. + + Instead work on a local variable and don't assign to current_base + until the setup is complete. + + This should be submitted to Niels Provos + +2006-07-03 18:35 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Handle IPv6 address -> string conversion too + +2006-07-03 18:03 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + + Close race condition + +2006-07-03 17:59 phk + + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + + Better arg checking + +2006-07-03 15:01 phk + + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + + more asserts + +2006-07-03 14:39 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + avoid const poison + +2006-07-03 14:39 phk + + * trunk/varnish-cache/bin/varnishd/cache_ban.c: + + Include pthread.h + +2006-07-03 14:37 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + + s/unsigned/size_t/ + +2006-07-03 14:36 phk + + * trunk/varnish-cache/bin/varnishd/hash_simple_list.c: + + s/init/start/ + +2006-07-03 12:41 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/hash_slinger.h, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Add another hash-method with better real-world survival chances: A classic + bucketed hash table of lists. Hash is MD5. Number of buckets and number + of mutexes can be configured at command line. + +2006-07-03 08:30 des + + * trunk/varnish-cache/configure.ac: + + Replace --enable-wall and --enable-pedantic with + --enable-developer-warnings, + which is roughly equivalent to FreeBSD's WARNS level 5 or 6. + +2006-07-01 05:44 phk + + * trunk/varnish-cache/include/http_headers.h: + + Mark more headers as not end-to-end + +2006-06-30 20:22 phk + + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + + Forgot to add shmlog.c (reminded by des@) + +2006-06-30 20:21 phk + + * trunk/varnish-cache/include/queue.h: + + Add TAILQ_FOREACH_SAFE() + +2006-06-30 20:17 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + + move all policy to rfc2616.c + +2006-06-30 13:44 des + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c, + trunk/varnish-cache/include/stats.h: + + Consistently use our own copy of queue.h. + +2006-06-30 11:20 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Fix object length double accounting in chunked fetch + +2006-06-30 09:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + Delete compiled VCL file after we tried to load it. + +2006-06-29 19:19 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Log objects banned to shmlog + +2006-06-29 19:06 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c: + + Track objects heap-position + +2006-06-29 17:09 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_main.c: + + Add the ability to instantly ban/purge all cached objects matching + a given regexp. + +2006-06-29 15:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Improve shm-logging of VCL activity + +2006-06-29 14:37 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Tag objects with their origin session xid and log it when we clean up. + +2006-06-29 13:04 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Add a unique transaction-ID to each request, and register it in the + shmlog so we can match backend transactions with client transactions. + +2006-06-28 21:38 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Convince flexelint that we know what we do with some asserts + +2006-06-28 21:33 phk + + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + + Put a mutex around the shmlog writes, I've seen my first race. + +2006-06-28 21:18 phk + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Add a -o argument which sorts the log into transactions before output, + this is a fair bit easier to chew through than the raw log (the default) + +2006-06-28 21:03 phk + + * trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c: + + Use shmlog api from libvarnishapi + +2006-06-28 20:58 phk + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Use SHMLOG api in libvarnishapi + +2006-06-28 20:58 phk + + * trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am: + + Add SHMLOG opening and walking functions to libvarnishapi + +2006-06-28 17:46 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Be more consistent about which headers we send back. + + Start 5 threads in the worker pool. + +2006-06-28 16:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Construct our own Content-length header, no matter which of the + three (straight, chunked, eof) modes we used to fetch the object. + +2006-06-28 16:58 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Don't finish the sbuf in mode 3 + +2006-06-28 16:57 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Assert that the lengths of the storage for the object add up. + +2006-06-28 16:57 phk + + * trunk/varnish-cache/include/http_headers.h: + + Don't pass Content-Lenght through, we build it ourselves + +2006-06-28 16:20 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + Pass fd to shmemlog + +2006-06-28 16:19 phk + + * trunk/varnish-cache/include/shmlog_tags.h: + + add tag for generated headers + +2006-06-28 16:19 phk + + * trunk/varnish-cache/include/http_headers.h: + + Don't pass If-* headers to backend + +2006-06-28 16:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c: + + Apply correct fd in Shmemlog + +2006-06-28 16:04 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Fix buglets, include test-driver. + +2006-06-28 11:29 phk + + * trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c: + + Give varnishstat a "-c" option to use curses to continously refresh + +2006-06-28 11:21 phk + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishstat, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/configure.ac: + + Add varnishstat program + +2006-06-28 10:31 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + 304's don't have a body + +2006-06-28 10:30 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Implement ->trim() + +2006-06-28 09:39 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: + + More stats counters + +2006-06-28 09:21 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/shmlog.h, + trunk/varnish-cache/include/stat_field.h, + trunk/varnish-cache/include/stats.h: + + Add statistics counter support. + + stat_field.h defines the counter fields with name, type, (printf)format + and description. + + stats.h defines a structure with these fields. + + shmlog.h makes the structure part of the shared memory logs header. + + Implent the "stats" CLI word in the management process. + +2006-06-26 19:25 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c: + + Call VCL to decide discard/prefetch for near-expiry objects. + + Put discard objects on deathrow where they will be culled from + in sequence. + + (prefetch not implemented yet) + +2006-06-26 19:24 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + + A temporary hack to deal with very old Date: headers until we figure + out what's going on. + +2006-06-26 19:23 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Implement HTTP/1.0 style fetching. + +2006-06-26 17:06 phk + + * trunk/varnish-cache/bin/varnishd/storage_malloc.c: + + Another little tweak + +2006-06-26 16:31 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + Dump numeric handling also, until we figure out trouble. + +2006-06-26 16:30 phk + + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + + typo + +2006-06-26 16:19 phk + + * trunk/varnish-cache/bin/varnishd/storage_malloc.c: + + Make this work again: record the stevedore in the storage object. + +2006-06-26 14:33 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c: + + Start releasing objects when they expire + +2006-06-26 14:00 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c: + + Move a bit more responsibility into the hash-slinger to get a cleaner + interface. + +2006-06-26 08:58 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c: + + Now that we approach the time where objects have to be destroyed again, + we need to move the data structures into the right shape. + + Push hashing into cache_hash.c + + Add objhead structure to hold the various hits for "Vary:" headers. + +2006-06-24 22:11 phk + + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + + A little bit more work on the expiry/prefetch thing. + +2006-06-24 21:54 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + + Use ttl=0 as a "invalid TTL" flag. + + Mark objects with ttl=0 uncachable. + + Add cacheable objects to the expiry heap + + Start an expiry thread which polls the root element once per second + +2006-06-24 21:42 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + + Truncate TTLs in the past to now. + +2006-06-24 21:09 phk + + * trunk/varnish-cache/bin/varnishd/cache.h: + + Autogenerate prototypes for method calling functions + +2006-06-24 21:07 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + + Add a "timeout" method to VCL, it can return "fetch" or "discard". + +2006-06-24 20:50 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + + Add a token type "METHOD", we use it for reference counting. + + Add a reference to the first backend {} we encounter, it is the default. + Add a reference to all backends assigned explicitly. + Add a reference to all methods. + + Enable reference check, complain if: backend, function or acl is defined + but not used, or used but not defined. + +2006-06-24 20:12 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Collapse multiline Fc and Fh calls where they fit + +2006-06-24 20:09 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + More printf sanitation: Create to convenience functions for output to the + fh and fc sbufs. + +2006-06-24 19:50 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Cave in and use printf format extensions for printing tokens. + Both Linux and FreeBSD supports them anyway. + +2006-06-24 19:41 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Add more shmemlog tags: + one for each VCL method to record the return + one for errors + one for linking a client session to a backend connection + Use them sensibly. + Put VCL name of backend into struct backend to improve log messages + +2006-06-22 16:17 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + + Improve the VCL compiler in various ways: + + Generate the methods and their legal returns with the tcl script. + + Add consistency checks to make sure methods don't use illegal returns, + and also check called subrourtines. + + Add consistency check to complain about recursive subroutine calls. + + Add consistency check to complain about unused or undefined subroutines. + +2006-06-21 10:28 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_main.c: + + Add (empty) source file for expiry/pretech code + +2006-06-21 10:21 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + + Start to respect TTL + +2006-06-21 10:13 phk + + * trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Add "-t default_ttl" option. 120 seconds by default. + +2006-06-21 09:58 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Quench some debugging + +2006-06-21 08:09 phk + + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/binary_heap.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/binary_heap.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Add a binary heap implementation for keeping track of objects expiry time. + +2006-06-20 19:49 phk + + * trunk/varnish-cache/include/vrt.h: + + typo + +2006-06-20 19:38 phk + + * trunk/varnish-cache/lib/libvcl/flint.lnt, + trunk/varnish-cache/lib/libvcl/flint.sh: + + FlexeLint files + +2006-06-20 19:37 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + FlexeLint cleanups + +2006-06-20 19:31 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Polish things to silence FlexeLint a bit + +2006-06-20 11:39 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: + + Rename vcl_lang.h to vcl.h and include practically nowhere. + + Remove #include bogohandling in vcl_gen_fixed_token.tcl + +2006-06-20 10:31 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + At the expense of some complexity and a small runtime overhead, + isolate the compiled code from the internal structures of the cache + process through of VRT functions. + +2006-06-20 09:41 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Work towards making struct sess opaque to the generated code. + +2006-06-20 09:28 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Rename the VCL compilers public functions to VCC prefix + +2006-06-20 09:25 phk + + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Get rid of VCL_FARGS and VCL_PASS_ARGS macros. + + Generate VGC prefixes instead of VCL. + +2006-06-20 09:15 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: + + Start putting some structure in the sources relating to VCL handling: + + Split the runtime support for compiled varnish programs out and give it the + prefix "VRT". + + Start using the prefix "VGC" for generated code. + + Prefix "VCC" will be for the compiler and "VCL" for calling the + compiled and + loaded functions. + +2006-06-18 10:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Output line+pos for counts. + +2006-06-18 10:19 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Insert a count-point after each conditional. + +2006-06-18 10:16 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Get the sense of string compares right. + +2006-06-18 10:12 phk + + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + + debug printf for max-age + +2006-06-18 10:10 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Implement req.request properly + +2006-06-18 10:04 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Pass if we spot an Authenticate or Cookie header + +2006-06-18 10:03 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + Add VCL function for getting HTTP header + +2006-06-18 10:02 phk + + * trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Add support for investigating random HTTP headers. + +2006-06-18 09:16 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + Add wrappers around VCL methos so logging and checking of returned handling + can be centralized. + + Remove old handling callbacks. + + Call hit/miss methods instead of lookup method. + +2006-06-18 09:14 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + add explicit "lookup" to recv method + +2006-06-18 09:11 phk + + * trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + + Correctly handle \ sequences in .h files in vcl_gen_fixed_token.tcl + + Make handling a named enum, and use it as a bitmap. + + Add "lookup" reserved word + + Add VCL_done() macro to use in compiled code to set handling and drop + the per-handling callbacks (apart from VCL_error()) + +2006-06-18 07:28 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + + Add "deliver" keyword to VCL compiler. + + Split vcl_lookup() in vcl_hit() and vcl_miss() + +2006-06-16 10:22 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Initial http_GetHdrField() function. + + Improve chunked encoding, allocate big storage chunks and trim the + last one at the end, instead of one storage chunk for each chunk + the remote server sends. + + Call RFC2616 policy code. + + Store headers from backend in cache and return to client. + +2006-06-16 10:20 phk + + * trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Add header field to object + +2006-06-16 10:19 phk + + * trunk/varnish-cache/include/http_headers.h: + + Supress Transfer-Encoding + +2006-06-16 10:18 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + + The beginnings of rfc2616 policy implemenation. + +2006-06-16 10:17 phk + + * trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + + Add trim method to storage backends so chunked encoding can be + stored efficiently. + +2006-06-16 10:16 phk + + * trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/time.c: + + Add time parse/format functions to libvarnish + +2006-06-15 08:04 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + + less noise + +2006-06-15 08:04 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c: + + Less noise + +2006-06-14 09:57 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + start examining HTTP status codes from backend + +2006-06-14 09:39 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Add vca_write_obj() which writes an sbuf (as) HTTP header and the + object from the sessions to the client. + +2006-06-14 09:25 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Clean up session messages a bit + +2006-06-14 09:23 phk + + * trunk/varnish-cache/include/shmlog_tags.h: + + Add HttpError tag + +2006-06-14 09:03 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Sanitize close/recycle session logic a bit. + +2006-06-14 08:53 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_main.c: + + Initialize the cache_acceptor.c/VCA in the same manner as other parts. + +2006-06-14 07:21 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c: + + Give storage backends a "send" method. + + Let storage_file use sendfile(2) for it. + +2006-06-14 06:58 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Complete the storage_file method. + +2006-06-13 20:09 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Default to "file" stevedore from now on. + +2006-06-13 20:06 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Be more aggressive about mmap'ing memory. The size_t thing is a bogus + constraint in FreeBSD and we shouldn't really listen to it. + + On my laptop I can mmap 2422MB file this way. + + This may be so aggressive that it leaves insufficient address space for + malloc/threadstacks and other issues. + + If we find a way to pick up a platform/architecture specific limit, we + can enforce that along the way. + + For now people can just specify a saner and smaller "-sfile" size. + +2006-06-13 13:47 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + mmap as much as the file as we are able to when the cache process opens + the stevedore. + + This should probably be (fine-)tuned later on as it might be too aggressive + when faced with user errors. + + Also, might it be possible to mmap() more than MAX_SIZE_T bytes if + it is done in multiple calls ? + +2006-06-13 13:14 phk + + * trunk/varnish-cache/bin/varnishd/storage_file.c: + + Calculate the size of the backing store file. + + A size can be specified in absolute terms (suffix: k, m, g, t supported), + but also as a percentage of the filesystems free space (suffix '%'). + + If the specified size is larger than an off_t can cope, we bisect + repeatedly until it can. + + If the size exceeds the available space of the filesystem, we truncate + to 80% of the free space. + + Then round down to an integral number of blocks, sized by the larger + of the filesystem blocksize and the pagesize. + + This was tricker than I'd expected... + +2006-06-13 13:10 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Clone the stevedore before calling its init function and be more precise + about any optional arguments. + +2006-06-13 08:05 phk + + * trunk/varnish-cache/bin/varnishd/_stevedore.h, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/stevedore.h: + + After having a strong cup of tea: don't name files with leading underscore + even though that's how FreeBSD's kernel does it. In my private world + a leading underscore means "junk file, remove at your pleasure". + +2006-06-13 08:02 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Clone the malloc stevedore to the file stevedore + +2006-06-13 07:59 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Remember to tell getopt about -s + +2006-06-13 07:57 phk + + * trunk/varnish-cache/bin/varnishd/_stevedore.h, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/storage_malloc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Put more meat on the stevedore (storage backend) interface: + + Pull the struct definition into _stevedore.h and include this from + cache.h and mgt.h, they both need to be able to see it. + + Add the stevedore pointer as an argument to the stevedore alloc function + so multiple stevedores is possible later on. + + Add the stevedore pointer to the storage object, so freeing it again is + possible. + + Add -s argument processing to select a given stevedore, call it's ->init + method and pass the stevedore in the heritage. + + In the cache process pick stevedore out from heritage, call its open + method. + +2006-06-13 07:26 phk + + * trunk/varnish-cache/bin/varnishd/storage_malloc.c: + + Use NULL init method + +2006-06-13 07:25 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c: + + Allow for NULL init methods for hash and stevedore + +2006-05-01 12:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Use vca_write/vca_flush + +2006-05-01 12:59 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Use vca_write/vca_flush + +2006-05-01 12:51 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Use vca_write/vca_flush + +2006-05-01 12:45 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Add vca_write() and vca_flush(), two functions which will attempt to + use writev() if possible. + + vca_flush() must be called before any memory previosly given to + vca_write is overwritten, and after the last call to vca_write() + +2006-05-01 12:28 phk + + * trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/flint.sh: + + Add FlexeLint files + +2006-05-01 12:27 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + bandaid for name-clash + +2006-05-01 12:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + + Keep track of how many connections we have open + +2006-05-01 12:27 phk + + * trunk/varnish-cache/bin/varnishd/cache.h: + + add missing extern + +2006-05-01 10:55 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Add INCOMPL() macro to mark missing code. + + Add http_HdrIs() to check if we have a given header and if we do + if it has a given value. + + Use it. + + Ignore SIGPIPE since SO_NOSIGPIPE doesn't work reliably, (but set + it on accepted TCP connections anyway). + + Update passing to match fetching, including a chunked encoding method. + +2006-05-01 07:54 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + + Add yet another thread with an event engine to monitor idle backend + connections and clean them out if the backend closes. + +2006-05-01 07:53 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Centralize "Connection: close" handling from the backend. + + Loop until we have the entire chunk in chunked encoding + +2006-04-25 09:32 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c: + + test backend connections at allocation time. + + General bush-wacking in the fetch code. + +2006-04-25 09:31 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + Fix argument to http_BuildSbuf + +2006-04-25 09:30 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + + Keep alive often enough + +2006-04-25 08:17 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Make width colum wider and decimal + +2006-04-25 08:17 phk + + * trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Add new shmlog tags and handling states + +2006-04-25 08:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Implement a rudimentary chunked Transfer-Encoding + +2006-04-25 07:10 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + reset header count before we dissect + +2006-04-25 07:04 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Track backend connections in shmem log + +2006-04-25 06:52 phk + + * trunk/varnish-cache/bin/varnishd/cache_http.c: + + Add an end pointer so allocation size can be changed on the fly + +2006-04-25 06:48 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Move shmlog entry, remove debugging + +2006-04-25 06:16 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Redo http header storage and processing + +2006-04-24 19:10 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Add an indecisive comment + +2006-04-24 19:09 phk + + * trunk/varnish-cache/include/http_headers.h: + + Sort and annotate + +2006-04-19 06:38 phk + + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + + Loop until we have read it all + +2006-04-19 06:34 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Implement enough of FetchSession and DeliverSession that we can actually + deliver a cached object. + +2006-04-18 08:23 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Add busyflag and strorage link to objects. + + Initialize default hasher and stevedore. + + Give each workerthread an object pointer to be kept populated with + a template object for when lookups miss and need to insert one. + + Add libmd to get MD5, (choice of hash-algorithm to be revisited later) + + Implement lookup, begin on fetch. + +2006-04-18 07:34 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + + Add trivial malloc backed storage backend. + +2006-04-12 08:58 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/include/shmlog.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_priv.h, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + + Implement the three function VCL model in the compiler. + +2006-04-12 08:56 phk + + * trunk/varnish-cache/include/http_headers.h: + + Add ETag: header + +2006-04-11 08:28 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/tcp.c: + + Beginnings of the object lookup stuff: A simple list based + implementation to get things moving. + +2006-04-06 10:01 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Close or recycle backend connections as appropriate + +2006-04-06 10:00 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c: + + Add VBE_RecycleFd() function to recycle backend connections + +2006-04-06 09:59 phk + + * trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Pass Content-Encoding header + +2006-04-06 09:38 phk + + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + Output the fd in decimal instead of hex. + + Do Id Keyword + +2006-04-06 09:33 phk + + * trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Rename hdr_end to a more sensible rcv_ptr which points to the first + unaccounted for character in the buffer. + + Do Id Keyword + +2006-04-06 09:30 phk + + * trunk/varnish-cache/include/shmlog_tags.h: + + Add shmlog tags for pipe and pass handling + +2006-04-06 09:11 phk + + * trunk/varnish-cache/include/shmlog_tags.h: + + Log tag for session reuse. + + Do Id Keyword + +2006-04-06 09:10 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Recycle sessions instead of retiring them. + +2006-04-06 09:09 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Prune the bits we used from the input buffer before we recycle the + session. + +2006-04-06 09:09 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Add a vca_recycle_session() function which sticks a session back into + the acceptors event engine. + + Do Id keyword + +2006-04-06 09:08 phk + + * trunk/varnish-cache/bin/varnishd/cache_httpd.c: + + Don't log the terminating NUL on response proto field. + +2006-04-06 08:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_httpd.c: + + Add an assert, remove debugging. + +2006-04-06 08:18 phk + + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Respect VCL choice of handling + + Do Id keyword + +2006-04-06 08:16 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + + Don't attempt to restart child process (yet). + + Add Id Keyword handling + +2006-04-06 08:15 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + It's cheaper to pipe than to pass, so if the client indicates + "Connection: close", pipe instead of passing. + +2006-04-06 07:50 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + + Use HttpdBuildSbuf() + + Enable Id keyword + +2006-04-06 07:50 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c: + + Add a function to (re)build a HTTP request or response into an sbuf. + + Enable Id keyword + +2006-04-05 10:33 phk + + * trunk/varnish-cache/autogen.sh: + + Eliminate leaked developer hacks. + +2006-04-05 09:40 phk + + * trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + + Account for the last byte of the header. + +2006-04-04 10:35 des + + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c: + + I can't get AM_CONDITIONAL to work properly, so use a bigger hammer. + +2006-04-04 10:09 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/mgt_child.c: + + More portability changes: include config.h and compat.h, get rid of + __unused. + +2006-04-04 10:08 des + + * trunk/varnish-cache/bin/varnishd/Makefile.am: + + Link in libcompat, and libsbuf is now static. + +2006-04-04 10:08 des + + * trunk/varnish-cache/lib/libsbuf/Makefile.am: + + Make libsbuf static. + +2006-04-04 10:07 des + + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/lib/Makefile.am, + trunk/varnish-cache/lib/libcompat, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c: + + Add a libcompat with strlcat() and strlcpy() from OpenBSD. + +2006-04-04 09:05 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Get pass-through working for the first request. + + Now we can start to play with multi-request sessions and all that. + +2006-04-04 08:20 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Add HTTP response headers and processing. + +2006-04-04 07:46 phk + + * trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/cli.c: + + Reverse constification of Argv functions. After cascading through all + the CLI functions we hit the fact that the evbuffer functions in libevent + are not properly constified. + + It's better to deconst the error messages and just "let it be known" that + argv[0] is const (or NULL). + +2006-04-04 07:30 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Get "Pass" mode moving + +2006-04-04 07:29 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c: + + Make the "receive a HTTP protocol header" code generic + +2006-04-04 07:27 phk + + * trunk/varnish-cache/include/vcl_lang.h: + + Add a session callback pointer to struct sess. + +2006-04-04 07:26 phk + + * trunk/varnish-cache/bin/varnishd/cli_event.c: + + Use bufferevent_base_set() from libevent + +2006-04-04 07:24 phk + + * trunk/varnish-cache/contrib/libevent/event.h: + + Add a missing prototype until libevent people catch up. + +2006-04-04 07:24 phk + + * trunk/varnish-cache/include/shmlog_tags.h: + + Add a Debug shmemlog tag. + +2006-04-04 07:24 des + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/cli.c, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Portability tweaks: use our own sbuf.h and queue.h; get rid of + __DECONST; get + rid of digittoint() (which is pointless since ISO C guarantees that digits + are consecutive in the execution character set); get rid of __unused. + + Also fix a buglet in argv.c's BackSlash() (parsing of octal numbers), and + constify the array passed around by ParseArgv() and FreeArgv(). + +2006-04-03 14:41 phk + + * trunk/varnish-cache/bin/varnishd/cache_httpd.c: + + Move memset further up. + +2006-04-03 14:20 des + + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/configure.ac, trunk/varnish-cache/contrib/Makefile.am: + + Hook up libevent to the build. Note that this should be made + conditional at + some later date. + +2006-04-03 14:04 des + + * trunk/varnish-cache/contrib/libevent/WIN32-Code/provos at badschwartau.provos.org.12766: + + + GC + +2006-04-03 12:05 des + + * trunk/varnish-cache/contrib/libevent/sample/Makefile.in, + trunk/varnish-cache/contrib/libevent/test/Makefile.in: + + Remove generated files which were committed by mistake. + +2006-04-03 11:59 des + + * trunk/varnish-cache/contrib/libevent/Makefile.am, + trunk/varnish-cache/contrib/libevent/README, + trunk/varnish-cache/contrib/libevent/WIN32-Code/win32.c, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsp, + trunk/varnish-cache/contrib/libevent/buffer.c, + trunk/varnish-cache/contrib/libevent/configure.in, + trunk/varnish-cache/contrib/libevent/devpoll.c, + trunk/varnish-cache/contrib/libevent/epoll.c, + trunk/varnish-cache/contrib/libevent/evbuffer.c, + trunk/varnish-cache/contrib/libevent/event.3, + trunk/varnish-cache/contrib/libevent/event.c, + trunk/varnish-cache/contrib/libevent/event.h, + trunk/varnish-cache/contrib/libevent/event_rpcgen.py, + trunk/varnish-cache/contrib/libevent/event_tagging.c, + trunk/varnish-cache/contrib/libevent/http.c, + trunk/varnish-cache/contrib/libevent/http.h, + trunk/varnish-cache/contrib/libevent/kqueue.c, + trunk/varnish-cache/contrib/libevent/log.h, + trunk/varnish-cache/contrib/libevent/poll.c, + trunk/varnish-cache/contrib/libevent/rtsig.c, + trunk/varnish-cache/contrib/libevent/select.c, + trunk/varnish-cache/contrib/libevent/signal.c, + trunk/varnish-cache/contrib/libevent/strlcpy.c, + trunk/varnish-cache/contrib/libevent/test/Makefile.am, + trunk/varnish-cache/contrib/libevent/test/regress.c, + trunk/varnish-cache/contrib/libevent/test/regress.h, + trunk/varnish-cache/contrib/libevent/test/regress.rpc, + trunk/varnish-cache/contrib/libevent/test/regress_http.c, + trunk/varnish-cache/contrib/libevent/test/test-weof.c, + trunk/varnish-cache/contrib/libevent/test/test.sh: + + Update from libevent CVS trunk. + +2006-04-03 11:05 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Segregate http header fields into a separate structure, we will + reuse them a few places by the looks of it. + + Add VCA_UNKNOWNHDR (=10) fields for unknown HTTP headers. + If more headers arrive than that, they're lost (and logged as such). + +2006-04-03 11:03 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + How I wish people would think more ahead when writing libraries like + libevent. The entire "implicit event engine" api assumption stinks. + + Deal with it better. + +2006-04-03 09:02 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + A little step for humanity but a big step for varnish: + + Implement pipe-through mode and see the first web-pages actually + pass through varnish. + +2006-04-03 07:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + Call the init function when the VCL code is loaded. + We may want to postpone this to use time later on. + +2006-04-03 07:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Add 5 dummy fields to the http headers, we will need them subsequently. + +2006-03-31 08:27 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: + + Use http_headers.h to define session fields for headers and to parse + them out of the header. + +2006-03-31 08:26 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + + Add missing pthread.h includes + +2006-03-31 08:25 phk + + * trunk/varnish-cache/include/shmlog_tags.h: + + Use http_headers.h to define HTTP header tags for logging + +2006-03-31 08:24 phk + + * trunk/varnish-cache/include/http_headers.h: + + Reusable macro definition of HTTP headers. We will need these + several different places in the sources. + +2006-03-30 11:16 phk + + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + get us closer to a connection to the backend + +2006-03-30 10:56 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Rework the compilation of backend specifications in order to be able + to check the provided hostname/portname at compile time. + +2006-03-30 09:26 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Add the beginning of a backend connection pool + +2006-03-30 08:05 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Promote the poll mutex to be a session mutex so that we can use it + for the VCL reference as well, this saves locking operations. + + Call the atual VCL code when we get the request. + +2006-03-30 07:05 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + + Integrate the VCL code closer in the cache process: The passed + argument will be the session structure. + + Add the pool of worker threads (cache_pool). With a unitary nature + of the VCL code, the HTTP parsing can be postponed to the worker thread. + + This actually helps us with CPU cache locality as it will reduce the + amount of memory allocated on one CPU but freed on another. + +2006-03-27 14:12 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Add config.load, config.inline and config.use commands. + +2006-03-27 14:11 phk + + * trunk/varnish-cache/include/libvcl.h: + + Forgot to add this one. Prototypes for the VCL compiler. + +2006-03-27 14:10 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + Add VCL_CompileFile() function. + +2006-03-27 13:59 phk + + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + + Just return if there is nothing to wait for. We get SIGCHLD'ed on + the popen child process. + +2006-03-27 13:57 phk + + * trunk/varnish-cache/include/cli_priv.h: + + Add a macro which we can #ifdef + +2006-03-27 12:27 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Build default VCL from "-b backend_IP" option and pass it to client + via heritage. + +2006-03-27 11:51 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + + edge closer towards being a nice member of society + +2006-03-27 11:22 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Experimentally pull in VCL program + +2006-03-27 11:21 phk + + * trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_priv.h: + + Actually generate a shared object + +2006-03-27 11:21 phk + + * trunk/varnish-cache/include/vcl_lang.h: + + Stuff VCL programs needs to know about. + +2006-03-27 09:02 phk + + * trunk/varnish-cache/configure.ac: + + add libvcl + +2006-03-27 09:01 phk + + * trunk/varnish-cache/lib/libvcl/Makefile, + trunk/varnish-cache/lib/libvcl/Makefile.am: + + Put under control of auto* tools + +2006-03-27 09:01 phk + + * trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + + Newly generated code + +2006-03-27 09:00 phk + + * trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: + + Don't generate sparse array code. + +2006-03-24 10:46 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/include/shmlog_tags.h: + + More complete HTTP parsing and logging. + +2006-03-24 10:23 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c: + + Change session memory management to avoid pollution + + Add fledling httpd parsing + +2006-03-24 10:22 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + + Add a VSLR() variant which logs a byte range without spending time in + sprintf + +2006-03-24 09:45 phk + + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/include/shmlog_tags.h: + + Log remote IP#:port on session open + +2006-03-24 09:14 phk + + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + + put symbolic names on the tags + +2006-03-24 09:05 phk + + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog, + trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/configure.ac: + + Add a minimal log tailer. + +2006-03-24 08:43 phk + + * trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/include/shmlog.h, + trunk/varnish-cache/include/shmlog_tags.h: + + Move the SHM tags into a resuable .h file. + + Minor nits + +2006-03-23 15:31 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Add shared memory log setup and stuffer function in the child process. + + Log whenever we get a CLI ping + +2006-03-23 12:20 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Now we're starting to get somewhere: Accept connections and assemble + a HTTP request. + +2006-03-23 08:45 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Open TCP sockets + +2006-03-17 13:41 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Make it possible to suspend and resume a cli connection while we wait + for response from the child (or otherwise). + + Add a generic "pass-through" handler for cli requests we just pass on + to the child. + +2006-03-17 10:03 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Add multiplexing for the mgt->child cli connection and get ping/pong + working across it. + + The management process will now keep the child process watchdog from + expiring. + +2006-03-16 12:14 phk + + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/cli.c: + + cleanup + +2006-03-16 10:48 phk + + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + + Expand the empty shell a bit. + + Add CLI handler on stdin (for now, in production only if + debug is specified). + + Implement help, verbos, ping and start. + + start forks the child process, sets up listeners on its stdout/stderr + (where nothing should arrive in production). + + Add SIGCHLD handler to reap and restart the child. + + Add shell "main" for the child: Set up a CLI handler on the pipes + passed as heritage. + + Add ping command and keepalive timeout. + +2006-03-16 10:46 phk + + * trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h: + + Functions to handle the CLI with event(3)'s buffer events. + + This may eventually belong in a library for wider use. + +2006-03-16 09:02 phk + + * trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/cli.c, + trunk/varnish-cache/lib/libvcl/Makefile: + + Generic and public stuff for CLI protocol handling. + +2006-03-16 08:30 phk + + * trunk/varnish-cache/include/cli.h: + + add min+max argument counts + +2006-03-15 20:34 phk + + * trunk/varnish-cache/include/cli.h: + + Add definitions pertaining to the ascii-protocol which will be used + multiple different places in the varnish architecture. + +2006-03-14 12:54 des + + * trunk/varnish-cache/contrib, trunk/varnish-cache/contrib/libevent, + trunk/varnish-cache/contrib/libevent/Makefile.am, + trunk/varnish-cache/contrib/libevent/README, + trunk/varnish-cache/contrib/libevent/WIN32-Code, + trunk/varnish-cache/contrib/libevent/WIN32-Code/config.h, + trunk/varnish-cache/contrib/libevent/WIN32-Code/misc.c, + trunk/varnish-cache/contrib/libevent/WIN32-Code/misc.h, + trunk/varnish-cache/contrib/libevent/WIN32-Code/provos at badschwartau.provos.org.12766, + trunk/varnish-cache/contrib/libevent/WIN32-Code/win32.c, + trunk/varnish-cache/contrib/libevent/WIN32-Prj, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test/event_test.dsp, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test/test.txt, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsp, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsw, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/signal_test, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/signal_test/signal_test.dsp, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/time_test, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/time_test/time_test.dsp, + trunk/varnish-cache/contrib/libevent/acconfig.h, + trunk/varnish-cache/contrib/libevent/buffer.c, + trunk/varnish-cache/contrib/libevent/compat, + trunk/varnish-cache/contrib/libevent/compat/sys, + trunk/varnish-cache/contrib/libevent/compat/sys/_time.h, + trunk/varnish-cache/contrib/libevent/compat/sys/queue.h, + trunk/varnish-cache/contrib/libevent/compat/sys/tree.h, + trunk/varnish-cache/contrib/libevent/configure.in, + trunk/varnish-cache/contrib/libevent/devpoll.c, + trunk/varnish-cache/contrib/libevent/epoll.c, + trunk/varnish-cache/contrib/libevent/epoll_sub.c, + trunk/varnish-cache/contrib/libevent/evbuffer.c, + trunk/varnish-cache/contrib/libevent/event-internal.h, + trunk/varnish-cache/contrib/libevent/event.3, + trunk/varnish-cache/contrib/libevent/event.c, + trunk/varnish-cache/contrib/libevent/event.h, + trunk/varnish-cache/contrib/libevent/evsignal.h, + trunk/varnish-cache/contrib/libevent/kqueue.c, + trunk/varnish-cache/contrib/libevent/log.c, + trunk/varnish-cache/contrib/libevent/log.h, + trunk/varnish-cache/contrib/libevent/poll.c, + trunk/varnish-cache/contrib/libevent/rtsig.c, + trunk/varnish-cache/contrib/libevent/sample, + trunk/varnish-cache/contrib/libevent/sample/Makefile.am, + trunk/varnish-cache/contrib/libevent/sample/Makefile.in, + trunk/varnish-cache/contrib/libevent/sample/event-test.c, + trunk/varnish-cache/contrib/libevent/sample/signal-test.c, + trunk/varnish-cache/contrib/libevent/sample/time-test.c, + trunk/varnish-cache/contrib/libevent/select.c, + trunk/varnish-cache/contrib/libevent/signal.c, + trunk/varnish-cache/contrib/libevent/test, + trunk/varnish-cache/contrib/libevent/test/Makefile.am, + trunk/varnish-cache/contrib/libevent/test/Makefile.in, + trunk/varnish-cache/contrib/libevent/test/bench.c, + trunk/varnish-cache/contrib/libevent/test/regress.c, + trunk/varnish-cache/contrib/libevent/test/test-eof.c, + trunk/varnish-cache/contrib/libevent/test/test-init.c, + trunk/varnish-cache/contrib/libevent/test/test-time.c, + trunk/varnish-cache/contrib/libevent/test/test-weof.c, + trunk/varnish-cache/contrib/libevent/test/test.sh: + + Add Niels Provos's libevent 1.1a. + +2006-03-14 12:00 des + + * trunk/varnish-cache/include/hash.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/include/queue.h, + trunk/varnish-cache/include/sbuf.h, trunk/varnish-cache/include/tree.h: + + Set the correct property (svn:keywords, not svn:keyword) + +2006-03-14 11:57 des + + * trunk/varnish-cache/lib/libsbuf/Makefile.am, + trunk/varnish-cache/lib/libsbuf/sbuf.3, + trunk/varnish-cache/lib/libsbuf/sbuf.c: + + Add a man page, and set the correct property (svn:keywords, not + svn:keyword) + +2006-03-14 09:31 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Add some trivial bits while I think about the hard ones + +2006-03-14 09:15 phk + + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/argv.c: + + Add a function to break a command line like string into an argv[]. + This will be useful for the various text based protocols etc. + +2006-03-13 14:23 des + + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/hash.h, + trunk/varnish-cache/include/queue.h, trunk/varnish-cache/include/tree.h: + + Add hash.h, queue.h and tree.h from NetBSD-CURRENT. + +2006-03-13 14:14 des + + * trunk/varnish-cache/configure.ac, trunk/varnish-cache/include/sbuf.h, + trunk/varnish-cache/lib/Makefile.am, trunk/varnish-cache/lib/libsbuf, + trunk/varnish-cache/lib/libsbuf/Makefile.am, + trunk/varnish-cache/lib/libsbuf/sbuf.c: + + Add libsbuf, based on the latest sbuf code from FreeBSD-CURRENT. + +2006-03-13 13:30 phk + + * trunk/varnish-cache/autogen.sh: + + Pick up the gnu-autotools binary directory if we spot one. This + makes life on FreeBSD somewhat easier. + +2006-03-13 12:37 phk + + * trunk/varnish-cache/lib/Makefile.am, trunk/varnish-cache/lib/libvcl, + trunk/varnish-cache/lib/libvcl/Makefile, + trunk/varnish-cache/lib/libvcl/sample.vcl, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_priv.h, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + + Add first cut of VCL compiler to the tree. + + The Makefile is a temporary shim until I get the auto* stuff working. + + The sample.vcl is a small mock-up to test the compiler. + + Some of the .h files needs to move other places in the fullness of time. + + But other than that... + +2006-03-02 10:32 des + + * trunk/varnish-cache: + + Ignore generated files; generated with the following command: + + svk propset svn:ignore "$(svk status | awk '/^\?/ { print $2 }')" . + +2006-03-02 10:31 des + + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/varnish, + trunk/varnish-cache/include/varnish/assert.h, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_log.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_util.c: + + Untested & undocumented login code. I don't have time to continue working + on it right now, but I want it in the tree so phk doesn't start duplicating + my effort. + +2006-03-02 10:29 des + + * trunk/varnish-cache/bin/varnishd: + + Add varnishd to ignore list. + +2006-02-27 14:21 des + + * trunk/varnish-cache/include: + + Ignore generated files. + +2006-02-27 14:21 des + + * trunk/varnish-cache/lib, trunk/varnish-cache/lib/libvarnish, + trunk/varnish-cache/lib/libvarnishapi: + + Ignore generated files. + +2006-02-27 14:21 des + + * trunk/varnish-cache/bin, trunk/varnish-cache/bin/varnishd: + + Ignore generated files. + +2006-02-27 11:10 des + + * trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am: + + Correct libtool idiom: run libtoolize after aclocal, and use LTLIBRARIES + instead of LIBRARIES. + +2006-02-27 09:55 des + + * trunk/varnish-cache/LICENSE: + + Don't forget the license! + +2006-02-24 14:35 des + + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/bin, trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishd, + trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/configure.ac, trunk/varnish-cache/include, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/varnishapi.h, trunk/varnish-cache/lib, + trunk/varnish-cache/lib/Makefile.am, + trunk/varnish-cache/lib/libvarnish, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am: + + Source tree structure as agreed. + +2006-02-22 14:31 des + + * trunk/varnish-cache, trunk/varnish-doc, trunk/varnish-proto, + trunk/varnish-tools: + + Additional subdivisions. + From des at projects.linpro.no Fri Aug 11 09:12:13 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 11:12:13 +0200 (CEST) Subject: r805 - in branches/0.9/varnish-cache: . bin/varnishd include lib/libcompat Message-ID: <20060811091213.3A4953BC125@projects.linpro.no> Author: des Date: 2006-08-11 11:12:12 +0200 (Fri, 11 Aug 2006) New Revision: 805 Added: branches/0.9/varnish-cache/INSTALL branches/0.9/varnish-cache/README branches/0.9/varnish-cache/svn2cl.xsl Modified: branches/0.9/varnish-cache/ChangeLog branches/0.9/varnish-cache/Makefile.am branches/0.9/varnish-cache/bin/varnishd/cache_acceptor.c branches/0.9/varnish-cache/bin/varnishd/cache_pass.c branches/0.9/varnish-cache/bin/varnishd/flint.lnt branches/0.9/varnish-cache/bin/varnishd/mgt_child.c branches/0.9/varnish-cache/bin/varnishd/mgt_cli.c branches/0.9/varnish-cache/bin/varnishd/mgt_vcc.c branches/0.9/varnish-cache/bin/varnishd/storage_file.c branches/0.9/varnish-cache/bin/varnishd/tcp.c branches/0.9/varnish-cache/bin/varnishd/varnishd.c branches/0.9/varnish-cache/configure.ac branches/0.9/varnish-cache/include/http_headers.h branches/0.9/varnish-cache/lib/libcompat/Makefile.am Log: Merge from trunk and bump version to 0.9.1. Modified: branches/0.9/varnish-cache/ChangeLog =================================================================== --- branches/0.9/varnish-cache/ChangeLog 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/ChangeLog 2006-08-11 09:12:12 UTC (rev 805) @@ -1,6012 +1,6806 @@ -2006-08-10 14:04 des +2006-08-11 08:40 des - * branches/0.9, branches/0.9/varnish-cache/configure.ac: Fork 0.9. + * trunk/varnish-cache/svn2cl.xsl: + Widen left and right margins, and add a blank line between the paths and + the message. + +2006-08-11 08:35 des + + * trunk/varnish-cache/svn2cl.xsl: + + Print the message separately from the paths to avoid strange wrapping. + +2006-08-11 08:34 des + + * trunk/varnish-cache/svn2cl.xsl: + + This is the XSL stylesheet used to generate the ChangeLog. + +2006-08-11 08:25 des + + * trunk/varnish-cache/Makefile.am: + + Include LICENSE and autogen.sh in the dist tarball. + +2006-08-11 08:25 des + + * trunk/varnish-cache/lib/libcompat/Makefile.am: + + Don't install libcompat.a. + +2006-08-11 08:24 des + + * trunk/varnish-cache/INSTALL, trunk/varnish-cache/README: + + Add a README and installation instructions. + +2006-08-11 07:35 phk + + * trunk/varnish-cache/include/http_headers.h: + + Don't filter Cache-Control out in replies from backend. + +2006-08-11 07:35 phk + + * trunk/varnish-cache/bin/varnishd/tcp.c: + + Fix protocol family selection logic to also work on + a FreeBSD machine with now IPv6. + + Remember to also free the addrinfo in case of success. + +2006-08-11 07:33 phk + + * trunk/varnish-cache/bin/varnishd/varnishd.c: + + Bail if we don't get a listening socket. + +2006-08-11 07:12 phk + + * trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + + Missed one: Only include compat headers if necessary + +2006-08-11 07:11 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/flint.sh, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/tcp.c: + + Pull in ../../config.h when running flexelint. + + Only include compat headers if we need them. + +2006-08-11 07:03 phk + + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + + Fix indentation + +2006-08-11 07:02 phk + + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + + Remove unused variable. + +2006-08-11 07:01 phk + + * trunk/varnish-cache/bin/varnishd/flint.sh: + + Point at KQUEUE version of acceptor by default. + +2006-08-11 07:01 phk + + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + + Fix an assert so it actually has a chance of firing: (an unsigned is + always >= 0) + 2006-08-10 13:03 des - * trunk/varnish-cache/bin/varnishd/cache_pass.c: Rewrite - pass_chunked(). + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + Rewrite pass_chunked(). + 2006-08-10 11:48 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Got the - requesttime right this time. - - I am noticing free()'s that are freeing empty - variables/pointers. Have to find where is happens. - Also noticing IP adresses not set correctly. - - Still load of debugcode. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Got the requesttime right this time. + + I am noticing free()'s that are freeing empty variables/pointers. Have + to find where is happens. + Also noticing IP adresses not set correctly. + + Still load of debugcode. + 2006-08-10 11:10 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Updated to - work with new inner workings (ReqStart, ReqEnd, sbuf replacement - etc). - - Code now compiles. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Updated to work with new inner workings (ReqStart, ReqEnd, sbuf + replacement etc). + + Code now compiles. + 2006-08-10 08:56 des - * trunk/varnish-cache/bin/varnishd/tcp.c: FreeBSD needs - for IPPROTO_IPV6 and IPV6_V6ONLY. + * trunk/varnish-cache/bin/varnishd/tcp.c: + FreeBSD needs for IPPROTO_IPV6 and IPV6_V6ONLY. + 2006-08-10 07:38 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Added some - more meat to the program. Loads of debug code still on. - - Next step is to add the correct time. It's a bit tricky, and I - haven't gotten it right just yet. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Added some more meat to the program. Loads of debug code still on. + + Next step is to add the correct time. It's a bit tricky, and I haven't + gotten it right just yet. + 2006-08-09 14:49 des - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/configure.ac: Add an epoll()-based acceptor - for Linux 2.6. Simple empirical tests indicate - that epoll() performs significantly better than poll() (less CPU - usage). + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/configure.ac: + Add an epoll()-based acceptor for Linux 2.6. Simple empirical tests + indicate + that epoll() performs significantly better than poll() (less CPU usage). + 2006-08-09 12:38 des - * trunk/varnish-cache/bin/varnishd/cache_center.c: Clear reference - to backend when we release our VCL reference. + * trunk/varnish-cache/bin/varnishd/cache_center.c: + Clear reference to backend when we release our VCL reference. + 2006-08-09 11:24 des - * trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/vcl_returns.h, - trunk/varnish-cache/include/vrt_obj.h, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, - trunk/varnish-cache/lib/libvcl/vcc_obj.c: Add support for using - separate backends for separate virtual hosts: - - - remove the obj.backend variable, which is not connected to - anything. - - define a req.backend variable and implement l/r functions for - it - - complete / correct support for setting / comparing backend - values + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: + Add support for using separate backends for separate virtual hosts: + + - remove the obj.backend variable, which is not connected to anything. + - define a req.backend variable and implement l/r functions for it + - complete / correct support for setting / comparing backend values + 2006-08-09 11:22 des - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_http.c: Cosmetic: - redefine HTTP_HDR_* as an enum and rename MAX_HTTP_HDRS to - HTTP_HDR_MAX. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c: + Cosmetic: redefine HTTP_HDR_* as an enum and rename MAX_HTTP_HDRS to + HTTP_HDR_MAX. + 2006-08-09 09:36 des - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/tcp.c: Rewrite open_tcp(): use - only one listening socket. Try for a combined - IPv6 / IPv4 socket; if IPv6 is not available, fall back to an - IPv4 socket. + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/tcp.c: + Rewrite open_tcp(): use only one listening socket. Try for a combined + IPv6 / IPv4 socket; if IPv6 is not available, fall back to an IPv4 socket. + 2006-08-08 14:52 des - * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: While FreeBSD - defaults to MAP_SHARED, Linux requires either MAP_SHARED or - MAP_PRIVATE to be specified. Do so. + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + While FreeBSD defaults to MAP_SHARED, Linux requires either MAP_SHARED or + MAP_PRIVATE to be specified. Do so. + 2006-08-08 14:00 des - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/configure.ac: Autodetect the need to link - against libdl for dlopen(). + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/configure.ac: + Autodetect the need to link against libdl for dlopen(). + 2006-08-08 12:57 des - * trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/configure.ac, - trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/compat/setproctitle.h, - trunk/varnish-cache/lib/libcompat/Makefile.am, - trunk/varnish-cache/lib/libcompat/setproctitle.c: Add a - setproctitle() stub to libcompat. + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat/setproctitle.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/setproctitle.c: + Add a setproctitle() stub to libcompat. + 2006-08-08 12:57 des - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: #include - "compat/srandomdev.h" for srandomdev() + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + #include "compat/srandomdev.h" for srandomdev() + 2006-08-08 12:55 des - * trunk/varnish-cache/include/compat/vis.h, - trunk/varnish-cache/lib/libcompat/vis.c: Expand keywords. + * trunk/varnish-cache/include/compat/vis.h, + trunk/varnish-cache/lib/libcompat/vis.c: + Expand keywords. + 2006-08-08 12:46 des - * trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/configure.ac: #include for - fstatfs if it is available. + * trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/configure.ac: + #include for fstatfs if it is available. + 2006-08-08 12:45 des - * trunk/varnish-cache/configure.ac: Now that we define - _GNU_SOURCE, the asprintf() / vasprintf() hack is no - longer required. + * trunk/varnish-cache/configure.ac: + Now that we define _GNU_SOURCE, the asprintf() / vasprintf() hack is no + longer required. + 2006-08-08 12:42 des - * trunk/varnish-cache/configure.ac: Defining _GNU_SOURCE gives us - native asprintf() and strptime() on glibc - systems, and has no effect on FreeBSD. + * trunk/varnish-cache/configure.ac: + Defining _GNU_SOURCE gives us native asprintf() and strptime() on glibc + systems, and has no effect on FreeBSD. + 2006-08-08 12:31 des - * trunk/varnish-cache/bin/varnishlog/Makefile.am, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/bin/varnishncsa/Makefile.am, - trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, - trunk/varnish-cache/bin/varnishstat/Makefile.am, - trunk/varnish-cache/bin/varnishtop/Makefile.am, - trunk/varnish-cache/bin/varnishtop/varnishtop.c, - trunk/varnish-cache/configure.ac, - trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/compat/vis.h, - trunk/varnish-cache/lib/libcompat/Makefile.am, - trunk/varnish-cache/lib/libcompat/vis.c: Bring in FreeBSD's - version of vis(3), strvis(3) and strvisx(3). + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat/vis.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/vis.c: + Bring in FreeBSD's version of vis(3), strvis(3) and strvisx(3). + 2006-08-08 12:15 des - * trunk/varnish-cache/configure.ac, - trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/compat/srandomdev.h, - trunk/varnish-cache/lib/libcompat/Makefile.am, - trunk/varnish-cache/lib/libcompat/srandomdev.c: Add a simple - srandomdev() implementation inspired by the one in FreeBSD. + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat/srandomdev.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/srandomdev.c: + Add a simple srandomdev() implementation inspired by the one in FreeBSD. + 2006-08-08 09:15 des - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: The correct - header for poll() is , not like the Linux - man page says (poll() is an XSI extension in SUSv[23]) + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + The correct header for poll() is , not like the Linux + man page says (poll() is an XSI extension in SUSv[23]) + 2006-08-08 07:47 des - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/configure.ac: Autodetect the availability of - kqueue() and / or poll(). + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/configure.ac: + Autodetect the availability of kqueue() and / or poll(). + 2006-08-08 07:47 des - * trunk/varnish-cache/bin/varnishstat/varnishstat.c: #include - "libvarnish.h" for varnish_version(). + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + #include "libvarnish.h" for varnish_version(). + 2006-08-08 07:36 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_response.c: Add back - sendfile support (under #ifdef HAVE_SENDFILE) but don't engage - it for small objects on the suspicion that it has highish setup - cost. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + Add back sendfile support (under #ifdef HAVE_SENDFILE) but don't engage + it for small objects on the suspicion that it has highish setup cost. + 2006-08-08 07:17 des - * trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/tcp.c, - trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/compat, - trunk/varnish-cache/include/compat.h, - trunk/varnish-cache/include/compat/asprintf.h, - trunk/varnish-cache/include/compat/strlcat.h, - trunk/varnish-cache/include/compat/strlcpy.h, - trunk/varnish-cache/include/compat/vasprintf.h, - trunk/varnish-cache/lib/libcompat/asprintf.c, - trunk/varnish-cache/lib/libcompat/strlcat.c, - trunk/varnish-cache/lib/libcompat/strlcpy.c, - trunk/varnish-cache/lib/libcompat/vasprintf.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.c: Split compat.h - into one header per function to avoid issues with e.g. the - vasprintf() prototype needing even when it isn't used. + * trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat, + trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/include/compat/asprintf.h, + trunk/varnish-cache/include/compat/strlcat.h, + trunk/varnish-cache/include/compat/strlcpy.h, + trunk/varnish-cache/include/compat/vasprintf.h, + trunk/varnish-cache/lib/libcompat/asprintf.c, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c, + trunk/varnish-cache/lib/libcompat/vasprintf.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c: + Split compat.h into one header per function to avoid issues with e.g. the + vasprintf() prototype needing even when it isn't used. + 2006-08-08 07:15 des - * trunk/varnish-cache/bin/varnishncsa/Makefile.am, - trunk/varnish-cache/bin/varnishstat/Makefile.am: - varnish{ncsa,stat} also need librt. + * trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishstat/Makefile.am: + varnish{ncsa,stat} also need librt. + 2006-08-08 07:03 des - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/hash_classic.c, - trunk/varnish-cache/configure.ac: Attempt to detect the - availability of RSA's MD5 implementation, and the - need to link against libmd to get it. - Attempt to detect the need for linking against librt to get - clock_gettime(). + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/configure.ac: + Attempt to detect the availability of RSA's MD5 implementation, and the + need to link against libmd to get it. + Attempt to detect the need for linking against librt to get + clock_gettime(). + 2006-08-08 07:01 phk - * trunk/varnish-cache/bin/varnishd/hash_classic.c: Fix braino + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + Fix braino + 2006-08-08 06:39 phk - * trunk/varnish-cache/bin/varnishd/hash_classic.c: Default to 4096 - buckets and 256 mutexes + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + Default to 4096 buckets and 256 mutexes + 2006-08-08 06:38 phk - * trunk/varnish-cache/bin/varnishd/hash_classic.c: Use crc32 hash - by default, MD5 is a compile time option + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + Use crc32 hash by default, MD5 is a compile time option + 2006-08-08 06:37 phk - * trunk/varnish-cache/bin/varnishd/flint.lnt: lbv_assert never - returns + * trunk/varnish-cache/bin/varnishd/flint.lnt: + lbv_assert never returns + 2006-08-07 21:08 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_token.c: 64bit changes + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + 64bit changes + 2006-08-07 21:01 phk - * trunk/varnish-cache/configure.ac: Add -Wformat and remove - -fno-inline which disables it. + * trunk/varnish-cache/configure.ac: + Add -Wformat and remove -fno-inline which disables it. + 2006-08-07 21:01 phk - * trunk/varnish-cache/lib/libvarnish/assert.c: Fix printf format - error + * trunk/varnish-cache/lib/libvarnish/assert.c: + Fix printf format error + 2006-08-07 20:50 phk - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, - trunk/varnish-cache/configure.ac: Update to new shmlog tag + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/configure.ac: + Update to new shmlog tag + 2006-08-07 20:47 phk - * trunk/varnish-cache/lib/libvcl/vcc_acl.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_priv.h, - trunk/varnish-cache/lib/libvcl/vcc_token.c: Eliminate use of - extensible printf + * trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_priv.h, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + Eliminate use of extensible printf + 2006-08-07 20:24 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Improve the "-d" - and "-d -d" facilities. - - When we close a CLI and it had fd# 0 and/or fd#1, reopen these - as /dev/null so the will not be reused for the CLI pipe to the - child on next restart, otherwise stdout/stderr output from the - manager would get sent there and confuse the clients CLI reader. - - Don't double free a pointer to the CLI buffer. - - Accept non-zero results from cli_readres() errors are non-fatal. - - Use stderr more consistently for manager debugging. + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Improve the "-d" and "-d -d" facilities. + + When we close a CLI and it had fd# 0 and/or fd#1, reopen these + as /dev/null so the will not be reused for the CLI pipe to the + child on next restart, otherwise stdout/stderr output from the + manager would get sent there and confuse the clients CLI reader. + + Don't double free a pointer to the CLI buffer. + + Accept non-zero results from cli_readres() errors are non-fatal. + + Use stderr more consistently for manager debugging. + 2006-08-07 18:33 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: An assert to catch - silly errors. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + An assert to catch silly errors. + 2006-08-07 17:27 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/include/shmlog_tags.h: Rename SHMlog tags - for consistency - XID -> ReqStart - ReqServTime -> ReqEnd + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/include/shmlog_tags.h: + Rename SHMlog tags for consistency + XID -> ReqStart + ReqServTime -> ReqEnd + 2006-08-07 17:18 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Remove printf - extensions used for development debugging + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Remove printf extensions used for development debugging + 2006-08-07 17:18 phk - * trunk/varnish-cache/include/libvarnish.h: Make assert do the - right thing + * trunk/varnish-cache/include/libvarnish.h: + Make assert do the right thing + 2006-08-07 17:15 phk - * trunk/varnish-cache/lib/libvcl/vcc_token.c: Clean up #includes + * trunk/varnish-cache/lib/libvcl/vcc_token.c: + Clean up #includes + 2006-08-07 17:10 phk - * trunk/varnish-cache/include/libvarnish.h, - trunk/varnish-cache/lib/libvarnish/assert.c: Call __assert() - lbv_assert() instead. + * trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/assert.c: + Call __assert() lbv_assert() instead. + 2006-08-07 17:08 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c, - trunk/varnish-cache/bin/varnishd/rfc2616.c, - trunk/varnish-cache/lib/libvarnish/assert.c: quench warnings - related to libvarnish.h + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/lib/libvarnish/assert.c: + quench warnings related to libvarnish.h + 2006-08-07 16:45 des - * trunk/varnish-cache/configure.ac: Don't trust the documentation - - when it says "additional headers", it - actually means "additional code to place before main() in the - test program" + * trunk/varnish-cache/configure.ac: + Don't trust the documentation - when it says "additional headers", it + actually means "additional code to place before main() in the test program" + 2006-08-07 16:42 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_session.c, - trunk/varnish-cache/bin/varnishd/hash_classic.c, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_event.c, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c, - trunk/varnish-cache/bin/varnishd/shmlog.c, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/tcp.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, - trunk/varnish-cache/bin/varnishtester/varnishtester.c, - trunk/varnish-cache/bin/varnishtop/varnishtop.c, - trunk/varnish-cache/include/libvarnish.h, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnish/argv.c, - trunk/varnish-cache/lib/libvarnish/assert.c: Add our own assert - in libvarnish.h - - Include libvarnish.h from cache.h and mgt.h + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishtester/varnishtester.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/assert.c: + Add our own assert in libvarnish.h + + Include libvarnish.h from cache.h and mgt.h + 2006-08-07 16:29 des - * trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: #include - "libvarnish.h" for varnish_version(). + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + #include "libvarnish.h" for varnish_version(). + 2006-08-07 16:26 des - * trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.c: #include - "compat.h" for asprintf(). + * trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c: + #include "compat.h" for asprintf(). + 2006-08-07 16:24 des - * trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, - trunk/varnish-cache/bin/varnishtop/varnishtop.c, - trunk/varnish-cache/lib/libvcl/vcc_acl.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_token.c: vsb.h is not a - system header. + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + vsb.h is not a system header. + 2006-08-07 16:23 des - * trunk/varnish-cache/bin/varnishtop/varnishtop.c: #include - "libvarnish.h" for varnish_version(). + * trunk/varnish-cache/bin/varnishtop/varnishtop.c: + #include "libvarnish.h" for varnish_version(). + 2006-08-07 16:23 des - * trunk/varnish-cache/bin/varnishd/mgt_vcc.c: #include "compat.h" - for asprintf(). Sort includes. + * trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + #include "compat.h" for asprintf(). Sort includes. + 2006-08-07 16:20 des - * trunk/varnish-cache/bin/varnishd/varnishd.c: Define INFTIM if it - isn't already. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Define INFTIM if it isn't already. + 2006-08-07 16:20 des - * trunk/varnish-cache/bin/varnishd/storage_file.c: Spell SIZE_MAX - correctly. + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Spell SIZE_MAX correctly. + 2006-08-07 16:17 des - * trunk/varnish-cache/bin/varnishd/mgt_event.c: Define INFTIM if - it isn't already. + * trunk/varnish-cache/bin/varnishd/mgt_event.c: + Define INFTIM if it isn't already. + 2006-08-07 16:17 des - * trunk/varnish-cache/bin/varnishd/mgt_cli.c: #include - for asprintf(). + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + #include for asprintf(). + 2006-08-07 16:15 phk - * trunk/varnish-cache/bin/varnishd/mgt_cli.c: Handle CLI trouble - with the childproc + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + Handle CLI trouble with the childproc + 2006-08-07 16:14 phk - * trunk/varnish-cache/include/cli.h, - trunk/varnish-cache/lib/libvarnish/cli_common.c: Add CLIS_COMMS - errno (400) and return an error text as well. + * trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/lib/libvarnish/cli_common.c: + Add CLIS_COMMS errno (400) and return an error text as well. + 2006-08-07 16:11 des - * trunk/varnish-cache/bin/varnishd/tcp.c, - trunk/varnish-cache/configure.ac: Check whether we have accept - filters before trying to use them. + * trunk/varnish-cache/bin/varnishd/tcp.c, trunk/varnish-cache/configure.ac: + Check whether we have accept filters before trying to use them. + 2006-08-07 16:05 phk - * trunk/varnish-cache/lib/libvarnish/cli_common.c: Handle read - errors on the cli pipes. + * trunk/varnish-cache/lib/libvarnish/cli_common.c: + Handle read errors on the cli pipes. + 2006-08-07 15:54 des - * trunk/varnish-cache/configure.ac: Improve descriptions of - HAVE_ASPRINTF / HAVE_VASPRINTF. + * trunk/varnish-cache/configure.ac: + Improve descriptions of HAVE_ASPRINTF / HAVE_VASPRINTF. + 2006-08-07 15:54 phk - * trunk/varnish-cache/lib/libvarnish/vsb.c: Quench warnings. + * trunk/varnish-cache/lib/libvarnish/vsb.c: + Quench warnings. + 2006-08-07 15:51 des - * trunk/varnish-cache/include/compat.h, - trunk/varnish-cache/lib/libcompat/vasprintf.c: My idiocy knows - no bounds. Make sure this actually builds. + * trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/lib/libcompat/vasprintf.c: + My idiocy knows no bounds. Make sure this actually builds. + 2006-08-07 15:47 des - * trunk/varnish-cache/configure.ac: Improve detection of the - presence and usability of asprintf() / vasprintf(). + * trunk/varnish-cache/configure.ac: + Improve detection of the presence and usability of asprintf() / + vasprintf(). + 2006-08-07 15:42 des - * trunk/varnish-cache/include/compat.h: paste-o. + * trunk/varnish-cache/include/compat.h: + paste-o. + 2006-08-07 15:24 des - * trunk/varnish-cache/configure.ac, - trunk/varnish-cache/include/compat.h, - trunk/varnish-cache/lib/libcompat/Makefile.am, - trunk/varnish-cache/lib/libcompat/asprintf.c, - trunk/varnish-cache/lib/libcompat/strlcat.c, - trunk/varnish-cache/lib/libcompat/strlcpy.c, - trunk/varnish-cache/lib/libcompat/vasprintf.c: Add - implementations of asprintf(3) and vasprintf(3). + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/asprintf.c, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c, + trunk/varnish-cache/lib/libcompat/vasprintf.c: + Add implementations of asprintf(3) and vasprintf(3). + 2006-08-07 15:09 des - * trunk/varnish-cache/include/libvarnish.h: Relucantly include - for time_t. We'll have to clean up our header - files at some point. + * trunk/varnish-cache/include/libvarnish.h: + Relucantly include for time_t. We'll have to clean up our header + files at some point. + 2006-08-07 15:08 des - * trunk/varnish-cache/bin/varnishd/shmlog.c: Remove redundant - definition of __assert(). + * trunk/varnish-cache/bin/varnishd/shmlog.c: + Remove redundant definition of __assert(). + 2006-08-07 15:00 des - * trunk/varnish-cache/include/libvarnish.h: TIM_{format,parse}() - are used unconditionally, so declare them unconditionally. + * trunk/varnish-cache/include/libvarnish.h: + TIM_{format,parse}() are used unconditionally, so declare them + unconditionally. + 2006-08-07 15:00 des - * trunk/varnish-cache/bin/varnishd/cache.h: Sort includes, add - for uint64_t. + * trunk/varnish-cache/bin/varnishd/cache.h: + Sort includes, add for uint64_t. + 2006-08-07 14:55 des - * trunk/varnish-cache/lib/libvcl/vcc_compile.c: Eliminate __unused. + * trunk/varnish-cache/lib/libvcl/vcc_compile.c: + Eliminate __unused. + 2006-08-07 14:52 des - * trunk/varnish-cache/lib/libvarnish/cli_common.c: Sort includes, - add for uintptr_t. + * trunk/varnish-cache/lib/libvarnish/cli_common.c: + Sort includes, add for uintptr_t. + 2006-08-07 12:42 des - * trunk/varnish-cache/lib/libvarnish/vsb.3: Define - str-Lb-libvarnish so ".Lb libvarnish" will work. This should be - in - a shared file somewhere with some soelim magic in the Makefile, - but don't - bother right now - the file isn't installed anyway. + * trunk/varnish-cache/lib/libvarnish/vsb.3: + Define str-Lb-libvarnish so ".Lb libvarnish" will work. This should be in + a shared file somewhere with some soelim magic in the Makefile, but don't + bother right now - the file isn't installed anyway. + 2006-08-07 12:35 des - * trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/bin/varnishncsa/Makefile.am, - trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, - trunk/varnish-cache/bin/varnishstat/Makefile.am, - trunk/varnish-cache/bin/varnishstat/varnishstat.c, - trunk/varnish-cache/bin/varnishtop/varnishtop.c, - trunk/varnish-cache/include/libvarnish.h, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnish/version.c: Add a -V option - (display version and exit) to all programs. + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/version.c: + Add a -V option (display version and exit) to all programs. + 2006-08-07 11:09 des - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_cli.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/cache_vrt_re.c, - trunk/varnish-cache/bin/varnishd/flint.lnt, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/bin/varnishlog/Makefile.am, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/bin/varnishncsa/Makefile.am, - trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, - trunk/varnish-cache/bin/varnishtop/Makefile.am, - trunk/varnish-cache/bin/varnishtop/varnishtop.c, - trunk/varnish-cache/configure.ac, - trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/cli_common.h, - trunk/varnish-cache/include/libvcl.h, - trunk/varnish-cache/include/sbuf.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/include/vsb.h, - trunk/varnish-cache/lib/Makefile.am, - trunk/varnish-cache/lib/libsbuf, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnish/cli_common.c, - trunk/varnish-cache/lib/libvarnish/vsb.3, - trunk/varnish-cache/lib/libvarnish/vsb.c, - trunk/varnish-cache/lib/libvcl/vcc_acl.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.h, - trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcc_token.c: Fold libsbuf into - libvarnish, with s/sbuf/vsb/g. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_re.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/cli_common.h, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/include/sbuf.h, trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/include/vsb.h, + trunk/varnish-cache/lib/Makefile.am, trunk/varnish-cache/lib/libsbuf, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/cli_common.c, + trunk/varnish-cache/lib/libvarnish/vsb.3, + trunk/varnish-cache/lib/libvarnish/vsb.c, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + Fold libsbuf into libvarnish, with s/sbuf/vsb/g. + 2006-08-07 10:46 phk - * trunk/varnish-cache/bin/varnishd/cache_pipe.c: Timeout pipe - connections after 600 seconds. + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: + Timeout pipe connections after 600 seconds. + 2006-08-07 10:40 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Use a 600 - second timeout, 120 second is too little. + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Use a 600 second timeout, 120 second is too little. + 2006-08-07 09:21 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Set - SO_SNDTIMEO to 120 seconds + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Set SO_SNDTIMEO to 120 seconds + 2006-08-07 08:42 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/stevedore.h, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/storage_malloc.c: First step of - slow client handling: Lose the stevedore function - for sending and instead record the fd+off_t in the storage - object. - - This eliminates sendfile from storage_file.c, next step is to put - it back in the generic code in cache_response.c + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + First step of slow client handling: Lose the stevedore function + for sending and instead record the fd+off_t in the storage object. + + This eliminates sendfile from storage_file.c, next step is to put + it back in the generic code in cache_response.c + 2006-08-07 05:52 des - * trunk/varnish-cache/bin/varnishd/cache_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/lib/libvarnish/cli_common.c: Update #include - directives. + * trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvarnish/cli_common.c: + Update #include directives. + 2006-08-07 05:49 des - * trunk/varnish-cache/bin/varnishd/cache_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.h, - trunk/varnish-cache/bin/varnishd/mgt_event.c, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c, - trunk/varnish-cache/include/binary_heap.h, - trunk/varnish-cache/include/cli_priv.h, - trunk/varnish-cache/include/miniobj.h, - trunk/varnish-cache/include/stats.h, - trunk/varnish-cache/include/varnish/assert.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvarnish/argv.c, - trunk/varnish-cache/lib/libvarnish/binary_heap.c, - trunk/varnish-cache/lib/libvarnish/cli.c, - trunk/varnish-cache/lib/libvarnish/time.c, - trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c, - trunk/varnish-cache/lib/libvarnishapi/varnish_log.c, - trunk/varnish-cache/lib/libvarnishapi/varnish_util.c: Expand - keywords. + * trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/include/binary_heap.h, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/miniobj.h, + trunk/varnish-cache/include/stats.h, + trunk/varnish-cache/include/varnish/assert.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/binary_heap.c, + trunk/varnish-cache/lib/libvarnish/cli.c, + trunk/varnish-cache/lib/libvarnish/time.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_log.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_util.c: + Expand keywords. + 2006-08-07 05:49 des - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/common_cli.c, - trunk/varnish-cache/bin/varnishd/common_cli.h, - trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/cli_common.h, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnish/cli_common.c: Move - common_cli.[ch] out of varnishd, and rename them to - cli_common.[ch]. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/cli_common.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/cli_common.c: + Move common_cli.[ch] out of varnishd, and rename them to cli_common.[ch]. + 2006-08-07 05:47 des - * trunk/varnish-cache/bin/varnishd/Makefile.am: List headers in - noinst_HEADERS instead of SOURCES. + * trunk/varnish-cache/bin/varnishd/Makefile.am: + List headers in noinst_HEADERS instead of SOURCES. + 2006-08-07 00:21 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Fresh start - after study of output from varnishlog -o. - - First off is IP adress logging and clearing. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Fresh start after study of output from varnishlog -o. + + First off is IP adress logging and clearing. + 2006-08-06 17:00 des - * trunk/varnish-cache: Add compile to svn:ignore. + * trunk/varnish-cache: + Add compile to svn:ignore. + 2006-08-06 16:55 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Make - -w - - work as expected. + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Make + -w - + work as expected. + 2006-08-06 15:02 des - * trunk/varnish-cache/bin/varnishlog/Makefile.am, - trunk/varnish-cache/bin/varnishncsa/Makefile.am, - trunk/varnish-cache/bin/varnishstat/Makefile.am, - trunk/varnish-cache/bin/varnishtester/Makefile.am, - trunk/varnish-cache/bin/varnishtop/Makefile.am, - trunk/varnish-cache/lib/libcompat/Makefile.am, - trunk/varnish-cache/lib/libsbuf/Makefile.am, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnishapi/Makefile.am, - trunk/varnish-cache/lib/libvcl/Makefile.am: Systematically - include config.h. + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishtester/Makefile.am, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libsbuf/Makefile.am, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am, + trunk/varnish-cache/lib/libvcl/Makefile.am: + Systematically include config.h. + 2006-08-06 14:33 des - * trunk/varnish-cache/bin/varnishd/Makefile.am: Forcibly include - config.h. + * trunk/varnish-cache/bin/varnishd/Makefile.am: + Forcibly include config.h. + 2006-08-06 13:51 des - * trunk/varnish-cache/configure.ac: Change version to "trunk" - until I can figure out a way to have it reflect - the current date. + * trunk/varnish-cache/configure.ac: + Change version to "trunk" until I can figure out a way to have it reflect + the current date. + 2006-08-06 13:49 des - * trunk/varnish-cache/configure.ac: Include -pipe in CFLAGS. - Reduce optimization level to -O when debugging. + * trunk/varnish-cache/configure.ac: + Include -pipe in CFLAGS. + Reduce optimization level to -O when debugging. + 2006-08-06 12:51 des - * trunk/varnish-cache: Adjust directory properties. + * trunk/varnish-cache: + Adjust directory properties. + 2006-08-06 12:49 des - * trunk/varnish-cache/bin/varnishlog, - trunk/varnish-cache/bin/varnishncsa, - trunk/varnish-cache/bin/varnishstat, - trunk/varnish-cache/bin/varnishtester, - trunk/varnish-cache/bin/varnishtop, - trunk/varnish-cache/lib/libcompat, - trunk/varnish-cache/lib/libsbuf, trunk/varnish-cache/lib/libvcl: - Adjust directory properties. + * trunk/varnish-cache/bin/varnishlog, + trunk/varnish-cache/bin/varnishncsa, + trunk/varnish-cache/bin/varnishstat, + trunk/varnish-cache/bin/varnishtester, + trunk/varnish-cache/bin/varnishtop, trunk/varnish-cache/lib/libcompat, + trunk/varnish-cache/lib/libsbuf, trunk/varnish-cache/lib/libvcl: + Adjust directory properties. + 2006-08-06 12:26 des - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishlog/Makefile.am, - trunk/varnish-cache/bin/varnishncsa/Makefile.am, - trunk/varnish-cache/bin/varnishstat/Makefile.am: Add missing - headers and man pages. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishstat/Makefile.am: + Add missing headers and man pages. + 2006-08-06 12:26 des - * trunk/varnish-cache/autogen.sh: We no longer have any - CONFIG_SUBDIRS. + * trunk/varnish-cache/autogen.sh: + We no longer have any CONFIG_SUBDIRS. + 2006-08-06 12:25 des - * trunk/varnish-cache/include/Makefile.am: Add missing headers. + * trunk/varnish-cache/include/Makefile.am: + Add missing headers. + 2006-08-06 12:23 des - * trunk/varnish-cache/Makefile.am: Umm, *really* retire libevent. + * trunk/varnish-cache/Makefile.am: + Umm, *really* retire libevent. + 2006-08-06 12:23 des - * trunk/varnish-cache/Makefile.am, - trunk/varnish-cache/configure.ac, trunk/varnish-cache/contrib: - Retire libevent. + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/configure.ac, + trunk/varnish-cache/contrib: + Retire libevent. + 2006-08-06 12:20 des - * trunk/varnish-cache/bin/Makefile.am, - trunk/varnish-cache/configure.ac: Fully disconnect varnishtester. + * trunk/varnish-cache/bin/Makefile.am, trunk/varnish-cache/configure.ac: + Fully disconnect varnishtester. + 2006-08-06 00:44 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: I have - realized that I have major structure problems. I will have to - study varnishlog output a bit more to understand it better. - - May wanna start clean again, and use hardearned knowledge to - make better and more robust structure. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + I have realized that I have major structure problems. I will have to + study varnishlog output a bit more to understand it better. + + May wanna start clean again, and use hardearned knowledge to make + better and more robust structure. + 2006-08-05 22:43 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Checks show - that my IP adress checker is very restrictive and probably - deletes other loglines. We still bleeds null lines also. - - This will have to be cleaned up. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Checks show that my IP adress checker is very restrictive and probably + deletes other loglines. We still bleeds null lines also. + + This will have to be cleaned up. + 2006-08-05 22:12 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Loglines with - no IP should no longer appear. That also cleared all lines - containing a null. Not sure if my check for IP is to harsly - implemented and cleans to much. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Loglines with no IP should no longer appear. That also cleared all + lines containing a null. Not sure if my check for IP is to harsly + implemented and cleans to much. + 2006-08-05 21:35 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Centralized - the stringwriting at last, also started memory cleanup. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Centralized the stringwriting at last, also started memory cleanup. + 2006-08-05 21:11 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Added user, - loginname, statuscode (200, 304 etc.), byte and referer to make - a logline compliant. User and loginname is hardcoded. Referer - and User-agen is unclean. Timecode is not working. This version - leaks memory bigtime, and is not ready for alpha yet. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Added user, loginname, statuscode (200, 304 etc.), byte and referer to + make a logline compliant. User and loginname is hardcoded. Referer and + User-agen is unclean. Timecode is not working. This version leaks + memory bigtime, and is not ready for alpha yet. + 2006-08-05 20:52 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: For - consistency: Go to deliver state instead of delivering locally. + * trunk/varnish-cache/bin/varnishd/cache_center.c: + For consistency: Go to deliver state instead of delivering locally. + 2006-08-05 18:11 phk - * trunk/varnish-cache/include/vcl.h, - trunk/varnish-cache/include/vcl_returns.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: Make vcl - methods call their defaults as a last resort. - - Fix the location table so it knows about the default code too. + * trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: + Make vcl methods call their defaults as a last resort. + + Fix the location table so it knows about the default code too. + 2006-08-05 17:30 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c: And that is not a - good idea either. + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + And that is not a good idea either. + 2006-08-05 17:30 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c: This was not a - valid test. + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + This was not a valid test. + 2006-08-05 17:04 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_cli.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Add some - undocumented code to look for something that worries me. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Add some undocumented code to look for something that worries me. + 2006-08-05 16:41 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c: Issue error - message for CLI::start and CLI::stop if child is - not in a legal state for command. + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + Issue error message for CLI::start and CLI::stop if child is + not in a legal state for command. + 2006-08-05 16:32 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c: Also trap SIGTERM + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + Also trap SIGTERM + 2006-08-05 16:31 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: More work on the - debug stunt + * trunk/varnish-cache/bin/varnishd/varnishd.c: + More work on the debug stunt + 2006-08-05 15:55 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c: Plug memory leaks - related to starting/stopping child. + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + Plug memory leaks related to starting/stopping child. + 2006-08-05 15:40 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c: Replace - client_should_run with a 5 state enum to avoid races if multiple - CLI sources yell at the same time. + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + Replace client_should_run with a 5 state enum to avoid races if multiple + CLI sources yell at the same time. + 2006-08-05 15:38 phk - * trunk/varnish-cache/bin/varnishd/mgt_cli.c: Bail if the cli pipe - is not ready + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + Bail if the cli pipe is not ready + 2006-08-05 15:38 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Polish the - debugstunt and make it possible to avoid it. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Polish the debugstunt and make it possible to avoid it. + 2006-08-05 15:35 phk - * trunk/varnish-cache/bin/varnishd/mgt_event.c: We don't disturb - ourselves. + * trunk/varnish-cache/bin/varnishd/mgt_event.c: + We don't disturb ourselves. + 2006-08-05 14:24 phk - * trunk/varnish-cache/bin/varnishd/common_cli.c, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_event.c, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c: More defensive - coding and a couple of bugs less. + * trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + More defensive coding and a couple of bugs less. + 2006-08-05 14:22 phk - * trunk/varnish-cache/lib/libvarnish/binary_heap.c: More defensive - coding. + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + More defensive coding. + 2006-08-05 12:45 phk - * trunk/varnish-cache/bin/varnishd/common_cli.c, - trunk/varnish-cache/bin/varnishd/common_cli.h, - trunk/varnish-cache/bin/varnishd/mgt_cli.c: Add a timeout to - reads from the child CLI pipe so we don't hang - for ever. + * trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_cli.c: + Add a timeout to reads from the child CLI pipe so we don't hang + for ever. + 2006-08-05 12:24 phk - * trunk/varnish-cache/bin/varnishd/flint.lnt: Improve. + * trunk/varnish-cache/bin/varnishd/flint.lnt: + Improve. + 2006-08-05 12:24 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c: Style cleanup. - - remove two unused variables. + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + Style cleanup. + + remove two unused variables. + 2006-08-05 12:24 phk - * trunk/varnish-cache/bin/varnishd/mgt_cli.c: Remove unused include - - Fix function arg type + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + Remove unused include + + Fix function arg type + 2006-08-05 12:23 phk - * trunk/varnish-cache/bin/varnishd/cache_expire.c: Make sanity - check of binheap permanent and fix style accordingly. + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + Make sanity check of binheap permanent and fix style accordingly. + 2006-08-05 12:23 phk - * trunk/varnish-cache/bin/varnishd/common_cli.c: Remove unused - include - - free buffer on error. + * trunk/varnish-cache/bin/varnishd/common_cli.c: + Remove unused include + + free buffer on error. + 2006-08-05 12:22 phk - * trunk/varnish-cache/bin/varnishd/cache_cli.c: Make sure we don't - overflow the line buffer - - Remove unused #include + * trunk/varnish-cache/bin/varnishd/cache_cli.c: + Make sure we don't overflow the line buffer + + Remove unused #include + 2006-08-05 12:20 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_vcl.c: Remove unused "ip" - from backend. - - Make VCL_Load static, and give it a NULL check. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + Remove unused "ip" from backend. + + Make VCL_Load static, and give it a NULL check. + 2006-08-05 12:19 phk - * trunk/varnish-cache/bin/varnishd/common_cli.h: Cleanup unused - stuff + * trunk/varnish-cache/bin/varnishd/common_cli.h: + Cleanup unused stuff + 2006-08-05 12:19 phk - * trunk/varnish-cache/bin/varnishd/mgt.h: Remove prototypes for no - longer existing functions + * trunk/varnish-cache/bin/varnishd/mgt.h: + Remove prototypes for no longer existing functions + 2006-08-05 12:18 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c: Remove unused - includes + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + Remove unused includes + 2006-08-05 12:17 phk - * trunk/varnish-cache/bin/varnishd/flint.sh: don't search libevent - for includes + * trunk/varnish-cache/bin/varnishd/flint.sh: + don't search libevent for includes + 2006-08-05 12:17 phk - * trunk/varnish-cache/bin/varnishd/mgt_event.c: style fix + * trunk/varnish-cache/bin/varnishd/mgt_event.c: + style fix + 2006-08-05 12:16 phk - * trunk/varnish-cache/bin/varnishd/mgt_vcc.c: Rename struct vcls - to vclprog + * trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + Rename struct vcls to vclprog + 2006-08-05 11:44 phk - * trunk/varnish-cache/bin/varnishd/cli_common.c: remove old file + * trunk/varnish-cache/bin/varnishd/cli_common.c: + remove old file + 2006-08-05 11:16 phk - * trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c: Change manager to - use mgt_event.h instead of threads to be lazy thread - developer compatible. - - POSIX, no surprise, doesn't really tell what should happen to a - threaded - process which forks and consequently implemenations vary - somewhat, - from Solaris which seems to Do The Right Thing, via Linux where - it - works "most of the time" and to FreeBSD which more or less - actively - sabotages any such attempt. - - Grin and live with it... + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + Change manager to use mgt_event.h instead of threads to be lazy thread + developer compatible. + + POSIX, no surprise, doesn't really tell what should happen to a threaded + process which forks and consequently implemenations vary somewhat, + from Solaris which seems to Do The Right Thing, via Linux where it + works "most of the time" and to FreeBSD which more or less actively + sabotages any such attempt. + + Grin and live with it... + 2006-08-05 11:13 phk - * trunk/varnish-cache/bin/varnishd/cache_cli.c: Remove pthread.h - include, it's included in cache.h + * trunk/varnish-cache/bin/varnishd/cache_cli.c: + Remove pthread.h include, it's included in cache.h + 2006-08-05 11:12 phk - * trunk/varnish-cache/bin/varnishd/mgt_event.c: Remove debugging - printfs + * trunk/varnish-cache/bin/varnishd/mgt_event.c: + Remove debugging printfs + 2006-08-05 11:08 phk - * trunk/varnish-cache/bin/varnishd/mgt_event.c: More bugfixes + * trunk/varnish-cache/bin/varnishd/mgt_event.c: + More bugfixes + 2006-08-05 11:07 phk - * trunk/varnish-cache/lib/libvarnish/binary_heap.c: Add assert + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + Add assert + 2006-08-05 10:31 phk - * trunk/varnish-cache/bin/varnishd/mgt_event.c, - trunk/varnish-cache/bin/varnishd/mgt_event.h: bugfixes + * trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: + bugfixes + 2006-08-05 09:27 phk - * trunk/varnish-cache/bin/varnishd/mgt_event.c, - trunk/varnish-cache/bin/varnishd/mgt_event.h: Add signal support. + * trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: + Add signal support. + 2006-08-05 08:49 phk - * trunk/varnish-cache/bin/varnishd/mgt_event.c, - trunk/varnish-cache/bin/varnishd/mgt_event.h: bugfixes + * trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: + bugfixes + 2006-08-05 08:19 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/mgt_event.c, - trunk/varnish-cache/bin/varnishd/mgt_event.h: Add a miniature - event engine based on poll(2). - - It's general enough to find other uses, but right now it's only - for - the manager process. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/mgt_event.c, + trunk/varnish-cache/bin/varnishd/mgt_event.h: + Add a miniature event engine based on poll(2). + + It's general enough to find other uses, but right now it's only for + the manager process. + 2006-08-05 01:17 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Got the IP, - Request and User-Agent sorted out. Working on the time + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Got the IP, Request and User-Agent sorted out. Working on the time + 2006-08-04 20:03 phk - * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Initialize all - directions to "opposite" for -b and -c to avoid - spurious first entries. + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Initialize all directions to "opposite" for -b and -c to avoid + spurious first entries. + 2006-08-04 19:42 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: Use id for - printing + * trunk/varnish-cache/bin/varnishd/cache_center.c: + Use id for printing + 2006-08-04 19:36 phk - * trunk/varnish-cache/include/stat_field.h: Stats field changes + * trunk/varnish-cache/include/stat_field.h: + Stats field changes + 2006-08-04 19:36 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/cache_session.c: More - comprehensive performance stats and a few asserts, just in case. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_session.c: + More comprehensive performance stats and a few asserts, just in case. + 2006-08-04 11:10 phk - * trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.h, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c: Now that we keep - track of loaded VCLs in the manager, we might - as well allow their manipulation also when the child is not - running. + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c: + Now that we keep track of loaded VCLs in the manager, we might + as well allow their manipulation also when the child is not + running. + 2006-08-04 10:54 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_cli.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.h, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c, - trunk/varnish-cache/include/cli.h, - trunk/varnish-cache/include/vcl.h, - trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl: Redo VCL - program handling. - - Keep track of all loaded VCL programs in the manager and tell the - child to load them via VCL. - - Don't start he acceptor thread until a "start" command cones down - the CLI. - - XXX: Right now we leak stuff when a VCL program is dicarded + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/include/cli.h, trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl: + Redo VCL program handling. + + Keep track of all loaded VCL programs in the manager and tell the + child to load them via VCL. + + Don't start he acceptor thread until a "start" command cones down + the CLI. + + XXX: Right now we leak stuff when a VCL program is dicarded + 2006-08-04 10:23 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_cli.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.h, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Redo our management - of compiled VCL programs: - - Take default_vcl out of heritage. - - Keep track of all compiled VCL files and delete them at - exit. - - After starting child, use CLI to load all vcl programs - and then issue "start" via the CLI. - - In the cacher, don't start the acceptor until we get - a start command. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Redo our management of compiled VCL programs: + + Take default_vcl out of heritage. + + Keep track of all compiled VCL files and delete them at + exit. + + After starting child, use CLI to load all vcl programs + and then issue "start" via the CLI. + + In the cacher, don't start the acceptor until we get + a start command. + 2006-08-04 09:19 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_vcc.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Move VCL compiler - related stuff to mgt_vcc.c + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_vcc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Move VCL compiler related stuff to mgt_vcc.c + 2006-08-04 09:06 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Remove old cli - related stuff, it now lives elsewhere + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Remove old cli related stuff, it now lives elsewhere + 2006-08-04 09:06 phk - * trunk/varnish-cache/bin/varnishd/mgt_cli.c: reimplement CLI stats + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + reimplement CLI stats + 2006-08-04 07:21 phk - * trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c: Implement CLI ping - in manager, this is a "per hop" command. - - Add mgt_cli_askchild() function to poke the CLI interface to - the child. - - Use it to ping the child every second. + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c: + Implement CLI ping in manager, this is a "per hop" command. + + Add mgt_cli_askchild() function to poke the CLI interface to + the child. + + Use it to ping the child every second. + 2006-08-04 07:20 phk - * trunk/varnish-cache/bin/varnishd/cache_cli.c, - trunk/varnish-cache/bin/varnishd/common_cli.c, - trunk/varnish-cache/bin/varnishd/common_cli.h: Move - cli_func_ping to common_cli + * trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h: + Move cli_func_ping to common_cli + 2006-08-04 07:19 phk - * trunk/varnish-cache/bin/varnishd/cache_main.c: SIGCHLD has - already been taken care of earlier. + * trunk/varnish-cache/bin/varnishd/cache_main.c: + SIGCHLD has already been taken care of earlier. + 2006-08-04 06:53 phk - * trunk/varnish-cache/bin/varnishd/common_cli.c, - trunk/varnish-cache/bin/varnishd/common_cli.h, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/include/cli.h: Change the CLI protocol in a - subtle but useful way: - - The first line of the response has a fixed format ("%-3d %-8u\n") - and consequently fixed length (CLI_LINE0_LEN == 13). - - This makes parsing responses more efficient. Add a function - in common_cli to do so. + * trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/include/cli.h: + Change the CLI protocol in a subtle but useful way: + + The first line of the response has a fixed format ("%-3d %-8u\n") + and consequently fixed length (CLI_LINE0_LEN == 13). + + This makes parsing responses more efficient. Add a function + in common_cli to do so. + 2006-08-04 06:23 phk - * trunk/varnish-cache/bin/varnishd/mgt_cli.c: (Re)Implement - passthru of cli commands, we can now talk with the - cache process again. + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + (Re)Implement passthru of cli commands, we can now talk with the + cache process again. + 2006-08-04 06:21 phk - * trunk/varnish-cache/include/cli.h: Add CLIS_CANT status code for - when something is valid but currently - impossible. + * trunk/varnish-cache/include/cli.h: + Add CLIS_CANT status code for when something is valid but currently + impossible. + 2006-08-04 06:21 phk - * trunk/varnish-cache/bin/varnishd/cache_cli.c: Typo: write cli - result to correct pipe. + * trunk/varnish-cache/bin/varnishd/cache_cli.c: + Typo: write cli result to correct pipe. + 2006-08-03 23:42 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Placed a new - sbuf_clear at a more strategic place. It got cluttered when a - host left without SessionClose of SessionReuse. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Placed a new sbuf_clear at a more strategic place. It got cluttered + when a host left without SessionClose of SessionReuse. + 2006-08-03 22:01 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Got a - workaround for IP adress fetching. If we connect logger while - Varnish is running, we won't catch the IP from SessionOpen since - it's already done that. Workaround is to catch the IP from - SessionReuse if IP of session is NULL + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Got a workaround for IP adress fetching. If we connect logger while + Varnish is running, we won't catch the IP from SessionOpen since it's + already done that. Workaround is to catch the IP from SessionReuse if + IP of session is NULL + 2006-08-03 19:21 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Fix copy&paste - bug in fetch_chunked. + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Fix copy&paste bug in fetch_chunked. + 2006-08-03 19:20 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Sanitycheck that - the length of an object adds up, right when we - fetch it. + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Sanitycheck that the length of an object adds up, right when we + fetch it. + 2006-08-03 11:46 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c: Imlement stopping - and restarting of child process. - - Not as useful as it will be yet, see ticket 22 + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + Imlement stopping and restarting of child process. + + Not as useful as it will be yet, see ticket 22 + 2006-08-03 11:45 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Make the pipe-stunt - debug process smarter. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Make the pipe-stunt debug process smarter. + 2006-08-03 10:37 phk - * trunk/varnish-cache/bin/Makefile.am: Take varnishtester out of - the loop until it can be de-libevented + * trunk/varnish-cache/bin/Makefile.am: + Take varnishtester out of the loop until it can be de-libevented + 2006-08-03 10:37 phk - * trunk/varnish-cache/bin/varnishd/mgt_cli.c: Add stop command as - well. + * trunk/varnish-cache/bin/varnishd/mgt_cli.c: + Add stop command as well. + 2006-08-03 10:16 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Think I have - found a program structure that works. Filling in bits to build - logline. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Think I have found a program structure that works. Filling in bits to + build logline. + 2006-08-03 09:45 phk - * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, - trunk/varnish-cache/bin/varnishtester/Makefile.am: Remove - libevent from the picture. + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/bin/varnishtester/Makefile.am: + Remove libevent from the picture. + 2006-08-03 09:45 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_cli.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cli_common.c, - trunk/varnish-cache/bin/varnishd/cli_event.c, - trunk/varnish-cache/bin/varnishd/cli_event.h, - trunk/varnish-cache/bin/varnishd/common_cli.c, - trunk/varnish-cache/bin/varnishd/common_cli.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/mgt_cli.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Rip out the old CLI - handling and start over, more or less. - - Still bits missing. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_common.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/common_cli.c, + trunk/varnish-cache/bin/varnishd/common_cli.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/mgt_cli.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Rip out the old CLI handling and start over, more or less. + + Still bits missing. + 2006-08-03 06:45 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_cli.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cli_event.h: Rework the cache - process CLI handling: - - We are only accepting CLI from the pipes in heritage, so simply - run a loop reading those, dispatching lines as we see them. - - Export CLI_cmds[] so that the management process can see it, - we might as well take advantage of the shared binary where we - can. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_cli.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.h: + Rework the cache process CLI handling: + + We are only accepting CLI from the pipes in heritage, so simply + run a loop reading those, dispatching lines as we see them. + + Export CLI_cmds[] so that the management process can see it, + we might as well take advantage of the shared binary where we can. + 2006-08-02 22:53 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Added - SessionReuse so I now write a logline for SessionClose and - SessionReuse. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Added SessionReuse so I now write a logline for SessionClose and + SessionReuse. + 2006-08-02 22:33 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Starting to - get the structure right (I think). Thx for the NULL on each - string Poul-Hennning :) + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Starting to get the structure right (I think). Thx for the NULL on + each string Poul-Hennning :) + 2006-08-02 20:59 phk - * trunk/varnish-cache/bin/varnishd/cache_expire.c: Add an assert, - just in case. + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + Add an assert, just in case. + 2006-08-02 20:54 phk - * trunk/varnish-cache/lib/libvarnish/binary_heap.c: Fix a bug when - deleting items in the binheap + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + Fix a bug when deleting items in the binheap + 2006-08-02 19:12 phk - * trunk/varnish-cache/bin/varnishd/cache_session.c: log StatAddr - with fd=0 to avoid out-of-order confusion + * trunk/varnish-cache/bin/varnishd/cache_session.c: + log StatAddr with fd=0 to avoid out-of-order confusion + 2006-08-02 18:17 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Allow ENOENT - on removing kqueue events, a close will have drained - them already. + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Allow ENOENT on removing kqueue events, a close will have drained + them already. + 2006-08-02 18:12 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Tell daemon(3) to - not chdir in debugging mode so we can find our core dumps. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Tell daemon(3) to not chdir in debugging mode so we can find our core + dumps. + 2006-08-02 17:45 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: Enter pass mode - through the front door. + * trunk/varnish-cache/bin/varnishd/cache_center.c: + Enter pass mode through the front door. + 2006-08-02 17:27 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: More asserts, - sp->vbc this time. + * trunk/varnish-cache/bin/varnishd/cache_center.c: + More asserts, sp->vbc this time. + 2006-08-02 15:55 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c: Remember to clear - sp->vbc + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + Remember to clear sp->vbc + 2006-08-02 13:28 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Don my plumbers - outfit and twist a lot of pipes into shape: - - When -d(ebug) is specified we fork before calling daemon. - - The parent process becomes a miniature cat(1) program which - connects - stdin/stdout with the management process stdin/stdout. - - It also knows that SIGINT should be passed on to the management - process - in order to make it DTRT. - - Any other cause of death for this "debugger" process will (once I - teach the CLI about it) not affect the running varnish and - therefore - it will be possible to start varnish in debugging mode, tweak - things - a bit and CTRL-D and leave it running in the properly - daemon(3)'ed - background. - - The reason for this rather complicated bit of pipework is that we - can not call daemon(3) once we have started any threads (only the - calling thread survives) and we would loose our parent - relationship - to the cache process also. + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Don my plumbers outfit and twist a lot of pipes into shape: + + When -d(ebug) is specified we fork before calling daemon. + + The parent process becomes a miniature cat(1) program which connects + stdin/stdout with the management process stdin/stdout. + + It also knows that SIGINT should be passed on to the management process + in order to make it DTRT. + + Any other cause of death for this "debugger" process will (once I + teach the CLI about it) not affect the running varnish and therefore + it will be possible to start varnish in debugging mode, tweak things + a bit and CTRL-D and leave it running in the properly daemon(3)'ed + background. + + The reason for this rather complicated bit of pipework is that we + can not call daemon(3) once we have started any threads (only the + calling thread survives) and we would loose our parent relationship + to the cache process also. + 2006-08-02 12:05 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Typo: Also - monitor remote sockets with the poll based acceptor. + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Typo: Also monitor remote sockets with the poll based acceptor. + 2006-08-02 11:58 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c: Remove the - libevent from the backend pool manager. - - Simplify the logic here while we're at it. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c: + Remove the libevent from the backend pool manager. + + Simplify the logic here while we're at it. + 2006-08-02 11:18 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Add - include + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Add include + 2006-08-02 11:17 phk - * trunk/varnish-cache/bin/varnishd/cache_pipe.c: Remove unused - struct. + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: + Remove unused struct. + 2006-08-02 10:53 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c: Simplify - backend connection memory management. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c: + Simplify backend connection memory management. + 2006-08-02 10:40 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Replace - libevent based acceptor with poll(2) based acceptor. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Replace libevent based acceptor with poll(2) based acceptor. + 2006-08-02 09:34 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_http.c: Bite the bullet - and write an alternate acceptor which uses kqueue - directly instead of libevent. - - Degeneralize the header reading code in cache_http.c which seems - to - be cleaner anyway. - - An #ifdef at the top of cache_acceptor.c selects which - implementation - you want: libevent or kqueue. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c: + Bite the bullet and write an alternate acceptor which uses kqueue + directly instead of libevent. + + Degeneralize the header reading code in cache_http.c which seems to + be cleaner anyway. + + An #ifdef at the top of cache_acceptor.c selects which implementation + you want: libevent or kqueue. + 2006-08-02 07:23 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Convert pipe to - use poll(2) on the two filedescriptors it cares about - and eliminate the per-workerthread event engine entirely. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Convert pipe to use poll(2) on the two filedescriptors it cares about + and eliminate the per-workerthread event engine entirely. + 2006-08-02 07:07 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c: I have nothing - but circumstantial evidence that libevent is involved - in the current stack corruption I see, but we might as well avoid - using it where we can: - - Don't engage the eventengine when we talk to the backend, just - call - read(2) directly. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c: + I have nothing but circumstantial evidence that libevent is involved + in the current stack corruption I see, but we might as well avoid + using it where we can: + + Don't engage the eventengine when we talk to the backend, just call + read(2) directly. + 2006-08-02 04:57 phk - * trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/hash_classic.c: More miniobj - paranoia + * trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c: + More miniobj paranoia + 2006-08-01 19:48 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: More miniobj - checks + * trunk/varnish-cache/bin/varnishd/cache_http.c: + More miniobj checks + 2006-08-01 17:54 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: More miniobj - checks + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + More miniobj checks + 2006-08-01 16:42 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/flint.lnt: More miniobj checks + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/flint.lnt: + More miniobj checks + 2006-08-01 16:26 phk - * trunk/varnish-cache/bin/varnishd/cache_response.c: more miniobj - checks + * trunk/varnish-cache/bin/varnishd/cache_response.c: + more miniobj checks + 2006-08-01 15:09 phk - * trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, - trunk/varnish-cache/bin/varnishd/cache_vrt_re.c: Flinting. + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_re.c: + Flinting. + 2006-08-01 15:08 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Make 32bit - limitation work better. + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Make 32bit limitation work better. + 2006-08-01 15:08 phk - * trunk/varnish-cache/bin/varnishd/hash_classic.c: Fixx off by one - error. + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + Fixx off by one error. + 2006-08-01 14:53 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/storage_file.c: Add miniobj - checks om SMF and STORAGE + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/storage_file.c: + Add miniobj checks om SMF and STORAGE + 2006-08-01 12:38 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c: This is getting - too longhaired: Give backend connections another - http header which we can use to build the object headers in. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c: + This is getting too longhaired: Give backend connections another + http header which we can use to build the object headers in. + 2006-08-01 12:04 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Experiment: - don't use req's workspace to build object http header. + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Experiment: don't use req's workspace to build object http header. + 2006-08-01 09:39 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/rfc2616.c, - trunk/varnish-cache/include/shmlog_tags.h: Record timestamp when - we have received completed HTTP request header, - and define this as the "start of request timestamp". - - Define "end of request timestamp" as when we are ready to - transmit - HTTP header back. - - SHMlog the start and difference between start and stop with - ReqServTime - tag. - - Keep track of idle sessions using CLOCK_MONOTONIC to avoid - trouble - here should our clock get stepped. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/include/shmlog_tags.h: + Record timestamp when we have received completed HTTP request header, + and define this as the "start of request timestamp". + + Define "end of request timestamp" as when we are ready to transmit + HTTP header back. + + SHMlog the start and difference between start and stop with ReqServTime + tag. + + Keep track of idle sessions using CLOCK_MONOTONIC to avoid trouble + here should our clock get stepped. + 2006-07-31 22:21 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Added some - more toying with the data. All is still a mess, and I am not - sure of structure yet. PHK is also doing changes in areas that - will be needed. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Added some more toying with the data. All is still a mess, and I am + not sure of structure yet. PHK is also doing changes in areas that + will be needed. + 2006-07-31 22:09 phk - * trunk/varnish-cache/bin/varnishd/shmlog.c, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Always NUL - terminate shmlog entries. + * trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Always NUL terminate shmlog entries. + 2006-07-31 21:49 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/include/shmlog_tags.h: Create three groups - of seven SHMlog tags: - - {Rx,Tx,Obj}{Request,Response,Status,URL,Protocol,Header,LostHeader} - - And log http header munching accordingly. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h: + Create three groups of seven SHMlog tags: + + {Rx,Tx,Obj}{Request,Response,Status,URL,Protocol,Header,LostHeader} + + And log http header munching accordingly. + 2006-07-31 21:46 phk - * trunk/varnish-cache/bin/varnishd/hash_classic.c: Remove unused - variable + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + Remove unused variable + 2006-07-31 21:37 phk - * trunk/varnish-cache/bin/varnishd/cache_session.c: addr might be - NULL if we are called from the prefetcher. + * trunk/varnish-cache/bin/varnishd/cache_session.c: + addr might be NULL if we are called from the prefetcher. + 2006-07-31 21:04 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_response.c: Add - http_ClrHeader() and cure an unintended bug-oid its use exposes: - we checked if the request is a GET long after we should have. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + Add http_ClrHeader() and cure an unintended bug-oid its use exposes: + we checked if the request is a GET long after we should have. + 2006-07-31 20:38 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_response.c: Add a - http_SetResp() function for constructing HTTP responses (like - 304). - - Eliminate the header index from http_SetHeader() which is no - unused. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + Add a http_SetResp() function for constructing HTTP responses (like 304). + + Eliminate the header index from http_SetHeader() which is no unused. + 2006-07-31 20:27 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/include/shmlog_tags.h: Log the headers we - store in the object under ObjHeader so that - we don't get two confusing batches of TxHeader in the sessions - logentries. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/include/shmlog_tags.h: + Log the headers we store in the object under ObjHeader so that + we don't get two confusing batches of TxHeader in the sessions logentries. + 2006-07-31 19:18 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: Fix the - dot-graph + * trunk/varnish-cache/bin/varnishd/cache_center.c: + Fix the dot-graph + 2006-07-31 14:50 andersb - * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: Initial - commit of real structure. This code will print the User-Agent. + * trunk/varnish-cache/bin/varnishncsa/varnishncsa.c: + Initial commit of real structure. This code will print the User-Agent. + 2006-07-31 07:26 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_response.c: Introduce - http_SetHeader() for setting a http header to a const string, - no need to waste time printf'ing in this case, and no need to - waste workspace. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + Introduce http_SetHeader() for setting a http header to a const string, + no need to waste time printf'ing in this case, and no need to waste + workspace. + 2006-07-31 07:13 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Don't fill more - than half the workspace with received data, we need to - have space for composing the reply as well. - - Without this fix, the entire workspace could be filled with - pipelined - requests and we would have no space to compose the reply. + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Don't fill more than half the workspace with received data, we need to + have space for composing the reply as well. + + Without this fix, the entire workspace could be filled with pipelined + requests and we would have no space to compose the reply. + 2006-07-31 06:36 des - * trunk/varnish-cache/bin/Makefile.am, - trunk/varnish-cache/bin/varnishncsa, - trunk/varnish-cache/bin/varnishncsa/Makefile.am, - trunk/varnish-cache/bin/varnishncsa/varnishncsa.1, - trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, - trunk/varnish-cache/configure.ac: Clone varnishncsa off of - varnishlog. Anders will hack on it to produce - NCSA-style (common / combined) logs. + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishncsa, + trunk/varnish-cache/bin/varnishncsa/Makefile.am, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.1, + trunk/varnish-cache/bin/varnishncsa/varnishncsa.c, + trunk/varnish-cache/configure.ac: + Clone varnishncsa off of varnishlog. Anders will hack on it to produce + NCSA-style (common / combined) logs. + 2006-07-31 06:24 des - * trunk/varnish-cache/bin/varnishd/hash_classic.c: Unbreak build. + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + Unbreak build. + 2006-07-28 13:41 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: "HEAD" has 4 - characters. + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + "HEAD" has 4 characters. + 2006-07-24 10:13 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: remove this file - (again) + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + remove this file (again) + 2006-07-22 22:01 phk - * trunk/varnish-cache/bin/varnishd/hash_classic.c: reorg a little - bit. + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + reorg a little bit. + 2006-07-22 21:20 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/stevedore.h, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/storage_malloc.c: Eliminate - redundant args from stevedore->send() - - Have WRK_Write() and friends return number of bytes (we can't use - WRK_Flush() as that may act on both header and body). - - Collect more stats. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + Eliminate redundant args from stevedore->send() + + Have WRK_Write() and friends return number of bytes (we can't use + WRK_Flush() as that may act on both header and body). + + Collect more stats. + 2006-07-22 20:57 phk - * 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_pool.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/cache_session.c, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/stat_field.h: Add per address, per - session and total statistics. - - We (will) collect data in unlocked per workerthread accumulators - and whenever the workerthread leaves the session, we charge the - bill to the srcaddr (issuing a StatAddr shmrecord), to the - session - and to the global counters in the stats struct. - - When sessions die we issue a StatSess shmrecord. - - StatAddr and StatSess has the same format: - address - port (always zero for StatAddr) - duration (seconds) - #sessions - #requests - #pipe - #pass - #fetch - #hdrbytes - #bodybytes + * 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_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: + Add per address, per session and total statistics. + + We (will) collect data in unlocked per workerthread accumulators + and whenever the workerthread leaves the session, we charge the + bill to the srcaddr (issuing a StatAddr shmrecord), to the session + and to the global counters in the stats struct. + + When sessions die we issue a StatSess shmrecord. + + StatAddr and StatSess has the same format: + address + port (always zero for StatAddr) + duration (seconds) + #sessions + #requests + #pipe + #pass + #fetch + #hdrbytes + #bodybytes + 2006-07-22 16:55 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Make sure there - always is a Host: header in fetch requests. - - We fill it in with backend.hostname, but this may not be optimal - (direct IP# etc etc) so VCL should be able to override it. + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Make sure there always is a Host: header in fetch requests. + + We fill it in with backend.hostname, but this may not be optimal + (direct IP# etc etc) so VCL should be able to override it. + 2006-07-22 16:26 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: Action pass - from vcl_hit() needs to go to STP_PASS + * trunk/varnish-cache/bin/varnishd/cache_center.c: + Action pass from vcl_hit() needs to go to STP_PASS + 2006-07-22 16:15 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c: Always use GET - and HTTP/1.1 against the backend for fetch + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c: + Always use GET and HTTP/1.1 against the backend for fetch + 2006-07-22 13:58 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: exit after error + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + exit after error + 2006-07-22 12:00 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_vrt_re.c, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.h, - trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: Implement - regexp matching of strings in VCL. - - For now we default to REG_EXTENDED, but it might make sense - to let the user control this flag and the case sensitivity. - - Another concern is the stringification of regexps, it may lead - to backslash madness. Maybe we should define '...' string types - also and do no backslash substitution in those at all. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_vrt_re.c, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: + Implement regexp matching of strings in VCL. + + For now we default to REG_EXTENDED, but it might make sense + to let the user control this flag and the case sensitivity. + + Another concern is the stringification of regexps, it may lead + to backslash madness. Maybe we should define '...' string types + also and do no backslash substitution in those at all. + 2006-07-22 10:41 phk - * trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/vcl_returns.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvcl/vcc_acl.c, - trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: Change the acl - syntax slightly: the ( ... ) should enclose all of - the rule (ie: also ! and /mask if present). - - Implement matching for IPv4. - - Acl tests are shmlogged as follows (doc candidate): - - shmlog tag: VCL_actl - - "NO_MATCH $acl" - client did not match access list $acl - "FAIL $acl $rule" - getaddrinfo(3) failed on $rule which had a '!' - "MATCH $acl $rule" - client matched $rule - "NEG_MATCH $acl $rule" - client matched negated (!) $rule + * trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c: + Change the acl syntax slightly: the ( ... ) should enclose all of + the rule (ie: also ! and /mask if present). + + Implement matching for IPv4. + + Acl tests are shmlogged as follows (doc candidate): + + shmlog tag: VCL_actl + + "NO_MATCH $acl" + client did not match access list $acl + "FAIL $acl $rule" + getaddrinfo(3) failed on $rule which had a '!' + "MATCH $acl $rule" + client matched $rule + "NEG_MATCH $acl $rule" + client matched negated (!) $rule + 2006-07-22 10:35 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_session.c: Store the - socket address in the session + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_session.c: + Store the socket address in the session + 2006-07-22 09:38 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, - trunk/varnish-cache/include/vcl.h, - trunk/varnish-cache/include/vcl_returns.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/include/vrt_obj.h, - trunk/varnish-cache/lib/libvcl/vcc_acl.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.h, - trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl: VCL - compiler: - add two sbufs for "init" and "fini" actions. - - VCL ACLs: Change syntax and implementation as follows. - - ACL Syntax now works the following way: - - acl $name { - ! ( "myhost.com" ) ; - "10.0.0.1" /8 ; - } - - The '!' means not. If the address matches the rest of the rule - the address does NOT match the acl and the search terminates - here. - - Enclosing the string in paranthesis means that the rule will be - ignored - if the string cannot be converted to an address (with - getaddrinfo). - - When a string can not be looked up, and is not enclosed in a - paranthesis, a positive rule (ie: without !) will not match and a - negative rule (with !) will match. - - A mask can always be supplied, no matter the style of the string - given, so it is possible to do things like: - - { "fw.ourcompany.dom" / 24 } - - Which means "any host on the same /24 subnet as - fw.ourcompany.dom". - - - Unfortunately getaddrinfo() does not return a TTL for the - results, - in the future we may want to use some kind of timeout to refresh - the lookups. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl: + VCL compiler: + add two sbufs for "init" and "fini" actions. + + VCL ACLs: Change syntax and implementation as follows. + + ACL Syntax now works the following way: + + acl $name { + ! ( "myhost.com" ) ; + "10.0.0.1" /8 ; + } + + The '!' means not. If the address matches the rest of the rule + the address does NOT match the acl and the search terminates here. + + Enclosing the string in paranthesis means that the rule will be ignored + if the string cannot be converted to an address (with getaddrinfo). + + When a string can not be looked up, and is not enclosed in a + paranthesis, a positive rule (ie: without !) will not match and a + negative rule (with !) will match. + + A mask can always be supplied, no matter the style of the string + given, so it is possible to do things like: + + { "fw.ourcompany.dom" / 24 } + + Which means "any host on the same /24 subnet as fw.ourcompany.dom". + + + Unfortunately getaddrinfo() does not return a TTL for the results, + in the future we may want to use some kind of timeout to refresh + the lookups. + 2006-07-22 08:02 phk - * trunk/varnish-cache/include/vrt_obj.h, - trunk/varnish-cache/lib/libvcl/Makefile.am, - trunk/varnish-cache/lib/libvcl/vcc_acl.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.h, - trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, - trunk/varnish-cache/lib/libvcl/vcc_obj.c: Split IP/ACL - compilation into vcc_acl.c + * trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/Makefile.am, + trunk/varnish-cache/lib/libvcl/vcc_acl.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: + Split IP/ACL compilation into vcc_acl.c + 2006-07-21 22:12 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/storage_file.c: Unless the user - specifies an explicit size, don't use more than 2GB - on 32 bit architectures to avoid running out of address room - - Make FlexeLint happy. + * trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/storage_file.c: + Unless the user specifies an explicit size, don't use more than 2GB + on 32 bit architectures to avoid running out of address room + + Make FlexeLint happy. + 2006-07-21 21:57 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/include/vcl_returns.h, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.h, - trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcc_token.c: Make FlexeLint - happier + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + Make FlexeLint happier + 2006-07-21 21:42 phk - * trunk/varnish-cache/autogen.phk: Drop this one now. + * trunk/varnish-cache/autogen.phk: + Drop this one now. + 2006-07-21 21:28 phk - * trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/rfc2616.c: Implement TTL - adjustment from VCL - - Log in shmem where the TTL came from (doc-candidate): - - 696613561 RFC 900 1153517009 1153517014 1153517914 900 0 - | | | | | | | | - | | | | | | | - age - | | | | | | - max-age - | | | | | Expires: header - | | | | Date: header - | | | "now" - | | TTL relative to "now" - | who set the TTL - xid of object - - or - - 696613561 VCL 20 1153517009 - | | | | - | | | "now" - | | TTL relative to "now" - | who set the TTL - xid of object + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + Implement TTL adjustment from VCL + + Log in shmem where the TTL came from (doc-candidate): + + 696613561 RFC 900 1153517009 1153517014 1153517914 900 0 + | | | | | | | | + | | | | | | | age + | | | | | | max-age + | | | | | Expires: header + | | | | Date: header + | | | "now" + | | TTL relative to "now" + | who set the TTL + xid of object + + or + + 696613561 VCL 20 1153517009 + | | | | + | | | "now" + | | TTL relative to "now" + | who set the TTL + xid of object + 2006-07-21 21:13 phk - * trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/vrt_obj.h, - trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, - trunk/varnish-cache/lib/libvcl/vcc_obj.c: More VRT work. - - Use macros for trivial objects which are just a field in a - struct. + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: + More VRT work. + + Use macros for trivial objects which are just a field in a struct. + 2006-07-21 21:01 phk - * trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/vrt.h: Update VRT to minimal - functional level again + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vrt.h: + Update VRT to minimal functional level again + 2006-07-21 20:51 phk - * trunk/varnish-cache/include/vrt_obj.h, - trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, - trunk/varnish-cache/lib/libvcl/vcc_obj.c: Use const char* for - safety + * trunk/varnish-cache/include/vrt_obj.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c: + Use const char* for safety + 2006-07-21 20:45 phk - * trunk/varnish-cache/include/binary_heap.h, - trunk/varnish-cache/include/miniobj.h, - trunk/varnish-cache/include/stat_field.h, - trunk/varnish-cache/include/stats.h, - trunk/varnish-cache/include/vcl.h, - trunk/varnish-cache/include/vcl_returns.h: Update + * trunk/varnish-cache/include/binary_heap.h, + trunk/varnish-cache/include/miniobj.h, + trunk/varnish-cache/include/stat_field.h, + trunk/varnish-cache/include/stats.h, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h: + Update + 2006-07-21 20:44 phk - * trunk/varnish-cache/include/vrt_obj.h: This file is generated. + * trunk/varnish-cache/include/vrt_obj.h: + This file is generated. + 2006-07-21 20:43 phk - * trunk/varnish-cache/lib/libvcl/Makefile.am, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.h, - trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, - trunk/varnish-cache/lib/libvcl/vcc_obj.c, - trunk/varnish-cache/lib/libvcl/vcc_token.c: Automate generation - of tables and prototypes for the objects which - VCL programs can manipulate. + * trunk/varnish-cache/lib/libvcl/Makefile.am, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c, + trunk/varnish-cache/lib/libvcl/vcc_token.c: + Automate generation of tables and prototypes for the objects which + VCL programs can manipulate. + 2006-07-21 18:12 phk - * trunk/varnish-cache/lib/libvcl/Makefile.am, - trunk/varnish-cache/lib/libvcl/vcc_compile.c, - trunk/varnish-cache/lib/libvcl/vcc_compile.h, - trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcc_obj.c, - trunk/varnish-cache/lib/libvcl/vcc_priv.h, - trunk/varnish-cache/lib/libvcl/vcc_token.c, - trunk/varnish-cache/lib/libvcl/vcc_token_defs.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_priv.h, - trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Move things - over to the correct "VCC" prefix. - - Split some stuff into separate files while we're at it. + * trunk/varnish-cache/lib/libvcl/Makefile.am, + trunk/varnish-cache/lib/libvcl/vcc_compile.c, + trunk/varnish-cache/lib/libvcl/vcc_compile.h, + trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcc_obj.c, + trunk/varnish-cache/lib/libvcl/vcc_priv.h, + trunk/varnish-cache/lib/libvcl/vcc_token.c, + trunk/varnish-cache/lib/libvcl/vcc_token_defs.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_priv.h, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + Move things over to the correct "VCC" prefix. + + Split some stuff into separate files while we're at it. + 2006-07-21 16:25 phk - * trunk/varnish-cache/include/http_headers.h: update comment + * trunk/varnish-cache/include/http_headers.h: + update comment + 2006-07-21 16:15 phk - * trunk/varnish-cache/bin/varnishd/rfc2616.c, - trunk/varnish-cache/include/shmlog_tags.h: Properly log TTL - calculation to shmem + * trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/include/shmlog_tags.h: + Properly log TTL calculation to shmem + 2006-07-21 16:06 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Fix formatting of - responses. + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Fix formatting of responses. + 2006-07-21 16:05 phk - * trunk/varnish-cache/bin/varnishd/rfc2616.c: Log TTL calculation - on the right fd + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + Log TTL calculation on the right fd + 2006-07-21 15:25 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/bin/varnishtop/varnishtop.c, - trunk/varnish-cache/include/varnishapi.h, - trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Work on - logtailer api a bit: - - By default, start at the last entry in shared memory. To dump - the - entire segment from the start, specify '-d' option. - - Terminate programs when '-r $file' reaches EOF + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Work on logtailer api a bit: + + By default, start at the last entry in shared memory. To dump the + entire segment from the start, specify '-d' option. + + Terminate programs when '-r $file' reaches EOF + 2006-07-21 12:18 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_session.c, - trunk/varnish-cache/bin/varnishd/flint.lnt: Cleanup + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/flint.lnt: + Cleanup + 2006-07-21 12:08 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c: Magic check on - struct vbe + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + Magic check on struct vbe + 2006-07-21 12:06 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c: Better name + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + Better name + 2006-07-21 11:55 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/include/http_headers.h, - trunk/varnish-cache/include/stat_field.h: Convert fetch, insert - and deliver to use new HTTP header munging code. - - Remove sbuf from workerthread, it is only used in the Error - handling - now and it will probably not even survive that in the long run. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/stat_field.h: + Convert fetch, insert and deliver to use new HTTP header munging code. + + Remove sbuf from workerthread, it is only used in the Error handling + now and it will probably not even survive that in the long run. + 2006-07-21 10:44 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Make pipe use the - new http manipulation. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Make pipe use the new http manipulation. + 2006-07-21 09:32 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - 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_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/http_headers.h: HTTP header munging - part (N of M) - - NB: Only pass mode (lightly) tested right now. - - Give up on the three element array per header and use a two - element struct - instead, it reduces obfuscation and removes risk of pointer - fandango. - - Introduce #defined filtercontrol in http_headers.h, use them in - a new - field. Only Pass is there for now. - - Use the http-workspace for building headers instead of sbuf. - - Move uiovec handling to cache_pool.c where it more naturally - belongs - and so we can use it on both backends and sessions. - - Add http header munging functiosn for copying, printf'ing, - filtering and - writing headers. + * trunk/varnish-cache/bin/varnishd/cache.h, + 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_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/http_headers.h: + HTTP header munging part (N of M) + + NB: Only pass mode (lightly) tested right now. + + Give up on the three element array per header and use a two element struct + instead, it reduces obfuscation and removes risk of pointer fandango. + + Introduce #defined filtercontrol in http_headers.h, use them in a new + field. Only Pass is there for now. + + Use the http-workspace for building headers instead of sbuf. + + Move uiovec handling to cache_pool.c where it more naturally belongs + and so we can use it on both backends and sessions. + + Add http header munging functiosn for copying, printf'ing, filtering and + writing headers. + 2006-07-21 07:18 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_session.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/shmlog_tags.h: Rename shmlog tags - for headers to RxHeader and TxHeader that's more - logical. - - Rename http_Init() to http_Setup() to avoid clash with - HTTP_Init(). - - Remove unused variable + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/shmlog_tags.h: + Rename shmlog tags for headers to RxHeader and TxHeader that's more + logical. + + Rename http_Init() to http_Setup() to avoid clash with HTTP_Init(). + + Remove unused variable + 2006-07-20 22:08 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/cache_session.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/rfc2616.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c: Yet another - refinement to the way we store and deal with HTTP headers. - - Record a triplet of {start, data, end} for all HTTP data items. - - This represents a regrettable uglification of the sourcecode, but - most of it compiles out to constants and the runtime benefits - will - be worth it. - - Generate H_FOO magic strings for all the headers we know about. - These strings have a length as first char and always ends in ':'. - - Also genereate H_FOO format strings in VCL compiler. - - Mandate (with assert) that header references happen using H_FOO - strings. - - Make number of allowed HTTP headers a compile time constant (32) - but make the workspace a run-time variable (4096). - - Introduce new SHM tag for dumping aborted HTTP protocol requests. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Yet another refinement to the way we store and deal with HTTP headers. + + Record a triplet of {start, data, end} for all HTTP data items. + + This represents a regrettable uglification of the sourcecode, but + most of it compiles out to constants and the runtime benefits will + be worth it. + + Generate H_FOO magic strings for all the headers we know about. + These strings have a length as first char and always ends in ':'. + + Also genereate H_FOO format strings in VCL compiler. + + Mandate (with assert) that header references happen using H_FOO strings. + + Make number of allowed HTTP headers a compile time constant (32) + but make the workspace a run-time variable (4096). + + Introduce new SHM tag for dumping aborted HTTP protocol requests. + 2006-07-20 15:10 phk - * trunk/varnish-cache/bin/varnishd/cache_expire.c: Add XXX comment + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + Add XXX comment + 2006-07-20 14:46 phk - * trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/include/stat_field.h: Keep an eye on deathrow + * trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/include/stat_field.h: + Keep an eye on deathrow + 2006-07-20 14:40 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_response.c: More asserts + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + More asserts + 2006-07-20 14:23 phk - * trunk/varnish-cache/bin/varnishd/cache_hash.c: We need to check - the TTL here also, if a (sequence of) slow client(s) - manages to hold the document referenced, the prefetcher may never - get lucky with it and it will linger here much past last sell - date. + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + We need to check the TTL here also, if a (sequence of) slow client(s) + manages to hold the document referenced, the prefetcher may never + get lucky with it and it will linger here much past last sell date. + 2006-07-20 13:42 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Only reference - srcaddr on first request on session + * trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Only reference srcaddr on first request on session + 2006-07-20 13:39 phk - * trunk/varnish-cache/bin/varnishd/cache_session.c: Be more - paranoid about srcaddr + * trunk/varnish-cache/bin/varnishd/cache_session.c: + Be more paranoid about srcaddr + 2006-07-20 13:33 phk - * trunk/varnish-cache/bin/varnishd/cache_session.c: upd + * trunk/varnish-cache/bin/varnishd/cache_session.c: + upd + 2006-07-20 13:29 phk - * trunk/varnish-cache/bin/varnishd/cache_session.c, - trunk/varnish-cache/include/stat_field.h: Keep track of active - source addresses + * trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/include/stat_field.h: + Keep track of active source addresses + 2006-07-20 12:03 phk - * trunk/varnish-cache/bin/varnishtop/varnishtop.c: Add -1 option - that stops comparison after first field. - - Useful with commands like: - - varnishtop -i header -1 - varnishtop -i srcaddr -1 - - where the variable part of the entry is less relevant. + * trunk/varnish-cache/bin/varnishtop/varnishtop.c: + Add -1 option that stops comparison after first field. + + Useful with commands like: + + varnishtop -i header -1 + varnishtop -i srcaddr -1 + + where the variable part of the entry is less relevant. + 2006-07-20 10:10 phk - * trunk/varnish-cache/bin/varnishstat/varnishstat.c: Show also - average since start + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + Show also average since start + 2006-07-20 09:58 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Hmm, that was a - bad idea. + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Hmm, that was a bad idea. + 2006-07-20 09:42 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Loop till we have - everything. + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Loop till we have everything. + 2006-07-20 09:29 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_response.c: Implement - "If-Modified-Since" conditional queries + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + Implement "If-Modified-Since" conditional queries + 2006-07-20 08:29 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_response.c: Remove - explicit worker thread arguments. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + Remove explicit worker thread arguments. + 2006-07-20 08:25 phk - * 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_pass.c, - trunk/varnish-cache/bin/varnishd/cache_response.c: Move the - delivery functions from acceptor to response + * 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_pass.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + Move the delivery functions from acceptor to response + 2006-07-19 21:16 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/include/stat_field.h: Rework the worker - thread pool logic slightly, we were leaking - threads before. + * trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: + Rework the worker thread pool logic slightly, we were leaking + threads before. + 2006-07-19 21:14 phk - * trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/shmlog.c, - trunk/varnish-cache/bin/varnishstat/varnishstat.c, - trunk/varnish-cache/include/stats.h: Include a "start_time" - timestamp in the stats and teach varnishstats - to print it in curses mode. - - Some polishing and cleanup. + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/include/stats.h: + Include a "start_time" timestamp in the stats and teach varnishstats + to print it in curses mode. + + Some polishing and cleanup. + 2006-07-19 20:07 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Use insert_pass in - vcl_fetch() so we cache the uncacheability. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Use insert_pass in vcl_fetch() so we cache the uncacheability. + 2006-07-19 20:06 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Don't explode - on trim's to zero size. - - Real fix should (maybe) be to callers + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Don't explode on trim's to zero size. + + Real fix should (maybe) be to callers + 2006-07-19 19:49 phk - * trunk/varnish-cache/bin/varnishtop/varnishtop.c: Update only - once per second. + * trunk/varnish-cache/bin/varnishtop/varnishtop.c: + Update only once per second. + 2006-07-19 19:48 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Make sure width and - precision arguments to printf %*.*s are ints. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Make sure width and precision arguments to printf %*.*s are ints. + 2006-07-19 19:47 phk - * trunk/varnish-cache/bin/varnishd/cache_session.c: Don't panic on - NULL srcaddr, but revisit later when we know the - details. Is it the Prefetcher ? + * trunk/varnish-cache/bin/varnishd/cache_session.c: + Don't panic on NULL srcaddr, but revisit later when we know the + details. Is it the Prefetcher ? + 2006-07-19 19:45 phk - * trunk/varnish-cache/bin/varnishd/cache_session.c: Delete the - right list item. + * trunk/varnish-cache/bin/varnishd/cache_session.c: + Delete the right list item. + 2006-07-19 19:45 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: Don't bother - determining if we should close if we already have done so. - Also: we may not have valid headers if cache_http.c threw a 400. + * trunk/varnish-cache/bin/varnishd/cache_center.c: + Don't bother determining if we should close if we already have done so. + Also: we may not have valid headers if cache_http.c threw a 400. + 2006-07-19 19:43 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Make sure hp->v - is NUL terminated. + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Make sure hp->v is NUL terminated. + 2006-07-19 12:37 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_session.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/hash_classic.c: Use miniobj.h - to catch pointer trouble + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c: + Use miniobj.h to catch pointer trouble + 2006-07-19 12:36 phk - * trunk/varnish-cache/include/miniobj.h: Add miniobj.h for - debugging + * trunk/varnish-cache/include/miniobj.h: + Add miniobj.h for debugging + 2006-07-19 11:53 phk - * trunk/varnish-cache/bin/varnishd/rfc2616.c: Avoid the Error path - for now. + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + Avoid the Error path for now. + 2006-07-19 11:11 phk - * trunk/varnish-cache/bin/varnishd/rfc2616.c: handle 302 for now. + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + handle 302 for now. + 2006-07-19 08:33 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c: Properly zero the - worker structure when we start a thread. + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + Properly zero the worker structure when we start a thread. + 2006-07-18 13:47 phk - * trunk/varnish-cache/bin/varnishd/cache_session.c: eliminate - debugging + * trunk/varnish-cache/bin/varnishd/cache_session.c: + eliminate debugging + 2006-07-18 13:19 phk - * trunk/varnish-cache/bin/varnishd/cache_expire.c: Delete binheap - root by it's index. - - Expect a refcount of one (the one holding the object in the hash) + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + Delete binheap root by it's index. + + Expect a refcount of one (the one holding the object in the hash) + 2006-07-18 13:18 phk - * trunk/varnish-cache/lib/libvarnish/binary_heap.c: Fix the Parent - calculation + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + Fix the Parent calculation + 2006-07-18 12:46 phk - * trunk/varnish-cache/lib/libvarnish/binary_heap.c: Set the index - of deleted elements to zero + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + Set the index of deleted elements to zero + 2006-07-18 12:40 phk - * trunk/varnish-cache/lib/libvarnish/binary_heap.c: Move the root - index from zero to one + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + Move the root index from zero to one + 2006-07-18 12:29 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Remove the - deref/unbusy stuff from FetchBody() it's done in central.c + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Remove the deref/unbusy stuff from FetchBody() it's done in central.c + 2006-07-18 12:28 phk - * trunk/varnish-cache/bin/varnishd/cache_hash.c: Assert that - object is busy when we call unbusy + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + Assert that object is busy when we call unbusy + 2006-07-18 12:27 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_http.c: Use a void * for - http_Read()'s buffer + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c: + Use a void * for http_Read()'s buffer + 2006-07-18 10:48 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c: Braino this time. + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + Braino this time. + 2006-07-18 10:45 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c: typo + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + typo + 2006-07-18 10:45 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c: Add http_Read() - which reads from a socket but soaks up any prefeched - tail first and use it all the places where this logic was - explicit - before. - - Fix Refcounting on objects when we insert/deliver + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + Add http_Read() which reads from a socket but soaks up any prefeched + tail first and use it all the places where this logic was explicit + before. + + Fix Refcounting on objects when we insert/deliver + 2006-07-18 10:32 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c: Use bigger - buffersizes for pass mode - - Terminate the sbuf with the reply headers properly. + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + Use bigger buffersizes for pass mode + + Terminate the sbuf with the reply headers properly. + 2006-07-18 09:02 phk - * 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: Retire the - http_GetReq(), http_GetURL() and http_GetProto() accessor - functions now that struct http is out of the closet. + * 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: + Retire the http_GetReq(), http_GetURL() and http_GetProto() accessor + functions now that struct http is out of the closet. + 2006-07-18 08:52 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: polish + * trunk/varnish-cache/bin/varnishd/cache_center.c: + polish + 2006-07-18 08:51 phk - * trunk/varnish-cache/bin/varnishd/cache_pipe.c: zero means 'all' - to http_GetTail() + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: + zero means 'all' to http_GetTail() + 2006-07-14 13:54 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: use space - to separate host and port in -b + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + use space to separate host and port in -b + 2006-07-14 13:52 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Use space to - separate host and port in backend spec. - - Polish usage message a bit. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Use space to separate host and port in backend spec. + + Polish usage message a bit. + 2006-07-14 13:33 phk - * 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_pool.c, - trunk/varnish-cache/bin/varnishd/steps.h: When during a lookup - we encounter a busy object, queue the session on - the objects waitinglist and disembark the worker thread so it - can do - something sensible in the mean time. - - This feature is unimportant in normal operation, but crucial to - resource management if a popular URL suddenly takes a long time - to - reply from the backend. - - Without this bit if semi-nasty code, we would tie up one worker - thread per client while waiting for the backend to come to it's - senses. + * 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_pool.c, + trunk/varnish-cache/bin/varnishd/steps.h: + When during a lookup we encounter a busy object, queue the session on + the objects waitinglist and disembark the worker thread so it can do + something sensible in the mean time. + + This feature is unimportant in normal operation, but crucial to + resource management if a popular URL suddenly takes a long time to + reply from the backend. + + Without this bit if semi-nasty code, we would tie up one worker + thread per client while waiting for the backend to come to it's + senses. + 2006-07-14 12:47 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_center.c: Have the - acceptor launch the session into STP_RECV + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_center.c: + Have the acceptor launch the session into STP_RECV + 2006-07-14 12:45 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Use the fact that - we have the worker thread in struct sess now. - - Move initial and final processing into cnt_recv() and cnt_done() + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Use the fact that we have the worker thread in struct sess now. + + Move initial and final processing into cnt_recv() and cnt_done() + 2006-07-14 12:30 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: Have the states - tell us if we are done yet with their return value, - so that we can implement disembarking the worker thread of the - object - is busy. + * trunk/varnish-cache/bin/varnishd/cache_center.c: + Have the states tell us if we are done yet with their return value, + so that we can implement disembarking the worker thread of the object + is busy. + 2006-07-14 12:22 phk - * trunk/varnish-cache/bin/varnishd/shmlog.c, - trunk/varnish-cache/include/shmlog.h: Put a starttime in shmem - so varnishstat can show average rates. + * trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/include/shmlog.h: + Put a starttime in shmem so varnishstat can show average rates. + 2006-07-14 12:12 phk - * trunk/varnish-cache/bin/varnishd/shmlog.c: Flexelint'ing, found - a spurious ';' + * trunk/varnish-cache/bin/varnishd/shmlog.c: + Flexelint'ing, found a spurious ';' + 2006-07-14 12:05 phk - * trunk/varnish-cache/bin/varnishd/shmlog.c, - trunk/varnish-cache/include/shmlog.h: More SHM creation polishing + * trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/include/shmlog.h: + More SHM creation polishing + 2006-07-14 11:44 phk - * trunk/varnish-cache/bin/varnishd/shmlog.c: Better and more - paranoid SHMEM creation logic + * trunk/varnish-cache/bin/varnishd/shmlog.c: + Better and more paranoid SHMEM creation logic + 2006-07-14 11:42 phk - * trunk/varnish-cache/bin/varnishd/cache_session.c: propset Id + * trunk/varnish-cache/bin/varnishd/cache_session.c: + propset Id + 2006-07-14 11:20 phk - * 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_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_session.c, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/stat_field.h: Change "client" to - "srcaddr", it's more descriptive. - - Add srcaddr management and start charging bytes to the srcaddr. + * 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_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_session.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: + Change "client" to "srcaddr", it's more descriptive. + + Add srcaddr management and start charging bytes to the srcaddr. + 2006-07-14 10:34 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/common.h, - trunk/varnish-cache/bin/varnishd/tcp.c: Rework the way we do - ascii representations of addresses + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/tcp.c: + Rework the way we do ascii representations of addresses + 2006-07-14 10:16 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - 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_main.c, - trunk/varnish-cache/bin/varnishd/cache_session.c: Move session - management to new file (cache_session, SES prefix) in - preparation of adding client tracking. - - Move the iovec's from the session to the worker and give the - session - a pointer to the worker so we can avoid passing it around as - argument. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + 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_main.c, + trunk/varnish-cache/bin/varnishd/cache_session.c: + Move session management to new file (cache_session, SES prefix) in + preparation of adding client tracking. + + Move the iovec's from the session to the worker and give the session + a pointer to the worker so we can avoid passing it around as argument. + 2006-07-12 23:30 phk - * trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/cli_event.c, - trunk/varnish-cache/bin/varnishd/flint.lnt, - trunk/varnish-cache/bin/varnishd/flint.sh, - trunk/varnish-cache/bin/varnishd/rfc2616.c, - trunk/varnish-cache/bin/varnishd/shmlog.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: More Flexelinting + * trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/flint.sh, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/shmlog.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + More Flexelinting + 2006-07-12 22:52 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_ban.c, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/flint.lnt, - trunk/varnish-cache/bin/varnishd/mgt_child.c: More flexelinting. - - No bugs so far. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/mgt_child.c: + More flexelinting. + + No bugs so far. + 2006-07-12 22:07 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c: Flexelint - harder. + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + Flexelint harder. + 2006-07-12 22:01 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/flint.lnt, - trunk/varnish-cache/bin/varnishd/varnishd.c: Give this file a - flexelinting + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Give this file a flexelinting + 2006-07-12 22:01 phk - * trunk/varnish-cache/bin/varnishd/cache.h: Improve the INCOMPL() - macro. + * trunk/varnish-cache/bin/varnishd/cache.h: + Improve the INCOMPL() macro. + 2006-07-12 20:21 phk - * trunk/varnish-cache/bin/varnishd/cache_vcl.c: More polishing. + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: + More polishing. + 2006-07-12 19:28 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c: Move sessmtx to - cache_vcl.c and call it vcl_mtx. - - Clean up naming for consistency while here. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + Move sessmtx to cache_vcl.c and call it vcl_mtx. + + Clean up naming for consistency while here. + 2006-07-12 15:07 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/stat_field.h: Implement - "insert_pass" mode where we cache that an entity must be passed. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: + Implement "insert_pass" mode where we cache that an entity must be passed. + 2006-07-12 14:13 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: Make Pass - possible from vcl_hit() + * trunk/varnish-cache/bin/varnishd/cache_center.c: + Make Pass possible from vcl_hit() + 2006-07-12 13:28 phk - * trunk/varnish-cache/bin/varnishd/cache_ban.c, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_response.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/common.h, - trunk/varnish-cache/bin/varnishd/hash_classic.c, - trunk/varnish-cache/bin/varnishd/hash_slinger.h, - trunk/varnish-cache/bin/varnishd/rfc2616.c, - trunk/varnish-cache/bin/varnishd/steps.h, - trunk/varnish-cache/bin/varnishd/stevedore.h, - trunk/varnish-cache/bin/varnishd/storage_file.c: Enable Id - keyword + * trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_response.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_slinger.h, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/steps.h, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c: + Enable Id keyword + 2006-07-12 13:28 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: First stab at - implementing pass in vcl_miss() + * trunk/varnish-cache/bin/varnishd/cache_center.c: + First stab at implementing pass in vcl_miss() + 2006-07-12 13:27 phk - * trunk/varnish-cache/bin/varnishd/cache_hash.c: Add explanation - for locking, some minor polishing. + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + Add explanation for locking, some minor polishing. + 2006-07-12 12:04 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/hash_classic.c, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c, - trunk/varnish-cache/bin/varnishd/hash_slinger.h: Hash on both - URL and Host header. If no host header, hash on URL twice. + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/hash_slinger.h: + Hash on both URL and Host header. If no host header, hash on URL twice. + 2006-07-12 11:48 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c: Make Pass work - again + * trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c: + Make Pass work again + 2006-07-12 11:45 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: Make pipe work - again + * trunk/varnish-cache/bin/varnishd/cache_center.c: + Make pipe work again + 2006-07-12 08:56 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c: Fix CLI - "config.load" + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + Fix CLI "config.load" + 2006-07-12 08:44 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Always - insert a backend when vcl is compiled. - - Respect '#' comments in script file. + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + Always insert a backend when vcl is compiled. + + Respect '#' comments in script file. + 2006-07-12 08:34 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/libvcl.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c: Teach the VCL - compiler about default functions, so that users will - not have to copy&paste the default methods if they have no - special - requirements for a particular method. - - No such facility exists for backends, so a backend description is - now the minumum VCL program. - - When we initialize the VCL compiler we hand it a piece of source - code - with the "default code", this must include definitions of all - methods - named with a "default_" prefix (ie: "default_vcl_recv" etc). - - During compilation we always compile this piece of source code - in (after - the user supplied VCL source). - - If the user did not provide a particular method, the default - method is - used instead. The user can also call the default method - directly, - for instance by: - - sub vcl_recv { - if (req.http.Expect) { - error; - } - call default_vcl_recv; - } - - Later on, this could be expanded to allow other subroutines to be - included in the default VCL for the users calling convenience. + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Teach the VCL compiler about default functions, so that users will + not have to copy&paste the default methods if they have no special + requirements for a particular method. + + No such facility exists for backends, so a backend description is + now the minumum VCL program. + + When we initialize the VCL compiler we hand it a piece of source code + with the "default code", this must include definitions of all methods + named with a "default_" prefix (ie: "default_vcl_recv" etc). + + During compilation we always compile this piece of source code in (after + the user supplied VCL source). + + If the user did not provide a particular method, the default method is + used instead. The user can also call the default method directly, + for instance by: + + sub vcl_recv { + if (req.http.Expect) { + error; + } + call default_vcl_recv; + } + + Later on, this could be expanded to allow other subroutines to be + included in the default VCL for the users calling convenience. + 2006-07-12 07:45 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Pause - after 'vcl' command + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + Pause after 'vcl' command + 2006-07-11 21:35 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: EOF - detection in libevent is buggy ?? Add exit cmd. - - Pause after cli until we see "OK" + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + EOF detection in libevent is buggy ?? Add exit cmd. + + Pause after cli until we see "OK" + 2006-07-11 21:30 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: add a req - command, various adjustments + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + add a req command, various adjustments + 2006-07-11 21:04 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Add - Pause() and Resume() to pace script execution + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + Add Pause() and Resume() to pace script execution + 2006-07-11 21:01 phk - * trunk/varnish-cache/bin/varnishd/cache_main.c: Add a printf when - cached is ready for the benefit of varnishtester + * trunk/varnish-cache/bin/varnishd/cache_main.c: + Add a printf when cached is ready for the benefit of varnishtester + 2006-07-11 20:49 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: open and - close commands + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + open and close commands + 2006-07-11 20:37 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: A vcl - keyword for loading a new config + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + A vcl keyword for loading a new config + 2006-07-11 19:29 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Add "cli" - to tell varnishd things + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + Add "cli" to tell varnishd things + 2006-07-11 19:16 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: If the - first char of the serve string is '!', close connection after - sending string. + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + If the first char of the serve string is '!', close connection after + sending string. + 2006-07-11 19:10 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Add a - server facility to act as backend for varnish + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + Add a server facility to act as backend for varnish + 2006-07-11 18:21 phk - * trunk/varnish-cache/bin/varnishtester/varnishtester.c: Minimal - ability to start and stop a varnishd + * trunk/varnish-cache/bin/varnishtester/varnishtester.c: + Minimal ability to start and stop a varnishd + 2006-07-11 18:16 phk - * trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Give 'exit' CLI - command some bite. we may want to be more careful - later on. + * trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Give 'exit' CLI command some bite. we may want to be more careful + later on. + 2006-07-11 17:53 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Unbuffer - stdout/stderr + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Unbuffer stdout/stderr + 2006-07-11 17:23 phk - * trunk/varnish-cache/bin/Makefile.am, - trunk/varnish-cache/bin/varnishtester, - trunk/varnish-cache/bin/varnishtester/Makefile.am, - trunk/varnish-cache/bin/varnishtester/varnishtester.c, - trunk/varnish-cache/configure.ac: Add stub varnishtester program + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishtester, + trunk/varnish-cache/bin/varnishtester/Makefile.am, + trunk/varnish-cache/bin/varnishtester/varnishtester.c, + trunk/varnish-cache/configure.ac: + Add stub varnishtester program + 2006-07-11 16:31 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Start the cache - process automatically, I've gotten tired of typing "start" :-) + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Start the cache process automatically, I've gotten tired of typing + "start" :-) + 2006-07-11 16:25 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Allow backend to be - specified as "host:port" to -b + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Allow backend to be specified as "host:port" to -b + 2006-07-11 16:17 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: add short - descriptive comments to each state + * trunk/varnish-cache/bin/varnishd/cache_center.c: + add short descriptive comments to each state + 2006-07-11 16:10 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c: Distribute code - from FetchSession almost correctly + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Distribute code from FetchSession almost correctly + 2006-07-11 16:03 phk - * trunk/varnish-cache/include/vcl_returns.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Add - "insert_pass" action in VCL + * trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + Add "insert_pass" action in VCL + 2006-07-11 15:54 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: Make things - work again by stuffing the old functions into the new - state engine. + * trunk/varnish-cache/bin/varnishd/cache_center.c: + Make things work again by stuffing the old functions into the new + state engine. + 2006-07-11 15:18 phk - * trunk/varnish-cache/bin/varnishd/cache_center.c: This commit - breaks warnish temporarily: - - Insert the new master state engine. - - A dot(1) graph is embedded in the source code and can be - extracted - with: - - sed -n '/^DOT/s///p' cache_center.c | dot -Tps > /tmp/_.ps + * trunk/varnish-cache/bin/varnishd/cache_center.c: + This commit breaks warnish temporarily: + + Insert the new master state engine. + + A dot(1) graph is embedded in the source code and can be extracted + with: + + sed -n '/^DOT/s///p' cache_center.c | dot -Tps > /tmp/_.ps + 2006-07-11 13:31 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/steps.h: Add enum for major - procesing steps + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/steps.h: + Add enum for major procesing steps + 2006-07-11 12:31 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_center.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Start - centralizing the flow of requests through varnish so we get - one source file with the highest level of policy. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_center.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Start centralizing the flow of requests through varnish so we get + one source file with the highest level of policy. + 2006-07-11 12:30 phk - * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Make -b and -c - less nonsensical when not specified + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Make -b and -c less nonsensical when not specified + 2006-07-11 12:00 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Pipe requests which - come with an Expect header. - - XXX: document that - error 417 "expectation failed" - might be a more sensible policy. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Pipe requests which come with an Expect header. + + XXX: document that + error 417 "expectation failed" + might be a more sensible policy. + 2006-07-11 11:41 des - * trunk/varnish-cache/bin/varnishlog/varnishlog.1: Document -b and - -c, and bump date. + * trunk/varnish-cache/bin/varnishlog/varnishlog.1: + Document -b and -c, and bump date. + 2006-07-11 11:36 phk - * trunk/varnish-cache/include/varnishapi.h, - trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Add -b[ackend] - and -c[lient] generic options to logtailers + * trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Add -b[ackend] and -c[lient] generic options to logtailers + 2006-07-11 07:38 phk - * trunk/varnish-cache/bin/varnishd/cache_response.c: Add 500 - messages. + * trunk/varnish-cache/bin/varnishd/cache_response.c: + Add 500 messages. + 2006-07-11 07:30 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/include/stat_field.h: Split http_Dissect() - into http_DissectRequest() and http_DissectResponse() + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: + Split http_Dissect() into http_DissectRequest() and http_DissectResponse() + 2006-07-11 06:30 des - * trunk/varnish-cache/bin/varnishd/varnishd.1: Add - cross-references and a commented-out STANDARDS section. + * trunk/varnish-cache/bin/varnishd/varnishd.1: + Add cross-references and a commented-out STANDARDS section. + 2006-07-11 06:28 des - * trunk/varnish-cache/include/shmlog_tags.h: Add a note to update - varnishlog(1) whenever this list changes. + * trunk/varnish-cache/include/shmlog_tags.h: + Add a note to update varnishlog(1) whenever this list changes. + 2006-07-11 06:27 des - * trunk/varnish-cache/bin/varnishstat/varnishstat.1: Add - cross-references. + * trunk/varnish-cache/bin/varnishstat/varnishstat.1: + Add cross-references. + 2006-07-11 06:26 des - * trunk/varnish-cache/bin/varnishlog/varnishlog.1: Document the - -C, -I, -X, -i, -x options. - Add a list of log entry tags. - Add cross-references to varnishd(1) and varnishstat(1). + * trunk/varnish-cache/bin/varnishlog/varnishlog.1: + Document the -C, -I, -X, -i, -x options. + Add a list of log entry tags. + Add cross-references to varnishd(1) and varnishstat(1). + 2006-07-10 21:54 phk - * trunk/varnish-cache/bin/Makefile.am, - trunk/varnish-cache/bin/varnishtop, - trunk/varnish-cache/bin/varnishtop/Makefile.am, - trunk/varnish-cache/bin/varnishtop/varnishtop.c, - trunk/varnish-cache/configure.ac: Add varnishtop log-tailer. - - - Try these: - - varnishtop -i url - - varhishtop -i header -C -I '^user-agent:' - - varhishtop -i header -C -I '^user-agent:' -X MSIE - - varhishtop -i header -C -I '^user-agent:.*MSIE' - - varhishtop -i header -C -I '^user-agent:.*java' - - You can also run them on the logfiles from the live test: - - zcat _vlog21.gz | varnishtop -r - -i header ... - - + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishtop, + trunk/varnish-cache/bin/varnishtop/Makefile.am, + trunk/varnish-cache/bin/varnishtop/varnishtop.c, + trunk/varnish-cache/configure.ac: + Add varnishtop log-tailer. + + + Try these: + + varnishtop -i url + + varhishtop -i header -C -I '^user-agent:' + + varhishtop -i header -C -I '^user-agent:' -X MSIE + + varhishtop -i header -C -I '^user-agent:.*MSIE' + + varhishtop -i header -C -I '^user-agent:.*java' + + You can also run them on the logfiles from the live test: + + zcat _vlog21.gz | varnishtop -r - -i header ... + + + 2006-07-10 21:49 phk - * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Fix so that both - -I and -X can be specified + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Fix so that both -I and -X can be specified + 2006-07-10 20:49 phk - * trunk/varnish-cache/include/varnishapi.h, - trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Implement -C, -I - and -X generic options + * trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Implement -C, -I and -X generic options + 2006-07-10 20:27 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/include/varnishapi.h, - trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Add tag names - array to libvarnishapi, everybody is going to need it. - - Implement -i tag[,tag ...] and -x tag[,tag ...] generic - arguments. + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Add tag names array to libvarnishapi, everybody is going to need it. + + Implement -i tag[,tag ...] and -x tag[,tag ...] generic arguments. + 2006-07-10 19:54 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/bin/varnishstat/varnishstat.c, - trunk/varnish-cache/include/varnishapi.h, - trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Improve - libvarnishapi interface to shared memory: - - Add function VSL_OpenStats() which directly returns a pointer - to the varnish_stats structure. - - Add opaque VSL_data structure as handle to the log-tailer - functions. - - Add generic argument parsing function for all log-tailers. - - Add support for generic "-r " option. + * trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Improve libvarnishapi interface to shared memory: + + Add function VSL_OpenStats() which directly returns a pointer + to the varnish_stats structure. + + Add opaque VSL_data structure as handle to the log-tailer functions. + + Add generic argument parsing function for all log-tailers. + + Add support for generic "-r " option. + 2006-07-10 15:02 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/include/stat_field.h: More statistics about - worker threads. + * trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: + More statistics about worker threads. + 2006-07-10 14:52 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/stat_field.h: Rewrite the worker - thread pool code. - - Assign prefix WRK to the worker pool. - - Introduce a struct workreq since the prefetcher (when it - happens) will - not have a session to pass in. - - The worker threads get a cond_var each and are hung from a list - in - most recently used order. - - When a request is queued and the worker thread list is not empty, - tickle the cond_var of the first one. - - If no threads were availble the max number of threads is not - reached, - try to start another worker thread. - - If the max was reached or the start filed (likely due to out of - memory) - indicate overflow and let the existing pool deal with it. - - Create only the minimum requested number of threads initially. - - Allow specification of the timeout before a dynamic worker - thread commits - suicide to be specified with -w. - - Default parameters are -w1,UINT_MAX,10 {min, max, timeout} + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/stat_field.h: + Rewrite the worker thread pool code. + + Assign prefix WRK to the worker pool. + + Introduce a struct workreq since the prefetcher (when it happens) will + not have a session to pass in. + + The worker threads get a cond_var each and are hung from a list in + most recently used order. + + When a request is queued and the worker thread list is not empty, + tickle the cond_var of the first one. + + If no threads were availble the max number of threads is not reached, + try to start another worker thread. + + If the max was reached or the start filed (likely due to out of memory) + indicate overflow and let the existing pool deal with it. + + Create only the minimum requested number of threads initially. + + Allow specification of the timeout before a dynamic worker thread commits + suicide to be specified with -w. + + Default parameters are -w1,UINT_MAX,10 {min, max, timeout} + 2006-07-10 13:59 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: use explicit - eventbase. + * trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + use explicit eventbase. + 2006-07-10 13:58 phk - * trunk/varnish-cache/contrib/libevent/event.c: Don't ever set - current_base in our version of libevent in order to flush - out any bugs it might cause. + * trunk/varnish-cache/contrib/libevent/event.c: + Don't ever set current_base in our version of libevent in order to flush + out any bugs it might cause. + 2006-07-10 13:48 phk - * trunk/varnish-cache/bin/varnishd/shmlog.c: Dump errno and - strerror in assert + * trunk/varnish-cache/bin/varnishd/shmlog.c: + Dump errno and strerror in assert + 2006-07-10 12:00 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c: Rework the - "connect to backend logic". - - Avoid calling getaddrinfo() for every connect by catching the - result - in the backend structure. - - Minimize number of socket/connect calls by caching the last good - address in the backend structure. - - If all addresses in the cached getaddrinfo() result fails, call - getaddrinfo() again (to catch DNS changes) and try the list - again. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c: + Rework the "connect to backend logic". + + Avoid calling getaddrinfo() for every connect by catching the result + in the backend structure. + + Minimize number of socket/connect calls by caching the last good + address in the backend structure. + + If all addresses in the cached getaddrinfo() result fails, call + getaddrinfo() again (to catch DNS changes) and try the list again. + 2006-07-10 11:24 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/common.h, - trunk/varnish-cache/bin/varnishd/tcp.c: Move sockaddr->ascii - conversion to tcp.c - - shmlog both ends of backend connections. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/tcp.c: + Move sockaddr->ascii conversion to tcp.c + + shmlog both ends of backend connections. + 2006-07-10 10:56 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_shmlog.c, - trunk/varnish-cache/bin/varnishd/cache_shmlog.h, - trunk/varnish-cache/bin/varnishd/common.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/shmlog.c: Be more consistent. - - cache_shmlog.c contains stuff for both cache and mgt, so remove - the - cache_ prefix. - - Rename cache_shmlog.h to common.h and put joint stuff there. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.h, + trunk/varnish-cache/bin/varnishd/common.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/shmlog.c: + Be more consistent. + + cache_shmlog.c contains stuff for both cache and mgt, so remove the + cache_ prefix. + + Rename cache_shmlog.h to common.h and put joint stuff there. + 2006-07-10 10:31 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c: put backend - session linkage in shmemlog for pipe and pass + * trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + put backend session linkage in shmemlog for pipe and pass + 2006-07-10 10:06 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Polish HTTP - reception a little bit + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Polish HTTP reception a little bit + 2006-07-10 10:05 phk - * trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/varnishd.c: Drop the max length - of first line, it's too expensive to enforce. + * trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Drop the max length of first line, it's too expensive to enforce. + 2006-07-10 09:52 phk - * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Fix cosmetic - warning + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Fix cosmetic warning + 2006-07-10 09:51 phk - * trunk/varnish-cache/bin/varnishstat/varnishstat.c: Silence - cosmetic warning. + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + Silence cosmetic warning. + 2006-07-10 09:48 phk - * trunk/varnish-cache/lib/libvarnish/time.c, - trunk/varnish-cache/lib/libvcl/vcl_compile.c: Fix cosmetic - warnings + * trunk/varnish-cache/lib/libvarnish/time.c, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Fix cosmetic warnings + 2006-07-10 09:47 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_ban.c, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_shmlog.c, - trunk/varnish-cache/bin/varnishd/cache_shmlog.h, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/cli_event.c, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/tcp.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Fix a bunch - warnings, all cosmetic. - - I'm using __unused for now, if we need to use something different - we can do a find/replace. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.h, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Fix a bunch warnings, all cosmetic. + + I'm using __unused for now, if we need to use something different + we can do a find/replace. + 2006-07-10 09:28 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Silence some - warnings + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Silence some warnings + 2006-07-10 09:07 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/include/stat_field.h: Allocate struct http - as part of the session allocation. - - Remove http_New() and http_Delete() + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/include/stat_field.h: + Allocate struct http as part of the session allocation. + + Remove http_New() and http_Delete() + 2006-07-10 08:41 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/varnishd.c: Add - heritage.mem_http_headers which is the maximum number of headers - we recognize. - - Add http_Init() which initializes struct http given sufficient - space. - - Respect heritage mem_* values in http_New() (while we still have - it) - - Allocate backend connections (vbe_conn) with super allocation - with - space for http and workspace. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Add heritage.mem_http_headers which is the maximum number of headers + we recognize. + + Add http_Init() which initializes struct http given sufficient space. + + Respect heritage mem_* values in http_New() (while we still have it) + + Allocate backend connections (vbe_conn) with super allocation with + space for http and workspace. + 2006-07-10 08:10 phk - * trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/varnishd.c: Put three memory - allocation hints into heritage: - - mem_http_1_line (512) - Maximum length of the reqeust/response line of a HTTP message - There is no point in filling the entire buffer with junk if - we get a preposterously long first line. - mem_http_header (4096) - Maximum length of entire HTTP header. If we overflow this - we return 400. - mem_workspace (currently 0) - In the future this will be the space we use for constructing - headers to send and edits done from VCL. + * trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Put three memory allocation hints into heritage: + + mem_http_1_line (512) + Maximum length of the reqeust/response line of a HTTP message + There is no point in filling the entire buffer with junk if + we get a preposterously long first line. + mem_http_header (4096) + Maximum length of entire HTTP header. If we overflow this + we return 400. + mem_workspace (currently 0) + In the future this will be the space we use for constructing + headers to send and edits done from VCL. + 2006-07-10 07:54 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c: Take the vbe_conn - (backend connection) structure out of the closet. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + Take the vbe_conn (backend connection) structure out of the closet. + 2006-07-10 07:07 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Turn a comment - into english + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Turn a comment into english + 2006-07-10 07:04 phk - * trunk/varnish-cache/bin/varnishd/cache.h: More sensible order of - pointers + * trunk/varnish-cache/bin/varnishd/cache.h: + More sensible order of pointers + 2006-07-09 21:21 phk - * trunk/varnish-cache/include/http_headers.h: Don't pass - cache-control through. + * trunk/varnish-cache/include/http_headers.h: + Don't pass cache-control through. + 2006-07-09 21:01 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Add a -h opt - which modifies -o to remove "trivial" entries. - - Trivial are - {GET,HEAD} which gets a hit and returns 200 - {GET,HEAD} which gets a miss, fetches, inserts and returns 200 + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Add a -h opt which modifies -o to remove "trivial" entries. + + Trivial are + {GET,HEAD} which gets a hit and returns 200 + {GET,HEAD} which gets a miss, fetches, inserts and returns 200 + 2006-07-09 09:16 des - * trunk/varnish-cache/configure.ac: Don't use braces where they - aren't needed. - Let automake know about config.h. - Bump version number to mark that we have passed the first live - test. + * trunk/varnish-cache/configure.ac: + Don't use braces where they aren't needed. + Let automake know about config.h. + Bump version number to mark that we have passed the first live test. + 2006-07-09 07:13 des - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/lib/libvcl/Makefile.am: List header files so - they are included in the distribution tarball. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/lib/libvcl/Makefile.am: + List header files so they are included in the distribution tarball. + 2006-07-09 06:35 des - * trunk/varnish-cache/configure.ac: Use the modern version of - AM_INIT_AUTOMAKE, allowing automake to deduce the - correct distribution name. + * trunk/varnish-cache/configure.ac: + Use the modern version of AM_INIT_AUTOMAKE, allowing automake to deduce the + correct distribution name. + 2006-07-08 20:29 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_shmlog.c: A few edits for - FlexeLint + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + A few edits for FlexeLint + 2006-07-08 20:19 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_ban.c, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_shmlog.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/hash_classic.c, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c, - trunk/varnish-cache/bin/varnishd/rfc2616.c, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/storage_malloc.c: Sanitize - #includes a bit in the cache process by moving fundamental - #includes to cache.h + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + Sanitize #includes a bit in the cache process by moving fundamental + #includes to cache.h + 2006-07-08 20:18 phk - * trunk/varnish-cache/bin/varnishd/flint.lnt: Silence a bogus - warning + * trunk/varnish-cache/bin/varnishd/flint.lnt: + Silence a bogus warning + 2006-07-08 19:54 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_http.c: 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 + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c: + 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 + 2006-07-08 19:46 des - * trunk/varnish-cache/configure.ac: Add --enable-debugging-symbols - which enables debugging sysmbols and disables - inlining and builtins. + * trunk/varnish-cache/configure.ac: + Add --enable-debugging-symbols which enables debugging sysmbols and + disables + inlining and builtins. + 2006-07-08 19:27 des - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Fix "set - backend.port". + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Fix "set backend.port". + 2006-07-08 19:25 des - * trunk/varnish-cache/autogen.des: My version. + * trunk/varnish-cache/autogen.des: + My version. + 2006-07-08 19:25 des - * trunk/varnish-cache/autogen.phk: Expand keywords. + * trunk/varnish-cache/autogen.phk: + Expand keywords. + 2006-07-07 08:40 phk - * trunk/varnish-cache/bin/varnishd/cache_pipe.c: Close gracefully - in pipe mode + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: + Close gracefully in pipe mode + 2006-07-07 07:48 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Set SO_LINGER - to zero + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Set SO_LINGER to zero + 2006-07-07 07:25 phk - * trunk/varnish-cache/bin/varnishd/tcp.c: Tell why bind(2) fails + * trunk/varnish-cache/bin/varnishd/tcp.c: + Tell why bind(2) fails + 2006-07-07 07:22 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Pipe anything - different from HEAD & GET + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Pipe anything different from HEAD & GET + 2006-07-07 07:22 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Don't filter - headers in Pipe mode + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Don't filter headers in Pipe mode + 2006-07-07 07:22 phk - * trunk/varnish-cache/bin/varnishd/cache_pipe.c: Fix pipe mode + * trunk/varnish-cache/bin/varnishd/cache_pipe.c: + Fix pipe mode + 2006-07-07 07:22 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Remove - debugging printf + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Remove debugging printf + 2006-07-07 07:15 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Time idle TCP - connections out after 30 seconds + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Time idle TCP connections out after 30 seconds + 2006-07-07 06:29 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Dump our buffer - as Debug if we have HTTP header trouble. - - Issue 400 for HTTP header buffer overflow. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Dump our buffer as Debug if we have HTTP header trouble. + + Issue 400 for HTTP header buffer overflow. + 2006-07-07 06:27 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Strvis(3) debug - data. + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Strvis(3) debug data. + 2006-07-06 22:33 phk - * trunk/varnish-cache/include/http_headers.h: Filter out - Content-Range headers. + * trunk/varnish-cache/include/http_headers.h: + Filter out Content-Range headers. + 2006-07-06 21:57 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Always log - the numeric code as "Status" + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Always log the numeric code as "Status" + 2006-07-06 21:57 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c: Log the found - objects XID when we have a hash-hit. + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + Log the found objects XID when we have a hash-hit. + 2006-07-06 21:56 phk - * trunk/varnish-cache/include/shmlog_tags.h: Add shmem tag for Hits + * trunk/varnish-cache/include/shmlog_tags.h: + Add shmem tag for Hits + 2006-07-06 21:47 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_response.c: Refuse all - requests without a protocol field with a 400 - - Implement a function to say "400" with. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_response.c: + Refuse all requests without a protocol field with a 400 + + Implement a function to say "400" with. + 2006-07-06 21:04 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_response.c: Add - cache_response for yelling at clients + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_response.c: + Add cache_response for yelling at clients + 2006-07-06 21:03 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Also flush - ordered after the long timeout. + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Also flush ordered after the long timeout. + 2006-07-06 21:00 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Strengthen HTTP - parsing + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Strengthen HTTP parsing + 2006-07-06 20:29 phk - * trunk/varnish-cache/bin/varnishd/cache_expire.c: Make sure the - grim reaper doesn't touch busy objects either. + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + Make sure the grim reaper doesn't touch busy objects either. + 2006-07-06 20:26 phk - * trunk/varnish-cache/bin/varnishd/cache_expire.c: The grim reaper - needs to wait for objects refcount to drop to zero. + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + The grim reaper needs to wait for objects refcount to drop to zero. + 2006-07-06 20:23 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Improvements to - flush things at timeout and at the end etc. + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Improvements to flush things at timeout and at the end etc. + 2006-07-06 13:40 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Silence typical - broken client connection messages and move the - interesting ones to shmem + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Silence typical broken client connection messages and move the + interesting ones to shmem + 2006-07-06 13:33 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c: Fix braino in - Pass handling + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + Fix braino in Pass handling + 2006-07-06 13:27 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Skip space before - request/response + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Skip space before request/response + 2006-07-06 13:02 des - * trunk/varnish-cache/bin/varnishstat/Makefile.am, - trunk/varnish-cache/bin/varnishstat/varnishstat.1: Add a - rudimentary man page. + * trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.1: + Add a rudimentary man page. + 2006-07-06 11:18 phk - * trunk/varnish-cache/autogen.phk: My version. + * trunk/varnish-cache/autogen.phk: + My version. + 2006-07-06 10:18 phk - * trunk/varnish-cache/bin/varnishstat/varnishstat.c: Add - exponential hitrate displays (with -c) + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + Add exponential hitrate displays (with -c) + 2006-07-06 09:31 des - * trunk/varnish-cache/bin/varnishlog/Makefile.am, - trunk/varnish-cache/bin/varnishlog/varnishlog.1: Add a - rudimentary man page. + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.1: + Add a rudimentary man page. + 2006-07-06 09:31 des - * trunk/varnish-cache/bin/varnishd/varnishd.1: Expand keywords + * trunk/varnish-cache/bin/varnishd/varnishd.1: + Expand keywords + 2006-07-06 09:13 des - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/varnishd.1: Add a rudimentary - man page. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/varnishd.1: + Add a rudimentary man page. + 2006-07-06 09:08 phk - * trunk/varnish-cache/bin/varnishd/tcp.c: Only complain if - accept_filters fail + * trunk/varnish-cache/bin/varnishd/tcp.c: + Only complain if accept_filters fail + 2006-07-06 09:06 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Remove debugging - code. + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Remove debugging code. + 2006-07-06 09:00 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Add -r file and - -w file options. - - These read/write from/to a binary file. + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Add -r file and -w file options. + + These read/write from/to a binary file. + 2006-07-06 08:45 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Increas shmem size - to 8M + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Increas shmem size to 8M + 2006-07-06 08:45 phk - * trunk/varnish-cache/bin/varnishd/tcp.c: Add accept filters + * trunk/varnish-cache/bin/varnishd/tcp.c: + Add accept filters + 2006-07-06 08:43 des - * trunk/varnish-cache/bin/varnishd/cache_shmlog.c, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Portability: - don't use non-portable mmap(2) flags. + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Portability: don't use non-portable mmap(2) flags. + 2006-07-06 08:43 des - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Portability: - Linux does not have SO_NOSIGPIPE. + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Portability: Linux does not have SO_NOSIGPIPE. + 2006-07-06 08:41 des - * trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/lib/libvarnish/argv.c: Portability: cast - unused parameters to void instead of marking them __unused. + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvarnish/argv.c: + Portability: cast unused parameters to void instead of marking them + __unused. + 2006-07-06 08:32 phk - * trunk/varnish-cache/bin/varnishd/rfc2616.c: 404 handling + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + 404 handling + 2006-07-06 08:07 des - * trunk/varnish-cache/bin/varnishd/cache_backend.c: Use - instead of to get both the prototype - for - ioctl(2) and the definition of FIONREAD. + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + Use instead of to get both the prototype for + ioctl(2) and the definition of FIONREAD. + 2006-07-05 14:40 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Fix off by one + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Fix off by one + 2006-07-05 14:40 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: printf format + * trunk/varnish-cache/bin/varnishd/storage_file.c: + printf format + 2006-07-05 13:54 phk - * trunk/varnish-cache/bin/varnishstat/varnishstat.c: Calculate - rate as signed. + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + Calculate rate as signed. + 2006-07-05 13:44 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Assert non-null - first + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Assert non-null first + 2006-07-05 13:19 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Send - "Connection: close" if not HTTP/1.1 + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Send "Connection: close" if not HTTP/1.1 + 2006-07-05 13:13 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/include/stat_field.h: Add more stats + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/include/stat_field.h: + Add more stats + 2006-07-05 13:09 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Some asserts to - guard against trouble. + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Some asserts to guard against trouble. + 2006-07-05 12:17 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Another pipeline - fix: don't clobber a pipelined partial header + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Another pipeline fix: don't clobber a pipelined partial header + 2006-07-05 11:42 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Don't lead http - header + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Don't lead http header + 2006-07-05 11:09 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Free the - session memory correctly + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Free the session memory correctly + 2006-07-05 10:59 phk - * trunk/varnish-cache/bin/varnishd/cache_hash.c: Free the right - header. + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + Free the right header. + 2006-07-05 10:55 phk - * trunk/varnish-cache/bin/varnishd/cache_hash.c: Don't leak - objects headers + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + Don't leak objects headers + 2006-07-05 10:01 phk - * trunk/varnish-cache/include/http_headers.h: Suppress - Accept-Ranges for now. + * trunk/varnish-cache/include/http_headers.h: + Suppress Accept-Ranges for now. + 2006-07-05 09:59 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Create an - X-Varnish header and put the XID there. + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Create an X-Varnish header and put the XID there. + 2006-07-05 09:56 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/stevedore.h, - trunk/varnish-cache/bin/varnishd/storage_file.c: Send headers - with sendfile + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c: + Send headers with sendfile + 2006-07-05 09:44 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/rfc2616.c: Add Age and Via - header to responses. - - Change arguments to vca_write_obj() (It should really be - "send_repsonse()" ?) - Store received age and time entered into cache in object. - Generate Age: and Via: headers as part of response. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + Add Age and Via header to responses. + + Change arguments to vca_write_obj() (It should really be + "send_repsonse()" ?) + Store received age and time entered into cache in object. + Generate Age: and Via: headers as part of response. + 2006-07-05 09:32 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Unify logging in - the response handling + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Unify logging in the response handling + 2006-07-05 09:11 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c: log responsecode - and length + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + log responsecode and length + 2006-07-05 09:10 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/rfc2616.c: Log reponse code and - object length + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + Log reponse code and object length + 2006-07-05 09:08 phk - * trunk/varnish-cache/include/shmlog_tags.h: Add Length tag + * trunk/varnish-cache/include/shmlog_tags.h: + Add Length tag + 2006-07-05 08:08 phk - * trunk/varnish-cache/bin/varnishstat/varnishstat.c: Show also - rate in curses display + * trunk/varnish-cache/bin/varnishstat/varnishstat.c: + Show also rate in curses display + 2006-07-05 07:45 phk - * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: Be more - conservative about wraparound and take them up front in all - cases. + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + Be more conservative about wraparound and take them up front in all cases. + 2006-07-04 22:08 phk - * trunk/varnish-cache/bin/varnishd/rfc2616.c: Implement our TTL - calculation. - - A first quick check against the weird timestamps from the VG - frontend - squids indicates sensible behaviour. + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + Implement our TTL calculation. + + A first quick check against the weird timestamps from the VG frontend + squids indicates sensible behaviour. + 2006-07-04 21:34 phk - * trunk/varnish-cache/bin/varnishd/rfc2616.c: Long comment - describing how TTL calculation will be done. - - Review encouraged. + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + Long comment describing how TTL calculation will be done. + + Review encouraged. + 2006-07-04 20:00 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_shmlog.c: Fix HEAD - requests: - - Make modes to http_BuildSbuf descriptive enums. - Send GET to backend also for HEAD requests. - Don't return body for HEAD requests. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + Fix HEAD requests: + + Make modes to http_BuildSbuf descriptive enums. + Send GET to backend also for HEAD requests. + Don't return body for HEAD requests. + 2006-07-04 19:36 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Fix pipelining. - - A braino in http_Dissect() resulted in an off-by-one error - (protected with assert now) - - Move any remaning bytes in buffer to front and check for - a complete header before arming the eventloop on the - session. + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Fix pipelining. + + A braino in http_Dissect() resulted in an off-by-one error + (protected with assert now) + + Move any remaning bytes in buffer to front and check for + a complete header before arming the eventloop on the + session. + 2006-07-04 14:45 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Make room for - protective terminating NUL + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Make room for protective terminating NUL + 2006-07-04 14:19 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c: retry backend - open, log diagnostics + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + retry backend open, log diagnostics + 2006-07-04 14:18 phk - * trunk/varnish-cache/bin/varnishd/cache_main.c: load VCL earlier + * trunk/varnish-cache/bin/varnishd/cache_main.c: + load VCL earlier + 2006-07-04 14:18 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Lock with a - mutex + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Lock with a mutex + 2006-07-04 13:45 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Shorter sleeps: - 1s -> 50msec + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Shorter sleeps: 1s -> 50msec + 2006-07-04 13:44 phk - * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: Fix off by one - error during wraparound. + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + Fix off by one error during wraparound. + 2006-07-04 09:28 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Close non - HTTP/1.1 request connections + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Close non HTTP/1.1 request connections + 2006-07-04 09:21 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Add missing '%' + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Add missing '%' + 2006-07-03 19:45 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: My workaround - for the missing OFF_T_MAX definition was not safe, - use a hardcoded "1<<30" which is. + * trunk/varnish-cache/bin/varnishd/storage_file.c: + My workaround for the missing OFF_T_MAX definition was not safe, + use a hardcoded "1<<30" which is. + 2006-07-03 19:35 phk - * trunk/varnish-cache/contrib/libevent/event.c: I have grumbled - about the evilness of "current_base" before, and this just - proves the point: If two threads call event_init() at the same - time, - they will both stomp on the same memory via current_base, and in - all - likelyhood, neither of them will manage to get the job done - properly. - - Instead work on a local variable and don't assign to current_base - until the setup is complete. - - This should be submitted to Niels Provos + * trunk/varnish-cache/contrib/libevent/event.c: + I have grumbled about the evilness of "current_base" before, and this just + proves the point: If two threads call event_init() at the same time, + they will both stomp on the same memory via current_base, and in all + likelyhood, neither of them will manage to get the job done properly. + + Instead work on a local variable and don't assign to current_base + until the setup is complete. + + This should be submitted to Niels Provos + 2006-07-03 18:35 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Handle IPv6 - address -> string conversion too + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Handle IPv6 address -> string conversion too + 2006-07-03 18:03 phk - * trunk/varnish-cache/bin/varnishd/cache_expire.c: Close race - condition + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + Close race condition + 2006-07-03 17:59 phk - * trunk/varnish-cache/bin/varnishd/hash_classic.c: Better arg - checking + * trunk/varnish-cache/bin/varnishd/hash_classic.c: + Better arg checking + 2006-07-03 15:01 phk - * trunk/varnish-cache/lib/libvarnish/binary_heap.c: more asserts + * trunk/varnish-cache/lib/libvarnish/binary_heap.c: + more asserts + 2006-07-03 14:39 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c: avoid const - poison + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + avoid const poison + 2006-07-03 14:39 phk - * trunk/varnish-cache/bin/varnishd/cache_ban.c: Include pthread.h + * trunk/varnish-cache/bin/varnishd/cache_ban.c: + Include pthread.h + 2006-07-03 14:37 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/storage_malloc.c: - s/unsigned/size_t/ + * trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + s/unsigned/size_t/ + 2006-07-03 14:36 phk - * trunk/varnish-cache/bin/varnishd/hash_simple_list.c: - s/init/start/ + * trunk/varnish-cache/bin/varnishd/hash_simple_list.c: + s/init/start/ + 2006-07-03 12:41 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/hash_classic.c, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c, - trunk/varnish-cache/bin/varnishd/hash_slinger.h, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/rfc2616.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Add another - hash-method with better real-world survival chances: A classic - bucketed hash table of lists. Hash is MD5. Number of buckets - and number - of mutexes can be configured at command line. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_classic.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/hash_slinger.h, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Add another hash-method with better real-world survival chances: A classic + bucketed hash table of lists. Hash is MD5. Number of buckets and number + of mutexes can be configured at command line. + 2006-07-03 08:30 des - * trunk/varnish-cache/configure.ac: Replace --enable-wall and - --enable-pedantic with --enable-developer-warnings, - which is roughly equivalent to FreeBSD's WARNS level 5 or 6. + * trunk/varnish-cache/configure.ac: + Replace --enable-wall and --enable-pedantic with + --enable-developer-warnings, + which is roughly equivalent to FreeBSD's WARNS level 5 or 6. + 2006-07-01 05:44 phk - * trunk/varnish-cache/include/http_headers.h: Mark more headers as - not end-to-end + * trunk/varnish-cache/include/http_headers.h: + Mark more headers as not end-to-end + 2006-06-30 20:22 phk - * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: Forgot to add - shmlog.c (reminded by des@) + * trunk/varnish-cache/lib/libvarnishapi/shmlog.c: + Forgot to add shmlog.c (reminded by des@) + 2006-06-30 20:21 phk - * trunk/varnish-cache/include/queue.h: Add TAILQ_FOREACH_SAFE() + * trunk/varnish-cache/include/queue.h: + Add TAILQ_FOREACH_SAFE() + 2006-06-30 20:17 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/rfc2616.c: move all policy to - rfc2616.c + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + move all policy to rfc2616.c + 2006-06-30 13:44 des - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/storage_malloc.c, - trunk/varnish-cache/include/stats.h: Consistently use our own - copy of queue.h. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c, + trunk/varnish-cache/include/stats.h: + Consistently use our own copy of queue.h. + 2006-06-30 11:20 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Fix object - length double accounting in chunked fetch + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Fix object length double accounting in chunked fetch + 2006-06-30 09:14 phk - * trunk/varnish-cache/bin/varnishd/cache_vcl.c: Delete compiled - VCL file after we tried to load it. + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: + Delete compiled VCL file after we tried to load it. + 2006-06-29 19:19 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/include/shmlog_tags.h: Log objects banned to - shmlog + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/include/shmlog_tags.h: + Log objects banned to shmlog + 2006-06-29 19:06 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_expire.c: Track objects - heap-position + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c: + Track objects heap-position + 2006-06-29 17:09 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_ban.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_main.c: Add the ability - to instantly ban/purge all cached objects matching - a given regexp. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_ban.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_main.c: + Add the ability to instantly ban/purge all cached objects matching + a given regexp. + 2006-06-29 15:14 phk - * trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/include/shmlog_tags.h: Improve shm-logging - of VCL activity + * trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h: + Improve shm-logging of VCL activity + 2006-06-29 14:37 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/include/shmlog_tags.h: Tag objects with - their origin session xid and log it when we clean up. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/include/shmlog_tags.h: + Tag objects with their origin session xid and log it when we clean up. + 2006-06-29 13:04 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/include/shmlog_tags.h: Add a unique - transaction-ID to each request, and register it in the - shmlog so we can match backend transactions with client - transactions. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/shmlog_tags.h: + Add a unique transaction-ID to each request, and register it in the + shmlog so we can match backend transactions with client transactions. + 2006-06-28 21:38 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Convince - flexelint that we know what we do with some asserts + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Convince flexelint that we know what we do with some asserts + 2006-06-28 21:33 phk - * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: Put a mutex - around the shmlog writes, I've seen my first race. + * trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + Put a mutex around the shmlog writes, I've seen my first race. + 2006-06-28 21:18 phk - * trunk/varnish-cache/bin/varnishlog/Makefile.am, - trunk/varnish-cache/bin/varnishlog/varnishlog.c: Add a -o - argument which sorts the log into transactions before output, - this is a fair bit easier to chew through than the raw log (the - default) + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Add a -o argument which sorts the log into transactions before output, + this is a fair bit easier to chew through than the raw log (the default) + 2006-06-28 21:03 phk - * trunk/varnish-cache/bin/varnishstat/Makefile.am, - trunk/varnish-cache/bin/varnishstat/varnishstat.c: Use shmlog - api from libvarnishapi + * trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c: + Use shmlog api from libvarnishapi + 2006-06-28 20:58 phk - * trunk/varnish-cache/bin/varnishlog/Makefile.am, - trunk/varnish-cache/bin/varnishlog/varnishlog.c: Use SHMLOG api - in libvarnishapi + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Use SHMLOG api in libvarnishapi + 2006-06-28 20:58 phk - * trunk/varnish-cache/include/varnishapi.h, - trunk/varnish-cache/lib/libvarnishapi/Makefile.am: Add SHMLOG - opening and walking functions to libvarnishapi + * trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am: + Add SHMLOG opening and walking functions to libvarnishapi + 2006-06-28 17:46 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Be more - consistent about which headers we send back. - - Start 5 threads in the worker pool. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Be more consistent about which headers we send back. + + Start 5 threads in the worker pool. + 2006-06-28 16:59 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Construct our - own Content-length header, no matter which of the - three (straight, chunked, eof) modes we used to fetch the object. + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Construct our own Content-length header, no matter which of the + three (straight, chunked, eof) modes we used to fetch the object. + 2006-06-28 16:58 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Don't finish the - sbuf in mode 3 + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Don't finish the sbuf in mode 3 + 2006-06-28 16:57 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Assert that - the lengths of the storage for the object add up. + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Assert that the lengths of the storage for the object add up. + 2006-06-28 16:57 phk - * trunk/varnish-cache/include/http_headers.h: Don't pass - Content-Lenght through, we build it ourselves + * trunk/varnish-cache/include/http_headers.h: + Don't pass Content-Lenght through, we build it ourselves + 2006-06-28 16:20 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c: Pass fd to - shmemlog + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + Pass fd to shmemlog + 2006-06-28 16:19 phk - * trunk/varnish-cache/include/shmlog_tags.h: add tag for generated - headers + * trunk/varnish-cache/include/shmlog_tags.h: + add tag for generated headers + 2006-06-28 16:19 phk - * trunk/varnish-cache/include/http_headers.h: Don't pass If-* - headers to backend + * trunk/varnish-cache/include/http_headers.h: + Don't pass If-* headers to backend + 2006-06-28 16:14 phk - * trunk/varnish-cache/bin/varnishd/cache_vrt.c: Apply correct fd - in Shmemlog + * trunk/varnish-cache/bin/varnishd/cache_vrt.c: + Apply correct fd in Shmemlog + 2006-06-28 16:04 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Fix buglets, - include test-driver. + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Fix buglets, include test-driver. + 2006-06-28 11:29 phk - * trunk/varnish-cache/bin/varnishstat/Makefile.am, - trunk/varnish-cache/bin/varnishstat/varnishstat.c: Give - varnishstat a "-c" option to use curses to continously refresh + * trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c: + Give varnishstat a "-c" option to use curses to continously refresh + 2006-06-28 11:21 phk - * trunk/varnish-cache/bin/Makefile.am, - trunk/varnish-cache/bin/varnishstat, - trunk/varnish-cache/bin/varnishstat/Makefile.am, - trunk/varnish-cache/bin/varnishstat/varnishstat.c, - trunk/varnish-cache/configure.ac: Add varnishstat program + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishstat, + trunk/varnish-cache/bin/varnishstat/Makefile.am, + trunk/varnish-cache/bin/varnishstat/varnishstat.c, + trunk/varnish-cache/configure.ac: + Add varnishstat program + 2006-06-28 10:31 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: 304's don't have - a body + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + 304's don't have a body + 2006-06-28 10:30 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Implement - ->trim() + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Implement ->trim() + 2006-06-28 09:39 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/include/stat_field.h: More stats counters + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/stat_field.h: + More stats counters + 2006-06-28 09:21 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_shmlog.c, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/shmlog.h, - trunk/varnish-cache/include/stat_field.h, - trunk/varnish-cache/include/stats.h: Add statistics counter - support. - - stat_field.h defines the counter fields with name, type, - (printf)format - and description. - - stats.h defines a structure with these fields. - - shmlog.h makes the structure part of the shared memory logs - header. - - Implent the "stats" CLI word in the management process. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/shmlog.h, + trunk/varnish-cache/include/stat_field.h, + trunk/varnish-cache/include/stats.h: + Add statistics counter support. + + stat_field.h defines the counter fields with name, type, (printf)format + and description. + + stats.h defines a structure with these fields. + + shmlog.h makes the structure part of the shared memory logs header. + + Implent the "stats" CLI word in the management process. + 2006-06-26 19:25 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_expire.c: Call VCL to - decide discard/prefetch for near-expiry objects. - - Put discard objects on deathrow where they will be culled from - in sequence. - - (prefetch not implemented yet) + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c: + Call VCL to decide discard/prefetch for near-expiry objects. + + Put discard objects on deathrow where they will be culled from + in sequence. + + (prefetch not implemented yet) + 2006-06-26 19:24 phk - * trunk/varnish-cache/bin/varnishd/rfc2616.c: A temporary hack to - deal with very old Date: headers until we figure - out what's going on. + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + A temporary hack to deal with very old Date: headers until we figure + out what's going on. + 2006-06-26 19:23 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Implement - HTTP/1.0 style fetching. + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Implement HTTP/1.0 style fetching. + 2006-06-26 17:06 phk - * trunk/varnish-cache/bin/varnishd/storage_malloc.c: Another - little tweak + * trunk/varnish-cache/bin/varnishd/storage_malloc.c: + Another little tweak + 2006-06-26 16:31 phk - * trunk/varnish-cache/bin/varnishd/cache_vcl.c: Dump numeric - handling also, until we figure out trouble. + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: + Dump numeric handling also, until we figure out trouble. + 2006-06-26 16:30 phk - * trunk/varnish-cache/bin/varnishd/cache_hash.c: typo + * trunk/varnish-cache/bin/varnishd/cache_hash.c: + typo + 2006-06-26 16:19 phk - * trunk/varnish-cache/bin/varnishd/storage_malloc.c: Make this - work again: record the stevedore in the storage object. + * trunk/varnish-cache/bin/varnishd/storage_malloc.c: + Make this work again: record the stevedore in the storage object. + 2006-06-26 14:33 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c: Start - releasing objects when they expire + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c: + Start releasing objects when they expire + 2006-06-26 14:00 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c: Move a bit - more responsibility into the hash-slinger to get a cleaner - interface. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c: + Move a bit more responsibility into the hash-slinger to get a cleaner + interface. + 2006-06-26 08:58 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_hash.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c: Now that we - approach the time where objects have to be destroyed again, - we need to move the data structures into the right shape. - - Push hashing into cache_hash.c - - Add objhead structure to hold the various hits for "Vary:" - headers. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_hash.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c: + Now that we approach the time where objects have to be destroyed again, + we need to move the data structures into the right shape. + + Push hashing into cache_hash.c + + Add objhead structure to hold the various hits for "Vary:" headers. + 2006-06-24 22:11 phk - * trunk/varnish-cache/bin/varnishd/cache_expire.c: A little bit - more work on the expiry/prefetch thing. + * trunk/varnish-cache/bin/varnishd/cache_expire.c: + A little bit more work on the expiry/prefetch thing. + 2006-06-24 21:54 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/rfc2616.c: Use ttl=0 as a - "invalid TTL" flag. - - Mark objects with ttl=0 uncachable. - - Add cacheable objects to the expiry heap - - Start an expiry thread which polls the root element once per - second + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + Use ttl=0 as a "invalid TTL" flag. + + Mark objects with ttl=0 uncachable. + + Add cacheable objects to the expiry heap + + Start an expiry thread which polls the root element once per second + 2006-06-24 21:42 phk - * trunk/varnish-cache/bin/varnishd/rfc2616.c: Truncate TTLs in the - past to now. + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + Truncate TTLs in the past to now. + 2006-06-24 21:09 phk - * trunk/varnish-cache/bin/varnishd/cache.h: Autogenerate - prototypes for method calling functions + * trunk/varnish-cache/bin/varnishd/cache.h: + Autogenerate prototypes for method calling functions + 2006-06-24 21:07 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/vcl.h, - trunk/varnish-cache/include/vcl_returns.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Add a "timeout" - method to VCL, it can return "fetch" or "discard". + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + Add a "timeout" method to VCL, it can return "fetch" or "discard". + 2006-06-24 20:50 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Add a token - type "METHOD", we use it for reference counting. - - Add a reference to the first backend {} we encounter, it is the - default. - Add a reference to all backends assigned explicitly. - Add a reference to all methods. - - Enable reference check, complain if: backend, function or acl is - defined - but not used, or used but not defined. + * trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + Add a token type "METHOD", we use it for reference counting. + + Add a reference to the first backend {} we encounter, it is the default. + Add a reference to all backends assigned explicitly. + Add a reference to all methods. + + Enable reference check, complain if: backend, function or acl is defined + but not used, or used but not defined. + 2006-06-24 20:12 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Collapse multiline - Fc and Fh calls where they fit + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Collapse multiline Fc and Fh calls where they fit + 2006-06-24 20:09 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: More printf - sanitation: Create to convenience functions for output to the - fh and fc sbufs. + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + More printf sanitation: Create to convenience functions for output to the + fh and fc sbufs. + 2006-06-24 19:50 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Cave in and use - printf format extensions for printing tokens. - Both Linux and FreeBSD supports them anyway. + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Cave in and use printf format extensions for printing tokens. + Both Linux and FreeBSD supports them anyway. + 2006-06-24 19:41 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add more - shmemlog tags: - one for each VCL method to record the return - one for errors - one for linking a client session to a backend connection - Use them sensibly. - Put VCL name of backend into struct backend to improve log - messages + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Add more shmemlog tags: + one for each VCL method to record the return + one for errors + one for linking a client session to a backend connection + Use them sensibly. + Put VCL name of backend into struct backend to improve log messages + 2006-06-22 16:17 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/vcl.h, - trunk/varnish-cache/include/vcl_returns.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Improve the VCL - compiler in various ways: - - Generate the methods and their legal returns with the tcl script. - - Add consistency checks to make sure methods don't use illegal - returns, - and also check called subrourtines. - - Add consistency check to complain about recursive subroutine - calls. - - Add consistency check to complain about unused or undefined - subroutines. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_returns.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + Improve the VCL compiler in various ways: + + Generate the methods and their legal returns with the tcl script. + + Add consistency checks to make sure methods don't use illegal returns, + and also check called subrourtines. + + Add consistency check to complain about recursive subroutine calls. + + Add consistency check to complain about unused or undefined subroutines. + 2006-06-21 10:28 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_expire.c, - trunk/varnish-cache/bin/varnishd/cache_main.c: Add (empty) - source file for expiry/pretech code + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_expire.c, + trunk/varnish-cache/bin/varnishd/cache_main.c: + Add (empty) source file for expiry/pretech code + 2006-06-21 10:21 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/rfc2616.c: Start to respect TTL + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + Start to respect TTL + 2006-06-21 10:13 phk - * trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/varnishd.c: Add "-t - default_ttl" option. 120 seconds by default. + * trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Add "-t default_ttl" option. 120 seconds by default. + 2006-06-21 09:58 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Quench some - debugging + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Quench some debugging + 2006-06-21 08:09 phk - * trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/binary_heap.h, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnish/binary_heap.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add a binary - heap implementation for keeping track of objects expiry time. + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/binary_heap.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/binary_heap.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Add a binary heap implementation for keeping track of objects expiry time. + 2006-06-20 19:49 phk - * trunk/varnish-cache/include/vrt.h: typo + * trunk/varnish-cache/include/vrt.h: + typo + 2006-06-20 19:38 phk - * trunk/varnish-cache/lib/libvcl/flint.lnt, - trunk/varnish-cache/lib/libvcl/flint.sh: FlexeLint files + * trunk/varnish-cache/lib/libvcl/flint.lnt, + trunk/varnish-cache/lib/libvcl/flint.sh: + FlexeLint files + 2006-06-20 19:37 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: FlexeLint cleanups + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + FlexeLint cleanups + 2006-06-20 19:31 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_shmlog.c, - trunk/varnish-cache/bin/varnishd/cli_event.c, - trunk/varnish-cache/bin/varnishd/flint.lnt, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Polish things to - silence FlexeLint a bit + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Polish things to silence FlexeLint a bit + 2006-06-20 11:39 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c, - trunk/varnish-cache/bin/varnishd/rfc2616.c, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/storage_malloc.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/vcl.h, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: Rename - vcl_lang.h to vcl.h and include practically nowhere. - - Remove #include bogohandling in vcl_gen_fixed_token.tcl + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/rfc2616.c, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: + Rename vcl_lang.h to vcl.h and include practically nowhere. + + Remove #include bogohandling in vcl_gen_fixed_token.tcl + 2006-06-20 10:31 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: At the expense - of some complexity and a small runtime overhead, - isolate the compiled code from the internal structures of the - cache - process through of VRT functions. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + At the expense of some complexity and a small runtime overhead, + isolate the compiled code from the internal structures of the cache + process through of VRT functions. + 2006-06-20 09:41 phk - * trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Work towards - making struct sess opaque to the generated code. + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Work towards making struct sess opaque to the generated code. + 2006-06-20 09:28 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/libvcl.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c: Rename the VCL - compilers public functions to VCC prefix + * trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Rename the VCL compilers public functions to VCC prefix + 2006-06-20 09:25 phk - * trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Get rid of - VCL_FARGS and VCL_PASS_ARGS macros. - - Generate VGC prefixes instead of VCL. + * trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Get rid of VCL_FARGS and VCL_PASS_ARGS macros. + + Generate VGC prefixes instead of VCL. + 2006-06-20 09:15 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/cache_vrt.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/include/vrt.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: Start - putting some structure in the sources relating to VCL handling: - - Split the runtime support for compiled varnish programs out and - give it the - prefix "VRT". - - Start using the prefix "VGC" for generated code. - - Prefix "VCC" will be for the compiler and "VCL" for calling the - compiled and - loaded functions. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cache_vrt.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/include/vrt.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: + Start putting some structure in the sources relating to VCL handling: + + Split the runtime support for compiled varnish programs out and give it the + prefix "VRT". + + Start using the prefix "VGC" for generated code. + + Prefix "VCC" will be for the compiler and "VCL" for calling the + compiled and + loaded functions. + 2006-06-18 10:28 phk - * trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Output - line+pos for counts. + * trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Output line+pos for counts. + 2006-06-18 10:19 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Insert a - count-point after each conditional. + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Insert a count-point after each conditional. + 2006-06-18 10:16 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Get the sense of - string compares right. + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Get the sense of string compares right. + 2006-06-18 10:12 phk - * trunk/varnish-cache/bin/varnishd/rfc2616.c: debug printf for - max-age + * trunk/varnish-cache/bin/varnishd/rfc2616.c: + debug printf for max-age + 2006-06-18 10:10 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Implement - req.request properly + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Implement req.request properly + 2006-06-18 10:04 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Pass if we spot an - Authenticate or Cookie header + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Pass if we spot an Authenticate or Cookie header + 2006-06-18 10:03 phk - * trunk/varnish-cache/bin/varnishd/cache_vcl.c: Add VCL function - for getting HTTP header + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: + Add VCL function for getting HTTP header + 2006-06-18 10:02 phk - * trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add support - for investigating random HTTP headers. + * trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Add support for investigating random HTTP headers. + 2006-06-18 09:16 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c: Add wrappers - around VCL methos so logging and checking of returned handling - can be centralized. - - Remove old handling callbacks. - - Call hit/miss methods instead of lookup method. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + Add wrappers around VCL methos so logging and checking of returned handling + can be centralized. + + Remove old handling callbacks. + + Call hit/miss methods instead of lookup method. + 2006-06-18 09:14 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: add explicit - "lookup" to recv method + * trunk/varnish-cache/bin/varnishd/varnishd.c: + add explicit "lookup" to recv method + 2006-06-18 09:11 phk - * trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Correctly - handle \ sequences in .h files in vcl_gen_fixed_token.tcl - - Make handling a named enum, and use it as a bitmap. - - Add "lookup" reserved word - - Add VCL_done() macro to use in compiled code to set handling and - drop - the per-handling callbacks (apart from VCL_error()) + * trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + Correctly handle \ sequences in .h files in vcl_gen_fixed_token.tcl + + Make handling a named enum, and use it as a bitmap. + + Add "lookup" reserved word + + Add VCL_done() macro to use in compiled code to set handling and drop + the per-handling callbacks (apart from VCL_error()) + 2006-06-18 07:28 phk - * trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Add "deliver" - keyword to VCL compiler. - - Split vcl_lookup() in vcl_hit() and vcl_miss() + * trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + Add "deliver" keyword to VCL compiler. + + Split vcl_lookup() in vcl_hit() and vcl_miss() + 2006-06-16 10:22 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Initial - http_GetHdrField() function. - - Improve chunked encoding, allocate big storage chunks and trim - the - last one at the end, instead of one storage chunk for each chunk - the remote server sends. - - Call RFC2616 policy code. - - Store headers from backend in cache and return to client. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Initial http_GetHdrField() function. + + Improve chunked encoding, allocate big storage chunks and trim the + last one at the end, instead of one storage chunk for each chunk + the remote server sends. + + Call RFC2616 policy code. + + Store headers from backend in cache and return to client. + 2006-06-16 10:20 phk - * trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add header - field to object + * trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Add header field to object + 2006-06-16 10:19 phk - * trunk/varnish-cache/include/http_headers.h: Supress - Transfer-Encoding + * trunk/varnish-cache/include/http_headers.h: + Supress Transfer-Encoding + 2006-06-16 10:18 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/rfc2616.c: The beginnings of - rfc2616 policy implemenation. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/rfc2616.c: + The beginnings of rfc2616 policy implemenation. + 2006-06-16 10:17 phk - * trunk/varnish-cache/bin/varnishd/stevedore.h, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/storage_malloc.c: Add trim - method to storage backends so chunked encoding can be - stored efficiently. + * trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + Add trim method to storage backends so chunked encoding can be + stored efficiently. + 2006-06-16 10:16 phk - * trunk/varnish-cache/include/libvarnish.h, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnish/time.c: Add time parse/format - functions to libvarnish + * trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/time.c: + Add time parse/format functions to libvarnish + 2006-06-15 08:04 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c: less noise + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + less noise + 2006-06-15 08:04 phk - * trunk/varnish-cache/bin/varnishd/cache_main.c: Less noise + * trunk/varnish-cache/bin/varnishd/cache_main.c: + Less noise + 2006-06-14 09:57 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c: start examining - HTTP status codes from backend + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + start examining HTTP status codes from backend + 2006-06-14 09:39 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Add - vca_write_obj() which writes an sbuf (as) HTTP header and the - object from the sessions to the client. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Add vca_write_obj() which writes an sbuf (as) HTTP header and the + object from the sessions to the client. + 2006-06-14 09:25 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Clean up session - messages a bit + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Clean up session messages a bit + 2006-06-14 09:23 phk - * trunk/varnish-cache/include/shmlog_tags.h: Add HttpError tag + * trunk/varnish-cache/include/shmlog_tags.h: + Add HttpError tag + 2006-06-14 09:03 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Sanitize - close/recycle session logic a bit. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Sanitize close/recycle session logic a bit. + 2006-06-14 08:53 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_main.c: Initialize the - cache_acceptor.c/VCA in the same manner as other parts. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_main.c: + Initialize the cache_acceptor.c/VCA in the same manner as other parts. + 2006-06-14 07:21 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/stevedore.h, - trunk/varnish-cache/bin/varnishd/storage_file.c: Give storage - backends a "send" method. - - Let storage_file use sendfile(2) for it. + * trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/stevedore.h, + trunk/varnish-cache/bin/varnishd/storage_file.c: + Give storage backends a "send" method. + + Let storage_file use sendfile(2) for it. + 2006-06-14 06:58 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Complete the - storage_file method. + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Complete the storage_file method. + 2006-06-13 20:09 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Default to "file" - stevedore from now on. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Default to "file" stevedore from now on. + 2006-06-13 20:06 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Be more - aggressive about mmap'ing memory. The size_t thing is a bogus - constraint in FreeBSD and we shouldn't really listen to it. - - On my laptop I can mmap 2422MB file this way. - - This may be so aggressive that it leaves insufficient address - space for - malloc/threadstacks and other issues. - - If we find a way to pick up a platform/architecture specific - limit, we - can enforce that along the way. - - For now people can just specify a saner and smaller "-sfile" - size. + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Be more aggressive about mmap'ing memory. The size_t thing is a bogus + constraint in FreeBSD and we shouldn't really listen to it. + + On my laptop I can mmap 2422MB file this way. + + This may be so aggressive that it leaves insufficient address space for + malloc/threadstacks and other issues. + + If we find a way to pick up a platform/architecture specific limit, we + can enforce that along the way. + + For now people can just specify a saner and smaller "-sfile" size. + 2006-06-13 13:47 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: mmap as much as - the file as we are able to when the cache process opens - the stevedore. - - This should probably be (fine-)tuned later on as it might be too - aggressive - when faced with user errors. - - Also, might it be possible to mmap() more than MAX_SIZE_T bytes - if - it is done in multiple calls ? + * trunk/varnish-cache/bin/varnishd/storage_file.c: + mmap as much as the file as we are able to when the cache process opens + the stevedore. + + This should probably be (fine-)tuned later on as it might be too aggressive + when faced with user errors. + + Also, might it be possible to mmap() more than MAX_SIZE_T bytes if + it is done in multiple calls ? + 2006-06-13 13:14 phk - * trunk/varnish-cache/bin/varnishd/storage_file.c: Calculate the - size of the backing store file. - - A size can be specified in absolute terms (suffix: k, m, g, t - supported), - but also as a percentage of the filesystems free space (suffix - '%'). - - If the specified size is larger than an off_t can cope, we - bisect - repeatedly until it can. - - If the size exceeds the available space of the filesystem, we - truncate - to 80% of the free space. - - Then round down to an integral number of blocks, sized by the - larger - of the filesystem blocksize and the pagesize. - - This was tricker than I'd expected... + * trunk/varnish-cache/bin/varnishd/storage_file.c: + Calculate the size of the backing store file. + + A size can be specified in absolute terms (suffix: k, m, g, t supported), + but also as a percentage of the filesystems free space (suffix '%'). + + If the specified size is larger than an off_t can cope, we bisect + repeatedly until it can. + + If the size exceeds the available space of the filesystem, we truncate + to 80% of the free space. + + Then round down to an integral number of blocks, sized by the larger + of the filesystem blocksize and the pagesize. + + This was tricker than I'd expected... + 2006-06-13 13:10 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Clone the stevedore - before calling its init function and be more precise - about any optional arguments. + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Clone the stevedore before calling its init function and be more precise + about any optional arguments. + 2006-06-13 08:05 phk - * trunk/varnish-cache/bin/varnishd/_stevedore.h, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/stevedore.h: After having a - strong cup of tea: don't name files with leading underscore - even though that's how FreeBSD's kernel does it. In my private - world - a leading underscore means "junk file, remove at your pleasure". + * trunk/varnish-cache/bin/varnishd/_stevedore.h, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/stevedore.h: + After having a strong cup of tea: don't name files with leading underscore + even though that's how FreeBSD's kernel does it. In my private world + a leading underscore means "junk file, remove at your pleasure". + 2006-06-13 08:02 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/storage_file.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Clone the malloc - stevedore to the file stevedore + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/storage_file.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Clone the malloc stevedore to the file stevedore + 2006-06-13 07:59 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Remember to tell - getopt about -s + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Remember to tell getopt about -s + 2006-06-13 07:57 phk - * trunk/varnish-cache/bin/varnishd/_stevedore.h, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/storage_malloc.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Put more meat on - the stevedore (storage backend) interface: - - Pull the struct definition into _stevedore.h and include this - from - cache.h and mgt.h, they both need to be able to see it. - - Add the stevedore pointer as an argument to the stevedore alloc - function - so multiple stevedores is possible later on. - - Add the stevedore pointer to the storage object, so freeing it - again is - possible. - - Add -s argument processing to select a given stevedore, call - it's ->init - method and pass the stevedore in the heritage. - - In the cache process pick stevedore out from heritage, call its - open method. + * trunk/varnish-cache/bin/varnishd/_stevedore.h, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/storage_malloc.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Put more meat on the stevedore (storage backend) interface: + + Pull the struct definition into _stevedore.h and include this from + cache.h and mgt.h, they both need to be able to see it. + + Add the stevedore pointer as an argument to the stevedore alloc function + so multiple stevedores is possible later on. + + Add the stevedore pointer to the storage object, so freeing it again is + possible. + + Add -s argument processing to select a given stevedore, call it's ->init + method and pass the stevedore in the heritage. + + In the cache process pick stevedore out from heritage, call its open + method. + 2006-06-13 07:26 phk - * trunk/varnish-cache/bin/varnishd/storage_malloc.c: Use NULL init - method + * trunk/varnish-cache/bin/varnishd/storage_malloc.c: + Use NULL init method + 2006-06-13 07:25 phk - * trunk/varnish-cache/bin/varnishd/cache_main.c: Allow for NULL - init methods for hash and stevedore + * trunk/varnish-cache/bin/varnishd/cache_main.c: + Allow for NULL init methods for hash and stevedore + 2006-05-01 12:59 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c: Use - vca_write/vca_flush + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + Use vca_write/vca_flush + 2006-05-01 12:59 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Use - vca_write/vca_flush + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Use vca_write/vca_flush + 2006-05-01 12:51 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c: Use - vca_write/vca_flush + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + Use vca_write/vca_flush + 2006-05-01 12:45 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Add - vca_write() and vca_flush(), two functions which will attempt to - use writev() if possible. - - vca_flush() must be called before any memory previosly given to - vca_write is overwritten, and after the last call to vca_write() + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Add vca_write() and vca_flush(), two functions which will attempt to + use writev() if possible. + + vca_flush() must be called before any memory previosly given to + vca_write is overwritten, and after the last call to vca_write() + 2006-05-01 12:28 phk - * trunk/varnish-cache/bin/varnishd/flint.lnt, - trunk/varnish-cache/bin/varnishd/flint.sh: Add FlexeLint files + * trunk/varnish-cache/bin/varnishd/flint.lnt, + trunk/varnish-cache/bin/varnishd/flint.sh: + Add FlexeLint files + 2006-05-01 12:27 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: bandaid for - name-clash + * trunk/varnish-cache/bin/varnishd/varnishd.c: + bandaid for name-clash + 2006-05-01 12:27 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c: Keep track of - how many connections we have open + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + Keep track of how many connections we have open + 2006-05-01 12:27 phk - * trunk/varnish-cache/bin/varnishd/cache.h: add missing extern + * trunk/varnish-cache/bin/varnishd/cache.h: + add missing extern + 2006-05-01 10:55 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Add INCOMPL() - macro to mark missing code. - - Add http_HdrIs() to check if we have a given header and if we do - if it has a given value. - - Use it. - - Ignore SIGPIPE since SO_NOSIGPIPE doesn't work reliably, (but set - it on accepted TCP connections anyway). - - Update passing to match fetching, including a chunked encoding - method. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Add INCOMPL() macro to mark missing code. + + Add http_HdrIs() to check if we have a given header and if we do + if it has a given value. + + Use it. + + Ignore SIGPIPE since SO_NOSIGPIPE doesn't work reliably, (but set + it on accepted TCP connections anyway). + + Update passing to match fetching, including a chunked encoding method. + 2006-05-01 07:54 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c: Add yet - another thread with an event engine to monitor idle backend - connections and clean them out if the backend closes. + * trunk/varnish-cache/bin/varnishd/cache_backend.c: + Add yet another thread with an event engine to monitor idle backend + connections and clean them out if the backend closes. + 2006-05-01 07:53 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Centralize - "Connection: close" handling from the backend. - - Loop until we have the entire chunk in chunked encoding + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Centralize "Connection: close" handling from the backend. + + Loop until we have the entire chunk in chunked encoding + 2006-04-25 09:32 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c: test backend - connections at allocation time. - - General bush-wacking in the fetch code. + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c: + test backend connections at allocation time. + + General bush-wacking in the fetch code. + 2006-04-25 09:31 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c: Fix argument to - http_BuildSbuf + * trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + Fix argument to http_BuildSbuf + 2006-04-25 09:30 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c: Keep alive often - enough + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + Keep alive often enough + 2006-04-25 08:17 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: Make width - colum wider and decimal + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Make width colum wider and decimal + 2006-04-25 08:17 phk - * trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add new shmlog - tags and handling states + * trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Add new shmlog tags and handling states + 2006-04-25 08:14 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Implement a - rudimentary chunked Transfer-Encoding + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Implement a rudimentary chunked Transfer-Encoding + 2006-04-25 07:10 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: reset header - count before we dissect + * trunk/varnish-cache/bin/varnishd/cache_http.c: + reset header count before we dissect + 2006-04-25 07:04 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c: Track backend - connections in shmem log + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Track backend connections in shmem log + 2006-04-25 06:52 phk - * trunk/varnish-cache/bin/varnishd/cache_http.c: Add an end - pointer so allocation size can be changed on the fly + * trunk/varnish-cache/bin/varnishd/cache_http.c: + Add an end pointer so allocation size can be changed on the fly + 2006-04-25 06:48 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Move shmlog - entry, remove debugging + * trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Move shmlog entry, remove debugging + 2006-04-25 06:16 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_http.c, - trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/http_headers.h, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Redo http - header storage and processing + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_http.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Redo http header storage and processing + 2006-04-24 19:10 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Add an indecisive - comment + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Add an indecisive comment + 2006-04-24 19:09 phk - * trunk/varnish-cache/include/http_headers.h: Sort and annotate + * trunk/varnish-cache/include/http_headers.h: + Sort and annotate + 2006-04-19 06:38 phk - * trunk/varnish-cache/bin/varnishd/cache_fetch.c: Loop until we - have read it all + * trunk/varnish-cache/bin/varnishd/cache_fetch.c: + Loop until we have read it all + 2006-04-19 06:34 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_fetch.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Implement - enough of FetchSession and DeliverSession that we can actually - deliver a cached object. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_fetch.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Implement enough of FetchSession and DeliverSession that we can actually + deliver a cached object. + 2006-04-18 08:23 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add busyflag - and strorage link to objects. - - Initialize default hasher and stevedore. - - Give each workerthread an object pointer to be kept populated - with - a template object for when lookups miss and need to insert one. - - Add libmd to get MD5, (choice of hash-algorithm to be revisited - later) - - Implement lookup, begin on fetch. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Add busyflag and strorage link to objects. + + Initialize default hasher and stevedore. + + Give each workerthread an object pointer to be kept populated with + a template object for when lookups miss and need to insert one. + + Add libmd to get MD5, (choice of hash-algorithm to be revisited later) + + Implement lookup, begin on fetch. + 2006-04-18 07:34 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c, - trunk/varnish-cache/bin/varnishd/storage_malloc.c: Add trivial - malloc backed storage backend. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/storage_malloc.c: + Add trivial malloc backed storage backend. + 2006-04-12 08:58 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/cli.h, - trunk/varnish-cache/include/cli_priv.h, - trunk/varnish-cache/include/libvcl.h, - trunk/varnish-cache/include/shmlog.h, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_priv.h, - trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Implement the - three function VCL model in the compiler. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/libvcl.h, + trunk/varnish-cache/include/shmlog.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_priv.h, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + Implement the three function VCL model in the compiler. + 2006-04-12 08:56 phk - * trunk/varnish-cache/include/http_headers.h: Add ETag: header + * trunk/varnish-cache/include/http_headers.h: + Add ETag: header + 2006-04-11 08:28 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_shmlog.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/cli_event.c, - trunk/varnish-cache/bin/varnishd/cli_event.h, - trunk/varnish-cache/bin/varnishd/hash_simple_list.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/tcp.c: Beginnings of the object - lookup stuff: A simple list based - implementation to get things moving. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/hash_simple_list.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/tcp.c: + Beginnings of the object lookup stuff: A simple list based + implementation to get things moving. + 2006-04-06 10:01 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c: Close or recycle - backend connections as appropriate + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + Close or recycle backend connections as appropriate + 2006-04-06 10:00 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c: Add - VBE_RecycleFd() function to recycle backend connections + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c: + Add VBE_RecycleFd() function to recycle backend connections + 2006-04-06 09:59 phk - * trunk/varnish-cache/include/http_headers.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Pass - Content-Encoding header + * trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Pass Content-Encoding header + 2006-04-06 09:38 phk - * trunk/varnish-cache/bin/varnishlog/Makefile.am, - trunk/varnish-cache/bin/varnishlog/varnishlog.c: Output the fd - in decimal instead of hex. - - Do Id Keyword + * trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c: + Output the fd in decimal instead of hex. + + Do Id Keyword + 2006-04-06 09:33 phk - * trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Rename hdr_end - to a more sensible rcv_ptr which points to the first - unaccounted for character in the buffer. - - Do Id Keyword + * trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Rename hdr_end to a more sensible rcv_ptr which points to the first + unaccounted for character in the buffer. + + Do Id Keyword + 2006-04-06 09:30 phk - * trunk/varnish-cache/include/shmlog_tags.h: Add shmlog tags for - pipe and pass handling + * trunk/varnish-cache/include/shmlog_tags.h: + Add shmlog tags for pipe and pass handling + 2006-04-06 09:11 phk - * trunk/varnish-cache/include/shmlog_tags.h: Log tag for session - reuse. - - Do Id Keyword + * trunk/varnish-cache/include/shmlog_tags.h: + Log tag for session reuse. + + Do Id Keyword + 2006-04-06 09:10 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c: Recycle sessions - instead of retiring them. + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + Recycle sessions instead of retiring them. + 2006-04-06 09:09 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c: Prune the bits we - used from the input buffer before we recycle the - session. + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + Prune the bits we used from the input buffer before we recycle the + session. + 2006-04-06 09:09 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c: Add a - vca_recycle_session() function which sticks a session back into - the acceptors event engine. - - Do Id keyword + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c: + Add a vca_recycle_session() function which sticks a session back into + the acceptors event engine. + + Do Id keyword + 2006-04-06 09:08 phk - * trunk/varnish-cache/bin/varnishd/cache_httpd.c: Don't log the - terminating NUL on response proto field. + * trunk/varnish-cache/bin/varnishd/cache_httpd.c: + Don't log the terminating NUL on response proto field. + 2006-04-06 08:18 phk - * trunk/varnish-cache/bin/varnishd/cache_httpd.c: Add an assert, - remove debugging. + * trunk/varnish-cache/bin/varnishd/cache_httpd.c: + Add an assert, remove debugging. + 2006-04-06 08:18 phk - * trunk/varnish-cache/bin/varnishd/cache_pool.c: Respect VCL - choice of handling - - Do Id keyword + * trunk/varnish-cache/bin/varnishd/cache_pool.c: + Respect VCL choice of handling + + Do Id keyword + 2006-04-06 08:16 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c: Don't attempt to - restart child process (yet). - - Add Id Keyword handling + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + Don't attempt to restart child process (yet). + + Add Id Keyword handling + 2006-04-06 08:15 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c: It's cheaper to - pipe than to pass, so if the client indicates - "Connection: close", pipe instead of passing. + * trunk/varnish-cache/bin/varnishd/cache_pass.c: + It's cheaper to pipe than to pass, so if the client indicates + "Connection: close", pipe instead of passing. + 2006-04-06 07:50 phk - * trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c: Use - HttpdBuildSbuf() - - Enable Id keyword + * trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c: + Use HttpdBuildSbuf() + + Enable Id keyword + 2006-04-06 07:50 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_httpd.c: Add a function - to (re)build a HTTP request or response into an sbuf. - - Enable Id keyword + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c: + Add a function to (re)build a HTTP request or response into an sbuf. + + Enable Id keyword + 2006-04-05 10:33 phk - * trunk/varnish-cache/autogen.sh: Eliminate leaked developer hacks. + * trunk/varnish-cache/autogen.sh: + Eliminate leaked developer hacks. + 2006-04-05 09:40 phk - * trunk/varnish-cache/autogen.sh, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c: Account for the - last byte of the header. + * trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c: + Account for the last byte of the header. + 2006-04-04 10:35 des - * trunk/varnish-cache/configure.ac, - trunk/varnish-cache/lib/libcompat/Makefile.am, - trunk/varnish-cache/lib/libcompat/strlcat.c, - trunk/varnish-cache/lib/libcompat/strlcpy.c: I can't get - AM_CONDITIONAL to work properly, so use a bigger hammer. + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c: + I can't get AM_CONDITIONAL to work properly, so use a bigger hammer. + 2006-04-04 10:09 des - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/mgt_child.c: More portability - changes: include config.h and compat.h, get rid of __unused. + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/mgt_child.c: + More portability changes: include config.h and compat.h, get rid of + __unused. + 2006-04-04 10:08 des - * trunk/varnish-cache/bin/varnishd/Makefile.am: Link in libcompat, - and libsbuf is now static. + * trunk/varnish-cache/bin/varnishd/Makefile.am: + Link in libcompat, and libsbuf is now static. + 2006-04-04 10:08 des - * trunk/varnish-cache/lib/libsbuf/Makefile.am: Make libsbuf static. + * trunk/varnish-cache/lib/libsbuf/Makefile.am: + Make libsbuf static. + 2006-04-04 10:07 des - * trunk/varnish-cache/configure.ac, - trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/compat.h, - trunk/varnish-cache/lib/Makefile.am, - trunk/varnish-cache/lib/libcompat, - trunk/varnish-cache/lib/libcompat/Makefile.am, - trunk/varnish-cache/lib/libcompat/strlcat.c, - trunk/varnish-cache/lib/libcompat/strlcpy.c: Add a libcompat - with strlcat() and strlcpy() from OpenBSD. + * trunk/varnish-cache/configure.ac, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/compat.h, + trunk/varnish-cache/lib/Makefile.am, + trunk/varnish-cache/lib/libcompat, + trunk/varnish-cache/lib/libcompat/Makefile.am, + trunk/varnish-cache/lib/libcompat/strlcat.c, + trunk/varnish-cache/lib/libcompat/strlcpy.c: + Add a libcompat with strlcat() and strlcpy() from OpenBSD. + 2006-04-04 09:05 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/include/http_headers.h, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Get - pass-through working for the first request. - - Now we can start to play with multi-request sessions and all - that. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Get pass-through working for the first request. + + Now we can start to play with multi-request sessions and all that. + 2006-04-04 08:20 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/include/http_headers.h, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add HTTP - response headers and processing. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Add HTTP response headers and processing. + 2006-04-04 07:46 phk - * trunk/varnish-cache/include/cli_priv.h, - trunk/varnish-cache/include/libvarnish.h, - trunk/varnish-cache/lib/libvarnish/argv.c, - trunk/varnish-cache/lib/libvarnish/cli.c: Reverse constification - of Argv functions. After cascading through all - the CLI functions we hit the fact that the evbuffer functions in - libevent - are not properly constified. - - It's better to deconst the error messages and just "let it be - known" that - argv[0] is const (or NULL). + * trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/cli.c: + Reverse constification of Argv functions. After cascading through all + the CLI functions we hit the fact that the evbuffer functions in libevent + are not properly constified. + + It's better to deconst the error messages and just "let it be known" that + argv[0] is const (or NULL). + 2006-04-04 07:30 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_pass.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/include/http_headers.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Get "Pass" - mode moving + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_pass.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Get "Pass" mode moving + 2006-04-04 07:29 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_httpd.c: Make the - "receive a HTTP protocol header" code generic + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c: + Make the "receive a HTTP protocol header" code generic + 2006-04-04 07:27 phk - * trunk/varnish-cache/include/vcl_lang.h: Add a session callback - pointer to struct sess. + * trunk/varnish-cache/include/vcl_lang.h: + Add a session callback pointer to struct sess. + 2006-04-04 07:26 phk - * trunk/varnish-cache/bin/varnishd/cli_event.c: Use - bufferevent_base_set() from libevent + * trunk/varnish-cache/bin/varnishd/cli_event.c: + Use bufferevent_base_set() from libevent + 2006-04-04 07:24 phk - * trunk/varnish-cache/contrib/libevent/event.h: Add a missing - prototype until libevent people catch up. + * trunk/varnish-cache/contrib/libevent/event.h: + Add a missing prototype until libevent people catch up. + 2006-04-04 07:24 phk - * trunk/varnish-cache/include/shmlog_tags.h: Add a Debug shmemlog - tag. + * trunk/varnish-cache/include/shmlog_tags.h: + Add a Debug shmemlog tag. + 2006-04-04 07:24 des - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/include/cli_priv.h, - trunk/varnish-cache/include/libvarnish.h, - trunk/varnish-cache/lib/libvarnish/argv.c, - trunk/varnish-cache/lib/libvarnish/cli.c, - trunk/varnish-cache/lib/libvcl/vcl_compile.c: Portability - tweaks: use our own sbuf.h and queue.h; get rid of __DECONST; get - rid of digittoint() (which is pointless since ISO C guarantees - that digits - are consecutive in the execution character set); get rid of - __unused. - - Also fix a buglet in argv.c's BackSlash() (parsing of octal - numbers), and - constify the array passed around by ParseArgv() and FreeArgv(). + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/cli.c, + trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Portability tweaks: use our own sbuf.h and queue.h; get rid of + __DECONST; get + rid of digittoint() (which is pointless since ISO C guarantees that digits + are consecutive in the execution character set); get rid of __unused. + + Also fix a buglet in argv.c's BackSlash() (parsing of octal numbers), and + constify the array passed around by ParseArgv() and FreeArgv(). + 2006-04-03 14:41 phk - * trunk/varnish-cache/bin/varnishd/cache_httpd.c: Move memset - further up. + * trunk/varnish-cache/bin/varnishd/cache_httpd.c: + Move memset further up. + 2006-04-03 14:20 des - * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, - trunk/varnish-cache/configure.ac, - trunk/varnish-cache/contrib/Makefile.am: Hook up libevent to the - build. Note that this should be made conditional at - some later date. + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/configure.ac, trunk/varnish-cache/contrib/Makefile.am: + Hook up libevent to the build. Note that this should be made + conditional at + some later date. + 2006-04-03 14:04 des - * trunk/varnish-cache/contrib/libevent/WIN32-Code/provos at badschwartau.provos.org.12766: - GC + * trunk/varnish-cache/contrib/libevent/WIN32-Code/provos at badschwartau.provos.org.12766: + + GC + 2006-04-03 12:05 des - * trunk/varnish-cache/contrib/libevent/sample/Makefile.in, - trunk/varnish-cache/contrib/libevent/test/Makefile.in: Remove - generated files which were committed by mistake. + * trunk/varnish-cache/contrib/libevent/sample/Makefile.in, + trunk/varnish-cache/contrib/libevent/test/Makefile.in: + Remove generated files which were committed by mistake. + 2006-04-03 11:59 des - * trunk/varnish-cache/contrib/libevent/Makefile.am, - trunk/varnish-cache/contrib/libevent/README, - trunk/varnish-cache/contrib/libevent/WIN32-Code/win32.c, - trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsp, - trunk/varnish-cache/contrib/libevent/buffer.c, - trunk/varnish-cache/contrib/libevent/configure.in, - trunk/varnish-cache/contrib/libevent/devpoll.c, - trunk/varnish-cache/contrib/libevent/epoll.c, - trunk/varnish-cache/contrib/libevent/evbuffer.c, - trunk/varnish-cache/contrib/libevent/event.3, - trunk/varnish-cache/contrib/libevent/event.c, - trunk/varnish-cache/contrib/libevent/event.h, - trunk/varnish-cache/contrib/libevent/event_rpcgen.py, - trunk/varnish-cache/contrib/libevent/event_tagging.c, - trunk/varnish-cache/contrib/libevent/http.c, - trunk/varnish-cache/contrib/libevent/http.h, - trunk/varnish-cache/contrib/libevent/kqueue.c, - trunk/varnish-cache/contrib/libevent/log.h, - trunk/varnish-cache/contrib/libevent/poll.c, - trunk/varnish-cache/contrib/libevent/rtsig.c, - trunk/varnish-cache/contrib/libevent/select.c, - trunk/varnish-cache/contrib/libevent/signal.c, - trunk/varnish-cache/contrib/libevent/strlcpy.c, - trunk/varnish-cache/contrib/libevent/test/Makefile.am, - trunk/varnish-cache/contrib/libevent/test/regress.c, - trunk/varnish-cache/contrib/libevent/test/regress.h, - trunk/varnish-cache/contrib/libevent/test/regress.rpc, - trunk/varnish-cache/contrib/libevent/test/regress_http.c, - trunk/varnish-cache/contrib/libevent/test/test-weof.c, - trunk/varnish-cache/contrib/libevent/test/test.sh: Update from - libevent CVS trunk. + * trunk/varnish-cache/contrib/libevent/Makefile.am, + trunk/varnish-cache/contrib/libevent/README, + trunk/varnish-cache/contrib/libevent/WIN32-Code/win32.c, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsp, + trunk/varnish-cache/contrib/libevent/buffer.c, + trunk/varnish-cache/contrib/libevent/configure.in, + trunk/varnish-cache/contrib/libevent/devpoll.c, + trunk/varnish-cache/contrib/libevent/epoll.c, + trunk/varnish-cache/contrib/libevent/evbuffer.c, + trunk/varnish-cache/contrib/libevent/event.3, + trunk/varnish-cache/contrib/libevent/event.c, + trunk/varnish-cache/contrib/libevent/event.h, + trunk/varnish-cache/contrib/libevent/event_rpcgen.py, + trunk/varnish-cache/contrib/libevent/event_tagging.c, + trunk/varnish-cache/contrib/libevent/http.c, + trunk/varnish-cache/contrib/libevent/http.h, + trunk/varnish-cache/contrib/libevent/kqueue.c, + trunk/varnish-cache/contrib/libevent/log.h, + trunk/varnish-cache/contrib/libevent/poll.c, + trunk/varnish-cache/contrib/libevent/rtsig.c, + trunk/varnish-cache/contrib/libevent/select.c, + trunk/varnish-cache/contrib/libevent/signal.c, + trunk/varnish-cache/contrib/libevent/strlcpy.c, + trunk/varnish-cache/contrib/libevent/test/Makefile.am, + trunk/varnish-cache/contrib/libevent/test/regress.c, + trunk/varnish-cache/contrib/libevent/test/regress.h, + trunk/varnish-cache/contrib/libevent/test/regress.rpc, + trunk/varnish-cache/contrib/libevent/test/regress_http.c, + trunk/varnish-cache/contrib/libevent/test/test-weof.c, + trunk/varnish-cache/contrib/libevent/test/test.sh: + Update from libevent CVS trunk. + 2006-04-03 11:05 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Segregate http - header fields into a separate structure, we will - reuse them a few places by the looks of it. - - Add VCA_UNKNOWNHDR (=10) fields for unknown HTTP headers. - If more headers arrive than that, they're lost (and logged as - such). + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Segregate http header fields into a separate structure, we will + reuse them a few places by the looks of it. + + Add VCA_UNKNOWNHDR (=10) fields for unknown HTTP headers. + If more headers arrive than that, they're lost (and logged as such). + 2006-04-03 11:03 phk - * trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cli_event.c, - trunk/varnish-cache/bin/varnishd/cli_event.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: How I wish people - would think more ahead when writing libraries like - libevent. The entire "implicit event engine" api assumption - stinks. - - Deal with it better. + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + How I wish people would think more ahead when writing libraries like + libevent. The entire "implicit event engine" api assumption stinks. + + Deal with it better. + 2006-04-03 09:02 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/bin/varnishd/cache_pipe.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/include/http_headers.h, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: A little step - for humanity but a big step for varnish: - - Implement pipe-through mode and see the first web-pages actually - pass through varnish. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_pipe.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + A little step for humanity but a big step for varnish: + + Implement pipe-through mode and see the first web-pages actually + pass through varnish. + 2006-04-03 07:27 phk - * trunk/varnish-cache/bin/varnishd/cache_vcl.c: Call the init - function when the VCL code is loaded. - We may want to postpone this to use time later on. + * trunk/varnish-cache/bin/varnishd/cache_vcl.c: + Call the init function when the VCL code is loaded. + We may want to postpone this to use time later on. + 2006-04-03 07:14 phk - * trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/include/http_headers.h, - trunk/varnish-cache/include/shmlog_tags.h, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add 5 dummy - fields to the http headers, we will need them subsequently. + * trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/include/http_headers.h, + trunk/varnish-cache/include/shmlog_tags.h, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Add 5 dummy fields to the http headers, we will need them subsequently. + 2006-03-31 08:27 phk - * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: Use - http_headers.h to define session fields for headers and to parse - them out of the header. + * trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: + Use http_headers.h to define session fields for headers and to parse + them out of the header. + 2006-03-31 08:26 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c: Add missing - pthread.h includes + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c: + Add missing pthread.h includes + 2006-03-31 08:25 phk - * trunk/varnish-cache/include/shmlog_tags.h: Use http_headers.h to - define HTTP header tags for logging + * trunk/varnish-cache/include/shmlog_tags.h: + Use http_headers.h to define HTTP header tags for logging + 2006-03-31 08:24 phk - * trunk/varnish-cache/include/http_headers.h: Reusable macro - definition of HTTP headers. We will need these - several different places in the sources. + * trunk/varnish-cache/include/http_headers.h: + Reusable macro definition of HTTP headers. We will need these + several different places in the sources. + 2006-03-30 11:16 phk - * trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: get us closer to a - connection to the backend + * trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + get us closer to a connection to the backend + 2006-03-30 10:56 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Rework the - compilation of backend specifications in order to be able - to check the provided hostname/portname at compile time. + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Rework the compilation of backend specifications in order to be able + to check the provided hostname/portname at compile time. + 2006-03-30 09:26 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_backend.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Add the - beginning of a backend connection pool + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_backend.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Add the beginning of a backend connection pool + 2006-03-30 08:05 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Promote the - poll mutex to be a session mutex so that we can use it - for the VCL reference as well, this saves locking operations. - - Call the atual VCL code when we get the request. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Promote the poll mutex to be a session mutex so that we can use it + for the VCL reference as well, this saves locking operations. + + Call the atual VCL code when we get the request. + 2006-03-30 07:05 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_pool.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/include/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Integrate the - VCL code closer in the cache process: The passed - argument will be the session structure. - - Add the pool of worker threads (cache_pool). With a unitary - nature - of the VCL code, the HTTP parsing can be postponed to the worker - thread. - - This actually helps us with CPU cache locality as it will reduce - the - amount of memory allocated on one CPU but freed on another. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_pool.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/include/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + Integrate the VCL code closer in the cache process: The passed + argument will be the session structure. + + Add the pool of worker threads (cache_pool). With a unitary nature + of the VCL code, the HTTP parsing can be postponed to the worker thread. + + This actually helps us with CPU cache locality as it will reduce the + amount of memory allocated on one CPU but freed on another. + 2006-03-27 14:12 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Add config.load, - config.inline and config.use commands. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Add config.load, config.inline and config.use commands. + 2006-03-27 14:11 phk - * trunk/varnish-cache/include/libvcl.h: Forgot to add this one. - Prototypes for the VCL compiler. + * trunk/varnish-cache/include/libvcl.h: + Forgot to add this one. Prototypes for the VCL compiler. + 2006-03-27 14:10 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: Add - VCL_CompileFile() function. + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + Add VCL_CompileFile() function. + 2006-03-27 13:59 phk - * trunk/varnish-cache/bin/varnishd/mgt_child.c: Just return if - there is nothing to wait for. We get SIGCHLD'ed on - the popen child process. + * trunk/varnish-cache/bin/varnishd/mgt_child.c: + Just return if there is nothing to wait for. We get SIGCHLD'ed on + the popen child process. + 2006-03-27 13:57 phk - * trunk/varnish-cache/include/cli_priv.h: Add a macro which we can - #ifdef + * trunk/varnish-cache/include/cli_priv.h: + Add a macro which we can #ifdef + 2006-03-27 12:27 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_vcl.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/varnishd.c: Build default VCL - from "-b backend_IP" option and pass it to client - via heritage. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_vcl.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Build default VCL from "-b backend_IP" option and pass it to client + via heritage. + 2006-03-27 11:51 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c: edge closer - towards being a nice member of society + * trunk/varnish-cache/lib/libvcl/vcl_compile.c: + edge closer towards being a nice member of society + 2006-03-27 11:22 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Experimentally pull - in VCL program + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Experimentally pull in VCL program + 2006-03-27 11:21 phk - * trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_priv.h: Actually generate a - shared object + * trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_priv.h: + Actually generate a shared object + 2006-03-27 11:21 phk - * trunk/varnish-cache/include/vcl_lang.h: Stuff VCL programs needs - to know about. + * trunk/varnish-cache/include/vcl_lang.h: + Stuff VCL programs needs to know about. + 2006-03-27 09:02 phk - * trunk/varnish-cache/configure.ac: add libvcl + * trunk/varnish-cache/configure.ac: + add libvcl + 2006-03-27 09:01 phk - * trunk/varnish-cache/lib/libvcl/Makefile, - trunk/varnish-cache/lib/libvcl/Makefile.am: Put under control of - auto* tools + * trunk/varnish-cache/lib/libvcl/Makefile, + trunk/varnish-cache/lib/libvcl/Makefile.am: + Put under control of auto* tools + 2006-03-27 09:01 phk - * trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: Newly - generated code + * trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c: + Newly generated code + 2006-03-27 09:00 phk - * trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: Don't - generate sparse array code. + * trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl: + Don't generate sparse array code. + 2006-03-24 10:46 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_httpd.c, - trunk/varnish-cache/include/shmlog_tags.h: More complete HTTP - parsing and logging. + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c, + trunk/varnish-cache/include/shmlog_tags.h: + More complete HTTP parsing and logging. + 2006-03-24 10:23 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_httpd.c: Change session - memory management to avoid pollution - - Add fledling httpd parsing + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_httpd.c: + Change session memory management to avoid pollution + + Add fledling httpd parsing + 2006-03-24 10:22 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_shmlog.c: Add a VSLR() - variant which logs a byte range without spending time in - sprintf + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c: + Add a VSLR() variant which logs a byte range without spending time in + sprintf + 2006-03-24 09:45 phk - * trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/include/shmlog_tags.h: Log remote IP#:port - on session open + * trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/include/shmlog_tags.h: + Log remote IP#:port on session open + 2006-03-24 09:14 phk - * trunk/varnish-cache/bin/varnishlog/varnishlog.c: put symbolic - names on the tags + * trunk/varnish-cache/bin/varnishlog/varnishlog.c: + put symbolic names on the tags + 2006-03-24 09:05 phk - * trunk/varnish-cache/bin/Makefile.am, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/bin/varnishlog, - trunk/varnish-cache/bin/varnishlog/Makefile.am, - trunk/varnish-cache/bin/varnishlog/varnishlog.c, - trunk/varnish-cache/configure.ac: Add a minimal log tailer. + * trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/bin/varnishlog, + trunk/varnish-cache/bin/varnishlog/Makefile.am, + trunk/varnish-cache/bin/varnishlog/varnishlog.c, + trunk/varnish-cache/configure.ac: + Add a minimal log tailer. + 2006-03-24 08:43 phk - * trunk/varnish-cache/include/cli.h, - trunk/varnish-cache/include/libvarnish.h, - trunk/varnish-cache/include/shmlog.h, - trunk/varnish-cache/include/shmlog_tags.h: Move the SHM tags - into a resuable .h file. - - Minor nits + * trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/include/shmlog.h, + trunk/varnish-cache/include/shmlog_tags.h: + Move the SHM tags into a resuable .h file. + + Minor nits + 2006-03-23 15:31 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cache_shmlog.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/varnishd.c: Add shared memory - log setup and stuffer function in the child process. - - Log whenever we get a CLI ping + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cache_shmlog.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Add shared memory log setup and stuffer function in the child process. + + Log whenever we get a CLI ping + 2006-03-23 12:20 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache.h, - trunk/varnish-cache/bin/varnishd/cache_acceptor.c, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/tcp.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Now we're starting - to get somewhere: Accept connections and assemble - a HTTP request. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache.h, + trunk/varnish-cache/bin/varnishd/cache_acceptor.c, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Now we're starting to get somewhere: Accept connections and assemble + a HTTP request. + 2006-03-23 08:45 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/tcp.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Open TCP sockets + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/tcp.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Open TCP sockets + 2006-03-17 13:41 phk - * trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cli_event.c, - trunk/varnish-cache/bin/varnishd/cli_event.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Make it possible to - suspend and resume a cli connection while we wait - for response from the child (or otherwise). - - Add a generic "pass-through" handler for cli requests we just - pass on - to the child. + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Make it possible to suspend and resume a cli connection while we wait + for response from the child (or otherwise). + + Add a generic "pass-through" handler for cli requests we just pass on + to the child. + 2006-03-17 10:03 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cli_event.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/mgt.h, - trunk/varnish-cache/bin/varnishd/mgt_child.c, - trunk/varnish-cache/bin/varnishd/varnishd.c: Add multiplexing - for the mgt->child cli connection and get ping/pong - working across it. - - The management process will now keep the child process watchdog - from - expiring. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/mgt.h, + trunk/varnish-cache/bin/varnishd/mgt_child.c, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Add multiplexing for the mgt->child cli connection and get ping/pong + working across it. + + The management process will now keep the child process watchdog from + expiring. + 2006-03-16 12:14 phk - * trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/cli_event.c, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/lib/libvarnish/argv.c, - trunk/varnish-cache/lib/libvarnish/cli.c: cleanup + * trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/lib/libvarnish/argv.c, + trunk/varnish-cache/lib/libvarnish/cli.c: + cleanup + 2006-03-16 10:48 phk - * trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/cache_main.c, - trunk/varnish-cache/bin/varnishd/heritage.h, - trunk/varnish-cache/bin/varnishd/varnishd.c: Expand the empty - shell a bit. - - Add CLI handler on stdin (for now, in production only if - debug is specified). - - Implement help, verbos, ping and start. - - start forks the child process, sets up listeners on its - stdout/stderr - (where nothing should arrive in production). - - Add SIGCHLD handler to reap and restart the child. - - Add shell "main" for the child: Set up a CLI handler on the - pipes - passed as heritage. - - Add ping command and keepalive timeout. + * trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/cache_main.c, + trunk/varnish-cache/bin/varnishd/heritage.h, + trunk/varnish-cache/bin/varnishd/varnishd.c: + Expand the empty shell a bit. + + Add CLI handler on stdin (for now, in production only if + debug is specified). + + Implement help, verbos, ping and start. + + start forks the child process, sets up listeners on its stdout/stderr + (where nothing should arrive in production). + + Add SIGCHLD handler to reap and restart the child. + + Add shell "main" for the child: Set up a CLI handler on the pipes + passed as heritage. + + Add ping command and keepalive timeout. + 2006-03-16 10:46 phk - * trunk/varnish-cache/bin/varnishd/cli_event.c, - trunk/varnish-cache/bin/varnishd/cli_event.h: Functions to - handle the CLI with event(3)'s buffer events. - - This may eventually belong in a library for wider use. + * trunk/varnish-cache/bin/varnishd/cli_event.c, + trunk/varnish-cache/bin/varnishd/cli_event.h: + Functions to handle the CLI with event(3)'s buffer events. + + This may eventually belong in a library for wider use. + 2006-03-16 09:02 phk - * trunk/varnish-cache/include/cli.h, - trunk/varnish-cache/include/cli_priv.h, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnish/cli.c, - trunk/varnish-cache/lib/libvcl/Makefile: Generic and public - stuff for CLI protocol handling. + * trunk/varnish-cache/include/cli.h, + trunk/varnish-cache/include/cli_priv.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/cli.c, + trunk/varnish-cache/lib/libvcl/Makefile: + Generic and public stuff for CLI protocol handling. + 2006-03-16 08:30 phk - * trunk/varnish-cache/include/cli.h: add min+max argument counts + * trunk/varnish-cache/include/cli.h: + add min+max argument counts + 2006-03-15 20:34 phk - * trunk/varnish-cache/include/cli.h: Add definitions pertaining to - the ascii-protocol which will be used - multiple different places in the varnish architecture. + * trunk/varnish-cache/include/cli.h: + Add definitions pertaining to the ascii-protocol which will be used + multiple different places in the varnish architecture. + 2006-03-14 12:54 des - * trunk/varnish-cache/contrib, - trunk/varnish-cache/contrib/libevent, - trunk/varnish-cache/contrib/libevent/Makefile.am, - trunk/varnish-cache/contrib/libevent/README, - trunk/varnish-cache/contrib/libevent/WIN32-Code, - trunk/varnish-cache/contrib/libevent/WIN32-Code/config.h, - trunk/varnish-cache/contrib/libevent/WIN32-Code/misc.c, - trunk/varnish-cache/contrib/libevent/WIN32-Code/misc.h, - trunk/varnish-cache/contrib/libevent/WIN32-Code/provos at badschwartau.provos.org.12766, - trunk/varnish-cache/contrib/libevent/WIN32-Code/win32.c, - trunk/varnish-cache/contrib/libevent/WIN32-Prj, - trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test, - trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test/event_test.dsp, - - trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test/test.txt, - trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsp, - trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsw, - trunk/varnish-cache/contrib/libevent/WIN32-Prj/signal_test, - trunk/varnish-cache/contrib/libevent/WIN32-Prj/signal_test/signal_test.dsp, - trunk/varnish-cache/contrib/libevent/WIN32-Prj/time_test, - trunk/varnish-cache/contrib/libevent/WIN32-Prj/time_test/time_test.dsp, - trunk/varnish-cache/contrib/libevent/acconfig.h, - trunk/varnish-cache/contrib/libevent/buffer.c, - trunk/varnish-cache/contrib/libevent/compat, - trunk/varnish-cache/contrib/libevent/compat/sys, - trunk/varnish-cache/contrib/libevent/compat/sys/_time.h, - trunk/varnish-cache/contrib/libevent/compat/sys/queue.h, - trunk/varnish-cache/contrib/libevent/compat/sys/tree.h, - trunk/varnish-cache/contrib/libevent/configure.in, - trunk/varnish-cache/contrib/libevent/devpoll.c, - trunk/varnish-cache/contrib/libevent/epoll.c, - trunk/varnish-cache/contrib/libevent/epoll_sub.c, - trunk/varnish-cache/contrib/libevent/evbuffer.c, - trunk/varnish-cache/contrib/libevent/event-internal.h, - trunk/varnish-cache/contrib/libevent/event.3, - trunk/varnish-cache/contrib/libevent/event.c, - trunk/varnish-cache/contrib/libevent/event.h, - trunk/varnish-cache/contrib/libevent/evsignal.h, - trunk/varnish-cache/contrib/libevent/kqueue.c, - trunk/varnish-cache/contrib/libevent/log.c, - trunk/varnish-cache/contrib/libevent/log.h, - trunk/varnish-cache/contrib/libevent/poll.c, - trunk/varnish-cache/contrib/libevent/rtsig.c, - trunk/varnish-cache/contrib/libevent/sample, - trunk/varnish-cache/contrib/libevent/sample/Makefile.am, - trunk/varnish-cache/contrib/libevent/sample/Makefile.in, - trunk/varnish-cache/contrib/libevent/sample/event-test.c, - trunk/varnish-cache/contrib/libevent/sample/signal-test.c, - trunk/varnish-cache/contrib/libevent/sample/time-test.c, - trunk/varnish-cache/contrib/libevent/select.c, - trunk/varnish-cache/contrib/libevent/signal.c, - trunk/varnish-cache/contrib/libevent/test, - trunk/varnish-cache/contrib/libevent/test/Makefile.am, - trunk/varnish-cache/contrib/libevent/test/Makefile.in, - trunk/varnish-cache/contrib/libevent/test/bench.c, - trunk/varnish-cache/contrib/libevent/test/regress.c, - trunk/varnish-cache/contrib/libevent/test/test-eof.c, - trunk/varnish-cache/contrib/libevent/test/test-init.c, - trunk/varnish-cache/contrib/libevent/test/test-time.c, - trunk/varnish-cache/contrib/libevent/test/test-weof.c, - trunk/varnish-cache/contrib/libevent/test/test.sh: Add Niels - Provos's libevent 1.1a. + * trunk/varnish-cache/contrib, trunk/varnish-cache/contrib/libevent, + trunk/varnish-cache/contrib/libevent/Makefile.am, + trunk/varnish-cache/contrib/libevent/README, + trunk/varnish-cache/contrib/libevent/WIN32-Code, + trunk/varnish-cache/contrib/libevent/WIN32-Code/config.h, + trunk/varnish-cache/contrib/libevent/WIN32-Code/misc.c, + trunk/varnish-cache/contrib/libevent/WIN32-Code/misc.h, + trunk/varnish-cache/contrib/libevent/WIN32-Code/provos at badschwartau.provos.org.12766, + trunk/varnish-cache/contrib/libevent/WIN32-Code/win32.c, + trunk/varnish-cache/contrib/libevent/WIN32-Prj, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test/event_test.dsp, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/event_test/test.txt, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsp, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/libevent.dsw, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/signal_test, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/signal_test/signal_test.dsp, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/time_test, + trunk/varnish-cache/contrib/libevent/WIN32-Prj/time_test/time_test.dsp, + trunk/varnish-cache/contrib/libevent/acconfig.h, + trunk/varnish-cache/contrib/libevent/buffer.c, + trunk/varnish-cache/contrib/libevent/compat, + trunk/varnish-cache/contrib/libevent/compat/sys, + trunk/varnish-cache/contrib/libevent/compat/sys/_time.h, + trunk/varnish-cache/contrib/libevent/compat/sys/queue.h, + trunk/varnish-cache/contrib/libevent/compat/sys/tree.h, + trunk/varnish-cache/contrib/libevent/configure.in, + trunk/varnish-cache/contrib/libevent/devpoll.c, + trunk/varnish-cache/contrib/libevent/epoll.c, + trunk/varnish-cache/contrib/libevent/epoll_sub.c, + trunk/varnish-cache/contrib/libevent/evbuffer.c, + trunk/varnish-cache/contrib/libevent/event-internal.h, + trunk/varnish-cache/contrib/libevent/event.3, + trunk/varnish-cache/contrib/libevent/event.c, + trunk/varnish-cache/contrib/libevent/event.h, + trunk/varnish-cache/contrib/libevent/evsignal.h, + trunk/varnish-cache/contrib/libevent/kqueue.c, + trunk/varnish-cache/contrib/libevent/log.c, + trunk/varnish-cache/contrib/libevent/log.h, + trunk/varnish-cache/contrib/libevent/poll.c, + trunk/varnish-cache/contrib/libevent/rtsig.c, + trunk/varnish-cache/contrib/libevent/sample, + trunk/varnish-cache/contrib/libevent/sample/Makefile.am, + trunk/varnish-cache/contrib/libevent/sample/Makefile.in, + trunk/varnish-cache/contrib/libevent/sample/event-test.c, + trunk/varnish-cache/contrib/libevent/sample/signal-test.c, + trunk/varnish-cache/contrib/libevent/sample/time-test.c, + trunk/varnish-cache/contrib/libevent/select.c, + trunk/varnish-cache/contrib/libevent/signal.c, + trunk/varnish-cache/contrib/libevent/test, + trunk/varnish-cache/contrib/libevent/test/Makefile.am, + trunk/varnish-cache/contrib/libevent/test/Makefile.in, + trunk/varnish-cache/contrib/libevent/test/bench.c, + trunk/varnish-cache/contrib/libevent/test/regress.c, + trunk/varnish-cache/contrib/libevent/test/test-eof.c, + trunk/varnish-cache/contrib/libevent/test/test-init.c, + trunk/varnish-cache/contrib/libevent/test/test-time.c, + trunk/varnish-cache/contrib/libevent/test/test-weof.c, + trunk/varnish-cache/contrib/libevent/test/test.sh: + Add Niels Provos's libevent 1.1a. + 2006-03-14 12:00 des - * trunk/varnish-cache/include/hash.h, - trunk/varnish-cache/include/libvarnish.h, - trunk/varnish-cache/include/queue.h, - trunk/varnish-cache/include/sbuf.h, - trunk/varnish-cache/include/tree.h: Set the correct property - (svn:keywords, not svn:keyword) + * trunk/varnish-cache/include/hash.h, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/include/queue.h, + trunk/varnish-cache/include/sbuf.h, trunk/varnish-cache/include/tree.h: + Set the correct property (svn:keywords, not svn:keyword) + 2006-03-14 11:57 des - * trunk/varnish-cache/lib/libsbuf/Makefile.am, - trunk/varnish-cache/lib/libsbuf/sbuf.3, - trunk/varnish-cache/lib/libsbuf/sbuf.c: Add a man page, and set - the correct property (svn:keywords, not svn:keyword) + * trunk/varnish-cache/lib/libsbuf/Makefile.am, + trunk/varnish-cache/lib/libsbuf/sbuf.3, + trunk/varnish-cache/lib/libsbuf/sbuf.c: + Add a man page, and set the correct property (svn:keywords, not + svn:keyword) + 2006-03-14 09:31 phk - * trunk/varnish-cache/bin/varnishd/varnishd.c: Add some trivial - bits while I think about the hard ones + * trunk/varnish-cache/bin/varnishd/varnishd.c: + Add some trivial bits while I think about the hard ones + 2006-03-14 09:15 phk - * trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/libvarnish.h, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnish/argv.c: Add a function to - break a command line like string into an argv[]. - This will be useful for the various text based protocols etc. + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/libvarnish.h, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnish/argv.c: + Add a function to break a command line like string into an argv[]. + This will be useful for the various text based protocols etc. + 2006-03-13 14:23 des - * trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/hash.h, - trunk/varnish-cache/include/queue.h, - trunk/varnish-cache/include/tree.h: Add hash.h, queue.h and - tree.h from NetBSD-CURRENT. + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/hash.h, + trunk/varnish-cache/include/queue.h, trunk/varnish-cache/include/tree.h: + Add hash.h, queue.h and tree.h from NetBSD-CURRENT. + 2006-03-13 14:14 des - * trunk/varnish-cache/configure.ac, - trunk/varnish-cache/include/sbuf.h, - trunk/varnish-cache/lib/Makefile.am, - trunk/varnish-cache/lib/libsbuf, - trunk/varnish-cache/lib/libsbuf/Makefile.am, - trunk/varnish-cache/lib/libsbuf/sbuf.c: Add libsbuf, based on - the latest sbuf code from FreeBSD-CURRENT. + * trunk/varnish-cache/configure.ac, trunk/varnish-cache/include/sbuf.h, + trunk/varnish-cache/lib/Makefile.am, trunk/varnish-cache/lib/libsbuf, + trunk/varnish-cache/lib/libsbuf/Makefile.am, + trunk/varnish-cache/lib/libsbuf/sbuf.c: + Add libsbuf, based on the latest sbuf code from FreeBSD-CURRENT. + 2006-03-13 13:30 phk - * trunk/varnish-cache/autogen.sh: Pick up the gnu-autotools binary - directory if we spot one. This - makes life on FreeBSD somewhat easier. + * trunk/varnish-cache/autogen.sh: + Pick up the gnu-autotools binary directory if we spot one. This + makes life on FreeBSD somewhat easier. + 2006-03-13 12:37 phk - * trunk/varnish-cache/lib/Makefile.am, - trunk/varnish-cache/lib/libvcl, - trunk/varnish-cache/lib/libvcl/Makefile, - trunk/varnish-cache/lib/libvcl/sample.vcl, - trunk/varnish-cache/lib/libvcl/vcl_compile.c, - trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, - trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, - trunk/varnish-cache/lib/libvcl/vcl_lang.h, - trunk/varnish-cache/lib/libvcl/vcl_priv.h, - trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: Add first cut - of VCL compiler to the tree. - - The Makefile is a temporary shim until I get the auto* stuff - working. - - The sample.vcl is a small mock-up to test the compiler. - - Some of the .h files needs to move other places in the fullness - of time. - - But other than that... + * trunk/varnish-cache/lib/Makefile.am, trunk/varnish-cache/lib/libvcl, + trunk/varnish-cache/lib/libvcl/Makefile, + trunk/varnish-cache/lib/libvcl/sample.vcl, + trunk/varnish-cache/lib/libvcl/vcl_compile.c, + trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c, + trunk/varnish-cache/lib/libvcl/vcl_gen_fixed_token.tcl, + trunk/varnish-cache/lib/libvcl/vcl_lang.h, + trunk/varnish-cache/lib/libvcl/vcl_priv.h, + trunk/varnish-cache/lib/libvcl/vcl_token_defs.h: + Add first cut of VCL compiler to the tree. + + The Makefile is a temporary shim until I get the auto* stuff working. + + The sample.vcl is a small mock-up to test the compiler. + + Some of the .h files needs to move other places in the fullness of time. + + But other than that... + 2006-03-02 10:32 des - * trunk/varnish-cache: Ignore generated files; generated with the - following command: - - svk propset svn:ignore "$(svk status | awk '/^\?/ { print $2 - }')" . + * trunk/varnish-cache: + Ignore generated files; generated with the following command: + + svk propset svn:ignore "$(svk status | awk '/^\?/ { print $2 }')" . + 2006-03-02 10:31 des - * trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/varnish, - trunk/varnish-cache/include/varnish/assert.h, - trunk/varnish-cache/include/varnishapi.h, - trunk/varnish-cache/lib/libvarnishapi/Makefile.am, - trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c, - trunk/varnish-cache/lib/libvarnishapi/varnish_log.c, - trunk/varnish-cache/lib/libvarnishapi/varnish_util.c: Untested & - undocumented login code. I don't have time to continue working - on it right now, but I want it in the tree so phk doesn't start - duplicating - my effort. + * trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/varnish, + trunk/varnish-cache/include/varnish/assert.h, + trunk/varnish-cache/include/varnishapi.h, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_log.c, + trunk/varnish-cache/lib/libvarnishapi/varnish_util.c: + Untested & undocumented login code. I don't have time to continue working + on it right now, but I want it in the tree so phk doesn't start duplicating + my effort. + 2006-03-02 10:29 des - * trunk/varnish-cache/bin/varnishd: Add varnishd to ignore list. + * trunk/varnish-cache/bin/varnishd: + Add varnishd to ignore list. + 2006-02-27 14:21 des - * trunk/varnish-cache/include: Ignore generated files. + * trunk/varnish-cache/include: + Ignore generated files. + 2006-02-27 14:21 des - * trunk/varnish-cache/lib, trunk/varnish-cache/lib/libvarnish, - trunk/varnish-cache/lib/libvarnishapi: Ignore generated files. + * trunk/varnish-cache/lib, trunk/varnish-cache/lib/libvarnish, + trunk/varnish-cache/lib/libvarnishapi: + Ignore generated files. + 2006-02-27 14:21 des - * trunk/varnish-cache/bin, trunk/varnish-cache/bin/varnishd: - Ignore generated files. + * trunk/varnish-cache/bin, trunk/varnish-cache/bin/varnishd: + Ignore generated files. + 2006-02-27 11:10 des - * trunk/varnish-cache/autogen.sh, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnishapi/Makefile.am: Correct - libtool idiom: run libtoolize after aclocal, and use LTLIBRARIES - instead of LIBRARIES. + * trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am: + Correct libtool idiom: run libtoolize after aclocal, and use LTLIBRARIES + instead of LIBRARIES. + 2006-02-27 09:55 des - * trunk/varnish-cache/LICENSE: Don't forget the license! + * trunk/varnish-cache/LICENSE: + Don't forget the license! + 2006-02-24 14:35 des - * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, - trunk/varnish-cache/bin, trunk/varnish-cache/bin/Makefile.am, - trunk/varnish-cache/bin/varnishd, - trunk/varnish-cache/bin/varnishd/Makefile.am, - trunk/varnish-cache/bin/varnishd/varnishd.c, - trunk/varnish-cache/configure.ac, trunk/varnish-cache/include, - trunk/varnish-cache/include/Makefile.am, - trunk/varnish-cache/include/varnishapi.h, - trunk/varnish-cache/lib, trunk/varnish-cache/lib/Makefile.am, - trunk/varnish-cache/lib/libvarnish, - trunk/varnish-cache/lib/libvarnish/Makefile.am, - trunk/varnish-cache/lib/libvarnishapi, - trunk/varnish-cache/lib/libvarnishapi/Makefile.am: Source tree - structure as agreed. + * trunk/varnish-cache/Makefile.am, trunk/varnish-cache/autogen.sh, + trunk/varnish-cache/bin, trunk/varnish-cache/bin/Makefile.am, + trunk/varnish-cache/bin/varnishd, + trunk/varnish-cache/bin/varnishd/Makefile.am, + trunk/varnish-cache/bin/varnishd/varnishd.c, + trunk/varnish-cache/configure.ac, trunk/varnish-cache/include, + trunk/varnish-cache/include/Makefile.am, + trunk/varnish-cache/include/varnishapi.h, trunk/varnish-cache/lib, + trunk/varnish-cache/lib/Makefile.am, + trunk/varnish-cache/lib/libvarnish, + trunk/varnish-cache/lib/libvarnish/Makefile.am, + trunk/varnish-cache/lib/libvarnishapi, + trunk/varnish-cache/lib/libvarnishapi/Makefile.am: + Source tree structure as agreed. + 2006-02-22 14:31 des - * trunk/varnish-cache, trunk/varnish-doc, trunk/varnish-proto, - trunk/varnish-tools: Additional subdivisions. + * trunk/varnish-cache, trunk/varnish-doc, trunk/varnish-proto, + trunk/varnish-tools: + Additional subdivisions. + Added: branches/0.9/varnish-cache/INSTALL =================================================================== --- branches/0.9/varnish-cache/INSTALL 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/INSTALL 2006-08-11 09:12:12 UTC (rev 805) @@ -0,0 +1,15 @@ + + Installation Instructions + + +Varnish uses the GNU autotools. To build and install Varnish, simply +run the 'configure' script in the top-level directory, then run 'make' +and 'make install'. + +Additional 'configure' options of interest: + + --enable-developer-warnings + enable strict warnings (default is NO) + --enable-debugging-symbols + enable debugging symbols (default is NO) + --enable-werror use -Werror (default is NO) Modified: branches/0.9/varnish-cache/Makefile.am =================================================================== --- branches/0.9/varnish-cache/Makefile.am 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/Makefile.am 2006-08-11 09:12:12 UTC (rev 805) @@ -1,3 +1,5 @@ # $Id$ SUBDIRS = include lib bin + +EXTRA_DIST = LICENSE autogen.sh Added: branches/0.9/varnish-cache/README =================================================================== --- branches/0.9/varnish-cache/README 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/README 2006-08-11 09:12:12 UTC (rev 805) @@ -0,0 +1,14 @@ + +This is an alpha release of the Varnish high-performance HTTP +accelerator. + +Please read the following web page before trying out Varnish: + + http://varnish.projects.linpro.no/wiki/AlphaReadme + +Technical questions about Varnish and this release should be addressed +to . + +For more information about the project, see: + + http://varnish.projects.linpro.no/wiki Modified: branches/0.9/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- branches/0.9/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-11 09:12:12 UTC (rev 805) @@ -30,7 +30,9 @@ #include #include +#ifndef HAVE_SRANDOMDEV #include "compat/srandomdev.h" +#endif #include "heritage.h" #include "shmlog.h" @@ -422,7 +424,6 @@ static void * vca_main(void *arg) { - unsigned u; struct kevent ke; int i; struct sess *sp; Modified: branches/0.9/varnish-cache/bin/varnishd/cache_pass.c =================================================================== --- branches/0.9/varnish-cache/bin/varnishd/cache_pass.c 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/bin/varnishd/cache_pass.c 2006-08-11 09:12:12 UTC (rev 805) @@ -118,8 +118,8 @@ sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, p, j); WRK_Flush(sp->wrk); p += j; + assert(u >= j); u -= j; - assert(u >= 0); if (u == 0) break; p = bp = buf; Modified: branches/0.9/varnish-cache/bin/varnishd/flint.lnt =================================================================== --- branches/0.9/varnish-cache/bin/varnishd/flint.lnt 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/bin/varnishd/flint.lnt 2006-08-11 09:12:12 UTC (rev 805) @@ -2,6 +2,8 @@ +libh mgt_event.h +-header(../../config.h) + // Fix strchr() semtics, it can only return NULL if arg2 != 0 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) Modified: branches/0.9/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- branches/0.9/varnish-cache/bin/varnishd/mgt_child.c 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/bin/varnishd/mgt_child.c 2006-08-11 09:12:12 UTC (rev 805) @@ -17,7 +17,9 @@ #include /* XXX */ +#ifndef HAVE_SETPROCTITLE #include "compat/setproctitle.h" +#endif #include "heritage.h" #include "mgt.h" Modified: branches/0.9/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- branches/0.9/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-11 09:12:12 UTC (rev 805) @@ -13,7 +13,10 @@ #include #include +#ifndef HAVE_VASPRINTF #include "compat/vasprintf.h" +#endif + #include "cli_priv.h" #include "cli.h" #include "vsb.h" @@ -263,7 +266,7 @@ if (p == NULL) return (0); *p = '\0'; -fprintf(stderr, "CLI <%s>\n", cp->buf); + fprintf(stderr, "CLI <%s>\n", cp->buf); vsb_clear(cp->cli->sb); cli_dispatch(cp->cli, cli_proto, cp->buf); vsb_finish(cp->cli->sb); Modified: branches/0.9/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- branches/0.9/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-11 09:12:12 UTC (rev 805) @@ -11,7 +11,9 @@ #include #include +#ifndef HAVE_ASPRINTF #include "compat/asprintf.h" +#endif #include "vsb.h" #include "queue.h" Modified: branches/0.9/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- branches/0.9/varnish-cache/bin/varnishd/storage_file.c 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/bin/varnishd/storage_file.c 2006-08-11 09:12:12 UTC (rev 805) @@ -23,7 +23,9 @@ #include #include +#ifndef HAVE_ASPRINTF #include "compat/asprintf.h" +#endif #include "shmlog.h" #include "cache.h" Modified: branches/0.9/varnish-cache/bin/varnishd/tcp.c =================================================================== --- branches/0.9/varnish-cache/bin/varnishd/tcp.c 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/bin/varnishd/tcp.c 2006-08-11 09:12:12 UTC (rev 805) @@ -13,7 +13,9 @@ #include #include +#ifndef HAVE_STRLCPY #include "compat/strlcpy.h" +#endif #include "heritage.h" #include "mgt.h" @@ -67,34 +69,38 @@ } #endif -int -open_tcp(const char *port) +static int +try_sock(int family, const char *port, struct addrinfo **resp) { struct addrinfo hints, *res; - int ret, sd, val; + int ret, sd; memset(&hints, 0, sizeof hints); - hints.ai_family = AF_INET6; + hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; - if ((ret = getaddrinfo(NULL, port, &hints, &res)) != 0) { - fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret)); + ret = getaddrinfo(NULL, port, &hints, &res); + if (ret != 0) return (-1); - } - sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (sd < 0 && errno == EPROTONOSUPPORT) { + if (sd < 0) freeaddrinfo(res); - hints.ai_family = AF_INET; - if ((ret = getaddrinfo(NULL, port, &hints, &res)) != 0) { - fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret)); - return (-1); - } - sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - } + else + *resp = res; + return (sd); +} + +int +open_tcp(const char *port) +{ + int sd, val; + struct addrinfo *res; + + sd = try_sock(AF_INET6, port, &res); + if (sd < 0) + sd = try_sock(AF_INET, port, &res); if (sd < 0) { - perror("socket()"); - freeaddrinfo(res); + fprintf(stderr, "Failed to get listening socket\n"); return (-1); } val = 1; @@ -127,6 +133,7 @@ #ifdef HAVE_ACCEPT_FILTERS accept_filter(sd); #endif + freeaddrinfo(res); heritage.socket = sd; return (0); } Modified: branches/0.9/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- branches/0.9/varnish-cache/bin/varnishd/varnishd.c 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/bin/varnishd/varnishd.c 2006-08-11 09:12:12 UTC (rev 805) @@ -397,7 +397,8 @@ * but do not answer. That, on the other hand, would eliminate the * possibility of doing a "no-glitch" restart of the child process. */ - open_tcp(portnumber); + if (open_tcp(portnumber)) + exit (2); VSL_MgtInit(SHMLOG_FILENAME, 8*1024*1024); Modified: branches/0.9/varnish-cache/configure.ac =================================================================== --- branches/0.9/varnish-cache/configure.ac 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/configure.ac 2006-08-11 09:12:12 UTC (rev 805) @@ -3,7 +3,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [0.9], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [0.9.1], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) Modified: branches/0.9/varnish-cache/include/http_headers.h =================================================================== --- branches/0.9/varnish-cache/include/http_headers.h 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/include/http_headers.h 2006-08-11 09:12:12 UTC (rev 805) @@ -34,7 +34,7 @@ HTTPH("Age", H_Age, 2, 0, 0, 0, 0) /* RFC2616 14.6 */ HTTPH("Allow", H_Allow, 2, 0, 0, 0, 0) /* RFC2616 14.7 */ HTTPH("Authorization", H_Authorization, 1, 0, 0, 0, 0) /* RFC2616 14.8 */ -HTTPH("Cache-Control", H_Cache_Control, 3, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.9 */ +HTTPH("Cache-Control", H_Cache_Control, 3, 3, HTTPH_R_PASS|HTTPH_R_FETCH, 0, 0) /* RFC2616 14.9 */ HTTPH("Connection", H_Connection, 3, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.10 */ HTTPH("Content-Encoding", H_Content_Encoding, 2, 0, 0, 0, 0) /* RFC2616 14.11 */ HTTPH("Content-Langugae", H_Content_Language, 2, 0, 0, 0, 0) /* RFC2616 14.12 */ Modified: branches/0.9/varnish-cache/lib/libcompat/Makefile.am =================================================================== --- branches/0.9/varnish-cache/lib/libcompat/Makefile.am 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/lib/libcompat/Makefile.am 2006-08-11 09:12:12 UTC (rev 805) @@ -2,7 +2,7 @@ INCLUDES = -I$(top_srcdir)/include -lib_LIBRARIES = libcompat.a +noinst_LIBRARIES = libcompat.a libcompat_a_SOURCES = \ asprintf.c \ Added: branches/0.9/varnish-cache/svn2cl.xsl =================================================================== --- branches/0.9/varnish-cache/svn2cl.xsl 2006-08-11 08:41:23 UTC (rev 804) +++ branches/0.9/varnish-cache/svn2cl.xsl 2006-08-11 09:12:12 UTC (rev 805) @@ -0,0 +1,405 @@ + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &newl; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &newl; + + + + + &space;&space; + + + + &newl; + &newl; + + + + + + + &newl; + + + + + &space;&space; + + + + &newl;&newl; + + + + + + :&space; + + + + + [r + + ]&space; + + + + + + + &newl; + + + + + + + &newl; + + &space;*&space; + + + + + &newl;&space;&space;&space; + + + + + + + + + + + + + &space; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ,&space; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + &space;&space;&space; + + + + + + + + + + &newl; + + + + + + + + + + + + + + + + + + &newl;&space;&space;&space; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &newl;&newl; + + + + + + + + + + + + + + + + + From des at projects.linpro.no Fri Aug 11 09:16:29 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 11:16:29 +0200 (CEST) Subject: r806 - tags Message-ID: <20060811091629.3B3A51EC803@projects.linpro.no> Author: des Date: 2006-08-11 11:16:29 +0200 (Fri, 11 Aug 2006) New Revision: 806 Added: tags/varnish-0.9.1/ Log: This is what was released as varnish-0.9.1. Copied: tags/varnish-0.9.1 (from rev 805, branches/0.9/varnish-cache) From andersb at projects.linpro.no Fri Aug 11 10:17:19 2006 From: andersb at projects.linpro.no (andersb at projects.linpro.no) Date: Fri, 11 Aug 2006 12:17:19 +0200 (CEST) Subject: r807 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20060811101719.03A4E1EC695@projects.linpro.no> Author: andersb Date: 2006-08-11 12:17:19 +0200 (Fri, 11 Aug 2006) New Revision: 807 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: More meat, and even more debug code. I am free()'ing stuff that does not exsist. Strugling with the pointers and strings, since they obviously are "bleeding" from one to another. I take that as a clear sign of not allocating and freeing right. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-11 09:16:29 UTC (rev 806) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-08-11 10:17:19 UTC (rev 807) @@ -43,6 +43,8 @@ unsigned char *df_s; // Datafield for %s, Status unsigned char *df_b; // Datafield for %b, Bytes struct tm *logline_time; // Datafield for %t + unsigned char *df_R; // Datafield for %{Referer}i + unsigned char *df_U; // Datafield for %{User-agent}i }; /* We make a array of pointers to vsb's. Sbuf is a string buffer. @@ -85,14 +87,15 @@ int j; // Used for requesttime. - char *tmpPtra; - char *tmpPtrb; - char *tmpPtrc; + char *tmpPtra = NULL; + char *tmpPtrb = NULL; + char *tmpPtrc = NULL; int timesec = 0; // Where we store the utime for request as int. char temp_time[27]; // Where we store the string we take from the log time_t req_time; // Timeobject used for making the requesttime. int i; + u = (p[2] << 8) | p[3]; if (ob[u] == NULL) { ob[u] = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); @@ -175,7 +178,19 @@ break; case SLT_RxHeader: - + /* + if (p[1] >= 11 && !strncasecmp((void *)&p[4], "user-agent:",11)){ + ll[u].df_U = strdup(p + 4); + } + if (p[1] >= 8 && !strncasecmp((void *)&p[4], "referer:",8)){ + ll[u].df_R = strdup(p + 4); + } + else if (ll[u].df_R == NULL){ + ll[u].df_R = strdup(p + 4); + ll[u].df_R[0] = '-'; + ll[u].df_R[1] = '\0'; + } + */ break; @@ -183,14 +198,15 @@ // We use ReqServTime to find how the time the request was delivered // also to define that a request is finished. - + /* tmpPtra = strdup(p + 4); + tmpPtrb = malloc(strlen(p + 4)); + tmpPtrc = malloc(strlen(p + 4)); temp_time[0] = '\0'; for ( tmpPtrb = strtok(tmpPtra," "); tmpPtrb != NULL; tmpPtrb = strtok(NULL, " ")){ if (i == 1){ // We have the right time - free(tmpPtra); tmpPtra = tmpPtrb; } //printf("ReqServTime number %d: %s\n", i, tmpPtrb); @@ -207,7 +223,7 @@ req_time = timesec; ll[u].logline_time = localtime(&req_time); strftime (temp_time, 50, "[%d/%b/%Y:%X %z] ", ll[u].logline_time); - + */ ll[u].df_rfini = 1; printf("ReqServTime [%d]\n", u); @@ -218,12 +234,13 @@ // XXX ask DES or PHK about this one. Am I overflowing? ll[u].df_b = strdup(p + 4); + /* if (!atoi(ll[u].df_b)){ ll[u].df_b[0] = '-'; ll[u].df_b[1] = '\0'; } + */ - break; case SLT_SessionClose: @@ -269,28 +286,64 @@ if (ll[u].df_rfini) { // We have a ReqServTime. Lets print the logline // and clear variables that are different for each request. - - printf("[%d] %s - - %s ", u, ll[u].df_h, temp_time ); + // + + if (ll[u].df_h[0] == '\0'){ + printf("Tom IP \n"); + } + else{ + printf("[%d] %s - - ", u, ll[u].df_h ); + vsb_finish(ob[u]); + printf("\"%s\"", vsb_data(ob[u])); + printf(" %s %s \"%s\" \"%s\"", ll[u].df_s, ll[u].df_b, ll[u].df_R, ll[u].df_U); + printf("\n"); + } + vsb_finish(ob[u]); - printf("\"%s\"", vsb_data(ob[u])); - printf(" %s %s ", ll[u].df_s, ll[u].df_b); - printf("\n"); - vsb_clear(ob[u]); - + vsb_clear(ob[u]); ll[u].df_rfini = 0; // Clear the TxStaus if (ll[u].df_s != NULL){ free(ll[u].df_s); - printf("Freed df_s\n"); + printf("Freed df_s [%d]\n", u); } if (ll[u].df_b != NULL){ free(ll[u].df_b); - printf("Freed df_b\n"); + printf("Freed df_b [%d]\n", u); } + // Clean User-Agent and Referer + if (ll[u].df_U != NULL){ + free(ll[u].df_U); + printf("Freed df_U [%d]\n", u); + } + + if (ll[u].df_R != NULL){ + free(ll[u].df_R); + printf("Freed df_R [%d]\n", u); + } + + // Clean up ReqEnd/Time variables + + if (tmpPtra != NULL){ + free(tmpPtra); + printf("Freed tmpPtra [%d]\n", u); + } + + if (tmpPtrb != NULL){ + free(tmpPtrb); + printf("Freed tmpPtrb [%d]\n", u); + } + if (tmpPtrc != NULL){ + free(tmpPtrc); + printf("Freed tmpPtrc [%d]\n", u); + } + temp_time[0] = '\0'; + + if (ll[u].df_hfini) { // We have a SessionClose. Lets clean data. // From phk at projects.linpro.no Fri Aug 11 10:20:06 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 12:20:06 +0200 (CEST) Subject: r808 - trunk/varnish-cache/lib/libvcl Message-ID: <20060811102006.117F21EC7E3@projects.linpro.no> Author: phk Date: 2006-08-11 12:20:05 +0200 (Fri, 11 Aug 2006) New Revision: 808 Modified: trunk/varnish-cache/lib/libvcl/flint.lnt Log: Improve flexelint setup Modified: trunk/varnish-cache/lib/libvcl/flint.lnt =================================================================== --- trunk/varnish-cache/lib/libvcl/flint.lnt 2006-08-11 10:17:19 UTC (rev 807) +++ trunk/varnish-cache/lib/libvcl/flint.lnt 2006-08-11 10:20:05 UTC (rev 808) @@ -6,6 +6,13 @@ -printf_code( ju, long long unsigned) -printf_code( jx, long long unsigned) +-header(../../config.h) +-sem(lbv_assert, r_no) +-sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) + +-ffc // No automatic custody + + -e763 // Redundant declaration for symbol '...' previously declared From phk at projects.linpro.no Fri Aug 11 10:47:40 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 12:47:40 +0200 (CEST) Subject: r809 - trunk/varnish-cache/lib/libvcl Message-ID: <20060811104740.812EB1EC80A@projects.linpro.no> Author: phk Date: 2006-08-11 12:47:40 +0200 (Fri, 11 Aug 2006) New Revision: 809 Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h trunk/varnish-cache/lib/libvcl/vcc_token.c Log: Don't recognize '\' as magic in CSTR tokens, use %xx escapes instead. Add decoded string element to struct token. Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.h 2006-08-11 10:20:05 UTC (rev 808) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.h 2006-08-11 10:47:40 UTC (rev 809) @@ -13,6 +13,7 @@ const char *e; TAILQ_ENTRY(token) list; unsigned cnt; + char *dec; }; struct tokenlist { Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-11 10:20:05 UTC (rev 808) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-11 10:47:40 UTC (rev 809) @@ -164,6 +164,59 @@ } /*-------------------------------------------------------------------- + * Decode %xx in a string + */ + +static int +vcc_xdig(const char c) +{ + static const char *xdigit = + "0123456789abcdef" + "0123456789ABCDEF"; + const char *p; + + p = strchr(xdigit, c); + assert(p != NULL); + return ((p - xdigit) % 16); +} + +static int +vcc_decstr(struct tokenlist *tl) +{ + const char *p; + char *q; + + assert(tl->t->tok == CSTR); + tl->t->dec = malloc((tl->t->e - tl->t->b) - 1); + assert(tl->t->dec != NULL); + q = tl->t->dec; + for (p = tl->t->b + 1; p < tl->t->e - 1; ) { + if (*p != '%') { + *q++ = *p++; + continue; + } + if (p + 4 > tl->t->e) { + vcc_AddToken(tl, CSTR, p, tl->t->e); + vsb_printf(tl->sb, + "Incomplete %%xx escape\n"); + vcc_ErrWhere(tl, tl->t); + return(1); + } + if (!isxdigit(p[1]) || !isxdigit(p[2])) { + vcc_AddToken(tl, CSTR, p, p + 3); + vsb_printf(tl->sb, + "Illegal hex char in %%xx escape\n"); + vcc_ErrWhere(tl, tl->t); + return(1); + } + *q++ = vcc_xdig(p[1]) * 16 + vcc_xdig(p[2]); + p += 3; + } + *q++ = '\0'; + return (0); +} + +/*-------------------------------------------------------------------- * Add a token to the token list. */ @@ -235,16 +288,21 @@ /* Match strings, with \\ and \" escapes */ if (*p == '"') { for (q = p + 1; q < e; q++) { - if (*q == '\\' && q[1] == '\\') + if (*q == '"') { q++; - else if (*q == '\\' && q[1] == '"') - q++; - else if (*q == '"') { - q++; break; } + if (*q == '\r' || *q == '\n') { + vcc_AddToken(tl, EOI, p, q); + vsb_printf(tl->sb, + "Unterminated string at\n"); + vcc_ErrWhere(tl, tl->t); + return; + } } vcc_AddToken(tl, CSTR, p, q); + if (vcc_decstr(tl)) + return; p = q; continue; } From phk at projects.linpro.no Fri Aug 11 11:22:33 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 13:22:33 +0200 (CEST) Subject: r810 - trunk/varnish-cache/lib/libvcl Message-ID: <20060811112233.295841EC80B@projects.linpro.no> Author: phk Date: 2006-08-11 13:22:33 +0200 (Fri, 11 Aug 2006) New Revision: 810 Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c Log: Until we know of a legitimate use for them, consider non !isgraph() %xx escapes an error. Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-11 10:47:40 UTC (rev 809) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2006-08-11 11:22:33 UTC (rev 810) @@ -185,6 +185,7 @@ { const char *p; char *q; + unsigned char u; assert(tl->t->tok == CSTR); tl->t->dec = malloc((tl->t->e - tl->t->b) - 1); @@ -209,7 +210,15 @@ vcc_ErrWhere(tl, tl->t); return(1); } - *q++ = vcc_xdig(p[1]) * 16 + vcc_xdig(p[2]); + u = vcc_xdig(p[1]) * 16 + vcc_xdig(p[2]); + if (!isgraph(u)) { + vcc_AddToken(tl, CSTR, p, p + 3); + vsb_printf(tl->sb, + "Control character in %%xx escape\n"); + vcc_ErrWhere(tl, tl->t); + return(1); + } + *q++ = u; p += 3; } *q++ = '\0'; From phk at projects.linpro.no Fri Aug 11 11:23:12 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 13:23:12 +0200 (CEST) Subject: r811 - trunk/varnish-cache/lib/libvcl Message-ID: <20060811112312.B9A111EC80C@projects.linpro.no> Author: phk Date: 2006-08-11 13:23:12 +0200 (Fri, 11 Aug 2006) New Revision: 811 Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_compile.h Log: Use the already decoded CSTR where applicable and use EncString() to encode strings for C source usage. Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2006-08-11 11:22:33 UTC (rev 810) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2006-08-11 11:23:12 UTC (rev 811) @@ -53,7 +53,6 @@ { unsigned mask, para, not; struct token *t, *an; - char *p; vcc_NextToken(tl); @@ -93,14 +92,16 @@ ExpectErr(tl, CNUM); mask = UintVal(tl); } - Fc(tl, 1, "{ %u, %u, %u, %.*s, \"", not, mask, para, PF(t)); + Fc(tl, 1, "{ %u, %u, %u, ", not, mask, para); + EncString(tl->fc, t); + Fc(tl, 0, ", \""); if (para) Fc(tl, 0, "("); if (not) Fc(tl, 0, "!"); - p = EncString(t); - Fc(tl, 0, "%s", p); - free(p); + Fc(tl, 0, "\\\"\" "); + EncString(tl->fc, t); + Fc(tl, 0, " \"\\\""); if (mask) Fc(tl, 0, "/%u", mask); if (para) Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-11 11:22:33 UTC (rev 810) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-11 11:23:12 UTC (rev 811) @@ -142,53 +142,22 @@ /*--------------------------------------------------------------------*/ -char * -EncString(struct token *t) +void +EncString(struct vsb *sb, struct token *t) { - char *p, *q; - const char *r; - unsigned u; + const char *p; assert(t->tok == CSTR); - p = malloc(t->e - t->b); - assert(p != NULL); - q = p; - for (r = t->b + 1; r < t->e - 1; ) { - if (*r != '\\') { - *q++ = *r++; - continue; - } - switch (r[1]) { - case 'n': *q++ = '\n'; r += 2; break; - case 'r': *q++ = '\r'; r += 2; break; - case 'v': *q++ = '\v'; r += 2; break; - case 'f': *q++ = '\f'; r += 2; break; - case 't': *q++ = '\t'; r += 2; break; - case 'b': *q++ = '\b'; r += 2; break; - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - u = r[1] - '0'; - r += 2; - if (isdigit(r[0]) && (r[0] - '0') < 8) { - u <<= 3; - u |= r[0] - '0'; - r++; - if (isdigit(r[0]) && (r[0] - '0') < 8) { - u <<= 3; - u |= r[0] - '0'; - r++; - } - } - *q++ = u; - break; - default: - *q++ = r[1]; - r += 2; - break; - } + vsb_cat(sb, "\""); + for (p = t->dec; *p != '\0'; p++) { + if (*p == '\\' || *p == '"') + vsb_printf(sb, "\\%c", *p); + else if (isgraph(*p)) + vsb_printf(sb, "%c", *p); + else + vsb_printf(sb, "\\%03o", *p); } - *q = '\0'; - return (p); + vsb_cat(sb, "\""); } /*--------------------------------------------------------------------*/ @@ -492,19 +461,20 @@ static void vcc_re(struct tokenlist *tl, const char *str, struct token *re) { - char buf[32], *p; + char buf[32]; - p = EncString(re); - if (VRT_re_test(tl->sb, p)) { + assert(re->tok == CSTR); + if (VRT_re_test(tl->sb, re->dec)) { vcc_ErrWhere(tl, re); return; } - free(p); sprintf(buf, "VGC_re_%u", tl->recnt++); Fc(tl, 1, "VRT_re_match(%s, %s)\n", str, buf); Fh(tl, 0, "void *%s;\n", buf); - Fi(tl, 0, "\tVRT_re_init(&%s, %.*s);\n", buf, PF(re)); + Fi(tl, 0, "\tVRT_re_init(&%s, ",buf); + EncString(tl->fi, re); + Fi(tl, 0, ");\n"); Ff(tl, 0, "\tVRT_re_fini(%s);\n", buf); } @@ -528,7 +498,8 @@ tl->t->tok == T_EQ ? "!" : "", vp->rname); vcc_NextToken(tl); ExpectErr(tl, CSTR); - Fc(tl, 0, "%.*s)\n", PF(tl->t)); + EncString(tl->fc, tl->t); + Fc(tl, 0, ")\n"); vcc_NextToken(tl); break; default: @@ -931,8 +902,6 @@ struct token *t_be = NULL; struct token *t_host = NULL; struct token *t_port = NULL; - char *host = NULL; - char *port = NULL; const char *ep; vcc_NextToken(tl); @@ -969,13 +938,17 @@ case HOSTNAME: ExpectErr(tl, CSTR); t_host = tl->t; - Fc(tl, 1, "\t%s %.*s);\n", vp->lname, PF(tl->t)); + Fc(tl, 1, "\t%s ", vp->lname); + EncString(tl->fc, t_host); + Fc(tl, 0, ");\n"); vcc_NextToken(tl); break; case PORTNAME: ExpectErr(tl, CSTR); t_port = tl->t; - Fc(tl, 1, "\t%s %.*s);\n", vp->lname, PF(tl->t)); + Fc(tl, 1, "\t%s ", vp->lname); + EncString(tl->fc, t_port); + Fc(tl, 0, ");\n"); vcc_NextToken(tl); break; default: @@ -994,18 +967,17 @@ vcc_ErrWhere(tl, tl->t); return; } - host = EncString(t_host); - ep = CheckHostPort(host, "80"); + ep = CheckHostPort(t_host->dec, "80"); if (ep != NULL) { vsb_printf(tl->sb, "Backend '%.*s': %s\n", PF(t_be), ep); vcc_ErrWhere(tl, t_host); return; } if (t_port != NULL) { - port = EncString(t_port); - ep = CheckHostPort(host, port); + ep = CheckHostPort(t_host->dec, t_port->dec); if (ep != NULL) { - vsb_printf(tl->sb, "Backend '%.*s': %s\n", PF(t_be), ep); + vsb_printf(tl->sb, + "Backend '%.*s': %s\n", PF(t_be), ep); vcc_ErrWhere(tl, t_port); return; } Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.h 2006-08-11 11:22:33 UTC (rev 810) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.h 2006-08-11 11:23:12 UTC (rev 811) @@ -111,7 +111,7 @@ unsigned UintVal(struct tokenlist *tl); void AddDef(struct tokenlist *tl, struct token *t, enum ref_type type); void AddRef(struct tokenlist *tl, struct token *t, enum ref_type type); -char *EncString(struct token *t); +void EncString(struct vsb *sb, struct token *t); /* vcc_obj.c */ From phk at projects.linpro.no Fri Aug 11 13:41:28 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 15:41:28 +0200 (CEST) Subject: r812 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811134128.7336A3BC1AD@projects.linpro.no> Author: phk Date: 2006-08-11 15:41:28 +0200 (Fri, 11 Aug 2006) New Revision: 812 Modified: trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/tcp.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: Add -T option. Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-11 11:23:12 UTC (rev 811) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-11 13:41:28 UTC (rev 812) @@ -10,7 +10,7 @@ extern struct evbase *mgt_evb; /* mgt_child.c */ -void mgt_run(int dflag); +void mgt_run(int dflag, const char *Tflag); extern pid_t mgt_pid, child_pid; /* mgt_cli.c */ @@ -20,6 +20,7 @@ int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...); void mgt_cli_start_child(int fdi, int fdo); void mgt_cli_stop_child(void); +int mgt_cli_telnet(const char *port); /* mgt_vcc.c */ void mgt_vcc_init(void); @@ -27,7 +28,7 @@ int mgt_push_vcls_and_start(unsigned *status, char **p); /* tcp.c */ -int open_tcp(const char *port); +int open_tcp(const char *port, int http); #include "stevedore.h" Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-11 11:23:12 UTC (rev 811) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-11 13:41:28 UTC (rev 812) @@ -276,7 +276,7 @@ */ void -mgt_run(int dflag) +mgt_run(int dflag, const char *Tflag) { struct sigaction sac; struct ev *e; @@ -290,6 +290,9 @@ if (dflag) mgt_cli_setup(0, 1, 1); + if (Tflag) + mgt_cli_telnet(Tflag); + e = ev_new(); assert(e != NULL); e->sig = SIGTERM; Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-11 11:23:12 UTC (rev 811) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-11 13:41:28 UTC (rev 812) @@ -12,6 +12,7 @@ #include #include #include +#include #ifndef HAVE_VASPRINTF #include "compat/vasprintf.h" @@ -27,6 +28,8 @@ #include "shmlog.h" static int cli_i = -1, cli_o = -1; +static int telnet_sock; +static struct ev *telnet_ev; /*--------------------------------------------------------------------*/ @@ -134,7 +137,6 @@ struct cli_proto *cp; unsigned u, v; - /* * Build the joint cli_proto by combining the manager process * entries with with the cache process entries. The latter @@ -165,8 +167,6 @@ /* Fixup the entry for 'help' entry */ assert(!strcmp(cli_proto[0].request, "help")); cli_proto[0].priv = cli_proto; - - /* XXX: open listening sockets, contact cluster server etc */ } /*-------------------------------------------------------------------- @@ -325,3 +325,39 @@ cp->ev->priv = cp; ev_add(mgt_evb, cp->ev); } + +static int +telnet_accept(struct ev *ev, int what) +{ + socklen_t l; + struct sockaddr addr[2]; /* XXX IPv6 hack */ + int i; + + (void)ev; + (void)what; + l = sizeof addr; + i = accept(telnet_sock, addr, &l); + if (i < 0) + return (0); + + mgt_cli_setup(i, i, 0); + return (0); +} + +int +mgt_cli_telnet(const char *port) +{ + + telnet_sock = open_tcp(port, 0); + if (telnet_sock < 0) { + fprintf(stderr, "Could not open TELNET port\n"); + exit (2); + } + telnet_ev = ev_new(); + assert(telnet_ev != NULL); + telnet_ev->fd = telnet_sock; + telnet_ev->fd_flags = POLLIN; + telnet_ev->callback = telnet_accept; + ev_add(mgt_evb, telnet_ev); + return (0); +} Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-11 11:23:12 UTC (rev 811) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-11 13:41:28 UTC (rev 812) @@ -16,7 +16,6 @@ #ifndef HAVE_STRLCPY #include "compat/strlcpy.h" #endif -#include "heritage.h" #include "mgt.h" /*--------------------------------------------------------------------*/ @@ -91,7 +90,7 @@ } int -open_tcp(const char *port) +open_tcp(const char *port, int http) { int sd, val; struct addrinfo *res; @@ -131,9 +130,11 @@ return (-1); } #ifdef HAVE_ACCEPT_FILTERS - accept_filter(sd); + if (http) + accept_filter(sd); +#else + (void)http; #endif freeaddrinfo(res); - heritage.socket = sd; - return (0); + return (sd); } Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-11 11:23:12 UTC (rev 811) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-11 13:41:28 UTC (rev 812) @@ -154,6 +154,7 @@ fprintf(stderr, " %-28s # %s\n", "", " -s file,,"); fprintf(stderr, " %-28s # %s\n", "-t", "Default TTL"); + fprintf(stderr, " %-28s # %s\n", "-T port", "Telnet port"); fprintf(stderr, " %-28s # %s\n", "-V", "version"); fprintf(stderr, " %-28s # %s\n", "-w int[,int[,int]]", "Number of worker threads"); @@ -166,7 +167,6 @@ #if 0 -c clusterid at cluster_controller -m memory_limit - -s kind[,storage-options] -l logfile,logsize -u uid -a CLI_port @@ -322,6 +322,7 @@ const char *fflag = NULL; const char *sflag = "file"; const char *hflag = "classic"; + const char *Tflag = NULL; setbuf(stdout, NULL); setbuf(stderr, NULL); @@ -334,7 +335,7 @@ heritage.wthread_timeout = 10; heritage.mem_workspace = 4096; - while ((o = getopt(argc, argv, "b:df:h:p:s:t:Vw:")) != -1) + while ((o = getopt(argc, argv, "b:df:h:p:s:t:T:Vw:")) != -1) switch (o) { case 'b': bflag = optarg; @@ -357,6 +358,9 @@ case 't': heritage.default_ttl = strtoul(optarg, NULL, 0); break; + case 'T': + Tflag = optarg; + break; case 'V': varnish_version("varnishd"); exit(0); @@ -397,7 +401,8 @@ * but do not answer. That, on the other hand, would eliminate the * possibility of doing a "no-glitch" restart of the child process. */ - if (open_tcp(portnumber)) + heritage.socket = open_tcp(portnumber, 1); + if (heritage.socket < 0) exit (2); VSL_MgtInit(SHMLOG_FILENAME, 8*1024*1024); @@ -411,7 +416,7 @@ mgt_cli_init(); - mgt_run(dflag); + mgt_run(dflag, Tflag); exit(0); } From phk at projects.linpro.no Fri Aug 11 14:09:09 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 16:09:09 +0200 (CEST) Subject: r813 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811140909.C4F0F1EC814@projects.linpro.no> Author: phk Date: 2006-08-11 16:09:09 +0200 (Fri, 11 Aug 2006) New Revision: 813 Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c Log: Use 1:1 for hashbucket:mutex ratio Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-11 13:41:28 UTC (rev 812) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-11 14:09:09 UTC (rev 813) @@ -40,7 +40,7 @@ static struct hcl_head *hcl_head; static unsigned hcl_nhash = 4096; -static unsigned hcl_nmtx = 256; +static unsigned hcl_nmtx = 4096; static pthread_mutex_t *hcl_mutex; /*--------------------------------------------------------------------*/ @@ -131,7 +131,7 @@ } hcl_nhash = u1; if (i == 1) { - hcl_nmtx = hcl_nhash / 16; + hcl_nmtx = hcl_nhash; if (hcl_nmtx < 1) hcl_nmtx = 1; return(0); From phk at projects.linpro.no Fri Aug 11 14:21:55 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 16:21:55 +0200 (CEST) Subject: r814 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811142155.E44DC3BC1AD@projects.linpro.no> Author: phk Date: 2006-08-11 16:21:55 +0200 (Fri, 11 Aug 2006) New Revision: 814 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_re.c Log: A NULL pointer does not match a regexp Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_re.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2006-08-11 14:09:09 UTC (rev 813) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2006-08-11 14:21:55 UTC (rev 814) @@ -43,6 +43,8 @@ regex_t *t; int i; + if (s == NULL) + return (0); t = re; i = regexec(t, s, 0, NULL, 0); if (i == 0) From phk at projects.linpro.no Fri Aug 11 14:26:59 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 16:26:59 +0200 (CEST) Subject: r815 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811142659.A6D681EC816@projects.linpro.no> Author: phk Date: 2006-08-11 16:26:59 +0200 (Fri, 11 Aug 2006) New Revision: 815 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_re.c Log: Assert regexp != NULL Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_re.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2006-08-11 14:21:55 UTC (rev 814) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2006-08-11 14:26:59 UTC (rev 815) @@ -45,6 +45,7 @@ if (s == NULL) return (0); + assert(re != NULL); t = re; i = regexec(t, s, 0, NULL, 0); if (i == 0) From des at projects.linpro.no Fri Aug 11 14:45:37 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 11 Aug 2006 16:45:37 +0200 (CEST) Subject: r816 - trunk/varnish-cache/bin/varnishd Message-ID: <20060811144537.397EC1EC814@projects.linpro.no> Author: des Date: 2006-08-11 16:45:37 +0200 (Fri, 11 Aug 2006) New Revision: 816 Modified: trunk/varnish-cache/bin/varnishd/tcp.c Log: Dirty hack: strip the leading "::ffff:" from v4-to-v6-mapped addresses. Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-11 14:26:59 UTC (rev 815) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-11 14:45:37 UTC (rev 816) @@ -33,6 +33,12 @@ strlcpy(pbuf, "Failed", plen); return; } + /* XXX dirty hack for v4-to-v6 mapped addresses */ + if (strncmp(abuf, "::ffff:", 7) == 0) { + for (i = 0; abuf[i + 7]; ++i) + abuf[i] = abuf[i + 7]; + abuf[i] = '\0'; + } } /*--------------------------------------------------------------------*/ From phk at projects.linpro.no Fri Aug 11 20:24:40 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 22:24:40 +0200 (CEST) Subject: r817 - in trunk/varnish-cache: include lib/libvarnishapi Message-ID: <20060811202440.BC3EE1EC817@projects.linpro.no> Author: phk Date: 2006-08-11 22:24:40 +0200 (Fri, 11 Aug 2006) New Revision: 817 Modified: trunk/varnish-cache/include/varnishapi.h trunk/varnish-cache/lib/libvarnishapi/shmlog.c Log: Improve the shmlog facilities. Move the sleeping and timing out into the library so we do not have to repeat it in all apps. Should we ever find an app that needs something else, we will cater for it then. Add VSL_Dispatch() which calls a (supplied) function (pointer) for each record. Additional useful information is passed as arguments, such as classification (backend/client/other) etc. Add a default handler for printing a record. Add VSL_Select() where the application can specify tags that are mandatory and which should not be subject to -i/-x/-I/-X/-b/-c filtering. Be more frugal with memory. Modified: trunk/varnish-cache/include/varnishapi.h =================================================================== --- trunk/varnish-cache/include/varnishapi.h 2006-08-11 14:45:37 UTC (rev 816) +++ trunk/varnish-cache/include/varnishapi.h 2006-08-11 20:24:40 UTC (rev 817) @@ -8,16 +8,21 @@ #define V_DEAD __attribute__ ((noreturn)) /* shmlog.c */ +typedef int vsl_handler(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr); +#define VSL_S_CLIENT (1 << 0) +#define VSL_S_BACKEND (1 << 1) #define VSL_ARGS "bcdr:i:x:CI:X:" +vsl_handler VSL_H_Print; struct VSL_data; struct VSL_data *VSL_New(void); +void VSL_Select(struct VSL_data *vd, unsigned tag); int VSL_OpenLog(struct VSL_data *vd); +int VSL_Dispatch(struct VSL_data *vd, vsl_handler *func, void *priv); int VSL_NextLog(struct VSL_data *lh, unsigned char **pp); int VSL_Arg(struct VSL_data *vd, int arg, const char *opt); struct varnish_stats *VSL_OpenStats(void); const char *VSL_tags[256]; - /* varnish_debug.c */ void vdb_panic(const char *, ...) V_DEAD; Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-11 14:45:37 UTC (rev 816) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-11 20:24:40 UTC (rev 817) @@ -11,16 +11,28 @@ #include #include #include +#include #include "shmlog.h" +#include "miniobj.h" #include "varnishapi.h" +/* Parameters */ +#define SLEEP_USEC (50*1000) +#define TIMEOUT_USEC (5*1000*1000) + +#define NFD (256 * 256) + struct VSL_data { + unsigned magic; +#define VSL_MAGIC 0x6e3bd69b + struct shmloghead *head; unsigned char *logstart; unsigned char *logend; unsigned char *ptr; + /* for -r option */ FILE *fi; unsigned char rbuf[5 + 255 + 1]; @@ -28,10 +40,14 @@ int c_opt; int d_opt; - int ix_opt; - unsigned char supr[256]; + unsigned flags; +#define F_SEEN_IX (1 << 0) - unsigned char dir[65536]; + unsigned char map[NFD]; +#define M_CLIENT (1 << 0) +#define M_BACKEND (1 << 1) +#define M_SUPPRESS (1 << 2) +#define M_SELECT (1 << 3) int regflags; regex_t *regincl; @@ -101,16 +117,33 @@ { struct VSL_data *vd; + assert(VSL_S_CLIENT == M_CLIENT); + assert(VSL_S_BACKEND == M_BACKEND); vd = calloc(sizeof *vd, 1); + assert(vd != NULL); vd->regflags = REG_EXTENDED | REG_NOSUB; + vd->magic = VSL_MAGIC; return (vd); } +/*--------------------------------------------------------------------*/ + +void +VSL_Select(struct VSL_data *vd, unsigned tag) +{ + + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); + vd->map[tag] |= M_SELECT; +} + +/*--------------------------------------------------------------------*/ + int VSL_OpenLog(struct VSL_data *vd) { unsigned char *p; + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); if (vd->fi != NULL) return (0); @@ -122,12 +155,6 @@ vd->logend = vd->logstart + vsl_lh->size; vd->ptr = vd->logstart; - if (vd->b_opt) - memset(vd->dir, 1, sizeof vd->dir); - - if (vd->c_opt) - memset(vd->dir, 2, sizeof vd->dir); - if (!vd->d_opt) while (vsl_nextlog(vd, &p) == 1) continue; @@ -140,8 +167,10 @@ vsl_nextlog(struct VSL_data *vd, unsigned char **pp) { unsigned char *p; + unsigned w; int i; + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); if (vd->fi != NULL) { i = fread(vd->rbuf, 4, 1, vd->fi); if (i != 1) @@ -154,19 +183,22 @@ } p = vd->ptr; - while (1) { + for (w = 0; w < TIMEOUT_USEC;) { if (*p == SLT_WRAPMARKER) { p = vd->logstart; continue; } if (*p == SLT_ENDMARKER) { - vd->ptr = p; - return (0); + w += SLEEP_USEC; + usleep(SLEEP_USEC); + continue; } vd->ptr = p + p[1] + 5; *pp = p; return (1); } + vd->ptr = p; + return (0); } int @@ -177,6 +209,7 @@ unsigned u; int i; + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); while (1) { i = vsl_nextlog(vd, &p); if (i != 1) @@ -184,19 +217,25 @@ u = (p[2] << 8) | p[3]; switch(p[0]) { case SLT_SessionOpen: - vd->dir[u] = 1; + vd->map[u] |= M_CLIENT; + vd->map[u] &= ~M_BACKEND; break; case SLT_BackendOpen: - vd->dir[u] = 2; + vd->map[u] |= M_BACKEND; + vd->map[u] &= ~M_CLIENT; break; default: break; } - if (vd->supr[p[0]]) + if (vd->map[p[0]] & M_SELECT) { + *pp = p; + return (1); + } + if (vd->map[p[0]] & M_SUPPRESS) continue; - if (vd->b_opt && vd->dir[u] == 1) + if (vd->b_opt && !(vd->map[u] & M_BACKEND)) continue; - if (vd->c_opt && vd->dir[u] == 2) + if (vd->c_opt && !(vd->map[u] & M_CLIENT)) continue; if (vd->regincl != NULL) { rm.rm_so = 0; @@ -219,10 +258,51 @@ /*--------------------------------------------------------------------*/ +int +VSL_Dispatch(struct VSL_data *vd, vsl_handler *func, void *priv) +{ + int i; + unsigned u; + unsigned char *p; + + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); + while (1) { + i = VSL_NextLog(vd, &p); + if (i <= 0) + return (i); + u = (p[2] << 8) | p[3]; + if (func(priv, + p[0], u, p[1], + vd->map[u] & (VSL_S_CLIENT|VSL_S_BACKEND), + p + 4)) + return (1); + } +} + +/*--------------------------------------------------------------------*/ + +int +VSL_H_Print(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) +{ + FILE *fo = priv; + + assert(fo != NULL); + if (tag == SLT_Debug) { + } + fprintf(fo, "%5d %-12s %c %.*s\n", + fd, VSL_tags[tag], + ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : ' '), + len, ptr); + return (0); +} + +/*--------------------------------------------------------------------*/ + static int vsl_r_arg(struct VSL_data *vd, const char *opt) { + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); if (!strcmp(opt, "-")) vd->fi = stdin; else @@ -242,6 +322,7 @@ regex_t **rp; char buf[BUFSIZ]; + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); if (arg == 'I') rp = &vd->regincl; else @@ -272,11 +353,12 @@ int i, j, l; const char *b, *e, *p, *q; + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); /* If first option is 'i', set all bits for supression */ - if (arg == 'i' && vd->ix_opt == 0) + if (arg == 'i' && !(vd->flags & F_SEEN_IX)) for (i = 0; i < 256; i++) - vd->supr[i] = 1; - vd->ix_opt = 1; + vd->map[i] |= M_SUPPRESS; + vd->flags |= F_SEEN_IX; for (b = opt; *b; b = e) { while (isspace(*b)) @@ -301,9 +383,9 @@ continue; if (arg == 'x') - vd->supr[i] = 1; + vd->map[i] |= M_SUPPRESS; else - vd->supr[i] = 0; + vd->map[i] &= ~M_SUPPRESS; break; } if (i == 256) { @@ -320,6 +402,8 @@ int VSL_Arg(struct VSL_data *vd, int arg, const char *opt) { + + CHECK_OBJ_NOTNULL(vd, VSL_MAGIC); switch (arg) { case 'b': vd->b_opt = !vd->b_opt; return (1); case 'c': vd->c_opt = !vd->c_opt; return (1); From phk at projects.linpro.no Fri Aug 11 20:28:45 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 22:28:45 +0200 (CEST) Subject: r818 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060811202845.9535A1EC817@projects.linpro.no> Author: phk Date: 2006-08-11 22:28:45 +0200 (Fri, 11 Aug 2006) New Revision: 818 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: Drop the -h option, it never really worked out. Use the new libvarnishapi facilities to structure code better. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-11 20:24:40 UTC (rev 817) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-11 20:28:45 UTC (rev 818) @@ -18,30 +18,19 @@ #include "shmlog.h" #include "varnishapi.h" +static int bflag, cflag; -static char * -vis_it(unsigned char *p) -{ - static char visbuf[255*4 + 3 + 1]; - - strcpy(visbuf, " ["); - strvisx(visbuf + 2, p + 4, p[1], - VIS_OCTAL | VIS_TAB | VIS_NL); - strcat(visbuf, "]"); - return (visbuf); -} - /* Ordering-----------------------------------------------------------*/ static struct vsb *ob[65536]; -static int hc[65536]; -static int xrf[65536]; +static unsigned char invcl[65536]; static void clean_order(void) { unsigned u; +printf("Clean\n"); for (u = 0; u < 65536; u++) { if (ob[u] == NULL) continue; @@ -52,143 +41,139 @@ } } -static void -order(unsigned char *p, int h_opt) +static int +h_order(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) { - unsigned u, v; - u = (p[2] << 8) | p[3]; - if (ob[u] == NULL) { - ob[u] = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); - assert(ob[u] != NULL); + (void)priv; + + if (!(spec & (VSL_S_CLIENT|VSL_S_BACKEND))) { + VSL_H_Print(stdout, tag, fd, len, spec, ptr); + return (0); } - v = 0; - switch (p[0]) { + if (ob[fd] == NULL) { + ob[fd] = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); + assert(ob[fd] != NULL); + } + switch (tag) { case SLT_VCL_call: - vsb_printf(ob[u], "%02x %3d %4d %-12s", - p[0], p[1], u, VSL_tags[p[0]]); - if (p[1] > 0) { - vsb_cat(ob[u], " <"); - vsb_bcat(ob[u], p + 4, p[1]); - } - if (h_opt && p[1] == 3 && !memcmp(p + 4, "hit", 3)) - hc[u]++; - break; + invcl[fd] = 1; + vsb_printf(ob[fd], "%5d %-12s %c <%.*s", + fd, VSL_tags[tag], + ((spec & VSL_S_CLIENT) ? 'c' : \ + (spec & VSL_S_BACKEND) ? 'b' : ' '), + len, ptr); + return (0); case SLT_VCL_trace: - if (p[1] > 0) { - vsb_cat(ob[u], " "); - vsb_bcat(ob[u], p + 4, p[1]); - } - break; case SLT_VCL_return: - if (p[1] > 0) { - vsb_cat(ob[u], " "); - vsb_bcat(ob[u], p + 4, p[1]); - vsb_cat(ob[u], ">\n"); + if (invcl[fd]) { + vsb_cat(ob[fd], " "); + vsb_bcat(ob[fd], ptr, len); + return (0); } - if (h_opt && p[1] == 7 && !memcmp(p + 4, "deliver", 7)) - hc[u]++; - if (h_opt && p[1] == 6 && !memcmp(p + 4, "insert", 6)) { - if (hc[xrf[u]] == 1) { - hc[u] += 2; - hc[xrf[u]] = 4; - } - } break; - case SLT_Debug: - if (p[1] == 0) - break; - if (!h_opt) - ; - else if (p[1] > 4 && !memcmp(p + 4, "TTD:", 4)) - break; - vsb_printf(ob[u], "%02x %3d %4d %-12s", - p[0], p[1], u, VSL_tags[p[0]]); - if (p[1] > 0) - vsb_cat(ob[u], vis_it(p)); - vsb_cat(ob[u], "\n"); - break; - case SLT_HttpError: - if (!h_opt) - v = 1; - else if (p[1] == 16 && !memcmp(p + 4, "Received nothing", 16)) - ; - else if (p[1] == 17 && !memcmp(p + 4, "Received errno 54", 17)) - ; - else - v = 1; - break; - case SLT_SessionClose: - if (!h_opt) - v = 1; - else if (p[1] == 10 && !memcmp(p + 4, "no request", 10)) - ; - else if (p[1] == 7 && !memcmp(p + 4, "timeout", 7)) - ; - else - v = 1; - break; - case SLT_RxRequest: - if (h_opt && p[1] == 3 && !memcmp(p + 4, "GET", 3)) - hc[u]++; - if (h_opt && p[1] == 4 && !memcmp(p + 4, "HEAD", 4)) - hc[u]++; - v = 1; - break; - case SLT_Backend: - xrf[u] = atoi(p + 4); - v = 1; - break; - case SLT_RxStatus: - if (h_opt && p[1] == 3 && !memcmp(p + 4, "200", 3)) - hc[u]++; - v = 1; - break; default: - v = 1; + if (invcl[fd]) + vsb_cat(ob[fd], "\n"); + invcl[fd] = 0; break; } - if (v) { - vsb_printf(ob[u], "%02x %3d %4d %-12s", - p[0], p[1], u, VSL_tags[p[0]]); - if (p[1] > 0) { - vsb_cat(ob[u], " <"); - vsb_bcat(ob[u], p + 4, p[1]); - vsb_cat(ob[u], ">"); - } - vsb_cat(ob[u], "\n"); - } - if (u == 0) { - vsb_finish(ob[u]); - printf("%s", vsb_data(ob[u])); - vsb_clear(ob[u]); - return; - } - switch (p[0]) { - case SLT_SessionClose: - case SLT_SessionReuse: + if (invcl[fd]) + vsb_cat(ob[fd], "\n"); + vsb_printf(ob[fd], "%5d %-12s %c %.*s\n", + fd, VSL_tags[tag], + ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : ' '), + len, ptr); + switch (tag) { + case SLT_ReqEnd: case SLT_BackendClose: case SLT_BackendReuse: - vsb_finish(ob[u]); - if ((hc[u] != 4 || h_opt == 0) && vsb_len(ob[u]) > 1) - printf("%s\n", vsb_data(ob[u])); - vsb_clear(ob[u]); - hc[u] = 0; - xrf[u] = 0; + case SLT_StatSess: + vsb_finish(ob[fd]); + if (vsb_len(ob[fd]) > 1) + printf("%s\n", vsb_data(ob[fd])); + vsb_clear(ob[fd]); break; default: break; } + return (0); } +static void +do_order(struct VSL_data *vd) +{ + int i; + if (!bflag) { + VSL_Select(vd, SLT_SessionOpen); + VSL_Select(vd, SLT_SessionClose); + VSL_Select(vd, SLT_ReqEnd); + } + if (!cflag) { + VSL_Select(vd, SLT_BackendOpen); + VSL_Select(vd, SLT_BackendClose); + VSL_Select(vd, SLT_BackendReuse); + } + while (1) { + i = VSL_Dispatch(vd, h_order, NULL); + if (i == 0) { + clean_order(); + fflush(stdout); + } + else if (i < 0) + break; + } + clean_order(); +} /*--------------------------------------------------------------------*/ static void +do_write(struct VSL_data *vd, const char *w_opt) +{ + FILE *wfile = NULL; + unsigned u; + int i; + unsigned char *p; + + if (!strcmp(w_opt, "-")) + wfile = stdout; + else + wfile = fopen(w_opt, "w"); + if (wfile == NULL) { + perror(w_opt); + exit (1); + } + u = 0; + while (1) { + i = VSL_NextLog(vd, &p); + if (i < 0) + break; + if (i == 0) { + fflush(wfile); + fprintf(stderr, "\nFlushed\n"); + } else { + i = fwrite(p, 5 + p[1], 1, wfile); + if (i != 1) + perror(w_opt); + u++; + if (!(u % 1000)) { + fprintf(stderr, "%u\r", u); + fflush(stderr); + } + } + } + exit (0); +} + +/*--------------------------------------------------------------------*/ + +static void usage(void) { - fprintf(stderr, "usage: varnishlog [-oV] [-w file] [-r file]\n"); + fprintf(stderr, + "usage: varnishlog [(stdopts)] [-oV] [-w file] [-r file]\n"); exit(1); } @@ -196,26 +181,14 @@ main(int argc, char **argv) { int i, c; - unsigned u, v; - unsigned char *p; int o_flag = 0; char *w_opt = NULL; - FILE *wfile = NULL; - int h_opt = 0; struct VSL_data *vd; vd = VSL_New(); - while ((c = getopt(argc, argv, VSL_ARGS "hoVw:")) != -1) { - i = VSL_Arg(vd, c, optarg); - if (i < 0) - exit (1); - if (i > 0) - continue; + while ((c = getopt(argc, argv, VSL_ARGS "oVw:")) != -1) { switch (c) { - case 'h': - h_opt = 1; - break; case 'o': o_flag = 1; break; @@ -225,79 +198,42 @@ case 'w': w_opt = optarg; break; + case 'c': + cflag = 1; + if (VSL_Arg(vd, c, optarg) > 0) + break; + usage(); + case 'b': + bflag = 1; + if (VSL_Arg(vd, c, optarg) > 0) + break; + usage(); default: + if (VSL_Arg(vd, c, optarg) > 0) + break; usage(); } } + if (o_flag && w_opt != NULL) + usage(); + if (VSL_OpenLog(vd)) exit (1); - if (o_flag && w_opt != NULL) - usage(); + if (w_opt != NULL) + do_write(vd, w_opt); - if (w_opt != NULL) { - if (!strcmp(w_opt, "-")) - wfile = stdout; - else - wfile = fopen(w_opt, "w"); - if (wfile == NULL) { - perror(w_opt); - exit (1); - } - } - u = 0; - v = 0; + if (o_flag) + do_order(vd); while (1) { - i = VSL_NextLog(vd, &p); - if (i < 0) + i = VSL_Dispatch(vd, VSL_H_Print, stdout); + if (i == 0) + fflush(stdout); + else if (i < 0) break; - if (i == 0) { - if (w_opt == NULL) { - if (o_flag && ++v == 100) - clean_order(); - fflush(stderr); - } else if (++v == 100) { - fflush(wfile); - fprintf(stderr, "\nFlushed\n"); - } - usleep(50000); - continue; - } - v = 0; - if (wfile != NULL) { - i = fwrite(p, 5 + p[1], 1, wfile); - if (i != 1) - perror(w_opt); - u++; - if (!(u % 1000)) { - fprintf(stderr, "%u\r", u); - fflush(stderr); - } - continue; - } - if (o_flag) { - order(p, h_opt); - continue; - } - u = (p[2] << 8) | p[3]; - printf("%02x %3d %4d %-12s", - p[0], p[1], u, VSL_tags[p[0]]); - - if (p[1] > 0) { - if (p[0] != SLT_Debug) { - printf(" <"); - fwrite(p + 4, p[1], 1, stdout); - printf(">"); - } else { - fputs(vis_it(p), stdout); - } - - } - printf("\n"); - } - if (o_flag) - clean_order(); + } + return (0); } From phk at projects.linpro.no Fri Aug 11 20:34:20 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 22:34:20 +0200 (CEST) Subject: r819 - trunk/varnish-cache/lib/libvarnishapi Message-ID: <20060811203420.EF8FC1EC818@projects.linpro.no> Author: phk Date: 2006-08-11 22:34:20 +0200 (Fri, 11 Aug 2006) New Revision: 819 Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c Log: Make lack of -d option work as expected. Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-11 20:28:45 UTC (rev 818) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-11 20:34:20 UTC (rev 819) @@ -155,9 +155,11 @@ vd->logend = vd->logstart + vsl_lh->size; vd->ptr = vd->logstart; - if (!vd->d_opt) - while (vsl_nextlog(vd, &p) == 1) - continue; + if (!vd->d_opt && vd->fi == NULL) { + for (p = vd->ptr; *p != SLT_ENDMARKER; ) + p += p[1] + 5; + vd->ptr = p; + } return (0); } From phk at projects.linpro.no Fri Aug 11 20:43:46 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 22:43:46 +0200 (CEST) Subject: r820 - trunk/varnish-cache/lib/libvarnishapi Message-ID: <20060811204346.1A62C1EC81A@projects.linpro.no> Author: phk Date: 2006-08-11 22:43:45 +0200 (Fri, 11 Aug 2006) New Revision: 820 Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c Log: Also mark as client on ReqStart Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-11 20:34:20 UTC (rev 819) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-11 20:43:45 UTC (rev 820) @@ -219,6 +219,7 @@ u = (p[2] << 8) | p[3]; switch(p[0]) { case SLT_SessionOpen: + case SLT_ReqStart: vd->map[u] |= M_CLIENT; vd->map[u] &= ~M_BACKEND; break; From phk at projects.linpro.no Fri Aug 11 20:46:08 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 22:46:08 +0200 (CEST) Subject: r821 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060811204608.672611EC81B@projects.linpro.no> Author: phk Date: 2006-08-11 22:46:08 +0200 (Fri, 11 Aug 2006) New Revision: 821 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: fix formatting glitches in -o mode Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-11 20:43:45 UTC (rev 820) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-11 20:46:08 UTC (rev 821) @@ -58,7 +58,7 @@ switch (tag) { case SLT_VCL_call: invcl[fd] = 1; - vsb_printf(ob[fd], "%5d %-12s %c <%.*s", + vsb_printf(ob[fd], "%5d %-12s %c %.*s", fd, VSL_tags[tag], ((spec & VSL_S_CLIENT) ? 'c' : \ (spec & VSL_S_BACKEND) ? 'b' : ' '), @@ -78,8 +78,10 @@ invcl[fd] = 0; break; } - if (invcl[fd]) + if (invcl[fd]) { vsb_cat(ob[fd], "\n"); + invcl[fd] = 0; + } vsb_printf(ob[fd], "%5d %-12s %c %.*s\n", fd, VSL_tags[tag], ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : ' '), From phk at projects.linpro.no Fri Aug 11 20:47:28 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 11 Aug 2006 22:47:28 +0200 (CEST) Subject: r822 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060811204728.B1D591EC81B@projects.linpro.no> Author: phk Date: 2006-08-11 22:47:28 +0200 (Fri, 11 Aug 2006) New Revision: 822 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: When -b and -c given, supress "other" messages. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-11 20:46:08 UTC (rev 821) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-11 20:47:28 UTC (rev 822) @@ -48,7 +48,8 @@ (void)priv; if (!(spec & (VSL_S_CLIENT|VSL_S_BACKEND))) { - VSL_H_Print(stdout, tag, fd, len, spec, ptr); + if (!bflag && !cflag) + VSL_H_Print(stdout, tag, fd, len, spec, ptr); return (0); } if (ob[fd] == NULL) { From des at projects.linpro.no Sun Aug 13 11:38:14 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Sun, 13 Aug 2006 13:38:14 +0200 (CEST) Subject: r823 - in trunk/varnish-cache: bin/varnishd include lib/libvcl Message-ID: <20060813113814.1D9441EC800@projects.linpro.no> Author: des Date: 2006-08-13 13:38:13 +0200 (Sun, 13 Aug 2006) New Revision: 823 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/include/vrt.h trunk/varnish-cache/include/vrt_obj.h trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Implement the "error" VCL keyword: - add fields to struct sess where VRT_error can store the error code and message - modify cnt_error() to pass these fields to RES_Error(), then clear them - modify RES_Error() (and the entire chain) to accept a third argument giving an explanation of the error. - have RES_Error() reset the worker before writing the error document, to make sure wfd is set. fixes: #4 Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-11 20:47:28 UTC (rev 822) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-13 11:38:13 UTC (rev 823) @@ -253,6 +253,9 @@ enum step step; unsigned handling; unsigned char wantbody; + int err_code; + const char *err_msg; + const char *err_expl; TAILQ_ENTRY(sess) list; @@ -402,7 +405,7 @@ #endif /* cache_response.c */ -void RES_Error(struct sess *sp, int error, const char *msg); +void RES_Error(struct sess *sp, int code, const char *msg, const char *expl); void RES_WriteObj(struct sess *sp); /* cache_vcl.c */ Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-11 20:47:28 UTC (rev 822) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-13 11:38:13 UTC (rev 823) @@ -130,9 +130,19 @@ DOT error -> DONE */ -static int cnt_error(struct sess *sp) { (void)sp; INCOMPL(); } +static int +cnt_error(struct sess *sp) +{ + RES_Error(sp, sp->err_code, sp->err_msg, sp->err_expl); + sp->err_code = 0; + sp->err_msg = NULL; + sp->err_expl = NULL; + sp->step = STP_DONE; + return (0); +} + /*-------------------------------------------------------------------- * We have fetched the headers from the backend, ask the VCL code what * to do next, then head off in that direction. @@ -550,7 +560,7 @@ sp->wrk->acct.req++; done = http_DissectRequest(sp->http, sp->fd); if (done != 0) { - RES_Error(sp, done, NULL); + RES_Error(sp, done, NULL, NULL); sp->step = STP_DONE; return (0); } Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-11 20:47:28 UTC (rev 822) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-13 11:38:13 UTC (rev 823) @@ -14,24 +14,32 @@ /*--------------------------------------------------------------------*/ void -RES_Error(struct sess *sp, int error, const char *msg) +RES_Error(struct sess *sp, int code, const char *msg, const char *expl) { char buf[40]; struct vsb *sb; sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(sb != NULL); + assert(code >= 100 && code <= 999); if (msg == NULL) { - switch (error) { + switch (code) { case 400: msg = "Bad Request"; break; case 500: msg = "Internal Error"; break; default: msg = "HTTP request error"; break; } } + if (expl == NULL) { + switch (code) { + case 400: expl = "Your HTTP protocol request did not make sense."; break; + case 404: expl = "The document you requested was not found."; break; + default: expl = "Something unexpected happened."; break; + } + } vsb_clear(sb); - vsb_printf(sb, "HTTP/1.1 %03d %s\r\n", error, msg); + vsb_printf(sb, "HTTP/1.1 %03d %s\r\n", code, msg); TIM_format(sp->t_req.tv_sec, buf); vsb_printf(sb, "Date: %s\r\n", buf); vsb_cat(sb, @@ -42,29 +50,18 @@ "\r\n" "\r\n" " \r\n"); - vsb_printf(sb, " %03d %s\r\n", error, msg); + vsb_printf(sb, " %03d %s\r\n", code, msg); vsb_cat(sb, " \r\n" " \r\n"); - vsb_printf(sb, "

Error %03d %s

\r\n", error, msg); - switch(error) { - case 400: - vsb_cat(sb, - " Your HTTP protocol request did not make sense.\r\n"); - break; - case 500: - default: - vsb_cat(sb, - " Something unexpected happened.\r\n"); - break; - } + vsb_printf(sb, "

Error %03d %s

\r\n", code, msg); + vsb_printf(sb, "

%s

\r\n", expl); vsb_cat(sb, - "

\r\n" - " \r\n" - " Varnish\r\n" + " Varnish\r\n" " \r\n" "\r\n"); vsb_finish(sb); + WRK_Reset(sp->wrk, &sp->fd); WRK_Write(sp->wrk, vsb_data(sb), vsb_len(sb)); WRK_Flush(sp->wrk); vca_close_session(sp, msg); Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-11 20:47:28 UTC (rev 822) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-13 11:38:13 UTC (rev 823) @@ -18,11 +18,14 @@ /*--------------------------------------------------------------------*/ void -VRT_error(struct sess *sp, unsigned err, const char *str) +VRT_error(struct sess *sp, unsigned code, const char *msg, const char *expl) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - VSL(SLT_Debug, 0, "VCL_error(%u, %s)", err, str); + VSL(SLT_Debug, 0, "VCL_error(%u, %s, %s)", code, msg, expl); + sp->err_code = code; + sp->err_msg = msg; + sp->err_expl = expl; } /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2006-08-11 20:47:28 UTC (rev 822) +++ trunk/varnish-cache/include/vrt.h 2006-08-13 11:38:13 UTC (rev 823) @@ -42,7 +42,7 @@ void VRT_count(struct sess *, unsigned); int VRT_rewrite(const char *, const char *); -void VRT_error(struct sess *, unsigned, const char *); +void VRT_error(struct sess *, unsigned, const char *, const char *); int VRT_switch_config(const char *); char *VRT_GetHdr(struct sess *, const char *); Modified: trunk/varnish-cache/include/vrt_obj.h =================================================================== --- trunk/varnish-cache/include/vrt_obj.h 2006-08-11 20:47:28 UTC (rev 822) +++ trunk/varnish-cache/include/vrt_obj.h 2006-08-13 11:38:13 UTC (rev 823) @@ -1,5 +1,5 @@ /* - * $Id: /mirror/varnish/trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 30495 2006-07-22T08:02:47.026287Z phk $ + * $Id: /mirror/varnish/trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 30980 2006-08-09T11:24:39.011200Z des $ * * NB: This file is machine generated, DO NOT EDIT! * Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-11 20:47:28 UTC (rev 822) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-13 11:38:13 UTC (rev 823) @@ -708,6 +708,7 @@ unsigned a; struct var *vp; struct token *at; + int i; at = tl->t; vcc_NextToken(tl); @@ -730,12 +731,16 @@ a = UintVal(tl); else a = 0; - Fc(tl, 1, "VRT_error(sp, %u, ", a); - if (tl->t->tok == CSTR) { - Fc(tl, 0, "%.*s);\n", PF(tl->t)); - vcc_NextToken(tl); - } else - Fc(tl, 0, "(const char *)0);\n"); + Fc(tl, 1, "VRT_error(sp, %u", a); + for (i = 0; i < 2; ++i) { + if (tl->t->tok == CSTR) { + Fc(tl, 0, ", %.*s", PF(tl->t)); + vcc_NextToken(tl); + } else { + Fc(tl, 0, ", (const char *)0"); + } + } + Fc(tl, 0, ");\n"); Fc(tl, 1, "VRT_done(sp, VCL_RET_ERROR);\n"); return; case T_SWITCH_CONFIG: Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2006-08-11 20:47:28 UTC (rev 822) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2006-08-13 11:38:13 UTC (rev 823) @@ -510,7 +510,7 @@ fputs("\n", f); fputs("void VRT_count(struct sess *, unsigned);\n", f); fputs("int VRT_rewrite(const char *, const char *);\n", f); - fputs("void VRT_error(struct sess *, unsigned, const char *);\n", f); + fputs("void VRT_error(struct sess *, unsigned, const char *, const char *);\n", f); fputs("int VRT_switch_config(const char *);\n", f); fputs("\n", f); fputs("char *VRT_GetHdr(struct sess *, const char *);\n", f); From des at linpro.no Sun Aug 13 11:40:20 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Sun, 13 Aug 2006 13:40:20 +0200 Subject: r823 - in trunk/varnish-cache: bin/varnishd include lib/libvcl References: <20060813113814.1D9441EC800@projects.linpro.no> Message-ID: des at projects.linpro.no writes: > Log: > Implement the "error" VCL keyword: > [...] > fixes: #4 this is supposed to automatically close ticket #4, but it doesn't seem to work. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at projects.linpro.no Tue Aug 15 07:55:17 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 15 Aug 2006 09:55:17 +0200 (CEST) Subject: r824 - trunk/varnish-cache/bin/varnishd Message-ID: <20060815075517.95D761EC80F@projects.linpro.no> Author: des Date: 2006-08-15 09:55:17 +0200 (Tue, 15 Aug 2006) New Revision: 824 Modified: trunk/varnish-cache/bin/varnishd/cache_response.c Log: Better 304 responses: include a Date header, and send the correct Last-Modified value. Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-13 11:38:13 UTC (rev 823) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-15 07:55:17 UTC (rev 824) @@ -72,17 +72,21 @@ /*--------------------------------------------------------------------*/ static void -res_do_304(struct sess *sp, char *p) +res_do_304(struct sess *sp) { + char lm[64]; VSL(SLT_Length, sp->fd, "%u", 0); http_ClrHeader(sp->http); sp->http->logtag = HTTP_Tx; http_SetResp(sp->fd, sp->http, "HTTP/1.1", "304", "Not Modified"); + TIM_format(sp->t_req.tv_sec, lm); + http_PrintfHeader(sp->fd, sp->http, "Date: %s\r\n", lm); http_SetHeader(sp->fd, sp->http, "Via: 1.1 varnish"); http_PrintfHeader(sp->fd, sp->http, "X-Varnish: %u", sp->xid); - http_PrintfHeader(sp->fd, sp->http, "Last-Modified: %s", p); + TIM_format(sp->obj->last_modified, lm); + http_PrintfHeader(sp->fd, sp->http, "Last-Modified: %s", lm); if (sp->doclose != NULL) http_SetHeader(sp->fd, sp->http, "Connection: close"); WRK_Reset(sp->wrk, &sp->fd); @@ -111,7 +115,7 @@ } VSL(SLT_Debug, sp->fd, "Cond: %d <= %d", sp->obj->last_modified, ims); - res_do_304(sp, p); + res_do_304(sp); return (1); } return (0); From phk at phk.freebsd.dk Tue Aug 15 07:57:52 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Tue, 15 Aug 2006 07:57:52 +0000 Subject: r824 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Tue, 15 Aug 2006 09:55:17 +0200." <20060815075517.95D761EC80F@projects.linpro.no> Message-ID: <17634.1155628672@critter.freebsd.dk> In message <20060815075517.95D761EC80F at projects.linpro.no>, des at projects.linpro .no writes: >+ char lm[64]; We should probably have a #define for that 64 -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at projects.linpro.no Tue Aug 15 10:36:43 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 15 Aug 2006 12:36:43 +0200 (CEST) Subject: r825 - trunk/varnish-cache/bin/varnishd Message-ID: <20060815103643.81C231EC815@projects.linpro.no> Author: des Date: 2006-08-15 12:36:43 +0200 (Tue, 15 Aug 2006) New Revision: 825 Modified: trunk/varnish-cache/bin/varnishd/cache_response.c Log: Fix a bug in previous commit: an extra CR LF was inserted after the Date header in a 304 response. Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-15 07:55:17 UTC (rev 824) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-15 10:36:43 UTC (rev 825) @@ -82,7 +82,7 @@ sp->http->logtag = HTTP_Tx; http_SetResp(sp->fd, sp->http, "HTTP/1.1", "304", "Not Modified"); TIM_format(sp->t_req.tv_sec, lm); - http_PrintfHeader(sp->fd, sp->http, "Date: %s\r\n", lm); + http_PrintfHeader(sp->fd, sp->http, "Date: %s", lm); http_SetHeader(sp->fd, sp->http, "Via: 1.1 varnish"); http_PrintfHeader(sp->fd, sp->http, "X-Varnish: %u", sp->xid); TIM_format(sp->obj->last_modified, lm); From des at projects.linpro.no Tue Aug 15 10:38:20 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 15 Aug 2006 12:38:20 +0200 (CEST) Subject: r826 - trunk/varnish-cache/bin/varnishd Message-ID: <20060815103820.B31161EC82C@projects.linpro.no> Author: des Date: 2006-08-15 12:38:20 +0200 (Tue, 15 Aug 2006) New Revision: 826 Modified: trunk/varnish-cache/bin/varnishd/cache_response.c Log: Correct inverted test in If-Modified-Since logic. This should fix the "stale front page" problem that has plagued VG. Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-15 10:36:43 UTC (rev 825) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-15 10:38:20 UTC (rev 826) @@ -108,7 +108,7 @@ ims = TIM_parse(p); if (ims > sp->t_req.tv_sec) /* [RFC2616 14.25] */ return (0); - if (ims > sp->obj->last_modified) { + if (sp->obj->last_modified > ims) { VSL(SLT_Debug, sp->fd, "Cond: %d > %d ", sp->obj->last_modified, ims); return (0); From phk at projects.linpro.no Fri Aug 18 16:04:42 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 18 Aug 2006 18:04:42 +0200 (CEST) Subject: r827 - trunk/varnish-cache/bin/varnishd Message-ID: <20060818160442.9DA221EC921@projects.linpro.no> Author: phk Date: 2006-08-18 18:04:42 +0200 (Fri, 18 Aug 2006) New Revision: 827 Modified: trunk/varnish-cache/bin/varnishd/tcp.c Log: Deeper listenqueue for HTTP sockets Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-15 10:38:20 UTC (rev 826) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-18 16:04:42 UTC (rev 827) @@ -129,7 +129,7 @@ close(sd); return (-1); } - if (listen(sd, 16) != 0) { + if (listen(sd, http ? 1024 : 16) != 0) { perror("listen()"); freeaddrinfo(res); close(sd); From phk at projects.linpro.no Fri Aug 18 18:00:25 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 18 Aug 2006 20:00:25 +0200 (CEST) Subject: r828 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060818180025.37A761EC829@projects.linpro.no> Author: phk Date: 2006-08-18 20:00:25 +0200 (Fri, 18 Aug 2006) New Revision: 828 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: Turn the "invcl" array into a flag array so we can put more stuff there. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-18 16:04:42 UTC (rev 827) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-18 18:00:25 UTC (rev 828) @@ -23,7 +23,8 @@ /* Ordering-----------------------------------------------------------*/ static struct vsb *ob[65536]; -static unsigned char invcl[65536]; +static unsigned char flg[65536]; +#define F_INVCL (1 << 0) static void clean_order(void) @@ -58,7 +59,7 @@ } switch (tag) { case SLT_VCL_call: - invcl[fd] = 1; + flg[fd] |= F_INVCL; vsb_printf(ob[fd], "%5d %-12s %c %.*s", fd, VSL_tags[tag], ((spec & VSL_S_CLIENT) ? 'c' : \ @@ -67,21 +68,18 @@ return (0); case SLT_VCL_trace: case SLT_VCL_return: - if (invcl[fd]) { + if (flg[fd] & F_INVCL) { vsb_cat(ob[fd], " "); vsb_bcat(ob[fd], ptr, len); return (0); } break; default: - if (invcl[fd]) - vsb_cat(ob[fd], "\n"); - invcl[fd] = 0; break; } - if (invcl[fd]) { + if (flg[fd] & F_INVCL) { vsb_cat(ob[fd], "\n"); - invcl[fd] = 0; + flg[fd] &= ~F_INVCL; } vsb_printf(ob[fd], "%5d %-12s %c %.*s\n", fd, VSL_tags[tag], From phk at projects.linpro.no Fri Aug 18 18:14:10 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 18 Aug 2006 20:14:10 +0200 (CEST) Subject: r829 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060818181410.56CCE1EC91F@projects.linpro.no> Author: phk Date: 2006-08-18 20:14:10 +0200 (Fri, 18 Aug 2006) New Revision: 829 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: Make it possible to select which requests we want to see in ordered mode. For instance ./varnishlog -o rxurl foo will only show requests that match the regexp "foo" on the rxurl field Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-18 18:00:25 UTC (rev 828) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-18 18:14:10 UTC (rev 829) @@ -9,6 +9,7 @@ #include #include #include +#include #include "compat/vis.h" @@ -20,12 +21,32 @@ static int bflag, cflag; +/* -------------------------------------------------------------------*/ + +static int +name2tag(const char *n) +{ + int i; + + for (i = 0; i < 256; i++) { + if (VSL_tags[i] == NULL) + continue; + if (!strcasecmp(n, VSL_tags[i])) + return (i); + } + return (-1); +} + /* Ordering-----------------------------------------------------------*/ static struct vsb *ob[65536]; static unsigned char flg[65536]; #define F_INVCL (1 << 0) +#define F_MATCH (1 << 1) +static int match_tag = -1; +static regex_t match_re; + static void clean_order(void) { @@ -57,6 +78,9 @@ ob[fd] = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(ob[fd] != NULL); } + if (tag == match_tag && + !regexec(&match_re, ptr, 0, NULL, 0)) + flg[fd] |= F_MATCH; switch (tag) { case SLT_VCL_call: flg[fd] |= F_INVCL; @@ -91,7 +115,8 @@ case SLT_BackendReuse: case SLT_StatSess: vsb_finish(ob[fd]); - if (vsb_len(ob[fd]) > 1) + if (vsb_len(ob[fd]) > 1 && + (match_tag == -1 || flg[fd] & F_MATCH)) printf("%s\n", vsb_data(ob[fd])); vsb_clear(ob[fd]); break; @@ -102,10 +127,24 @@ } static void -do_order(struct VSL_data *vd) +do_order(struct VSL_data *vd, int argc, char **argv) { int i; + if (argc == 2) { + match_tag = name2tag(argv[0]); + if (match_tag < 0) { + fprintf(stderr, "Tag \"%s\" unknown\n", argv[0]); + exit (2); + } + i = regcomp(&match_re, argv[1], REG_EXTENDED); + if (i) { + char buf[BUFSIZ]; + regerror(i, &match_re, buf, sizeof buf); + fprintf(stderr, "%s\n", buf); + exit (2); + } + } if (!bflag) { VSL_Select(vd, SLT_SessionOpen); VSL_Select(vd, SLT_SessionClose); @@ -226,7 +265,7 @@ do_write(vd, w_opt); if (o_flag) - do_order(vd); + do_order(vd, argc - optind, argv + optind); while (1) { i = VSL_Dispatch(vd, VSL_H_Print, stdout); From phk at projects.linpro.no Fri Aug 18 18:16:53 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 18 Aug 2006 20:16:53 +0200 (CEST) Subject: r830 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060818181653.ECFEE1EC91F@projects.linpro.no> Author: phk Date: 2006-08-18 20:16:53 +0200 (Fri, 18 Aug 2006) New Revision: 830 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: Remember to clear match bit Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-18 18:14:10 UTC (rev 829) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-18 18:16:53 UTC (rev 830) @@ -118,6 +118,7 @@ if (vsb_len(ob[fd]) > 1 && (match_tag == -1 || flg[fd] & F_MATCH)) printf("%s\n", vsb_data(ob[fd])); + flg[fd] &= ~F_MATCH; vsb_clear(ob[fd]); break; default: From phk at projects.linpro.no Fri Aug 18 19:10:44 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 18 Aug 2006 21:10:44 +0200 (CEST) Subject: r831 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060818191044.D23FF1EC91D@projects.linpro.no> Author: phk Date: 2006-08-18 21:10:44 +0200 (Fri, 18 Aug 2006) New Revision: 831 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: Set REG_NOSUB for speed Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-18 18:16:53 UTC (rev 830) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-18 19:10:44 UTC (rev 831) @@ -138,7 +138,7 @@ fprintf(stderr, "Tag \"%s\" unknown\n", argv[0]); exit (2); } - i = regcomp(&match_re, argv[1], REG_EXTENDED); + i = regcomp(&match_re, argv[1], REG_EXTENDED | REG_NOSUB); if (i) { char buf[BUFSIZ]; regerror(i, &match_re, buf, sizeof buf); From phk at projects.linpro.no Fri Aug 18 19:53:43 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 18 Aug 2006 21:53:43 +0200 (CEST) Subject: r832 - trunk/varnish-cache/bin/varnishd Message-ID: <20060818195343.47EDA1EC927@projects.linpro.no> Author: phk Date: 2006-08-18 21:53:43 +0200 (Fri, 18 Aug 2006) New Revision: 832 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_http.c Log: Do a better job on Connection: header processing in client requests. Add a flag field for each HTTP header and define a bit HDF_FILTER to mean "filter this out", and initialize to zero all relevant places. If HDF_FILTER is set, do not copy the header across when filtering. Run through Connection: header (if present) and set HDF_FILTER on any header that matches a word in the contents. If we are not HTTP/1.1 and have no Connection header, we close the session when this reqest is done. If we have a Connection header, we respect that. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-18 19:10:44 UTC (rev 831) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-18 19:53:43 UTC (rev 832) @@ -73,6 +73,8 @@ } logtag; struct http_hdr hd[HTTP_HDR_MAX]; + unsigned char hdf[HTTP_HDR_MAX]; +#define HDF_FILTER (1 << 0) /* Filtered by Connection */ unsigned nhd; }; @@ -360,6 +362,7 @@ int http_RecvHead(struct http *hp, int fd); int http_DissectRequest(struct http *sp, int fd); int http_DissectResponse(struct http *sp, int fd); +void http_DoConnection(struct sess *sp); #define HTTPH(a, b, c, d, e, f, g) extern char b[]; #include "http_headers.h" Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-18 19:10:44 UTC (rev 831) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-18 19:53:43 UTC (rev 832) @@ -565,10 +565,7 @@ return (0); } - if (http_GetHdr(sp->http, H_Connection, &b) && !strcmp(b, "close")) - sp->doclose = "Connection:"; - else if (strcmp(sp->http->hd[HTTP_HDR_PROTO].b, "HTTP/1.1")) - sp->doclose = "not HTTP/1.1"; + http_DoConnection(sp); sp->backend = sp->vcl->backend[0]; Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-18 19:10:44 UTC (rev 831) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-18 19:53:43 UTC (rev 832) @@ -99,35 +99,47 @@ /*--------------------------------------------------------------------*/ -int -http_GetHdr(struct http *hp, const char *hdr, char **ptr) +static unsigned +http_findhdr(struct http *hp, unsigned l, const char *hdr) { - unsigned u, l; - char *p; + unsigned u; - l = hdr[0]; - assert(l == strlen(hdr + 1)); - assert(hdr[l] == ':'); - hdr++; for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) { assert(hp->hd[u].b != NULL); assert(hp->hd[u].e != NULL); - if (hp->hd[u].e < hp->hd[u].b + l) + if (hp->hd[u].e < hp->hd[u].b + l + 1) continue; - if (hp->hd[u].b[l-1] != ':') + if (hp->hd[u].b[l] != ':') continue; if (strncasecmp(hdr, hp->hd[u].b, l)) continue; - p = hp->hd[u].b + l; - while (isspace(*p)) - p++; - *ptr = p; - return (1); + return (u); } - *ptr = NULL; return (0); } +int +http_GetHdr(struct http *hp, const char *hdr, char **ptr) +{ + unsigned u, l; + char *p; + + l = hdr[0]; + assert(l == strlen(hdr + 1)); + assert(hdr[l] == ':'); + hdr++; + u = http_findhdr(hp, l - 1, hdr); + if (u == 0) { + *ptr = NULL; + return (0); + } + p = hp->hd[u].b + l; + while (isspace(*p)) + p++; + *ptr = p; + return (1); +} + /*--------------------------------------------------------------------*/ int @@ -165,6 +177,43 @@ /*--------------------------------------------------------------------*/ +void +http_DoConnection(struct sess *sp) +{ + struct http *hp = sp->http; + char *p, *q; + int i; + unsigned u; + + if (!http_GetHdr(hp, H_Connection, &p)) { + if (strcmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1")) + sp->doclose = "not HTTP/1.1"; + return; + } + VSL(SLT_Debug, sp->fd, "DoConnect(%s)", p); + for (; *p; p++) { + if (isspace(*p)) + continue; + if (*p == ',') + continue; + for (q = p + 1; *q; q++) + if (*q == ',' || isspace(*q)) + break; + i = q - p; + if (i == 5 && !strncasecmp(p, "close", i)) + sp->doclose = "Connection: close"; + u = http_findhdr(hp, i, p); + if (u != 0) + hp->hdf[u] |= HDF_FILTER; + VSL(SLT_Debug, sp->fd, "FLD(%.*s) u = %u", q - p, p, u); + if (!*q) + break; + p = q; + } +} + +/*--------------------------------------------------------------------*/ + int http_HdrIs(struct http *hp, const char *hdr, const char *val) { @@ -275,6 +324,7 @@ hp->conds = 1; if (hp->nhd < HTTP_HDR_MAX) { + hp->hdf[hp->nhd] = 0; hp->hd[hp->nhd].b = p; hp->hd[hp->nhd].e = q; VSLH(HTTP_T_Header, fd, hp, hp->nhd); @@ -577,6 +627,7 @@ assert(fm != NULL); to->hd[n].b = (void*)(uintptr_t)fm; to->hd[n].e = (void*)(uintptr_t)strchr(fm, '\0'); + to->hdf[n] = 0; VSLH(tag, fd, to, n); } @@ -588,6 +639,7 @@ assert(fm->hd[n].b != NULL); to->hd[n].b = fm->hd[n].b; to->hd[n].e = fm->hd[n].e; + to->hdf[n] = fm->hdf[n]; VSLH(tag, fd, to, n); } @@ -664,6 +716,8 @@ CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); to->nhd = HTTP_HDR_FIRST; for (u = HTTP_HDR_FIRST; u < fm->nhd; u++) { + if (fm->hdf[u] & HDF_FILTER) + continue; #define HTTPH(a, b, c, d, e, f, g) \ if (((e) & how) && http_IsHdr(&fm->hd[u], (b))) \ continue; From phk at projects.linpro.no Fri Aug 18 20:07:37 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 18 Aug 2006 22:07:37 +0200 (CEST) Subject: r833 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060818200737.878521EC92A@projects.linpro.no> Author: phk Date: 2006-08-18 22:07:37 +0200 (Fri, 18 Aug 2006) New Revision: 833 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: Respect and clear TAG also on flush Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-18 19:53:43 UTC (rev 832) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-18 20:07:37 UTC (rev 833) @@ -57,8 +57,10 @@ if (ob[u] == NULL) continue; vsb_finish(ob[u]); - if (vsb_len(ob[u])) + if (vsb_len(ob[u]) > 1 && + (match_tag == -1 || flg[u] & F_MATCH)) printf("%s\n", vsb_data(ob[u])); + flg[u] = 0; vsb_clear(ob[u]); } } From phk at projects.linpro.no Sat Aug 19 19:46:32 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 19 Aug 2006 21:46:32 +0200 (CEST) Subject: r834 - trunk/varnish-cache/bin/varnishd Message-ID: <20060819194632.468CF1EC925@projects.linpro.no> Author: phk Date: 2006-08-19 21:46:32 +0200 (Sat, 19 Aug 2006) New Revision: 834 Modified: trunk/varnish-cache/bin/varnishd/shmlog.c Log: Don't re-mmap the shmlog in the child, we already did it in the management process and the inherited copy is perfectly fine to use. Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-18 20:07:37 UTC (rev 833) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-19 19:46:32 UTC (rev 834) @@ -124,19 +124,12 @@ VSL_Init(void) { - loghead = mmap(NULL, heritage.vsl_size, - PROT_READ|PROT_WRITE, - MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED, - heritage.vsl_fd, 0); - assert(loghead != MAP_FAILED); - assert(loghead->magic == SHMLOGHEAD_MAGIC); assert(loghead->hdrsize == sizeof *loghead); - /* XXX check sanity of loghead */ + /* XXX more check sanity of loghead ? */ logstart = (unsigned char *)loghead + loghead->start; AZ(pthread_mutex_init(&vsl_mutex, NULL)); loghead->starttime = time(NULL); - VSL_stats = &loghead->stats; memset(VSL_stats, 0, sizeof *VSL_stats); } @@ -181,9 +174,10 @@ } heritage.vsl_size = slh.size + slh.start; - /* - * Call VSL_Init so that we get a VSL_stats pointer in the - * management process as well. - */ - VSL_Init(); + loghead = mmap(NULL, heritage.vsl_size, + PROT_READ|PROT_WRITE, + MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED, + heritage.vsl_fd, 0); + assert(loghead != MAP_FAILED); + VSL_stats = &loghead->stats; } From phk at projects.linpro.no Sat Aug 19 20:15:09 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 19 Aug 2006 22:15:09 +0200 (CEST) Subject: r835 - trunk/varnish-cache/bin/varnishd Message-ID: <20060819201509.EFB681EC92E@projects.linpro.no> Author: phk Date: 2006-08-19 22:15:09 +0200 (Sat, 19 Aug 2006) New Revision: 835 Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_pool.c trunk/varnish-cache/bin/varnishd/cache_session.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/rfc2616.c trunk/varnish-cache/bin/varnishd/shmlog.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: We have a number of adjustable parameters, things like "default TTL" which should be adjustable at runtime. We need to make adjustments in such a way that a restart of the child also uses the new paramters. We can either do this by parsing the CLI in both mgt+child and have both update their private copy, or we can parse it only in one of them and update a shared copy. We opt for the latter method. Add a "struct params" which holds the adjustable parameters and put on in the shmlog segment, between struct shmloghead and the round-robin buffer. Move parameters from heritage to params. We put it there without exposing it in struct shmloghead which is the public view of the shared memory because we do not want to make it a public API or even to tempt people to think that it is one. Now I just need to add the CLI functions to actually twiddle the parameters. Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-19 19:46:32 UTC (rev 834) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-19 20:15:09 UTC (rev 835) @@ -39,7 +39,7 @@ struct vbe_conn *vbc; unsigned char *p; - vbc = calloc(sizeof *vbc + heritage.mem_workspace * 2, 1); + vbc = calloc(sizeof *vbc + params->mem_workspace * 2, 1); if (vbc == NULL) return (NULL); VSL_stats->n_vbe_conn++; @@ -48,9 +48,9 @@ vbc->http2 = &vbc->http_mem[1]; vbc->fd = -1; p = (void *)(vbc + 1); - http_Setup(vbc->http, p, heritage.mem_workspace); - p += heritage.mem_workspace; - http_Setup(vbc->http2, p, heritage.mem_workspace); + http_Setup(vbc->http, p, params->mem_workspace); + p += params->mem_workspace; + http_Setup(vbc->http2, p, params->mem_workspace); return (vbc); } Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-19 19:46:32 UTC (rev 834) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-19 20:15:09 UTC (rev 835) @@ -192,7 +192,7 @@ } else { /* If we are a dynamic thread, time out and die */ AZ(clock_gettime(CLOCK_REALTIME, &ts)); - ts.tv_sec += heritage.wthread_timeout; + ts.tv_sec += params->wthread_timeout; if (pthread_cond_timedwait(&w->cv, &wrk_mtx, &ts)) { VSL_stats->n_wrk--; TAILQ_REMOVE(&wrk_idle, w, list); @@ -237,7 +237,7 @@ wrk_overflow++; /* Can we create more threads ? */ - if (VSL_stats->n_wrk >= heritage.wthread_max) { + if (VSL_stats->n_wrk >= params->wthread_max) { VSL_stats->n_wrk_max++; AZ(pthread_mutex_unlock(&wrk_mtx)); return; @@ -273,8 +273,8 @@ AZ(pthread_mutex_init(&wrk_mtx, NULL)); - VSL(SLT_Debug, 0, "Starting %u worker threads", heritage.wthread_min); - for (i = 0; i < heritage.wthread_min; i++) { + VSL(SLT_Debug, 0, "Starting %u worker threads", params->wthread_min); + for (i = 0; i < params->wthread_min; i++) { VSL_stats->n_wrk++; AZ(pthread_create(&tp, NULL, wrk_thread, &i)); AZ(pthread_detach(tp)); Modified: trunk/varnish-cache/bin/varnishd/cache_session.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-19 19:46:32 UTC (rev 834) +++ trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-19 20:15:09 UTC (rev 835) @@ -186,7 +186,7 @@ struct sessmem *sm; sm = calloc( - sizeof *sm + heritage.mem_workspace, + sizeof *sm + params->mem_workspace, 1); if (sm == NULL) return (NULL); @@ -203,7 +203,7 @@ sm->sess.sockaddrlen = len; } - http_Setup(&sm->http, (void *)(sm + 1), heritage.mem_workspace); + http_Setup(&sm->http, (void *)(sm + 1), params->mem_workspace); sm->sess.acct.first = time(NULL); Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-19 19:46:32 UTC (rev 834) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-19 20:15:09 UTC (rev 835) @@ -25,6 +25,11 @@ /* Hash method */ struct hash_slinger *hash; +}; + +struct params { + + /* TTL used for lack of anything better */ unsigned default_ttl; /* Worker threads */ @@ -36,6 +41,7 @@ unsigned mem_workspace; }; +extern struct params *params; extern struct heritage heritage; void child_main(void); Modified: trunk/varnish-cache/bin/varnishd/rfc2616.c =================================================================== --- trunk/varnish-cache/bin/varnishd/rfc2616.c 2006-08-19 19:46:32 UTC (rev 834) +++ trunk/varnish-cache/bin/varnishd/rfc2616.c 2006-08-19 20:15:09 UTC (rev 835) @@ -111,7 +111,7 @@ retirement_age = h_expires - h_date; } if (retirement_age == INT_MAX) - retirement_age = heritage.default_ttl; + retirement_age = params->default_ttl; ttd = obj->entered + retirement_age; } Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-19 19:46:32 UTC (rev 834) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-19 20:15:09 UTC (rev 835) @@ -135,49 +135,76 @@ /*--------------------------------------------------------------------*/ -void -VSL_MgtInit(const char *fn, unsigned size) +static int +vsl_goodold(int fd) { struct shmloghead slh; - int i = 0; + int i; memset(&slh, 0, sizeof slh); /* XXX: for flexelint */ - heritage.vsl_fd = open(fn, O_RDWR, 0644); - if (heritage.vsl_fd >= 0) - i = read(heritage.vsl_fd, &slh, sizeof slh); - if (heritage.vsl_fd < 0 || i != sizeof slh || - slh.magic != SHMLOGHEAD_MAGIC || - slh.hdrsize != sizeof slh) { - /* XXX more checks */ + i = read(fd, &slh, sizeof slh); + if (i != sizeof slh) + return (0); + if (slh.magic != SHMLOGHEAD_MAGIC) + return (0); + if (slh.hdrsize != sizeof slh) + return (0); + if (slh.start != sizeof slh + sizeof *params) + return (0); + /* XXX more checks */ + heritage.vsl_size = slh.size + slh.start; + return (1); +} - fprintf(stderr, "Creating new SHMFILE\n"); - if (heritage.vsl_fd >= 0) - close(heritage.vsl_fd); - (void)unlink(fn); - heritage.vsl_fd = open(fn, O_RDWR | O_CREAT, 0644); - if (heritage.vsl_fd < 0) { - fprintf(stderr, "Could not open %s: %s\n", - fn, strerror(errno)); - exit (1); - } +static void +vsl_buildnew(const char *fn, unsigned size) +{ + struct shmloghead slh; + int i; - memset(&slh, 0, sizeof slh); - slh.magic = SHMLOGHEAD_MAGIC; - slh.hdrsize = sizeof slh; - slh.size = size; - slh.ptr = 0; - slh.start = sizeof slh; - AZ(lseek(heritage.vsl_fd, 0, SEEK_SET)); - i = write(heritage.vsl_fd, &slh, sizeof slh); - assert(i == sizeof slh); - AZ(ftruncate(heritage.vsl_fd, (off_t)sizeof slh + (off_t)size)); + (void)unlink(fn); + heritage.vsl_fd = open(fn, O_RDWR | O_CREAT, 0644); + if (heritage.vsl_fd < 0) { + fprintf(stderr, "Could not open %s: %s\n", + fn, strerror(errno)); + exit (1); } - heritage.vsl_size = slh.size + slh.start; + memset(&slh, 0, sizeof slh); + slh.magic = SHMLOGHEAD_MAGIC; + slh.hdrsize = sizeof slh; + slh.size = size; + slh.ptr = 0; + slh.start = sizeof slh + sizeof *params; + i = write(heritage.vsl_fd, &slh, sizeof slh); + assert(i == sizeof slh); + heritage.vsl_size = slh.start + size; + AZ(ftruncate(heritage.vsl_fd, (off_t)heritage.vsl_size)); +} + +void +VSL_MgtInit(const char *fn, unsigned size) +{ + int i; + struct params *pp; + + i = open(fn, O_RDWR, 0644); + if (i >= 0 && vsl_goodold(i)) { + fprintf(stderr, "Using old SHMFILE\n"); + heritage.vsl_fd = i; + } else { + fprintf(stderr, "Creating new SHMFILE\n"); + (void)close(i); + vsl_buildnew(fn, size); + } + loghead = mmap(NULL, heritage.vsl_size, PROT_READ|PROT_WRITE, MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED, heritage.vsl_fd, 0); assert(loghead != MAP_FAILED); VSL_stats = &loghead->stats; + pp = (void *)(loghead + 1); + memcpy(pp, params, sizeof *pp); + params = pp; } Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-19 19:46:32 UTC (rev 834) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-19 20:15:09 UTC (rev 835) @@ -32,6 +32,7 @@ #endif struct heritage heritage; +struct params *params; /*--------------------------------------------------------------------*/ @@ -188,13 +189,13 @@ usage(); if (ua < 1) usage(); - heritage.wthread_min = ua; - heritage.wthread_max = ua; - heritage.wthread_timeout = 10; + params->wthread_min = ua; + params->wthread_max = ua; + params->wthread_timeout = 10; if (i >= 2) - heritage.wthread_max = ub; + params->wthread_max = ub; if (i >= 3) - heritage.wthread_timeout = uc; + params->wthread_timeout = uc; } /*-------------------------------------------------------------------- @@ -323,17 +324,20 @@ const char *sflag = "file"; const char *hflag = "classic"; const char *Tflag = NULL; + struct params param; setbuf(stdout, NULL); setbuf(stderr, NULL); + memset(¶m, 0, sizeof param); + params = ¶m; mgt_vcc_init(); - heritage.default_ttl = 120; - heritage.wthread_min = 1; - heritage.wthread_max = UINT_MAX; - heritage.wthread_timeout = 10; - heritage.mem_workspace = 4096; + params->default_ttl = 120; + params->wthread_min = 1; + params->wthread_max = UINT_MAX; + params->wthread_timeout = 10; + params->mem_workspace = 4096; while ((o = getopt(argc, argv, "b:df:h:p:s:t:T:Vw:")) != -1) switch (o) { @@ -356,7 +360,7 @@ sflag = optarg; break; case 't': - heritage.default_ttl = strtoul(optarg, NULL, 0); + params->default_ttl = strtoul(optarg, NULL, 0); break; case 'T': Tflag = optarg; From phk at projects.linpro.no Sat Aug 19 20:16:48 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 19 Aug 2006 22:16:48 +0200 (CEST) Subject: r836 - trunk/varnish-cache/bin/varnishd Message-ID: <20060819201648.906E51EC93C@projects.linpro.no> Author: phk Date: 2006-08-19 22:16:48 +0200 (Sat, 19 Aug 2006) New Revision: 836 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: cleanup Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-19 20:15:09 UTC (rev 835) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-19 20:16:48 UTC (rev 836) @@ -116,15 +116,13 @@ { CLI_CONFIG_DISCARD, mcf_config_discard, NULL }, { CLI_CONFIG_LIST, mcf_config_list, NULL }, #if 0 - { CLI_SERVER_STOP, m_cli_func_server_stop, NULL }, { CLI_SERVER_RESTART }, - { CLI_PING, m_cli_func_ping, NULL }, { CLI_ZERO }, { CLI_VERBOSE, m_cli_func_verbose, NULL }, { CLI_EXIT, m_cli_func_exit, NULL}, -#endif { CLI_QUIT }, { CLI_BYE }, +#endif { NULL } }; From phk at projects.linpro.no Sat Aug 19 20:28:30 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 19 Aug 2006 22:28:30 +0200 (CEST) Subject: r837 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20060819202830.2E7021EC93B@projects.linpro.no> Author: phk Date: 2006-08-19 22:28:30 +0200 (Sat, 19 Aug 2006) New Revision: 837 Added: trunk/varnish-cache/bin/varnishd/mgt_param.c Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_cli.h trunk/varnish-cache/include/cli.h Log: Add two new CLI commands: param.set and param.show. Eliminate requirement that "help" be first, I was just lazy I guess. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-19 20:16:48 UTC (rev 836) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-19 20:28:30 UTC (rev 837) @@ -31,6 +31,7 @@ mgt_child.c \ mgt_cli.c \ mgt_event.c \ + mgt_param.c \ mgt_vcc.c \ rfc2616.c \ shmlog.c \ Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-19 20:16:48 UTC (rev 836) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-19 20:28:30 UTC (rev 837) @@ -104,8 +104,8 @@ static struct cli_proto *cli_proto; +/* XXX: what order should this list be in ? */ static struct cli_proto mgt_cli_proto[] = { - { CLI_HELP, cli_func_help, NULL }, /* must be first */ { CLI_PING, cli_func_ping }, { CLI_SERVER_START, mcf_server_startstop, NULL }, { CLI_SERVER_STOP, mcf_server_startstop, &cli_proto }, @@ -115,6 +115,9 @@ { CLI_CONFIG_USE, mcf_config_use, NULL }, { CLI_CONFIG_DISCARD, mcf_config_discard, NULL }, { CLI_CONFIG_LIST, mcf_config_list, NULL }, + { CLI_PARAM_SHOW, mcf_param_show, NULL }, + { CLI_PARAM_SET, mcf_param_set, NULL }, + { CLI_HELP, cli_func_help, NULL }, #if 0 { CLI_SERVER_RESTART }, { CLI_ZERO }, @@ -163,8 +166,12 @@ } /* Fixup the entry for 'help' entry */ - assert(!strcmp(cli_proto[0].request, "help")); - cli_proto[0].priv = cli_proto; + for (u = 0; cli_proto[u].request != NULL; u++) { + if (!strcmp(cli_proto[u].request, "help")) { + cli_proto[u].priv = cli_proto; + break; + } + } } /*-------------------------------------------------------------------- Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.h 2006-08-19 20:16:48 UTC (rev 836) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.h 2006-08-19 20:28:30 UTC (rev 837) @@ -5,6 +5,10 @@ /* mgt_child.c */ cli_func_t mcf_server_startstop; +/* mgt_param.c */ +cli_func_t mcf_param_show; +cli_func_t mcf_param_set; + /* mgt_vcc.c */ cli_func_t mcf_config_load; cli_func_t mcf_config_inline; Added: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-19 20:16:48 UTC (rev 836) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-19 20:28:30 UTC (rev 837) @@ -0,0 +1,28 @@ +/* + * $Id$ + */ + +#include + +#include "cli_priv.h" +#include "mgt.h" +#include "mgt_cli.h" + +void +mcf_param_show(struct cli *cli, char **av, void *priv) +{ + + (void)cli; + (void)av; + (void)priv; +} + +void +mcf_param_set(struct cli *cli, char **av, void *priv) +{ + + (void)cli; + (void)av; + (void)priv; +} + Modified: trunk/varnish-cache/include/cli.h =================================================================== --- trunk/varnish-cache/include/cli.h 2006-08-19 20:16:48 UTC (rev 836) +++ trunk/varnish-cache/include/cli.h 2006-08-19 20:28:30 UTC (rev 837) @@ -77,6 +77,18 @@ "\tSwitch to the named configuration immediately.", \ 1, 1 +#define CLI_PARAM_SHOW \ + "param.show", \ + "param.show []", \ + "\tShow parameters and their values.", \ + 0, 1 + +#define CLI_PARAM_SET \ + "param.set", \ + "param.set ", \ + "\tSet parameter value.", \ + 2,2 + #define CLI_SERVER_FREEZE \ "server.freeze", \ "server.freeze", \ From phk at projects.linpro.no Sat Aug 19 21:32:10 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 19 Aug 2006 23:32:10 +0200 (CEST) Subject: r838 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20060819213210.320BB1EC935@projects.linpro.no> Author: phk Date: 2006-08-19 23:32:10 +0200 (Sat, 19 Aug 2006) New Revision: 838 Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/include/cli.h Log: Implement the first load of tweable parameters Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-19 20:28:30 UTC (rev 837) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-19 21:32:10 UTC (rev 838) @@ -2,27 +2,247 @@ * $Id$ */ +#include +#include #include +#include +#include "cli.h" #include "cli_priv.h" #include "mgt.h" #include "mgt_cli.h" +#include "heritage.h" + +struct parspec; + +typedef void tweak_t(struct cli *, struct parspec *, const char *arg); + +struct parspec { + const char *name; + tweak_t *func; + const char *expl; +}; + +/*--------------------------------------------------------------------*/ + +static void +tweak_default_ttl(struct cli *cli, struct parspec *par, const char *arg) +{ + + (void)par; + if (arg != NULL) + params->default_ttl = strtoul(arg, NULL, 0); + cli_out(cli, "%u [seconds]\n", params->default_ttl); +} + +/*--------------------------------------------------------------------*/ + +static void +tweak_thread_pool_min(struct cli *cli, struct parspec *par, const char *arg) +{ + unsigned u; + + (void)par; + if (arg != NULL) { + u = strtoul(arg, NULL, 0); + if (u >= params->wthread_max) { + cli_out(cli, "Minimum must be less than maximum\n"); + cli_result(cli, CLIS_PARAM); + return; + } + params->wthread_min = u; + } + cli_out(cli, "%u [threads]\n", params->wthread_min); +} + +/*--------------------------------------------------------------------*/ + +static void +tweak_thread_pool_max(struct cli *cli, struct parspec *par, const char *arg) +{ + unsigned u; + + (void)par; + if (arg != NULL) { + u = strtoul(arg, NULL, 0); + if (u <= params->wthread_min) { + cli_out(cli, "Maximum must be greater than minimum\n"); + cli_result(cli, CLIS_PARAM); + return; + } + params->wthread_max = u; + } + if (params->wthread_max == UINT_MAX) + cli_out(cli, "unlimited\n"); + else + cli_out(cli, "%u [threads]\n", params->wthread_max); +} + +/*--------------------------------------------------------------------*/ + +static void +tweak_thread_pool_timeout(struct cli *cli, struct parspec *par, const char *arg) +{ + unsigned u; + + (void)par; + if (arg != NULL) { + u = strtoul(arg, NULL, 0); + if (u == 0) { + cli_out(cli, "Timeout must be greater than zero\n"); + cli_result(cli, CLIS_PARAM); + return; + } + params->wthread_timeout = u; + } + cli_out(cli, "%u [seconds]\n", params->wthread_timeout); +} +/*--------------------------------------------------------------------*/ + +static void +tweak_http_workspace(struct cli *cli, struct parspec *par, const char *arg) +{ + unsigned u; + + (void)par; + if (arg != NULL) { + u = strtoul(arg, NULL, 0); + if (u <= 1024) { + cli_out(cli, "Workspace must be at least 1024 bytes\n"); + cli_result(cli, CLIS_PARAM); + return; + } + params->mem_workspace = u; + } + cli_out(cli, "%u [bytes]\n", params->mem_workspace); +} + +/*--------------------------------------------------------------------*/ + +/* + * Make sure to end all lines with either a space or newline of the + * formatting will go haywire. + */ + +#define DELAYED_EFFECT \ + "\nNB: This parameter will take some time to take effect.\n" + +#define SHOULD_RESTART \ + "\nNB: This parameter will not take full effect until the " \ + "child process has been restarted.\n" + +#define MUST_RESTART \ + "\nNB: This parameter will not take any effect until the " \ + "child process has been restarted.\n" + + +static struct parspec parspec[] = { + { "default_ttl", tweak_default_ttl, + "The TTL assigned to objects if neither the backend nor " + "the VCL code assigns one.\n" + "Objects already cached will not be affected by changes " + "made until they are fetched from the backend again.\n" + "To force an immediate effect at the expense of a total " + "flush of the cache use \"url.purge .\"\n" + "Default is 120 seconds. " }, + { "thread_pool_min", tweak_thread_pool_min, + "The minimum number of threads in the worker pool.\n" + DELAYED_EFFECT + "Default is 1 thread. " + "Minimum is 1 thread. " }, + { "thread_pool_max", tweak_thread_pool_max, + "The maximum number of threads in the worker pool.\n" + DELAYED_EFFECT + "Default is no limit." }, + { "thread_pool_timeout", tweak_thread_pool_timeout, + "Thread dies after this many seconds of inactivity.\n" + "Default is 10 seconds. " + "Minimum is 1 second. " }, + { "http_workspace", tweak_http_workspace, + "Bytes of HTTP protocol workspace allocated. " + "This space must be big enough for the entire HTTP protocol " + "header and any edits done to it in the VCL code.\n" + SHOULD_RESTART + "Default is 4096 bytes. " + "Minimum is 1024 bytes. " }, + { NULL, NULL, NULL } +}; + +/*--------------------------------------------------------------------*/ + void mcf_param_show(struct cli *cli, char **av, void *priv) { + struct parspec *pp; + const char *p, *q; + int lfmt; - (void)cli; - (void)av; (void)priv; + if (av[2] == NULL || strcmp(av[2], "-l")) + lfmt = 0; + else + lfmt = 1; + for (pp = parspec; pp->name != NULL; pp++) { + if (av[2] != NULL && !lfmt && strcmp(pp->name, av[2])) + continue; + cli_out(cli, "%-20s ", pp->name); + if (pp->func == NULL) { + cli_out(cli, "Not implemented.\n"); + if (av[2] != NULL && !lfmt) + return; + else + continue; + } + pp->func(cli, pp, NULL); + if (av[2] != NULL) { + /* Format text to 72 col width */ + for (p = pp->expl; *p != '\0'; ) { + q = strchr(p, '\n'); + if (q == NULL) + q = strchr(p, '\0'); + assert(q != NULL); + if (q > p + 52) { + q = p + 52; + while (q > p && *q != ' ') + q--; + assert(q != NULL); + } + cli_out(cli, "%20s %.*s\n", "", q - p, p); + p = q; + if (*p == ' ' || *p == '\n') + p++; + } + if (!lfmt) + return; + else + cli_out(cli, "\n"); + } + } + if (av[2] != NULL && !lfmt) { + cli_result(cli, CLIS_PARAM); + cli_out(cli, "Unknown paramter \"%s\".", av[2]); + } } +/*--------------------------------------------------------------------*/ + void mcf_param_set(struct cli *cli, char **av, void *priv) { + struct parspec *pp; - (void)cli; - (void)av; (void)priv; + for (pp = parspec; pp->name != NULL; pp++) { + if (!strcmp(pp->name, av[2])) { + cli_out(cli, "%-20s ", pp->name); + pp->func(cli, pp, av[3]); + return; + } + } + if (av[2] != NULL) { + cli_result(cli, CLIS_PARAM); + cli_out(cli, "Unknown paramter \"%s\".", av[2]); + } } Modified: trunk/varnish-cache/include/cli.h =================================================================== --- trunk/varnish-cache/include/cli.h 2006-08-19 20:28:30 UTC (rev 837) +++ trunk/varnish-cache/include/cli.h 2006-08-19 21:32:10 UTC (rev 838) @@ -79,9 +79,9 @@ #define CLI_PARAM_SHOW \ "param.show", \ - "param.show []", \ + "param.show [-l] []", \ "\tShow parameters and their values.", \ - 0, 1 + 0, 2 #define CLI_PARAM_SET \ "param.set", \ From phk at projects.linpro.no Sat Aug 19 21:48:30 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 19 Aug 2006 23:48:30 +0200 (CEST) Subject: r839 - trunk/varnish-cache/bin/varnishd Message-ID: <20060819214830.2156B1EC93D@projects.linpro.no> Author: phk Date: 2006-08-19 23:48:30 +0200 (Sat, 19 Aug 2006) New Revision: 839 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: Make the session timeout and send timeout tweakables. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-19 21:32:10 UTC (rev 838) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-19 21:48:30 UTC (rev 839) @@ -79,7 +79,7 @@ { struct timeval tv; - tv.tv_sec = 600; + tv.tv_sec = params->send_timeout; tv.tv_usec = 0; AZ(setsockopt(sp->fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv)); } @@ -233,7 +233,7 @@ vca_handover(sp, i); continue; } - if (sp->t_idle.tv_sec + 5 < t.tv_sec) { + if (sp->t_idle.tv_sec + params->sess_timeout < t.tv_sec) { TAILQ_REMOVE(&sesshead, sp, list); vca_unpoll(sp->fd); vca_close_session(sp, "timeout"); @@ -354,7 +354,7 @@ clock_gettime(CLOCK_MONOTONIC, &t); TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (sp->t_idle.tv_sec + 5 < t.tv_sec) { + if (sp->t_idle.tv_sec + params->sess_timeout < t.tv_sec) { TAILQ_REMOVE(&sesshead, sp, list); vca_del(sp->fd); vca_close_session(sp, "timeout"); @@ -400,7 +400,8 @@ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); memset(ke, 0, sizeof ke); EV_SET(&ke[0], sp->fd, EVFILT_READ, arm, 0, 0, sp); - EV_SET(&ke[1], sp->fd, EVFILT_TIMER, arm , 0, 5000, sp); + EV_SET(&ke[1], sp->fd, EVFILT_TIMER, arm , 0, + params->sess_timeout * 1000, sp); i = kevent(kq, ke, 2, NULL, 0, NULL); if (arm == EV_ADD) assert(i == 0); Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-19 21:32:10 UTC (rev 838) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-19 21:48:30 UTC (rev 839) @@ -39,6 +39,10 @@ /* Memory allocation hints */ unsigned mem_workspace; + + /* Acceptor hints */ + unsigned sess_timeout; + unsigned send_timeout; }; extern struct params *params; Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-19 21:32:10 UTC (rev 838) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-19 21:48:30 UTC (rev 839) @@ -120,6 +120,46 @@ /*--------------------------------------------------------------------*/ +static void +tweak_sess_timeout(struct cli *cli, struct parspec *par, const char *arg) +{ + unsigned u; + + (void)par; + if (arg != NULL) { + u = strtoul(arg, NULL, 0); + if (u == 0) { + cli_out(cli, "Timeout must be greater than zero\n"); + cli_result(cli, CLIS_PARAM); + return; + } + params->sess_timeout = u; + } + cli_out(cli, "%u [seconds]\n", params->sess_timeout); +} + +/*--------------------------------------------------------------------*/ + +static void +tweak_send_timeout(struct cli *cli, struct parspec *par, const char *arg) +{ + unsigned u; + + (void)par; + if (arg != NULL) { + u = strtoul(arg, NULL, 0); + if (u == 0) { + cli_out(cli, "Timeout must be greater than zero\n"); + cli_result(cli, CLIS_PARAM); + return; + } + params->send_timeout = u; + } + cli_out(cli, "%u [seconds]\n", params->send_timeout); +} + +/*--------------------------------------------------------------------*/ + /* * Make sure to end all lines with either a space or newline of the * formatting will go haywire. @@ -166,6 +206,21 @@ SHOULD_RESTART "Default is 4096 bytes. " "Minimum is 1024 bytes. " }, + { "sess_timeout", tweak_sess_timeout, + "Idle timeout for persistent sessions. " + "If a HTTP request has not been received in this many " + "seconds, the session is closed.\n" +#ifdef HAVE_ACCEPT_FILTERS + DELAYED_EFFECT +#endif + "Default is 15 seconds. " }, + { "send_timeout", tweak_send_timeout, + "Send timeout for client connections. " + "If no data has been sent to the client in this many seconds, " + "the session is closed.\n" + "See getopt(3) under SO_SNDTIMEO for more information.\n" + "Default is 600 seconds. " }, + { NULL, NULL, NULL } }; Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-19 21:32:10 UTC (rev 838) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-19 21:48:30 UTC (rev 839) @@ -333,11 +333,14 @@ params = ¶m; mgt_vcc_init(); + /* XXX: move this to mgt_params.c ?? */ params->default_ttl = 120; params->wthread_min = 1; params->wthread_max = UINT_MAX; params->wthread_timeout = 10; params->mem_workspace = 4096; + params->sess_timeout = 15; + params->send_timeout = 600; while ((o = getopt(argc, argv, "b:df:h:p:s:t:T:Vw:")) != -1) switch (o) { From phk at projects.linpro.no Sun Aug 20 07:26:52 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 09:26:52 +0200 (CEST) Subject: r840 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060820072652.78CB31EC92A@projects.linpro.no> Author: phk Date: 2006-08-20 09:26:52 +0200 (Sun, 20 Aug 2006) New Revision: 840 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: Make sure we have predictable column numbers by printing '-' if it is neither classified as client or backend. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-19 21:48:30 UTC (rev 839) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-20 07:26:52 UTC (rev 840) @@ -89,7 +89,7 @@ vsb_printf(ob[fd], "%5d %-12s %c %.*s", fd, VSL_tags[tag], ((spec & VSL_S_CLIENT) ? 'c' : \ - (spec & VSL_S_BACKEND) ? 'b' : ' '), + (spec & VSL_S_BACKEND) ? 'b' : '-'), len, ptr); return (0); case SLT_VCL_trace: @@ -109,7 +109,7 @@ } vsb_printf(ob[fd], "%5d %-12s %c %.*s\n", fd, VSL_tags[tag], - ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : ' '), + ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : '-'), len, ptr); switch (tag) { case SLT_ReqEnd: From phk at projects.linpro.no Sun Aug 20 07:27:33 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 09:27:33 +0200 (CEST) Subject: r841 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820072733.5A80F1EC945@projects.linpro.no> Author: phk Date: 2006-08-20 09:27:33 +0200 (Sun, 20 Aug 2006) New Revision: 841 Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Add note that send_timeout has DELAYED effect Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-20 07:26:52 UTC (rev 840) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-20 07:27:33 UTC (rev 841) @@ -218,6 +218,7 @@ "Send timeout for client connections. " "If no data has been sent to the client in this many seconds, " "the session is closed.\n" + DELAYED_EFFECT "See getopt(3) under SO_SNDTIMEO for more information.\n" "Default is 600 seconds. " }, From phk at projects.linpro.no Sun Aug 20 07:27:53 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 09:27:53 +0200 (CEST) Subject: r842 - in trunk/varnish-cache: . bin bin/varnishhist Message-ID: <20060820072753.1AB911EC93F@projects.linpro.no> Author: phk Date: 2006-08-20 09:27:52 +0200 (Sun, 20 Aug 2006) New Revision: 842 Added: trunk/varnish-cache/bin/varnishhist/ trunk/varnish-cache/bin/varnishhist/Makefile.am trunk/varnish-cache/bin/varnishhist/varnishhist.c Modified: trunk/varnish-cache/bin/Makefile.am trunk/varnish-cache/configure.ac Log: Add varnishhist(1) a program that shows the responsetime as a curses histogram. Modified: trunk/varnish-cache/bin/Makefile.am =================================================================== --- trunk/varnish-cache/bin/Makefile.am 2006-08-20 07:27:33 UTC (rev 841) +++ trunk/varnish-cache/bin/Makefile.am 2006-08-20 07:27:52 UTC (rev 842) @@ -1,3 +1,3 @@ # $Id$ -SUBDIRS = varnishd varnishlog varnishncsa varnishstat varnishtop +SUBDIRS = varnishd varnishhist varnishlog varnishncsa varnishstat varnishtop Added: trunk/varnish-cache/bin/varnishhist/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishhist/Makefile.am 2006-08-20 07:27:33 UTC (rev 841) +++ trunk/varnish-cache/bin/varnishhist/Makefile.am 2006-08-20 07:27:52 UTC (rev 842) @@ -0,0 +1,17 @@ +# $Id: Makefile.am 767 2006-08-08 12:31:19Z des $ + +INCLUDES = -I$(top_srcdir)/include + +bin_PROGRAMS = varnishhist + +# dist_man_MANS = varnishlog.1 + +varnishhist_SOURCES = varnishhist.c + +varnishhist_CFLAGS = -include config.h + +varnishhist_LDADD = \ + $(top_builddir)/lib/libcompat/libcompat.a \ + $(top_builddir)/lib/libvarnish/libvarnish.la \ + $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ + -lm -lcurses Added: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-20 07:27:33 UTC (rev 841) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-20 07:27:52 UTC (rev 842) @@ -0,0 +1,144 @@ +/* + * $Id: varnishlog.c 833 2006-08-18 20:07:37Z phk $ + * + * Log tailer for Varnish + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "compat/vis.h" + +#include "libvarnish.h" +#include "shmlog.h" +#include "varnishapi.h" + +#define HIST_LOW -55 +#define HIST_HIGH 20 +#define HIST_W (1 + (HIST_HIGH - HIST_LOW)) +#define HIST_N 1000 + +static unsigned char rr_hist[HIST_N]; +static unsigned next_hist; +static unsigned bucket_hist[HIST_W]; +static double c_hist; + +static void +r_hist(void) +{ + int x, y; + double m, r; + + m = 0; + r = 0; + for (x = 0; x < HIST_W; x++) { + if (bucket_hist[x] > m) + m = bucket_hist[x]; + r += bucket_hist[x]; + } + + mvprintw(0, 0, "Max %.0f Scale %u Tot: %.0f", m, HIST_N, r); + m = HIST_N / (LINES - 3); + move(1,0); + for (y = LINES - 3; y > 0; y--) { + if (y == 1) + r = 0; + else + r = y * m; + for (x = 0; x < HIST_W; x++) + addch(bucket_hist[x] > r ? '#' : ' '); + addch('\n'); + } + refresh(); +} + +static int +h_hist(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) +{ + double b; + int i; + + (void)priv; + (void)fd; + (void)len; + (void)spec; + if (tag != SLT_ReqEnd) + return (0); + i = sscanf(ptr, "%*d %*f %*f %lf", &b); + assert(i == 1); + i = log(b) * c_hist; + if (i < HIST_LOW) + i = HIST_LOW; + if (i > HIST_HIGH) + i = HIST_HIGH; + i -= HIST_LOW; + bucket_hist[rr_hist[next_hist]]--; + rr_hist[next_hist] = i; + bucket_hist[rr_hist[next_hist]]++; + if (++next_hist == HIST_N) { + next_hist = 0; + } + if (!(next_hist % 100)) + r_hist(); + return (0); +} + +/*--------------------------------------------------------------------*/ + +static void +usage(void) +{ + fprintf(stderr, + "usage: varnishhist"); + exit(1); +} + +int +main(int argc, char **argv) +{ + int i, c, x; + struct VSL_data *vd; + + vd = VSL_New(); + + while ((c = getopt(argc, argv, VSL_ARGS)) != -1) { + switch (c) { + default: + if (VSL_Arg(vd, c, optarg) > 0) + break; + usage(); + } + } + + c_hist = 10.0 / log(10.0); + initscr(); + erase(); + + bucket_hist[0] = HIST_N; + move(LINES - 2, 0); + for (x = 0; x < HIST_W; x++) + addch('-'); + + for (x = 0; x < HIST_W; x++) { + if ((x + HIST_LOW) % 10 != 0) + continue; + mvprintw(LINES - 2, x, "+"); + mvprintw(LINES - 1, x, "|1e%d", (x + HIST_LOW) / 10); + } + + while (1) { + i = VSL_Dispatch(vd, h_hist, NULL); + if (i < 0) + break; + if (i == 0) + r_hist(); + } + + return (0); +} Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-20 07:27:33 UTC (rev 841) +++ trunk/varnish-cache/configure.ac 2006-08-20 07:27:52 UTC (rev 842) @@ -98,6 +98,7 @@ bin/Makefile bin/varnishd/Makefile bin/varnishlog/Makefile + bin/varnishhist/Makefile bin/varnishncsa/Makefile bin/varnishstat/Makefile bin/varnishtop/Makefile From phk at projects.linpro.no Sun Aug 20 07:32:50 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 09:32:50 +0200 (CEST) Subject: r843 - trunk/varnish-cache/bin/varnishhist Message-ID: <20060820073250.E26111EC947@projects.linpro.no> Author: phk Date: 2006-08-20 09:32:50 +0200 (Sun, 20 Aug 2006) New Revision: 843 Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c Log: Remember to open the shmlog Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-20 07:27:52 UTC (rev 842) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-20 07:32:50 UTC (rev 843) @@ -116,6 +116,9 @@ } } + if (VSL_OpenLog(vd)) + exit (1); + c_hist = 10.0 / log(10.0); initscr(); erase(); From phk at projects.linpro.no Sun Aug 20 11:19:21 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 13:19:21 +0200 (CEST) Subject: r844 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820111921.0C6BB1EC934@projects.linpro.no> Author: phk Date: 2006-08-20 13:19:20 +0200 (Sun, 20 Aug 2006) New Revision: 844 Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c Log: Respect lower pool limit dynamically Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-20 07:32:50 UTC (rev 843) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-20 11:19:20 UTC (rev 844) @@ -160,6 +160,7 @@ struct worker *w, ww; struct timespec ts; + (void)priv; w = &ww; memset(w, 0, sizeof *w); w->magic = WORKER_MAGIC; @@ -168,10 +169,8 @@ AZ(pthread_mutex_lock(&wrk_mtx)); w->nbr = VSL_stats->n_wrk; - if (priv == NULL) { - VSL_stats->n_wrk_create++; - VSL(SLT_WorkThread, 0, "%u born dynamic", w->nbr); - } + VSL_stats->n_wrk_create++; + VSL(SLT_WorkThread, 0, "%u born", w->nbr); TAILQ_INSERT_HEAD(&wrk_busy, w, list); while (1) { CHECK_OBJ_NOTNULL(w, WORKER_MAGIC); @@ -187,7 +186,7 @@ TAILQ_INSERT_HEAD(&wrk_idle, w, list); /* If we are a reserved thread we don't die */ - if (priv != NULL) { + if (w->nbr < params->wthread_min) { AZ(pthread_cond_wait(&w->cv, &wrk_mtx)); } else { /* If we are a dynamic thread, time out and die */ @@ -276,7 +275,7 @@ VSL(SLT_Debug, 0, "Starting %u worker threads", params->wthread_min); for (i = 0; i < params->wthread_min; i++) { VSL_stats->n_wrk++; - AZ(pthread_create(&tp, NULL, wrk_thread, &i)); + AZ(pthread_create(&tp, NULL, wrk_thread, NULL)); AZ(pthread_detach(tp)); } } From phk at projects.linpro.no Sun Aug 20 12:15:15 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 14:15:15 +0200 (CEST) Subject: r845 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820121515.230221EC221@projects.linpro.no> Author: phk Date: 2006-08-20 14:15:15 +0200 (Sun, 20 Aug 2006) New Revision: 845 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Pull out up to 20 kevents at time instead of just one. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-20 11:19:20 UTC (rev 844) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-20 12:15:15 UTC (rev 845) @@ -422,11 +422,13 @@ vca_kq_sess(sp, EV_ADD); } +#define NKEV 20 + static void * vca_main(void *arg) { - struct kevent ke; - int i; + struct kevent ke[10]; + int i, j, n; struct sess *sp; (void)arg; @@ -436,44 +438,38 @@ if (heritage.socket >= 0) { - memset(&ke, 0, sizeof ke); - EV_SET(&ke, heritage.socket, + memset(&ke[0], 0, sizeof ke[0]); + EV_SET(&ke[0], heritage.socket, EVFILT_READ, EV_ADD, 0, 0, accept_f); - AZ(kevent(kq, &ke, 1, NULL, 0, NULL)); + AZ(kevent(kq, &ke[0], 1, NULL, 0, NULL)); } while (1) { - i = kevent(kq, NULL, 0, &ke, 1, NULL); - assert(i == 1); -#if 0 - printf("i = %d\n", i); - printf("ke.ident = %ju\n", (uintmax_t)ke.ident); - printf("ke.filter = %u\n", ke.filter); - printf("ke.flags = %u\n", ke.flags); - printf("ke.fflags = %u\n", ke.fflags); - printf("ke.data = %jd\n", (intmax_t)ke.data); - printf("ke.udata = %p\n", ke.udata); -#endif - if (ke.udata == accept_f) { - accept_f(ke.ident); - continue; - } - CAST_OBJ_NOTNULL(sp, ke.udata, SESS_MAGIC); - if (ke.filter == EVFILT_READ) { - i = http_RecvSome(sp->fd, sp->http); - if (i == -1) + n = kevent(kq, NULL, 0, ke, NKEV, NULL); + assert(n >= 1); + VSL(SLT_Debug, 0, "KQ %d", n); + for (j = 0; j < n; j++) { + if (ke[j].udata == accept_f) { + accept_f(ke[j].ident); continue; - vca_kq_sess(sp, EV_DELETE); - vca_handover(sp, i); - continue; + } + CAST_OBJ_NOTNULL(sp, ke[j].udata, SESS_MAGIC); + if (ke[j].filter == EVFILT_READ) { + i = http_RecvSome(sp->fd, sp->http); + if (i == -1) + continue; + vca_kq_sess(sp, EV_DELETE); + vca_handover(sp, i); + continue; + } + if (ke[j].filter == EVFILT_TIMER) { + vca_kq_sess(sp, EV_DELETE); + vca_close_session(sp, "timeout"); + vca_return_session(sp); + continue; + } + INCOMPL(); } - if (ke.filter == EVFILT_TIMER) { - vca_kq_sess(sp, EV_DELETE); - vca_close_session(sp, "timeout"); - vca_return_session(sp); - continue; - } - INCOMPL(); } INCOMPL(); From phk at projects.linpro.no Sun Aug 20 13:38:34 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 15:38:34 +0200 (CEST) Subject: r846 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820133834.AD80D1EC94C@projects.linpro.no> Author: phk Date: 2006-08-20 15:38:34 +0200 (Sun, 20 Aug 2006) New Revision: 846 Modified: trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: Make autostart a tweakable parameter, this is useful for debugging Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-20 12:15:15 UTC (rev 845) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-20 13:38:34 UTC (rev 846) @@ -43,6 +43,9 @@ /* Acceptor hints */ unsigned sess_timeout; unsigned send_timeout; + + /* Management hints */ + unsigned auto_restart; }; extern struct params *params; Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-20 12:15:15 UTC (rev 845) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-20 13:38:34 UTC (rev 846) @@ -247,8 +247,10 @@ child_fds[0] = -1; fprintf(stderr, "Child cleaned\n"); - if (child_state == CH_DIED) + if (child_state == CH_DIED && params->auto_restart) start_child(); + else if (child_state == CH_DIED) + child_state = CH_STOPPED; else if (child_state == CH_STOPPING) child_state = CH_STOPPED; return (0); Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-20 12:15:15 UTC (rev 845) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-20 13:38:34 UTC (rev 846) @@ -160,6 +160,26 @@ /*--------------------------------------------------------------------*/ +static void +tweak_auto_restart(struct cli *cli, struct parspec *par, const char *arg) +{ + unsigned u; + + (void)par; + if (arg != NULL) { + u = strtoul(arg, NULL, 0); + if (u != 0 && u != 1) { + cli_out(cli, "Only zero and one allowed.\n"); + cli_result(cli, CLIS_PARAM); + return; + } + params->auto_restart = u; + } + cli_out(cli, "%u {1 = yes, 0 = no}\n", params->auto_restart); +} + +/*--------------------------------------------------------------------*/ + /* * Make sure to end all lines with either a space or newline of the * formatting will go haywire. @@ -221,7 +241,10 @@ DELAYED_EFFECT "See getopt(3) under SO_SNDTIMEO for more information.\n" "Default is 600 seconds. " }, - + { "auto_restart", tweak_auto_restart, + "Restart child process automatically if it dies. " + "1 = yes, 0 = no.\n" + "Default is 1. " }, { NULL, NULL, NULL } }; Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-20 12:15:15 UTC (rev 845) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-20 13:38:34 UTC (rev 846) @@ -341,6 +341,7 @@ params->mem_workspace = 4096; params->sess_timeout = 15; params->send_timeout = 600; + params->auto_restart = 1; while ((o = getopt(argc, argv, "b:df:h:p:s:t:T:Vw:")) != -1) switch (o) { From phk at projects.linpro.no Sun Aug 20 13:39:24 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 15:39:24 +0200 (CEST) Subject: r847 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820133924.CEBB11EC94D@projects.linpro.no> Author: phk Date: 2006-08-20 15:39:24 +0200 (Sun, 20 Aug 2006) New Revision: 847 Modified: trunk/varnish-cache/bin/varnishd/varnishd.c Log: New defaults: 5 sec session timeout 60 sec thread pool timeout Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-20 13:38:34 UTC (rev 846) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-20 13:39:24 UTC (rev 847) @@ -337,9 +337,9 @@ params->default_ttl = 120; params->wthread_min = 1; params->wthread_max = UINT_MAX; - params->wthread_timeout = 10; + params->wthread_timeout = 60; params->mem_workspace = 4096; - params->sess_timeout = 15; + params->sess_timeout = 5; params->send_timeout = 600; params->auto_restart = 1; From phk at projects.linpro.no Sun Aug 20 14:53:12 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 16:53:12 +0200 (CEST) Subject: r848 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820145312.E1A1C1EC94C@projects.linpro.no> Author: phk Date: 2006-08-20 16:53:12 +0200 (Sun, 20 Aug 2006) New Revision: 848 Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: Fix malloc bug. Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-20 13:39:24 UTC (rev 847) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-20 14:53:12 UTC (rev 848) @@ -181,9 +181,10 @@ "config.load %s %s\n", vp->name, vp->fname)) return (1); free(*p); - if (vp->active && - mgt_cli_askchild(status, p, - "config.use %s\n", vp->name, vp->fname)) + if (!vp->active) + continue; + if (mgt_cli_askchild(status, p, "config.use %s\n", + vp->name, vp->fname)) return (1); free(*p); } From phk at projects.linpro.no Sun Aug 20 14:53:26 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 16:53:26 +0200 (CEST) Subject: r849 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820145326.4797A1EC94F@projects.linpro.no> Author: phk Date: 2006-08-20 16:53:26 +0200 (Sun, 20 Aug 2006) New Revision: 849 Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c Log: pid -1 is not our child Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-20 14:53:12 UTC (rev 848) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-20 14:53:26 UTC (rev 849) @@ -217,7 +217,7 @@ ev_poker = NULL; r = wait4(-1, &status, WNOHANG, NULL); - if (r != child_pid) { + if (r != child_pid || r == -1) { fprintf(stderr, "Unknown child died pid=%d status=0x%x\n", r, status); return (0); From phk at projects.linpro.no Sun Aug 20 15:11:34 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 17:11:34 +0200 (CEST) Subject: r850 - trunk/varnish-cache/lib/libvarnish Message-ID: <20060820151134.5CB951EC951@projects.linpro.no> Author: phk Date: 2006-08-20 17:11:34 +0200 (Sun, 20 Aug 2006) New Revision: 850 Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c Log: Assert that the cli status is valid Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-20 14:53:26 UTC (rev 849) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-20 15:11:34 UTC (rev 850) @@ -58,6 +58,8 @@ * any misformats by snprintf */ + assert(cli->result >= 100); + assert(cli->result <= 999); i = snprintf(res, sizeof res, "%-3d %-8d\n", cli->result, vsb_len(cli->sb)); assert(i == CLI_LINE0_LEN); From phk at projects.linpro.no Sun Aug 20 15:11:53 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 17:11:53 +0200 (CEST) Subject: r851 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820151153.25CC11EC953@projects.linpro.no> Author: phk Date: 2006-08-20 17:11:53 +0200 (Sun, 20 Aug 2006) New Revision: 851 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: Make sure the returns have some value. Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-20 15:11:34 UTC (rev 850) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-20 15:11:53 UTC (rev 851) @@ -187,8 +187,15 @@ va_list ap; unsigned u; - if (cli_i < 0|| cli_o < 0) + if (resp != NULL) + *resp = NULL; + if (status != NULL) + *status = 0; + if (cli_i < 0|| cli_o < 0) { + if (status != NULL) + *status = CLIS_CANT; return (CLIS_CANT); + } va_start(ap, fmt); i = vasprintf(&p, fmt, ap); va_end(ap); From phk at projects.linpro.no Sun Aug 20 15:12:13 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 17:12:13 +0200 (CEST) Subject: r852 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820151213.753AC1EC951@projects.linpro.no> Author: phk Date: 2006-08-20 17:12:13 +0200 (Sun, 20 Aug 2006) New Revision: 852 Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: Don't chat up non-running childs. Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-20 15:11:53 UTC (rev 851) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-20 15:12:13 UTC (rev 852) @@ -309,7 +309,8 @@ (void)priv; vp = mcf_find_vcl(cli, av[2]); if (vp != NULL && vp->active == 0) { - if (mgt_cli_askchild(&status, &p, "config.use %s\n", av[2])) { + if (child_pid >= 0 && + mgt_cli_askchild(&status, &p, "config.use %s\n", av[2])) { cli_result(cli, status); cli_out(cli, "%s", p); free(p); @@ -338,7 +339,8 @@ cli_result(cli, CLIS_PARAM); cli_out(cli, "Cannot discard active VCL program\n"); } else if (vp != NULL) { - if (mgt_cli_askchild(&status, &p, + if (child_pid >= 0 && + mgt_cli_askchild(&status, &p, "config.discard %s\n", av[2])) { cli_result(cli, status); cli_out(cli, "%s", p); From phk at projects.linpro.no Sun Aug 20 15:12:26 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 17:12:26 +0200 (CEST) Subject: r853 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820151226.844751EC954@projects.linpro.no> Author: phk Date: 2006-08-20 17:12:26 +0200 (Sun, 20 Aug 2006) New Revision: 853 Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c Log: Use TxHeader for pipe backend. Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-20 15:12:13 UTC (rev 852) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-20 15:12:26 UTC (rev 853) @@ -51,6 +51,7 @@ vc = VBE_GetFd(sp->backend, sp->xid); assert(vc != NULL); VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name); + vc->http->logtag = HTTP_Tx; http_CopyReq(vc->fd, vc->http, sp->http); http_FilterHeader(vc->fd, vc->http, sp->http, HTTPH_R_PIPE); From phk at projects.linpro.no Sun Aug 20 16:34:51 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 18:34:51 +0200 (CEST) Subject: r854 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820163451.4C47A1EC956@projects.linpro.no> Author: phk Date: 2006-08-20 18:34:51 +0200 (Sun, 20 Aug 2006) New Revision: 854 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: Remove unused variable. Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-20 15:12:26 UTC (rev 853) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-20 16:34:51 UTC (rev 854) @@ -548,7 +548,6 @@ cnt_recv(struct sess *sp) { int done; - char *b; sp->t0 = time(NULL); assert(sp->vcl == NULL); From phk at projects.linpro.no Sun Aug 20 16:35:01 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 18:35:01 +0200 (CEST) Subject: r855 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820163501.C1D4C1EC957@projects.linpro.no> Author: phk Date: 2006-08-20 18:35:01 +0200 (Sun, 20 Aug 2006) New Revision: 855 Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c Log: Add some debugging Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-20 16:34:51 UTC (rev 854) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-20 16:35:01 UTC (rev 855) @@ -22,12 +22,16 @@ i = read(fds[idx].fd, buf, sizeof buf); if (i <= 0) { + VSL(SLT_Debug, fds[idx].fd, "Pipe Shut read(read)"); + VSL(SLT_Debug, fds[1-idx].fd, "Pipe Shut write(read)"); shutdown(fds[idx].fd, SHUT_RD); shutdown(fds[1-idx].fd, SHUT_WR); fds[idx].events = 0; } else { j = write(fds[1-idx].fd, buf, i); if (i != j) { + VSL(SLT_Debug, fds[idx].fd, "Pipe Shut write(write)"); + VSL(SLT_Debug, fds[1-idx].fd, "Pipe Shut read(write)"); shutdown(fds[idx].fd, SHUT_WR); shutdown(fds[1-idx].fd, SHUT_RD); fds[1-idx].events = 0; From phk at projects.linpro.no Sun Aug 20 16:35:19 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 18:35:19 +0200 (CEST) Subject: r856 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820163519.7F4331EC958@projects.linpro.no> Author: phk Date: 2006-08-20 18:35:19 +0200 (Sun, 20 Aug 2006) New Revision: 856 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Heavy-duty work on kqueue acceptor. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-20 16:35:01 UTC (rev 855) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-20 16:35:19 UTC (rev 856) @@ -272,6 +272,7 @@ struct workreq workreq; struct acct acct; + unsigned kqa; }; struct backend { Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-20 16:35:01 UTC (rev 855) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-20 16:35:19 UTC (rev 856) @@ -396,7 +396,6 @@ struct kevent ke[2]; int i; - assert(arm == EV_ADD || arm == EV_DELETE); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); memset(ke, 0, sizeof ke); EV_SET(&ke[0], sp->fd, EVFILT_READ, arm, 0, 0, sp); @@ -410,16 +409,19 @@ } static void -accept_f(int fd) +accept_f(int fd, int nq) { struct sess *sp; - sp = vca_accept_sess(fd); - if (sp == NULL) - return; - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - http_RecvPrep(sp->http); - vca_kq_sess(sp, EV_ADD); + while (nq-- > 0) { + sp = vca_accept_sess(fd); + if (sp == NULL) + return; + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); + http_RecvPrep(sp->http); + vca_kq_sess(sp, EV_ADD); + sp->kqa = 1; + } } #define NKEV 20 @@ -427,7 +429,7 @@ static void * vca_main(void *arg) { - struct kevent ke[10]; + struct kevent ke[10], *kp; int i, j, n; struct sess *sp; @@ -448,24 +450,43 @@ n = kevent(kq, NULL, 0, ke, NKEV, NULL); assert(n >= 1); VSL(SLT_Debug, 0, "KQ %d", n); - for (j = 0; j < n; j++) { - if (ke[j].udata == accept_f) { - accept_f(ke[j].ident); + for (kp = ke, j = 0; j < n; j++, kp++) { + if (kp->udata == accept_f) { + VSL(SLT_Debug, kp->ident, + "KQ accept data %d\n", kp->data); + accept_f(kp->ident, kp->data); continue; } - CAST_OBJ_NOTNULL(sp, ke[j].udata, SESS_MAGIC); - if (ke[j].filter == EVFILT_READ) { - i = http_RecvSome(sp->fd, sp->http); - if (i == -1) - continue; - vca_kq_sess(sp, EV_DELETE); - vca_handover(sp, i); + CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC); + if (sp->kqa == 0 || 1) { + VSL(SLT_Debug, sp->fd, + "KQ %d/%d %s flags %x fflags %x data %x\n", + j, n, + kp->filter == EVFILT_READ ? "R" : "T", + kp->flags, kp->fflags, kp->data); + assert (sp->kqa); + } + if (kp->filter == EVFILT_READ) { + if (kp->data > 0) { + i = http_RecvSome(sp->fd, sp->http); + if (i == -1) + continue; + vca_kq_sess(sp, EV_DISABLE); + sp->kqa = 0; + vca_handover(sp, i); + } else if (kp->flags == EV_EOF) { + sp->kqa = 0; + vca_close_session(sp, "no request"); + SES_Delete(sp); + } else + INCOMPL(); continue; } - if (ke[j].filter == EVFILT_TIMER) { - vca_kq_sess(sp, EV_DELETE); + if (kp->filter == EVFILT_TIMER) { + vca_kq_sess(sp, EV_DISABLE); + sp->kqa = 0; vca_close_session(sp, "timeout"); - vca_return_session(sp); + SES_Delete(sp); continue; } INCOMPL(); @@ -489,8 +510,10 @@ VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); if (http_RecvPrepAgain(sp->http)) vca_handover(sp, 0); - else - vca_kq_sess(sp, EV_ADD); + else { + sp->kqa = 1; + vca_kq_sess(sp, EV_ENABLE); + } } #endif /* ACCEPTOR_USE_KQUEUE */ From phk at projects.linpro.no Sun Aug 20 18:33:21 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 20:33:21 +0200 (CEST) Subject: r857 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820183321.B13211EC957@projects.linpro.no> Author: phk Date: 2006-08-20 20:33:21 +0200 (Sun, 20 Aug 2006) New Revision: 857 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Give the kevent acceptor another overhaul. On a number of fine points the kevent API behaves different from what I would have expected. For instance EV_DISABLE/EV_ENABLE on a timer does not reset the timer. This is a very defensive version and if that works, it can be optimized some more. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-20 16:35:19 UTC (rev 856) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-20 18:33:21 UTC (rev 857) @@ -97,7 +97,7 @@ if (bad) { vca_close_session(sp, bad == 1 ? "overflow" : "no request"); - vca_return_session(sp); + SES_Delete(sp); return; } sp->step = STP_RECV; @@ -394,42 +394,99 @@ vca_kq_sess(struct sess *sp, int arm) { struct kevent ke[2]; - int i; + int i, j; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); memset(ke, 0, sizeof ke); - EV_SET(&ke[0], sp->fd, EVFILT_READ, arm, 0, 0, sp); - EV_SET(&ke[1], sp->fd, EVFILT_TIMER, arm , 0, - params->sess_timeout * 1000, sp); - i = kevent(kq, ke, 2, NULL, 0, NULL); - if (arm == EV_ADD) - assert(i == 0); - else - assert(i == 0 || errno == ENOENT); + j = 0; + /* close(2) automatically removes the EVFILT_READ event */ + if (sp->fd >= 0) + EV_SET(&ke[j++], sp->fd, EVFILT_READ, arm, 0, 0, sp); + EV_SET(&ke[j++], sp->id, EVFILT_TIMER | EV_ONESHOT, + arm == EV_ADD || arm == EV_ENABLE ? EV_ADD : EV_DELETE, + 0, params->sess_timeout * 1000, sp); + if (arm == EV_ADD || arm == EV_ENABLE) + sp->kqa = 1; + else + sp->kqa = 0; + i = kevent(kq, ke, j, NULL, 0, NULL); + assert(i == 0); } -static void -accept_f(int fd, int nq) +static struct sess * +vca_kev(struct kevent *kp) { + int i; struct sess *sp; - while (nq-- > 0) { - sp = vca_accept_sess(fd); - if (sp == NULL) - return; - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - http_RecvPrep(sp->http); - vca_kq_sess(sp, EV_ADD); - sp->kqa = 1; + if (kp->udata == vca_accept_sess) { + assert(kp->data > 0); + while (kp->data-- > 0) { + sp = vca_accept_sess(kp->ident); + if (sp == NULL) + return (NULL); + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); + http_RecvPrep(sp->http); + vca_kq_sess(sp, EV_ADD); + } + return (NULL); } + if (kp->udata == NULL) { + VSL(SLT_Debug, 0, + "KQ RACE %s flags %x fflags %x data %x", + kp->filter == EVFILT_READ ? "R" : "T", + kp->flags, kp->fflags, kp->data); + return (NULL); + } + CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC); + if (sp->kqa == 0) { + VSL(SLT_Debug, sp->fd, + "KQ %s flags %x fflags %x data %x", + kp->filter == EVFILT_READ ? "R" : "T", + kp->flags, kp->fflags, kp->data); + return (NULL); + } + if (kp->filter == EVFILT_READ) { + if (kp->data > 0) { + i = http_RecvSome(sp->fd, sp->http); + switch (i) { + case -1: + return (NULL); + case 0: + vca_kq_sess(sp, EV_DISABLE); + vca_handover(sp, i); + return (NULL); /* ?? */ + case 1: + vca_close_session(sp, "overflow"); + break; + case 2: + vca_close_session(sp, "no request"); + break; + default: + INCOMPL(); + } + return (sp); + } + if (kp->flags == EV_EOF) { + vca_close_session(sp, "EOF"); + return (sp); + } + INCOMPL(); + } + if (kp->filter == EVFILT_TIMER) { + vca_close_session(sp, "timeout"); + return (sp); + } + INCOMPL(); } -#define NKEV 20 +#define NKEV 100 + static void * vca_main(void *arg) { - struct kevent ke[10], *kp; + struct kevent ke[NKEV], *kp; int i, j, n; struct sess *sp; @@ -439,60 +496,25 @@ assert(kq >= 0); - if (heritage.socket >= 0) { - memset(&ke[0], 0, sizeof ke[0]); - EV_SET(&ke[0], heritage.socket, - EVFILT_READ, EV_ADD, 0, 0, accept_f); - AZ(kevent(kq, &ke[0], 1, NULL, 0, NULL)); - } + assert(heritage.socket >= 0); + EV_SET(&ke[0], heritage.socket, + EVFILT_READ, EV_ADD, 0, 0, vca_accept_sess); + AZ(kevent(kq, &ke[0], 1, NULL, 0, NULL)); while (1) { n = kevent(kq, NULL, 0, ke, NKEV, NULL); - assert(n >= 1); - VSL(SLT_Debug, 0, "KQ %d", n); + assert(n >= 1 && n <= NKEV); for (kp = ke, j = 0; j < n; j++, kp++) { - if (kp->udata == accept_f) { - VSL(SLT_Debug, kp->ident, - "KQ accept data %d\n", kp->data); - accept_f(kp->ident, kp->data); - continue; + sp = vca_kev(kp); + if (sp != NULL) { + vca_kq_sess(sp, EV_DELETE); + SES_Delete(sp); + for (i = j; i < n; i++) + if (ke[i].udata == sp) + ke[i].udata = NULL; } - CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC); - if (sp->kqa == 0 || 1) { - VSL(SLT_Debug, sp->fd, - "KQ %d/%d %s flags %x fflags %x data %x\n", - j, n, - kp->filter == EVFILT_READ ? "R" : "T", - kp->flags, kp->fflags, kp->data); - assert (sp->kqa); - } - if (kp->filter == EVFILT_READ) { - if (kp->data > 0) { - i = http_RecvSome(sp->fd, sp->http); - if (i == -1) - continue; - vca_kq_sess(sp, EV_DISABLE); - sp->kqa = 0; - vca_handover(sp, i); - } else if (kp->flags == EV_EOF) { - sp->kqa = 0; - vca_close_session(sp, "no request"); - SES_Delete(sp); - } else - INCOMPL(); - continue; - } - if (kp->filter == EVFILT_TIMER) { - vca_kq_sess(sp, EV_DISABLE); - sp->kqa = 0; - vca_close_session(sp, "timeout"); - SES_Delete(sp); - continue; - } - INCOMPL(); } } - INCOMPL(); } @@ -510,10 +532,8 @@ VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); if (http_RecvPrepAgain(sp->http)) vca_handover(sp, 0); - else { - sp->kqa = 1; + else vca_kq_sess(sp, EV_ENABLE); - } } #endif /* ACCEPTOR_USE_KQUEUE */ From phk at projects.linpro.no Sun Aug 20 19:55:55 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 20 Aug 2006 21:55:55 +0200 (CEST) Subject: r858 - trunk/varnish-cache/bin/varnishd Message-ID: <20060820195555.2F2611EC94F@projects.linpro.no> Author: phk Date: 2006-08-20 21:55:55 +0200 (Sun, 20 Aug 2006) New Revision: 858 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Close another tiny race. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-20 18:33:21 UTC (rev 857) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-20 19:55:55 UTC (rev 858) @@ -394,21 +394,26 @@ vca_kq_sess(struct sess *sp, int arm) { struct kevent ke[2]; - int i, j; + int i, j, arm2; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); memset(ke, 0, sizeof ke); j = 0; - /* close(2) automatically removes the EVFILT_READ event */ + if (arm == EV_ADD || arm == EV_ENABLE) { + assert(sp->kqa == 0); + sp->kqa = 1; + arm2 = EV_ADD; + } else { + assert(sp->kqa == 1); + sp->kqa = 0; + arm2 = EV_DELETE; + } + EV_SET(&ke[j++], sp->id, EVFILT_TIMER, arm2, + 0, params->sess_timeout * 1000, sp); + j = 0; if (sp->fd >= 0) EV_SET(&ke[j++], sp->fd, EVFILT_READ, arm, 0, 0, sp); - EV_SET(&ke[j++], sp->id, EVFILT_TIMER | EV_ONESHOT, - arm == EV_ADD || arm == EV_ENABLE ? EV_ADD : EV_DELETE, - 0, params->sess_timeout * 1000, sp); - if (arm == EV_ADD || arm == EV_ENABLE) - sp->kqa = 1; - else - sp->kqa = 0; + i = kevent(kq, ke, j, NULL, 0, NULL); assert(i == 0); } @@ -440,7 +445,7 @@ } CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC); if (sp->kqa == 0) { - VSL(SLT_Debug, sp->fd, + VSL(SLT_Debug, sp->id, "KQ %s flags %x fflags %x data %x", kp->filter == EVFILT_READ ? "R" : "T", kp->flags, kp->fflags, kp->data); From phk at projects.linpro.no Mon Aug 21 09:49:02 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 11:49:02 +0200 (CEST) Subject: r859 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821094902.6B14C1EC949@projects.linpro.no> Author: phk Date: 2006-08-21 11:49:02 +0200 (Mon, 21 Aug 2006) New Revision: 859 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: This assert is not warranted, a connection might disappear before we get to it. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-20 19:55:55 UTC (rev 858) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 09:49:02 UTC (rev 859) @@ -425,7 +425,6 @@ struct sess *sp; if (kp->udata == vca_accept_sess) { - assert(kp->data > 0); while (kp->data-- > 0) { sp = vca_accept_sess(kp->ident); if (sp == NULL) From phk at projects.linpro.no Mon Aug 21 09:49:43 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 11:49:43 +0200 (CEST) Subject: r860 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821094943.98A361EC949@projects.linpro.no> Author: phk Date: 2006-08-21 11:49:43 +0200 (Mon, 21 Aug 2006) New Revision: 860 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Don't hose TIMER kevent with READ kevent Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 09:49:02 UTC (rev 859) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 09:49:43 UTC (rev 860) @@ -398,7 +398,6 @@ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); memset(ke, 0, sizeof ke); - j = 0; if (arm == EV_ADD || arm == EV_ENABLE) { assert(sp->kqa == 0); sp->kqa = 1; @@ -408,9 +407,9 @@ sp->kqa = 0; arm2 = EV_DELETE; } + j = 0; EV_SET(&ke[j++], sp->id, EVFILT_TIMER, arm2, 0, params->sess_timeout * 1000, sp); - j = 0; if (sp->fd >= 0) EV_SET(&ke[j++], sp->fd, EVFILT_READ, arm, 0, 0, sp); From phk at projects.linpro.no Mon Aug 21 09:51:24 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 11:51:24 +0200 (CEST) Subject: r861 - trunk/varnish-cache/bin/varnishhist Message-ID: <20060821095124.06B3B1EC959@projects.linpro.no> Author: phk Date: 2006-08-21 11:51:23 +0200 (Mon, 21 Aug 2006) New Revision: 861 Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c Log: Adjusments to scale. Refresh 1/sec max Put more in the rolling buffer. Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-21 09:49:43 UTC (rev 860) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-21 09:51:23 UTC (rev 861) @@ -19,10 +19,10 @@ #include "shmlog.h" #include "varnishapi.h" -#define HIST_LOW -55 -#define HIST_HIGH 20 +#define HIST_LOW -50 +#define HIST_HIGH 25 #define HIST_W (1 + (HIST_HIGH - HIST_LOW)) -#define HIST_N 1000 +#define HIST_N 10000 static unsigned char rr_hist[HIST_N]; static unsigned next_hist; @@ -34,7 +34,13 @@ { int x, y; double m, r; + time_t t; + static time_t tl; + t = time(NULL); + if (t == tl) + return; + tl = t; m = 0; r = 0; for (x = 0; x < HIST_W; x++) { @@ -70,7 +76,11 @@ (void)spec; if (tag != SLT_ReqEnd) return (0); +#if 0 + i = sscanf(ptr, "%*d %*f %*f %*f %lf", &b); +#else i = sscanf(ptr, "%*d %*f %*f %lf", &b); +#endif assert(i == 1); i = log(b) * c_hist; if (i < HIST_LOW) From phk at projects.linpro.no Mon Aug 21 10:59:01 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 12:59:01 +0200 (CEST) Subject: r862 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821105901.2B5771EC932@projects.linpro.no> Author: phk Date: 2006-08-21 12:59:00 +0200 (Mon, 21 Aug 2006) New Revision: 862 Added: trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Break the acceptors out into their own files. The intent here is to compile in all acceptors supported on the operating system and allow the user to select one at startup time. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-21 09:51:23 UTC (rev 861) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-21 10:59:00 UTC (rev 862) @@ -8,6 +8,9 @@ varnishd_SOURCES = \ cache_acceptor.c \ + cache_acceptor_epoll.c \ + cache_acceptor_poll.c \ + cache_acceptor_kqueue.c \ cache_backend.c \ cache_ban.c \ cache_center.c \ Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 09:51:23 UTC (rev 861) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 10:59:00 UTC (rev 862) @@ -9,7 +9,7 @@ #undef ACCEPTOR_USE_KQUEUE #undef ACCEPTOR_USE_EPOLL #undef ACCEPTOR_USE_POLL - + #if defined(HAVE_KQUEUE) #define ACCEPTOR_USE_KQUEUE 1 #elif defined(HAVE_EPOLL_CTL) @@ -37,11 +37,25 @@ #include "heritage.h" #include "shmlog.h" #include "cache.h" +#include "cache_acceptor.h" -static pthread_t vca_thread; + +static struct acceptor *vca_acceptors[] = { +#if defined(HAVE_KQUEUE) + &acceptor_kqueue, +#endif +#if defined(HAVE_EPOLL_CTL) + &acceptor_epoll, +#endif +#if defined(HAVE_POLL_CTL) + &acceptor_poll, +#endif + NULL, +}; + static unsigned xids; -static struct sess * +struct sess * vca_accept_sess(int fd) { socklen_t l; @@ -90,7 +104,7 @@ return (sp); } -static void +void vca_handover(struct sess *sp, int bad) { @@ -107,460 +121,35 @@ WRK_QueueSession(sp); } -/*====================================================================*/ -#ifdef ACCEPTOR_USE_POLL - -#include - -static struct pollfd *pollfd; -static unsigned npoll; - -static int pipes[2]; - -static TAILQ_HEAD(,sess) sesshead = TAILQ_HEAD_INITIALIZER(sesshead); - /*--------------------------------------------------------------------*/ -static void -vca_pollspace(int fd) -{ - struct pollfd *p; - unsigned u, v; - - if (fd < npoll) - return; - if (npoll == 0) - npoll = 16; - for (u = npoll; fd >= u; ) - u += u; - VSL(SLT_Debug, 0, "Acceptor Pollspace %u", u); - p = realloc(pollfd, u * sizeof *p); - assert(p != NULL); - memset(p + npoll, 0, (u - npoll) * sizeof *p); - for (v = npoll ; v <= u; v++) - p->fd = -1; - pollfd = p; - npoll = u; -} - -/*--------------------------------------------------------------------*/ - -static void -vca_poll(int fd) -{ - vca_pollspace(fd); - pollfd[fd].fd = fd; - pollfd[fd].events = POLLIN; -} - -static void -vca_unpoll(int fd) -{ - vca_pollspace(fd); - pollfd[fd].fd = -1; - pollfd[fd].events = 0; -} - -/*--------------------------------------------------------------------*/ - -static void -vca_rcvhdev(struct sess *sp) -{ - - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - TAILQ_INSERT_TAIL(&sesshead, sp, list); - vca_poll(sp->fd); -} - -static void -accept_f(int fd) -{ - struct sess *sp; - - sp = vca_accept_sess(fd); - if (sp == NULL) - return; - - http_RecvPrep(sp->http); - vca_rcvhdev(sp); -} - -static void * -vca_main(void *arg) -{ - unsigned u, v; - struct sess *sp, *sp2; - struct timespec t; - int i; - - (void)arg; - - AZ(pipe(pipes)); - vca_poll(pipes[0]); - - if (heritage.socket >= 0) - vca_poll(heritage.socket); - - while (1) { - v = poll(pollfd, npoll, 5000); - if (v && pollfd[pipes[0]].revents) { - v--; - i = read(pipes[0], &sp, sizeof sp); - assert(i == sizeof sp); - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (http_RecvPrepAgain(sp->http)) - vca_handover(sp, 0); - else - vca_rcvhdev(sp); - } - if (heritage.socket >= 0 && - pollfd[heritage.socket].revents) { - accept_f(heritage.socket); - v--; - } - clock_gettime(CLOCK_MONOTONIC, &t); - TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (pollfd[sp->fd].revents) { - v--; - i = http_RecvSome(sp->fd, sp->http); - if (i < 0) - continue; - - vca_unpoll(sp->fd); - TAILQ_REMOVE(&sesshead, sp, list); - vca_handover(sp, i); - continue; - } - if (sp->t_idle.tv_sec + params->sess_timeout < t.tv_sec) { - TAILQ_REMOVE(&sesshead, sp, list); - vca_unpoll(sp->fd); - vca_close_session(sp, "timeout"); - vca_return_session(sp); - continue; - } - if (v == 0) - break; - } - } - - INCOMPL(); -} - -/*--------------------------------------------------------------------*/ - void -vca_return_session(struct sess *sp) +vca_close_session(struct sess *sp, const char *why) { - if (sp->fd < 0) { - SES_Delete(sp); - return; - } - (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); - VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); - assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); + VSL(SLT_SessionClose, sp->fd, why); + if (sp->fd >= 0) + AZ(close(sp->fd)); + sp->fd = -1; } -#endif /* ACCEPTOR_USE_POLL */ -/*====================================================================*/ -#ifdef ACCEPTOR_USE_EPOLL - -#include - -static int epfd = -1; -static int pipes[2]; - -static TAILQ_HEAD(,sess) sesshead = TAILQ_HEAD_INITIALIZER(sesshead); - -static void -vca_add(int fd, void *data) -{ - struct epoll_event ev = { EPOLLIN | EPOLLPRI, { data } }; - AZ(epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &ev)); -} - -static void -vca_del(int fd) -{ - AZ(epoll_ctl(epfd, EPOLL_CTL_DEL, fd, NULL)); -} - -static void -vca_rcvhdev(struct sess *sp) -{ - - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - TAILQ_INSERT_TAIL(&sesshead, sp, list); - vca_add(sp->fd, sp); -} - -static void -accept_f(int fd) -{ - struct sess *sp; - - sp = vca_accept_sess(fd); - if (sp == NULL) - return; - http_RecvPrep(sp->http); - vca_rcvhdev(sp); -} - -static void * -vca_main(void *arg) -{ - struct epoll_event ev; - struct timespec t; - struct sess *sp, *sp2; - int i; - - (void)arg; - - epfd = epoll_create(16); - assert(epfd >= 0); - - AZ(pipe(pipes)); - vca_add(pipes[0], pipes); - - if (heritage.socket >= 0) - vca_add(heritage.socket, accept_f); - - while (1) { - if (epoll_wait(epfd, &ev, 1, 5000) > 0) { - if (ev.data.ptr == pipes) { - i = read(pipes[0], &sp, sizeof sp); - assert(i == sizeof sp); - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (http_RecvPrepAgain(sp->http)) - vca_handover(sp, 0); - else - vca_rcvhdev(sp); - } else if (ev.data.ptr == accept_f) { - accept_f(heritage.socket); - } else { - CAST_OBJ_NOTNULL(sp, ev.data.ptr, SESS_MAGIC); - i = http_RecvSome(sp->fd, sp->http); - if (i != -1) { - TAILQ_REMOVE(&sesshead, sp, list); - vca_del(sp->fd); - vca_handover(sp, i); - } - } - } - /* check for timeouts */ - clock_gettime(CLOCK_MONOTONIC, &t); - TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (sp->t_idle.tv_sec + params->sess_timeout < t.tv_sec) { - TAILQ_REMOVE(&sesshead, sp, list); - vca_del(sp->fd); - vca_close_session(sp, "timeout"); - vca_return_session(sp); - continue; - } - } - } - - INCOMPL(); -} - -/*--------------------------------------------------------------------*/ - void vca_return_session(struct sess *sp) { - if (sp->fd < 0) { - SES_Delete(sp); - return; - } - (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); - VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); - assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); -} - -#endif /* ACCEPTOR_USE_EPOLL */ -/*====================================================================*/ -#ifdef ACCEPTOR_USE_KQUEUE - -#include - -static int kq = -1; - -static void -vca_kq_sess(struct sess *sp, int arm) -{ - struct kevent ke[2]; - int i, j, arm2; - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - memset(ke, 0, sizeof ke); - if (arm == EV_ADD || arm == EV_ENABLE) { - assert(sp->kqa == 0); - sp->kqa = 1; - arm2 = EV_ADD; - } else { - assert(sp->kqa == 1); - sp->kqa = 0; - arm2 = EV_DELETE; - } - j = 0; - EV_SET(&ke[j++], sp->id, EVFILT_TIMER, arm2, - 0, params->sess_timeout * 1000, sp); - if (sp->fd >= 0) - EV_SET(&ke[j++], sp->fd, EVFILT_READ, arm, 0, 0, sp); - - i = kevent(kq, ke, j, NULL, 0, NULL); - assert(i == 0); + vca_acceptors[0]->recycle(sp); } -static struct sess * -vca_kev(struct kevent *kp) -{ - int i; - struct sess *sp; - - if (kp->udata == vca_accept_sess) { - while (kp->data-- > 0) { - sp = vca_accept_sess(kp->ident); - if (sp == NULL) - return (NULL); - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - http_RecvPrep(sp->http); - vca_kq_sess(sp, EV_ADD); - } - return (NULL); - } - if (kp->udata == NULL) { - VSL(SLT_Debug, 0, - "KQ RACE %s flags %x fflags %x data %x", - kp->filter == EVFILT_READ ? "R" : "T", - kp->flags, kp->fflags, kp->data); - return (NULL); - } - CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC); - if (sp->kqa == 0) { - VSL(SLT_Debug, sp->id, - "KQ %s flags %x fflags %x data %x", - kp->filter == EVFILT_READ ? "R" : "T", - kp->flags, kp->fflags, kp->data); - return (NULL); - } - if (kp->filter == EVFILT_READ) { - if (kp->data > 0) { - i = http_RecvSome(sp->fd, sp->http); - switch (i) { - case -1: - return (NULL); - case 0: - vca_kq_sess(sp, EV_DISABLE); - vca_handover(sp, i); - return (NULL); /* ?? */ - case 1: - vca_close_session(sp, "overflow"); - break; - case 2: - vca_close_session(sp, "no request"); - break; - default: - INCOMPL(); - } - return (sp); - } - if (kp->flags == EV_EOF) { - vca_close_session(sp, "EOF"); - return (sp); - } - INCOMPL(); - } - if (kp->filter == EVFILT_TIMER) { - vca_close_session(sp, "timeout"); - return (sp); - } - INCOMPL(); -} - - -#define NKEV 100 - -static void * -vca_main(void *arg) -{ - struct kevent ke[NKEV], *kp; - int i, j, n; - struct sess *sp; - - (void)arg; - - kq = kqueue(); - assert(kq >= 0); - - - assert(heritage.socket >= 0); - EV_SET(&ke[0], heritage.socket, - EVFILT_READ, EV_ADD, 0, 0, vca_accept_sess); - AZ(kevent(kq, &ke[0], 1, NULL, 0, NULL)); - - while (1) { - n = kevent(kq, NULL, 0, ke, NKEV, NULL); - assert(n >= 1 && n <= NKEV); - for (kp = ke, j = 0; j < n; j++, kp++) { - sp = vca_kev(kp); - if (sp != NULL) { - vca_kq_sess(sp, EV_DELETE); - SES_Delete(sp); - for (i = j; i < n; i++) - if (ke[i].udata == sp) - ke[i].udata = NULL; - } - } - } - INCOMPL(); -} - /*--------------------------------------------------------------------*/ void -vca_return_session(struct sess *sp) -{ - - if (sp->fd < 0) { - SES_Delete(sp); - return; - } - (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); - VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); - if (http_RecvPrepAgain(sp->http)) - vca_handover(sp, 0); - else - vca_kq_sess(sp, EV_ENABLE); -} - -#endif /* ACCEPTOR_USE_KQUEUE */ -/*====================================================================*/ - -/*--------------------------------------------------------------------*/ - -void -vca_close_session(struct sess *sp, const char *why) -{ - - VSL(SLT_SessionClose, sp->fd, why); - if (sp->fd >= 0) - AZ(close(sp->fd)); - sp->fd = -1; -} - -/*--------------------------------------------------------------------*/ - -void VCA_Init(void) { - AZ(pthread_create(&vca_thread, NULL, vca_main, NULL)); srandomdev(); xids = random(); + + /* XXX: Add selector mechanism at some point */ + vca_acceptors[0]->init(); } Added: trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c 2006-08-21 09:51:23 UTC (rev 861) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c 2006-08-21 10:59:00 UTC (rev 862) @@ -0,0 +1,157 @@ +/* + * $Id: cache_acceptor.c 860 2006-08-21 09:49:43Z phk $ + * + * XXX: We need to pass sessions back into the event engine when they are + * reused. Not sure what the most efficient way is for that. For now + * write the session pointer to a pipe which the event engine monitors. + */ + +#if defined(HAVE_EPOLL_CTL) + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifndef HAVE_SRANDOMDEV +#include "compat/srandomdev.h" +#endif + +#include "heritage.h" +#include "shmlog.h" +#include "cache.h" +#include "cache_acceptor.h" + +static pthread_t vca_epoll_thread; +static int epfd = -1; +static int pipes[2]; + +static TAILQ_HEAD(,sess) sesshead = TAILQ_HEAD_INITIALIZER(sesshead); + +static void +vca_add(int fd, void *data) +{ + struct epoll_event ev = { EPOLLIN | EPOLLPRI, { data } }; + AZ(epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &ev)); +} + +static void +vca_del(int fd) +{ + AZ(epoll_ctl(epfd, EPOLL_CTL_DEL, fd, NULL)); +} + +static void +vca_rcvhdev(struct sess *sp) +{ + + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); + TAILQ_INSERT_TAIL(&sesshead, sp, list); + vca_add(sp->fd, sp); +} + +static void +accept_f(int fd) +{ + struct sess *sp; + + sp = vca_accept_sess(fd); + if (sp == NULL) + return; + http_RecvPrep(sp->http); + vca_rcvhdev(sp); +} + +static void * +vca_main(void *arg) +{ + struct epoll_event ev; + struct timespec t; + struct sess *sp, *sp2; + int i; + + (void)arg; + + epfd = epoll_create(16); + assert(epfd >= 0); + + AZ(pipe(pipes)); + vca_add(pipes[0], pipes); + + if (heritage.socket >= 0) + vca_add(heritage.socket, accept_f); + + while (1) { + if (epoll_wait(epfd, &ev, 1, 5000) > 0) { + if (ev.data.ptr == pipes) { + i = read(pipes[0], &sp, sizeof sp); + assert(i == sizeof sp); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (http_RecvPrepAgain(sp->http)) + vca_handover(sp, 0); + else + vca_rcvhdev(sp); + } else if (ev.data.ptr == accept_f) { + accept_f(heritage.socket); + } else { + CAST_OBJ_NOTNULL(sp, ev.data.ptr, SESS_MAGIC); + i = http_RecvSome(sp->fd, sp->http); + if (i != -1) { + TAILQ_REMOVE(&sesshead, sp, list); + vca_del(sp->fd); + vca_handover(sp, i); + } + } + } + /* check for timeouts */ + clock_gettime(CLOCK_MONOTONIC, &t); + TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (sp->t_idle.tv_sec + params->sess_timeout < t.tv_sec) { + TAILQ_REMOVE(&sesshead, sp, list); + vca_del(sp->fd); + vca_close_session(sp, "timeout"); + vca_return_session(sp); + continue; + } + } + } + + INCOMPL(); +} + +/*--------------------------------------------------------------------*/ + +static void +vca_epoll_recycle(struct sess *sp) +{ + + if (sp->fd < 0) { + SES_Delete(sp); + return; + } + (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); + VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); + assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); +} + +static void +vca_epoll_init(void) +{ + AZ(pthread_create(&vca_epoll_thread, NULL, vca_main, NULL)); +} + +struct acceptor acceptor_epoll = { + .name = "epoll", + .init = vca_epoll_init, + .recycle = vca_epoll_recycle, +}; + +#endif /* defined(HAVE_EPOLL_CTL) */ Added: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-21 09:51:23 UTC (rev 861) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-21 10:59:00 UTC (rev 862) @@ -0,0 +1,195 @@ +/* + * $Id: cache_acceptor.c 860 2006-08-21 09:49:43Z phk $ + * + * XXX: We need to pass sessions back into the event engine when they are + * reused. Not sure what the most efficient way is for that. For now + * write the session pointer to a pipe which the event engine monitors. + */ + +#if defined(HAVE_KQUEUE) + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifndef HAVE_SRANDOMDEV +#include "compat/srandomdev.h" +#endif + +#include "heritage.h" +#include "shmlog.h" +#include "cache.h" +#include "cache_acceptor.h" + +static pthread_t vca_kqueue_thread; +static int kq = -1; + +static void +vca_kq_sess(struct sess *sp, int arm) +{ + struct kevent ke[2]; + int i, j, arm2; + + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + memset(ke, 0, sizeof ke); + if (arm == EV_ADD || arm == EV_ENABLE) { + assert(sp->kqa == 0); + sp->kqa = 1; + arm2 = EV_ADD; + } else { + assert(sp->kqa == 1); + sp->kqa = 0; + arm2 = EV_DELETE; + } + j = 0; + EV_SET(&ke[j++], sp->id, EVFILT_TIMER, arm2, + 0, params->sess_timeout * 1000, sp); + if (sp->fd >= 0) + EV_SET(&ke[j++], sp->fd, EVFILT_READ, arm, 0, 0, sp); + + i = kevent(kq, ke, j, NULL, 0, NULL); + assert(i == 0); +} + +static struct sess * +vca_kev(struct kevent *kp) +{ + int i; + struct sess *sp; + + if (kp->udata == vca_accept_sess) { + while (kp->data-- > 0) { + sp = vca_accept_sess(kp->ident); + if (sp == NULL) + return (NULL); + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); + http_RecvPrep(sp->http); + vca_kq_sess(sp, EV_ADD); + } + return (NULL); + } + if (kp->udata == NULL) { + VSL(SLT_Debug, 0, + "KQ RACE %s flags %x fflags %x data %x", + kp->filter == EVFILT_READ ? "R" : "T", + kp->flags, kp->fflags, kp->data); + return (NULL); + } + CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC); + if (sp->kqa == 0) { + VSL(SLT_Debug, sp->id, + "KQ %s flags %x fflags %x data %x", + kp->filter == EVFILT_READ ? "R" : "T", + kp->flags, kp->fflags, kp->data); + return (NULL); + } + if (kp->filter == EVFILT_READ) { + if (kp->data > 0) { + i = http_RecvSome(sp->fd, sp->http); + switch (i) { + case -1: + return (NULL); + case 0: + vca_kq_sess(sp, EV_DISABLE); + vca_handover(sp, i); + return (NULL); /* ?? */ + case 1: + vca_close_session(sp, "overflow"); + break; + case 2: + vca_close_session(sp, "no request"); + break; + default: + INCOMPL(); + } + return (sp); + } + if (kp->flags == EV_EOF) { + vca_close_session(sp, "EOF"); + return (sp); + } + INCOMPL(); + } + if (kp->filter == EVFILT_TIMER) { + vca_close_session(sp, "timeout"); + return (sp); + } + INCOMPL(); +} + + +#define NKEV 100 + +static void * +vca_main(void *arg) +{ + struct kevent ke[NKEV], *kp; + int i, j, n; + struct sess *sp; + + (void)arg; + + kq = kqueue(); + assert(kq >= 0); + + + assert(heritage.socket >= 0); + EV_SET(&ke[0], heritage.socket, + EVFILT_READ, EV_ADD, 0, 0, vca_accept_sess); + AZ(kevent(kq, &ke[0], 1, NULL, 0, NULL)); + + while (1) { + n = kevent(kq, NULL, 0, ke, NKEV, NULL); + assert(n >= 1 && n <= NKEV); + for (kp = ke, j = 0; j < n; j++, kp++) { + sp = vca_kev(kp); + if (sp != NULL) { + vca_kq_sess(sp, EV_DELETE); + SES_Delete(sp); + for (i = j; i < n; i++) + if (ke[i].udata == sp) + ke[i].udata = NULL; + } + } + } + INCOMPL(); +} + +/*--------------------------------------------------------------------*/ + +static void +vca_kqueue_recycle(struct sess *sp) +{ + + if (sp->fd < 0) { + SES_Delete(sp); + return; + } + (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); + VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); + if (http_RecvPrepAgain(sp->http)) + vca_handover(sp, 0); + else + vca_kq_sess(sp, EV_ENABLE); +} + +static void +vca_kqueue_init(void) +{ + AZ(pthread_create(&vca_kqueue_thread, NULL, vca_main, NULL)); +} + +struct acceptor acceptor_kqueue = { + .name = "kqueue", + .init = vca_kqueue_init, + .recycle = vca_kqueue_recycle, +}; + +#endif /* defined(HAVE_KQUEUE) */ Added: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2006-08-21 09:51:23 UTC (rev 861) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2006-08-21 10:59:00 UTC (rev 862) @@ -0,0 +1,195 @@ +/* + * $Id: cache_acceptor.c 860 2006-08-21 09:49:43Z phk $ + * + * XXX: We need to pass sessions back into the event engine when they are + * reused. Not sure what the most efficient way is for that. For now + * write the session pointer to a pipe which the event engine monitors. + */ + +#if defined(HAVE_POLL) + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifndef HAVE_SRANDOMDEV +#include "compat/srandomdev.h" +#endif + +#include "heritage.h" +#include "shmlog.h" +#include "cache.h" +#include "cache_acceptor.h" + +static pthread_t vca_poll_thread; +static struct pollfd *pollfd; +static unsigned npoll; + +static int pipes[2]; + +static TAILQ_HEAD(,sess) sesshead = TAILQ_HEAD_INITIALIZER(sesshead); + +/*--------------------------------------------------------------------*/ + +static void +vca_pollspace(int fd) +{ + struct pollfd *p; + unsigned u, v; + + if (fd < npoll) + return; + if (npoll == 0) + npoll = 16; + for (u = npoll; fd >= u; ) + u += u; + VSL(SLT_Debug, 0, "Acceptor Pollspace %u", u); + p = realloc(pollfd, u * sizeof *p); + assert(p != NULL); + memset(p + npoll, 0, (u - npoll) * sizeof *p); + for (v = npoll ; v <= u; v++) + p->fd = -1; + pollfd = p; + npoll = u; +} + +/*--------------------------------------------------------------------*/ + +static void +vca_poll(int fd) +{ + vca_pollspace(fd); + pollfd[fd].fd = fd; + pollfd[fd].events = POLLIN; +} + +static void +vca_unpoll(int fd) +{ + vca_pollspace(fd); + pollfd[fd].fd = -1; + pollfd[fd].events = 0; +} + +/*--------------------------------------------------------------------*/ + +static void +vca_rcvhdev(struct sess *sp) +{ + + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); + TAILQ_INSERT_TAIL(&sesshead, sp, list); + vca_poll(sp->fd); +} + +static void +accept_f(int fd) +{ + struct sess *sp; + + sp = vca_accept_sess(fd); + if (sp == NULL) + return; + + http_RecvPrep(sp->http); + vca_rcvhdev(sp); +} + +static void * +vca_main(void *arg) +{ + unsigned u, v; + struct sess *sp, *sp2; + struct timespec t; + int i; + + (void)arg; + + AZ(pipe(pipes)); + vca_poll(pipes[0]); + + if (heritage.socket >= 0) + vca_poll(heritage.socket); + + while (1) { + v = poll(pollfd, npoll, 5000); + if (v && pollfd[pipes[0]].revents) { + v--; + i = read(pipes[0], &sp, sizeof sp); + assert(i == sizeof sp); + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (http_RecvPrepAgain(sp->http)) + vca_handover(sp, 0); + else + vca_rcvhdev(sp); + } + if (heritage.socket >= 0 && + pollfd[heritage.socket].revents) { + accept_f(heritage.socket); + v--; + } + clock_gettime(CLOCK_MONOTONIC, &t); + TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (pollfd[sp->fd].revents) { + v--; + i = http_RecvSome(sp->fd, sp->http); + if (i < 0) + continue; + + vca_unpoll(sp->fd); + TAILQ_REMOVE(&sesshead, sp, list); + vca_handover(sp, i); + continue; + } + if (sp->t_idle.tv_sec + params->sess_timeout < t.tv_sec) { + TAILQ_REMOVE(&sesshead, sp, list); + vca_unpoll(sp->fd); + vca_close_session(sp, "timeout"); + vca_return_session(sp); + continue; + } + if (v == 0) + break; + } + } + + INCOMPL(); +} + +/*--------------------------------------------------------------------*/ + +static void +vca_poll_recycle(struct sess *sp) +{ + + if (sp->fd < 0) { + SES_Delete(sp); + return; + } + (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); + VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); + assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); +} + +static void +vca_poll_init(void) +{ + AZ(pthread_create(&vca_poll_thread, NULL, vca_main, NULL)); +} + +struct acceptor acceptor_poll = { + .name = "poll", + .init = vca_poll_init, + .recycle = vca_poll_recycle, +}; + +#endif /* defined(HAVE_POLL) */ From phk at projects.linpro.no Mon Aug 21 11:05:08 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 13:05:08 +0200 (CEST) Subject: r863 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821110508.C56031EC95C@projects.linpro.no> Author: phk Date: 2006-08-21 13:05:08 +0200 (Mon, 21 Aug 2006) New Revision: 863 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c Log: various cleanups. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 10:59:00 UTC (rev 862) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 11:05:08 UTC (rev 863) @@ -6,20 +6,6 @@ * write the session pointer to a pipe which the event engine monitors. */ -#undef ACCEPTOR_USE_KQUEUE -#undef ACCEPTOR_USE_EPOLL -#undef ACCEPTOR_USE_POLL - -#if defined(HAVE_KQUEUE) -#define ACCEPTOR_USE_KQUEUE 1 -#elif defined(HAVE_EPOLL_CTL) -#define ACCEPTOR_USE_EPOLL 1 -#elif defined(HAVE_POLL) -#define ACCEPTOR_USE_POLL 1 -#else -#error No usable acceptors detected. -#endif - #include #include #include @@ -47,7 +33,7 @@ #if defined(HAVE_EPOLL_CTL) &acceptor_epoll, #endif -#if defined(HAVE_POLL_CTL) +#if defined(HAVE_POLL) &acceptor_poll, #endif NULL, @@ -151,5 +137,9 @@ xids = random(); /* XXX: Add selector mechanism at some point */ + if (vca_acceptors[0]->name == NULL) { + fprintf(stderr, "No acceptor in program\n"); + exit (2); + } vca_acceptors[0]->init(); } Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2006-08-21 10:59:00 UTC (rev 862) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2006-08-21 11:05:08 UTC (rev 863) @@ -106,7 +106,7 @@ static void * vca_main(void *arg) { - unsigned u, v; + unsigned v; struct sess *sp, *sp2; struct timespec t; int i; From phk at projects.linpro.no Mon Aug 21 11:11:02 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 13:11:02 +0200 (CEST) Subject: r864 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821111102.43D4B1EC95E@projects.linpro.no> Author: phk Date: 2006-08-21 13:11:02 +0200 (Mon, 21 Aug 2006) New Revision: 864 Added: trunk/varnish-cache/bin/varnishd/cache_acceptor.h Log: Add file Added: trunk/varnish-cache/bin/varnishd/cache_acceptor.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2006-08-21 11:05:08 UTC (rev 863) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2006-08-21 11:11:02 UTC (rev 864) @@ -0,0 +1,31 @@ +/* + * $Id$ + */ + +struct sess; + +typedef void acceptor_init_f(void); +typedef void acceptor_recycle_f(struct sess *); + +struct acceptor { + const char *name; + acceptor_init_f *init; + acceptor_recycle_f *recycle; +}; + +#if defined(HAVE_EPOLL_CTL) +extern struct acceptor acceptor_epoll; +#endif + +#if defined(HAVE_KQUEUE) +extern struct acceptor acceptor_kqueue; +#endif + +#if defined(HAVE_POLL) +extern struct acceptor acceptor_poll; +#endif + +/* vca_acceptor.c */ +struct sess *vca_accept_sess(int fd); +void vca_handover(struct sess *sp, int bad); + From phk at projects.linpro.no Mon Aug 21 11:18:26 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 13:18:26 +0200 (CEST) Subject: r865 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821111826.7E4911EC932@projects.linpro.no> Author: phk Date: 2006-08-21 13:18:26 +0200 (Mon, 21 Aug 2006) New Revision: 865 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c Log: Split the accepting and session-herding functionality into two threads, this is totally free from a locking point of view, but will cost in context switches. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-21 11:11:02 UTC (rev 864) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-21 11:18:26 UTC (rev 865) @@ -28,9 +28,12 @@ #include "cache.h" #include "cache_acceptor.h" -static pthread_t vca_kqueue_thread; +static pthread_t vca_kqueue_thread1; +static pthread_t vca_kqueue_thread2; static int kq = -1; +#define NKEV 100 + static void vca_kq_sess(struct sess *sp, int arm) { @@ -64,17 +67,6 @@ int i; struct sess *sp; - if (kp->udata == vca_accept_sess) { - while (kp->data-- > 0) { - sp = vca_accept_sess(kp->ident); - if (sp == NULL) - return (NULL); - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - http_RecvPrep(sp->http); - vca_kq_sess(sp, EV_ADD); - } - return (NULL); - } if (kp->udata == NULL) { VSL(SLT_Debug, 0, "KQ RACE %s flags %x fflags %x data %x", @@ -125,10 +117,8 @@ } -#define NKEV 100 - static void * -vca_main(void *arg) +vca_kqueue_main(void *arg) { struct kevent ke[NKEV], *kp; int i, j, n; @@ -139,12 +129,6 @@ kq = kqueue(); assert(kq >= 0); - - assert(heritage.socket >= 0); - EV_SET(&ke[0], heritage.socket, - EVFILT_READ, EV_ADD, 0, 0, vca_accept_sess); - AZ(kevent(kq, &ke[0], 1, NULL, 0, NULL)); - while (1) { n = kevent(kq, NULL, 0, ke, NKEV, NULL); assert(n >= 1 && n <= NKEV); @@ -162,6 +146,22 @@ INCOMPL(); } +static void * +vca_kqueue_acct(void *arg) +{ + struct sess *sp; + + (void)arg; + while (1) { + sp = vca_accept_sess(heritage.socket); + if (sp == NULL) + continue; + clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); + http_RecvPrep(sp->http); + vca_kq_sess(sp, EV_ADD); + } +} + /*--------------------------------------------------------------------*/ static void @@ -183,7 +183,8 @@ static void vca_kqueue_init(void) { - AZ(pthread_create(&vca_kqueue_thread, NULL, vca_main, NULL)); + AZ(pthread_create(&vca_kqueue_thread1, NULL, vca_kqueue_main, NULL)); + AZ(pthread_create(&vca_kqueue_thread2, NULL, vca_kqueue_acct, NULL)); } struct acceptor acceptor_kqueue = { From phk at projects.linpro.no Mon Aug 21 12:12:17 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 14:12:17 +0200 (CEST) Subject: r866 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821121217.0EC1F1EC965@projects.linpro.no> Author: phk Date: 2006-08-21 14:12:16 +0200 (Mon, 21 Aug 2006) New Revision: 866 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_acceptor.h trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/steps.h Log: Create the possiblity for the the acceptor to send the session directly to the workerpool instead of taking the detour around the session-herder. This saves a context switch and is presumabley a good idea because the majority of sessions will have requst already in the pipeline. For accept filters it makes even more sense because we know this to be the case. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 11:18:26 UTC (rev 865) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 12:12:16 UTC (rev 866) @@ -84,7 +84,16 @@ AZ(setsockopt(sp->fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv)); } #endif +#ifdef SO_RCVTIMEO + { + struct timeval tv; + tv.tv_sec = params->sess_timeout; + tv.tv_usec = 0; + AZ(setsockopt(sp->fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv)); + } +#endif + TCP_name(addr, l, sp->addr, sizeof sp->addr, sp->port, sizeof sp->port); VSL(SLT_SessionOpen, sp->fd, "%s %s", sp->addr, sp->port); return (sp); @@ -107,6 +116,16 @@ WRK_QueueSession(sp); } +void +vca_handfirst(struct sess *sp) +{ + sp->step = STP_FIRST; + VSL_stats->client_req++; + sp->xid = xids++; + VSL(SLT_ReqStart, sp->fd, "XID %u", sp->xid); + WRK_QueueSession(sp); +} + /*--------------------------------------------------------------------*/ void Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2006-08-21 11:18:26 UTC (rev 865) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2006-08-21 12:12:16 UTC (rev 866) @@ -28,4 +28,5 @@ /* vca_acceptor.c */ struct sess *vca_accept_sess(int fd); void vca_handover(struct sess *sp, int bad); +void vca_handfirst(struct sess *sp); Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-21 11:18:26 UTC (rev 865) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-21 12:12:16 UTC (rev 866) @@ -235,7 +235,37 @@ INCOMPL(); } +static int +cnt_first(struct sess *sp) +{ + int i; + for (;;) { + i = http_RecvSome(sp->fd, sp->http); + switch (i) { + case -1: + continue; + case 0: + sp->step = STP_RECV; + return (0); + case 1: + vca_close_session(sp, "overflow"); + SES_Charge(sp); + vca_return_session(sp); + sp->step = STP_DONE; + return (1); + case 2: + vca_close_session(sp, "no request"); + SES_Charge(sp); + vca_return_session(sp); + sp->step = STP_DONE; + return (1); + default: + INCOMPL(); + } + } +} + /*-------------------------------------------------------------------- * We had a cache hit. Ask VCL, then march off as instructed. * Modified: trunk/varnish-cache/bin/varnishd/steps.h =================================================================== --- trunk/varnish-cache/bin/varnishd/steps.h 2006-08-21 11:18:26 UTC (rev 865) +++ trunk/varnish-cache/bin/varnishd/steps.h 2006-08-21 12:12:16 UTC (rev 866) @@ -1,5 +1,6 @@ /* $Id$ */ +STEP(first, FIRST) STEP(recv, RECV) STEP(pipe, PIPE) STEP(pass, PASS) From des at projects.linpro.no Mon Aug 21 12:54:53 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 21 Aug 2006 14:54:53 +0200 (CEST) Subject: r867 - trunk/varnish-cache/bin/varnishhist Message-ID: <20060821125453.994C61EC963@projects.linpro.no> Author: des Date: 2006-08-21 14:54:53 +0200 (Mon, 21 Aug 2006) New Revision: 867 Modified: trunk/varnish-cache/bin/varnishhist/ Log: Set properties. Property changes on: trunk/varnish-cache/bin/varnishhist ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in varnishhist From des at projects.linpro.no Mon Aug 21 12:55:56 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 21 Aug 2006 14:55:56 +0200 (CEST) Subject: r868 - trunk/varnish-cache/bin/varnishhist Message-ID: <20060821125556.7E4B21EC966@projects.linpro.no> Author: des Date: 2006-08-21 14:55:56 +0200 (Mon, 21 Aug 2006) New Revision: 868 Modified: trunk/varnish-cache/bin/varnishhist/Makefile.am trunk/varnish-cache/bin/varnishhist/varnishhist.c Log: Set properties. Modified: trunk/varnish-cache/bin/varnishhist/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishhist/Makefile.am 2006-08-21 12:54:53 UTC (rev 867) +++ trunk/varnish-cache/bin/varnishhist/Makefile.am 2006-08-21 12:55:56 UTC (rev 868) @@ -1,4 +1,4 @@ -# $Id: Makefile.am 767 2006-08-08 12:31:19Z des $ +# $Id$ INCLUDES = -I$(top_srcdir)/include Property changes on: trunk/varnish-cache/bin/varnishhist/Makefile.am ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-21 12:54:53 UTC (rev 867) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-21 12:55:56 UTC (rev 868) @@ -1,5 +1,5 @@ /* - * $Id: varnishlog.c 833 2006-08-18 20:07:37Z phk $ + * $Id$ * * Log tailer for Varnish */ Property changes on: trunk/varnish-cache/bin/varnishhist/varnishhist.c ___________________________________________________________________ Name: svn:keywords + Id From des at projects.linpro.no Mon Aug 21 12:57:32 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 21 Aug 2006 14:57:32 +0200 (CEST) Subject: r869 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060821125732.C2FDC1EC966@projects.linpro.no> Author: des Date: 2006-08-21 14:57:32 +0200 (Mon, 21 Aug 2006) New Revision: 869 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: When writing to a file, open it with O_APPEND rather than O_TRUNC. Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-21 12:55:56 UTC (rev 868) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-21 12:57:32 UTC (rev 869) @@ -4,12 +4,13 @@ * Log tailer for Varnish */ -#include #include -#include +#include +#include +#include #include +#include #include -#include #include "compat/vis.h" @@ -175,36 +176,25 @@ static void do_write(struct VSL_data *vd, const char *w_opt) { - FILE *wfile = NULL; - unsigned u; - int i; + int fd, i; unsigned char *p; if (!strcmp(w_opt, "-")) - wfile = stdout; + fd = STDOUT_FILENO; else - wfile = fopen(w_opt, "w"); - if (wfile == NULL) { + fd = open(w_opt, O_WRONLY|O_APPEND|O_CREAT, 0644); + if (fd < 0) { perror(w_opt); exit (1); } - u = 0; while (1) { i = VSL_NextLog(vd, &p); if (i < 0) break; - if (i == 0) { - fflush(wfile); - fprintf(stderr, "\nFlushed\n"); - } else { - i = fwrite(p, 5 + p[1], 1, wfile); + if (i > 0) { + i = write(fd, p, 5 + p[1]); if (i != 1) perror(w_opt); - u++; - if (!(u % 1000)) { - fprintf(stderr, "%u\r", u); - fflush(stderr); - } } } exit (0); From phk at projects.linpro.no Mon Aug 21 13:15:02 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 15:15:02 +0200 (CEST) Subject: r870 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821131502.3518A1EC968@projects.linpro.no> Author: phk Date: 2006-08-21 15:15:02 +0200 (Mon, 21 Aug 2006) New Revision: 870 Modified: trunk/varnish-cache/bin/varnishd/cache_session.c Log: Increase client hash to 1k Cache used sessmem chunks on a private list and recycle from there, no point in bothering malloc all the time. Modified: trunk/varnish-cache/bin/varnishd/cache_session.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-21 12:57:32 UTC (rev 869) +++ trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-21 13:15:02 UTC (rev 870) @@ -21,7 +21,7 @@ #include "shmlog.h" #include "cache.h" -#define CLIENT_HASH 256 +#define CLIENT_HASH 1024 #define CLIENT_TTL 30 /*--------------------------------------------------------------------*/ @@ -33,14 +33,18 @@ struct sess sess; struct http http; struct sockaddr sockaddr[2]; /* INET6 hack */ + TAILQ_ENTRY(sessmem) list; }; /*--------------------------------------------------------------------*/ +static TAILQ_HEAD(,sessmem) ses_free_mem = + TAILQ_HEAD_INITIALIZER(ses_free_mem); + TAILQ_HEAD(srcaddrhead ,srcaddr); - static struct srcaddrhead srcaddr_hash[CLIENT_HASH]; static pthread_mutex_t ses_mtx; +static pthread_mutex_t ses_mem_mtx; /*-------------------------------------------------------------------- * Assign a srcaddr to this session. @@ -185,13 +189,21 @@ { struct sessmem *sm; - sm = calloc( - sizeof *sm + params->mem_workspace, - 1); + AZ(pthread_mutex_lock(&ses_mem_mtx)); + sm = TAILQ_FIRST(&ses_free_mem); + if (sm != NULL) + TAILQ_REMOVE(&ses_free_mem, sm, list); + AZ(pthread_mutex_unlock(&ses_mem_mtx)); + if (sm == NULL) { + sm = calloc(sizeof *sm + params->mem_workspace, 1); + sm->magic = SESSMEM_MAGIC; + VSL_stats->n_sess_mem++; + } if (sm == NULL) return (NULL); - sm->magic = SESSMEM_MAGIC; + CHECK_OBJ_NOTNULL(sm, SESSMEM_MAGIC); VSL_stats->n_sess++; + memset(&sm->sess, 0, sizeof sm->sess); sm->sess.magic = SESS_MAGIC; sm->sess.mem = sm; sm->sess.http = &sm->http; @@ -225,7 +237,9 @@ b->sess, b->req, b->pipe, b->pass, b->fetch, b->hdrbytes, b->bodybytes); CHECK_OBJ_NOTNULL(sp->mem, SESSMEM_MAGIC); - free(sp->mem); + AZ(pthread_mutex_lock(&ses_mem_mtx)); + TAILQ_INSERT_HEAD(&ses_free_mem, sp->mem, list); + AZ(pthread_mutex_unlock(&ses_mem_mtx)); } /*--------------------------------------------------------------------*/ @@ -238,4 +252,5 @@ for (i = 0; i < CLIENT_HASH; i++) TAILQ_INIT(&srcaddr_hash[i]); AZ(pthread_mutex_init(&ses_mtx, NULL)); + AZ(pthread_mutex_init(&ses_mem_mtx, NULL)); } From phk at projects.linpro.no Mon Aug 21 13:15:40 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 15:15:40 +0200 (CEST) Subject: r871 - trunk/varnish-cache/include Message-ID: <20060821131540.E77111EC96A@projects.linpro.no> Author: phk Date: 2006-08-21 15:15:40 +0200 (Mon, 21 Aug 2006) New Revision: 871 Modified: trunk/varnish-cache/include/stat_field.h Log: Add n_sess_mem Modified: trunk/varnish-cache/include/stat_field.h =================================================================== --- trunk/varnish-cache/include/stat_field.h 2006-08-21 13:15:02 UTC (rev 870) +++ trunk/varnish-cache/include/stat_field.h 2006-08-21 13:15:40 UTC (rev 871) @@ -13,6 +13,7 @@ MAC_STAT(n_srcaddr, uint64_t, "u", "N struct srcaddr") MAC_STAT(n_srcaddr_act, uint64_t, "u", "N active struct srcaddr") +MAC_STAT(n_sess_mem, uint64_t, "u", "N struct sess_mem") MAC_STAT(n_sess, uint64_t, "u", "N struct sess") MAC_STAT(n_object, uint64_t, "u", "N struct object") MAC_STAT(n_objecthead, uint64_t, "u", "N struct objecthead") From des at projects.linpro.no Mon Aug 21 17:26:11 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 21 Aug 2006 19:26:11 +0200 (CEST) Subject: r872 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821172611.515871EC967@projects.linpro.no> Author: des Date: 2006-08-21 19:26:11 +0200 (Mon, 21 Aug 2006) New Revision: 872 Modified: trunk/varnish-cache/bin/varnishd/common.h trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/tcp.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: Rename open_tcp() to TCP_open() and modify it to open only one socket of the appropriate type for the address that was passed in. Introduce TCP_parse(), which extracts an address and port from a string of the form "hostname:port", "i.p.v.4:port" or "[i:p:v:6]:port" (where "port" can be either a decimal number or a service name). Use TCP_parse() to parse the argument to -a (listen address), -b (backend address) and -T (telnet address). Eliminate -p (listen port). While there, rename a bunch of "fooflag" variables which aren't flags to "foo_arg". Modified: trunk/varnish-cache/bin/varnishd/common.h =================================================================== --- trunk/varnish-cache/bin/varnishd/common.h 2006-08-21 13:15:40 UTC (rev 871) +++ trunk/varnish-cache/bin/varnishd/common.h 2006-08-21 17:26:11 UTC (rev 872) @@ -15,3 +15,5 @@ void TCP_name(struct sockaddr *addr, unsigned l, char *abuf, unsigned alen, char *pbuf, unsigned plen); void TCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen); +int TCP_parse(const char *str, char **addr, char **port); +int TCP_open(const char *addr, const char *port, int http); Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-21 13:15:40 UTC (rev 871) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-21 17:26:11 UTC (rev 872) @@ -10,7 +10,7 @@ extern struct evbase *mgt_evb; /* mgt_child.c */ -void mgt_run(int dflag, const char *Tflag); +void mgt_run(int dflag, const char *T_arg); extern pid_t mgt_pid, child_pid; /* mgt_cli.c */ @@ -20,16 +20,13 @@ int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...); void mgt_cli_start_child(int fdi, int fdo); void mgt_cli_stop_child(void); -int mgt_cli_telnet(const char *port); +int mgt_cli_telnet(const char *T_arg); /* mgt_vcc.c */ void mgt_vcc_init(void); int mgt_vcc_default(const char *bflag, const char *fflag); int mgt_push_vcls_and_start(unsigned *status, char **p); -/* tcp.c */ -int open_tcp(const char *port, int http); - #include "stevedore.h" extern struct stevedore sma_stevedore; Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-21 13:15:40 UTC (rev 871) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-21 17:26:11 UTC (rev 872) @@ -278,7 +278,7 @@ */ void -mgt_run(int dflag, const char *Tflag) +mgt_run(int dflag, const char *T_arg) { struct sigaction sac; struct ev *e; @@ -292,8 +292,8 @@ if (dflag) mgt_cli_setup(0, 1, 1); - if (Tflag) - mgt_cli_telnet(Tflag); + if (T_arg) + mgt_cli_telnet(T_arg); e = ev_new(); assert(e != NULL); Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-21 13:15:40 UTC (rev 871) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-21 17:26:11 UTC (rev 872) @@ -357,10 +357,14 @@ } int -mgt_cli_telnet(const char *port) +mgt_cli_telnet(const char *T_arg) { + char *addr, *port; - telnet_sock = open_tcp(port, 0); + TCP_parse(T_arg, &addr, &port); + telnet_sock = TCP_open(addr, port, 0); + free(addr); + free(port); if (telnet_sock < 0) { fprintf(stderr, "Could not open TELNET port\n"); exit (2); Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-21 13:15:40 UTC (rev 871) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-21 17:26:11 UTC (rev 872) @@ -118,8 +118,9 @@ /*--------------------------------------------------------------------*/ int -mgt_vcc_default(const char *bflag, const char *fflag) +mgt_vcc_default(const char *b_arg, const char *f_arg) { + char *addr, *port; char *buf, *vf; const char *p, *q; struct vsb *sb; @@ -127,7 +128,7 @@ sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(sb != NULL); - if (bflag != NULL) { + if (b_arg != NULL) { /* * XXX: should do a "HEAD /" on the -b argument to see that * XXX: it even works. On the other hand, we should do that @@ -136,26 +137,24 @@ * XXX: a bug for a backend to not reply at that time, so then * XXX: again: we should check it here in the "trivial" case. */ - p = strchr(bflag, ' '); - if (p != NULL) { - q = p + 1; - } else { - p = strchr(bflag, '\0'); - assert(p != NULL); - q = "http"; + if (TCP_parse(b_arg, &addr, &port) != 0) { + fprintf(stderr, "invalid backend address\n"); + return (1); } buf = NULL; asprintf(&buf, "backend default {\n" - " set backend.host = \"%*.*s\";\n" + " set backend.host = \"%s\";\n" " set backend.port = \"%s\";\n" - "}\n", (int)(p - bflag), (int)(p - bflag), bflag, q); + "}\n", addr, port ? port : "http"); + free(addr); + free(port); assert(buf != NULL); vf = VCC_Compile(sb, buf, NULL); free(buf); } else { - vf = VCC_CompileFile(sb, fflag); + vf = VCC_CompileFile(sb, f_arg); } vsb_finish(sb); if (vsb_len(sb) > 0) { Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-21 13:15:40 UTC (rev 871) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-21 17:26:11 UTC (rev 872) @@ -74,38 +74,55 @@ } #endif -static int -try_sock(int family, const char *port, struct addrinfo **resp) +int +TCP_parse(const char *str, char **addr, char **port) { + const char *p; + + *addr = *port = NULL; + + if (str[0] == '[') { + /* IPv6 address of the form [::1]:80 */ + if ((p = strchr(str, ']')) == NULL || + p == str + 1 || + (p[1] != '\0' && p[1] != ':')) + return (-1); + *addr = strndup(str + 1, p - (str + 1)); + if (p[1] == ':') + *port = strdup(p + 2); + } else { + /* IPv4 address of the form 127.0.0.1:80, or non-numeric */ + p = strchr(str, ':'); + if (p == NULL) { + *addr = strdup(str); + } else { + if (p == str) + return (-1); + *addr = strndup(str, p - str); + *port = strdup(p + 1); + } + } + return (0); +} + +int +TCP_open(const char *addr, const char *port, int http) +{ struct addrinfo hints, *res; - int ret, sd; + int ret, sd, val; memset(&hints, 0, sizeof hints); - hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; - ret = getaddrinfo(NULL, port, &hints, &res); - if (ret != 0) + ret = getaddrinfo(addr, port, &hints, &res); + if (ret != 0) { + fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(ret)); return (-1); + } sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (sd < 0) + if (sd < 0) { + perror("socket()"); freeaddrinfo(res); - else - *resp = res; - return (sd); -} - -int -open_tcp(const char *port, int http) -{ - int sd, val; - struct addrinfo *res; - - sd = try_sock(AF_INET6, port, &res); - if (sd < 0) - sd = try_sock(AF_INET, port, &res); - if (sd < 0) { - fprintf(stderr, "Failed to get listening socket\n"); return (-1); } val = 1; @@ -115,14 +132,6 @@ close(sd); return (-1); } - val = 0; - if (res->ai_family == AF_INET6 && - setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof val) != 0) { - perror("setsockopt(IPV6_V6ONLY, 0)"); - freeaddrinfo(res); - close(sd); - return (-1); - } if (bind(sd, res->ai_addr, res->ai_addrlen) != 0) { perror("bind()"); freeaddrinfo(res); Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-21 13:15:40 UTC (rev 871) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-21 17:26:11 UTC (rev 872) @@ -47,25 +47,25 @@ } static void -setup_hash(const char *sflag) +setup_hash(const char *s_arg) { const char *p, *q; struct hash_slinger *hp; - p = strchr(sflag, ','); + p = strchr(s_arg, ','); if (p == NULL) - q = p = strchr(sflag, '\0'); + q = p = strchr(s_arg, '\0'); else q = p + 1; assert(p != NULL); assert(q != NULL); - if (!cmp_hash(&hcl_slinger, sflag, p)) { + if (!cmp_hash(&hcl_slinger, s_arg, p)) { hp = &hcl_slinger; - } else if (!cmp_hash(&hsl_slinger, sflag, p)) { + } else if (!cmp_hash(&hsl_slinger, s_arg, p)) { hp = &hsl_slinger; } else { fprintf(stderr, "Unknown hash method \"%.*s\"\n", - (int)(p - sflag), sflag); + (int)(p - s_arg), s_arg); exit (2); } heritage.hash = hp; @@ -92,25 +92,25 @@ } static void -setup_storage(const char *sflag) +setup_storage(const char *s_arg) { const char *p, *q; struct stevedore *stp; - p = strchr(sflag, ','); + p = strchr(s_arg, ','); if (p == NULL) - q = p = strchr(sflag, '\0'); + q = p = strchr(s_arg, '\0'); else q = p + 1; assert(p != NULL); assert(q != NULL); - if (!cmp_storage(&sma_stevedore, sflag, p)) { + if (!cmp_storage(&sma_stevedore, s_arg, p)) { stp = &sma_stevedore; - } else if (!cmp_storage(&smf_stevedore, sflag, p)) { + } else if (!cmp_storage(&smf_stevedore, s_arg, p)) { stp = &smf_stevedore; } else { fprintf(stderr, "Unknown storage method \"%.*s\"\n", - (int)(p - sflag), sflag); + (int)(p - s_arg), s_arg); exit (2); } heritage.stevedore = malloc(sizeof *heritage.stevedore); @@ -125,12 +125,14 @@ usage(void) { fprintf(stderr, "usage: varnishd [options]\n"); - fprintf(stderr, " %-28s # %s\n", "-b backend", - "backend location"); + fprintf(stderr, " %-28s # %s\n", "-a address:port", + "HTTP listen address and port"); + fprintf(stderr, " %-28s # %s\n", "-b address:port", + "backend address and port"); fprintf(stderr, " %-28s # %s\n", "", " -b "); fprintf(stderr, " %-28s # %s\n", "", - " -b ' '"); + " -b ':'"); fprintf(stderr, " %-28s # %s\n", "-d", "debug"); fprintf(stderr, " %-28s # %s\n", "-f file", "VCL_file"); fprintf(stderr, " %-28s # %s\n", @@ -143,7 +145,6 @@ " -h classic,"); fprintf(stderr, " %-28s # %s\n", "", " -h classic,,"); - fprintf(stderr, " %-28s # %s\n", "-p number", "TCP listen port"); fprintf(stderr, " %-28s # %s\n", "-s kind[,storageoptions]", "Backend storage specification"); fprintf(stderr, " %-28s # %s\n", "", @@ -155,7 +156,8 @@ fprintf(stderr, " %-28s # %s\n", "", " -s file,,"); fprintf(stderr, " %-28s # %s\n", "-t", "Default TTL"); - fprintf(stderr, " %-28s # %s\n", "-T port", "Telnet port"); + fprintf(stderr, " %-28s # %s\n", "-T address:port", + "Telnet listen address and port"); fprintf(stderr, " %-28s # %s\n", "-V", "version"); fprintf(stderr, " %-28s # %s\n", "-w int[,int[,int]]", "Number of worker threads"); @@ -317,13 +319,14 @@ main(int argc, char *argv[]) { int o; - const char *portnumber = "8080"; - unsigned dflag = 0; - const char *bflag = NULL; - const char *fflag = NULL; - const char *sflag = "file"; - const char *hflag = "classic"; - const char *Tflag = NULL; + unsigned d_flag = 0; + char *addr, *port; + const char *a_arg = "0.0.0.0:http"; + const char *b_arg = NULL; + const char *f_arg = NULL; + const char *h_flag = "classic"; + const char *s_arg = "file"; + const char *T_arg = NULL; struct params param; setbuf(stdout, NULL); @@ -343,31 +346,31 @@ params->send_timeout = 600; params->auto_restart = 1; - while ((o = getopt(argc, argv, "b:df:h:p:s:t:T:Vw:")) != -1) + while ((o = getopt(argc, argv, "a:b:df:h:s:t:T:Vw:")) != -1) switch (o) { + case 'a': + a_arg = optarg; + break; case 'b': - bflag = optarg; + b_arg = optarg; break; case 'd': - dflag++; + d_flag++; break; case 'f': - fflag = optarg; + f_arg = optarg; break; case 'h': - hflag = optarg; + h_flag = optarg; break; - case 'p': - portnumber = optarg; - break; case 's': - sflag = optarg; + s_arg = optarg; break; case 't': params->default_ttl = strtoul(optarg, NULL, 0); break; case 'T': - Tflag = optarg; + T_arg = optarg; break; case 'V': varnish_version("varnishd"); @@ -387,20 +390,20 @@ usage(); } - if (bflag != NULL && fflag != NULL) { + if (b_arg != NULL && f_arg != NULL) { fprintf(stderr, "Only one of -b or -f can be specified\n"); usage(); } - if (bflag == NULL && fflag == NULL) { + if (b_arg == NULL && f_arg == NULL) { fprintf(stderr, "One of -b or -f must be specified\n"); usage(); } - if (mgt_vcc_default(bflag, fflag)) + if (mgt_vcc_default(b_arg, f_arg)) exit (2); - setup_storage(sflag); - setup_hash(hflag); + setup_storage(s_arg); + setup_hash(h_flag); /* * XXX: Lacking the suspend/resume facility (due to the socket API @@ -409,22 +412,26 @@ * but do not answer. That, on the other hand, would eliminate the * possibility of doing a "no-glitch" restart of the child process. */ - heritage.socket = open_tcp(portnumber, 1); + if (TCP_parse(a_arg, &addr, &port) != 0) + fprintf(stderr, "invalid listen address\n"); + heritage.socket = TCP_open(addr, port ? port : "http", 1); + free(addr); + free(port); if (heritage.socket < 0) exit (2); VSL_MgtInit(SHMLOG_FILENAME, 8*1024*1024); - if (dflag == 1) + if (d_flag == 1) DebugStunt(); - if (dflag < 2) - daemon(dflag, dflag); - if (dflag == 1) + if (d_flag < 2) + daemon(d_flag, d_flag); + if (d_flag == 1) printf("%d\n", getpid()); mgt_cli_init(); - mgt_run(dflag, Tflag); + mgt_run(d_flag, T_arg); exit(0); } From phk at projects.linpro.no Mon Aug 21 17:32:41 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 19:32:41 +0200 (CEST) Subject: r873 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821173241.CF2B21EC95E@projects.linpro.no> Author: phk Date: 2006-08-21 19:32:41 +0200 (Mon, 21 Aug 2006) New Revision: 873 Modified: trunk/varnish-cache/bin/varnishd/cache_session.c Log: Retire sessions if the workspace size changes, properly cache the workspace size so we do not get caught unaware when it changes. Implement flip-flop free queue where SES_New() can read from one of them without a lock, which frees happen to the other one under lock. If the lock-less queue is empty, SES_New() flips the two queues under lock and tries again. If that queue is also empty call malloc(3). Modified: trunk/varnish-cache/bin/varnishd/cache_session.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-21 17:26:11 UTC (rev 872) +++ trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-21 17:32:41 UTC (rev 873) @@ -33,14 +33,19 @@ struct sess sess; struct http http; struct sockaddr sockaddr[2]; /* INET6 hack */ + unsigned workspace; TAILQ_ENTRY(sessmem) list; }; /*--------------------------------------------------------------------*/ -static TAILQ_HEAD(,sessmem) ses_free_mem = - TAILQ_HEAD_INITIALIZER(ses_free_mem); +static TAILQ_HEAD(,sessmem) ses_free_mem[2] = { + TAILQ_HEAD_INITIALIZER(ses_free_mem[0]), + TAILQ_HEAD_INITIALIZER(ses_free_mem[1]), +}; +static unsigned ses_qp; + TAILQ_HEAD(srcaddrhead ,srcaddr); static struct srcaddrhead srcaddr_hash[CLIENT_HASH]; static pthread_mutex_t ses_mtx; @@ -188,15 +193,37 @@ SES_New(struct sockaddr *addr, unsigned len) { struct sessmem *sm; + unsigned u; - AZ(pthread_mutex_lock(&ses_mem_mtx)); - sm = TAILQ_FIRST(&ses_free_mem); - if (sm != NULL) - TAILQ_REMOVE(&ses_free_mem, sm, list); - AZ(pthread_mutex_unlock(&ses_mem_mtx)); + + /* + * One of the two queues is unlocked because only one + * thread ever gets here to empty it. + */ + assert(ses_qp <= 1); + sm = TAILQ_FIRST(&ses_free_mem[ses_qp]); if (sm == NULL) { - sm = calloc(sizeof *sm + params->mem_workspace, 1); + /* + * If that queue is empty, flip queues holding the lock + * and try the new unlocked queue. + */ + AZ(pthread_mutex_lock(&ses_mem_mtx)); + ses_qp = 1 - ses_qp; + AZ(pthread_mutex_unlock(&ses_mem_mtx)); + sm = TAILQ_FIRST(&ses_free_mem[ses_qp]); + } + if (sm != NULL) { + TAILQ_REMOVE(&ses_free_mem[ses_qp], sm, list); + } else { + /* + * If that fails, alloc new one. + */ + u = params->mem_workspace; + sm = malloc(sizeof *sm + u); + if (sm == NULL) + return (NULL); sm->magic = SESSMEM_MAGIC; + sm->workspace = u; VSL_stats->n_sess_mem++; } if (sm == NULL) @@ -215,7 +242,7 @@ sm->sess.sockaddrlen = len; } - http_Setup(&sm->http, (void *)(sm + 1), params->mem_workspace); + http_Setup(&sm->http, (void *)(sm + 1), sm->workspace); sm->sess.acct.first = time(NULL); @@ -226,8 +253,12 @@ SES_Delete(struct sess *sp) { struct acct *b = &sp->acct; + struct sessmem *sm; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + sm = sp->mem; + CHECK_OBJ_NOTNULL(sm, SESSMEM_MAGIC); + assert(sp->obj == NULL); assert(sp->vcl == NULL); VSL_stats->n_sess--; @@ -236,10 +267,14 @@ sp->addr, sp->port, time(NULL) - b->first, b->sess, b->req, b->pipe, b->pass, b->fetch, b->hdrbytes, b->bodybytes); - CHECK_OBJ_NOTNULL(sp->mem, SESSMEM_MAGIC); - AZ(pthread_mutex_lock(&ses_mem_mtx)); - TAILQ_INSERT_HEAD(&ses_free_mem, sp->mem, list); - AZ(pthread_mutex_unlock(&ses_mem_mtx)); + if (sm->workspace != params->mem_workspace) { + VSL_stats->n_sess_mem--; + free(sm); + } else { + AZ(pthread_mutex_lock(&ses_mem_mtx)); + TAILQ_INSERT_HEAD(&ses_free_mem[1 - ses_qp], sm, list); + AZ(pthread_mutex_unlock(&ses_mem_mtx)); + } } /*--------------------------------------------------------------------*/ From phk at phk.freebsd.dk Mon Aug 21 17:35:39 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Mon, 21 Aug 2006 17:35:39 +0000 Subject: r872 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Mon, 21 Aug 2006 19:26:11 +0200." <20060821172611.515871EC967@projects.linpro.no> Message-ID: <19914.1156181739@critter.freebsd.dk> In message <20060821172611.515871EC967 at projects.linpro.no>, des at projects.linpro .no writes: >+ return (-1); >+ *addr = strndup(str + 1, p - (str + 1)); strndup() ?? -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From phk at projects.linpro.no Mon Aug 21 17:49:39 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 19:49:39 +0200 (CEST) Subject: r874 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821174939.B38CD1EC96C@projects.linpro.no> Author: phk Date: 2006-08-21 19:49:39 +0200 (Mon, 21 Aug 2006) New Revision: 874 Modified: trunk/varnish-cache/bin/varnishd/tcp.c Log: Bandaid until Dag Erling does what's necessary Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-21 17:32:41 UTC (rev 873) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-21 17:49:39 UTC (rev 874) @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -74,6 +75,19 @@ } #endif +static char * +strndup(const char *p, unsigned n) +{ + char *q; + + q = malloc(n + 1); + if (q != NULL) { + memcpy(q, p, n); + q[n] = '\0'; + } + return (q); +} + int TCP_parse(const char *str, char **addr, char **port) { From phk at phk.freebsd.dk Mon Aug 21 17:53:30 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Mon, 21 Aug 2006 17:53:30 +0000 Subject: r872 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Mon, 21 Aug 2006 19:26:11 +0200." <20060821172611.515871EC967@projects.linpro.no> Message-ID: <26311.1156182810@critter.freebsd.dk> In message <20060821172611.515871EC967 at projects.linpro.no>, des at projects.linpro .no writes: >Introduce TCP_parse(), which extracts an address and port from a string of >the form "hostname:port", "i.p.v.4:port" or "[i:p:v:6]:port" (where "port" >can be either a decimal number or a service name). So how do I say "ANY_IPV4:80" ? I think the removal of -p is a step backwards in user-friendlyness. -a is probably a good idea, but -p is intuitive. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From phk at projects.linpro.no Mon Aug 21 18:55:24 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 20:55:24 +0200 (CEST) Subject: r875 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821185524.847B71EC970@projects.linpro.no> Author: phk Date: 2006-08-21 20:55:24 +0200 (Mon, 21 Aug 2006) New Revision: 875 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_acceptor.h trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c Log: Overhaul kqueue acceptor in light of todays learnings. Use the pipe trick to inject sessions into the system, as far as I can tell it is cheaper because of the low rate it happens and the high rate of mutex operations avoided. Ignore the timer event, but purge the list every time we wake up to reduce lumpyness of timeout'ing. Centralize the polling of a session so we don't have the same two messages spread out all over the place. Centralize the acceptor thread and send things directly to the worker thread, leaving only the session-herder in the split out files. poll & epoll not yet updated accordingly. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-21 17:49:39 UTC (rev 874) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-21 18:55:24 UTC (rev 875) @@ -272,7 +272,6 @@ struct workreq workreq; struct acct acct; - unsigned kqa; }; struct backend { Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 17:49:39 UTC (rev 874) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 18:55:24 UTC (rev 875) @@ -40,6 +40,7 @@ }; static unsigned xids; +static pthread_t vca_thread_acct; struct sess * vca_accept_sess(int fd) @@ -128,6 +129,23 @@ /*--------------------------------------------------------------------*/ +int +vca_pollsession(struct sess *sp) +{ + int i; + + i = http_RecvSome(sp->fd, sp->http); + if (i < 1) + return (i); + if (i == 1) + vca_close_session(sp, "overflow"); + else if (i == 2) + vca_close_session(sp, "no request"); + return (1); +} + +/*--------------------------------------------------------------------*/ + void vca_close_session(struct sess *sp, const char *why) { @@ -143,11 +161,35 @@ { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + if (sp->fd >= 0) { + VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); + (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); + if (http_RecvPrepAgain(sp->http)) + vca_handover(sp, 0); + } vca_acceptors[0]->recycle(sp); } /*--------------------------------------------------------------------*/ +static void * +vca_acct(void *arg) +{ + struct sess *sp; + + (void)arg; + while (1) { + sp = vca_accept_sess(heritage.socket); + if (sp == NULL) + continue; + http_RecvPrep(sp->http); + vca_handfirst(sp); + } +} + + +/*--------------------------------------------------------------------*/ + void VCA_Init(void) { @@ -161,4 +203,5 @@ exit (2); } vca_acceptors[0]->init(); + AZ(pthread_create(&vca_thread_acct, NULL, vca_acct, NULL)); } Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2006-08-21 17:49:39 UTC (rev 874) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2006-08-21 18:55:24 UTC (rev 875) @@ -29,4 +29,5 @@ struct sess *vca_accept_sess(int fd); void vca_handover(struct sess *sp, int bad); void vca_handfirst(struct sess *sp); +int vca_pollsession(struct sess *sp); Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-21 17:49:39 UTC (rev 874) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-21 18:55:24 UTC (rev 875) @@ -19,109 +19,82 @@ #include #include -#ifndef HAVE_SRANDOMDEV -#include "compat/srandomdev.h" -#endif - #include "heritage.h" #include "shmlog.h" #include "cache.h" #include "cache_acceptor.h" -static pthread_t vca_kqueue_thread1; -static pthread_t vca_kqueue_thread2; +static pthread_t vca_kqueue_thread; static int kq = -1; +static TAILQ_HEAD(,sess) sesshead = TAILQ_HEAD_INITIALIZER(sesshead); +static int pipes[2]; + #define NKEV 100 static void vca_kq_sess(struct sess *sp, int arm) { - struct kevent ke[2]; - int i, j, arm2; + struct kevent ke; + int i; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - memset(ke, 0, sizeof ke); - if (arm == EV_ADD || arm == EV_ENABLE) { - assert(sp->kqa == 0); - sp->kqa = 1; - arm2 = EV_ADD; - } else { - assert(sp->kqa == 1); - sp->kqa = 0; - arm2 = EV_DELETE; - } - j = 0; - EV_SET(&ke[j++], sp->id, EVFILT_TIMER, arm2, - 0, params->sess_timeout * 1000, sp); - if (sp->fd >= 0) - EV_SET(&ke[j++], sp->fd, EVFILT_READ, arm, 0, 0, sp); - - i = kevent(kq, ke, j, NULL, 0, NULL); + if (sp->fd < 0) + return; + EV_SET(&ke, sp->fd, EVFILT_READ, arm, 0, 0, sp); + i = kevent(kq, &ke, 1, NULL, 0, NULL); assert(i == 0); } -static struct sess * +static void vca_kev(struct kevent *kp) { int i; struct sess *sp; - if (kp->udata == NULL) { - VSL(SLT_Debug, 0, - "KQ RACE %s flags %x fflags %x data %x", - kp->filter == EVFILT_READ ? "R" : "T", - kp->flags, kp->fflags, kp->data); - return (NULL); + assert(kp->udata != NULL); + if (kp->udata == pipes) { + while (kp->data > 0) { + i = read(pipes[0], &sp, sizeof sp); + assert(i == sizeof sp); + kp->data -= i; + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + TAILQ_INSERT_TAIL(&sesshead, sp, list); + vca_kq_sess(sp, EV_ADD); + } + return; } CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC); - if (sp->kqa == 0) { - VSL(SLT_Debug, sp->id, - "KQ %s flags %x fflags %x data %x", - kp->filter == EVFILT_READ ? "R" : "T", - kp->flags, kp->fflags, kp->data); - return (NULL); - } - if (kp->filter == EVFILT_READ) { - if (kp->data > 0) { - i = http_RecvSome(sp->fd, sp->http); - switch (i) { - case -1: - return (NULL); - case 0: - vca_kq_sess(sp, EV_DISABLE); - vca_handover(sp, i); - return (NULL); /* ?? */ - case 1: - vca_close_session(sp, "overflow"); - break; - case 2: - vca_close_session(sp, "no request"); - break; - default: - INCOMPL(); - } - return (sp); + if (kp->data > 0) { + i = vca_pollsession(sp); + if (i == -1) + return; + TAILQ_REMOVE(&sesshead, sp, list); + if (i == 0) { + vca_kq_sess(sp, EV_DELETE); + vca_handover(sp, i); + } else { + SES_Delete(sp); } - if (kp->flags == EV_EOF) { - vca_close_session(sp, "EOF"); - return (sp); - } - INCOMPL(); + return; } - if (kp->filter == EVFILT_TIMER) { - vca_close_session(sp, "timeout"); - return (sp); + if (kp->flags == EV_EOF) { + TAILQ_REMOVE(&sesshead, sp, list); + vca_close_session(sp, "EOF"); + SES_Delete(sp); + return; } INCOMPL(); } +/*--------------------------------------------------------------------*/ static void * vca_kqueue_main(void *arg) { struct kevent ke[NKEV], *kp; int i, j, n; + struct timespec ts; struct sess *sp; (void)arg; @@ -129,62 +102,57 @@ kq = kqueue(); assert(kq >= 0); + j = 0; + EV_SET(&ke[j++], 0, EVFILT_TIMER, EV_ADD, 0, 100, NULL); + EV_SET(&ke[j++], pipes[0], EVFILT_READ, EV_ADD, 0, 0, pipes); + i = kevent(kq, ke, j, NULL, 0, NULL); + assert(i == 0); + while (1) { n = kevent(kq, NULL, 0, ke, NKEV, NULL); assert(n >= 1 && n <= NKEV); for (kp = ke, j = 0; j < n; j++, kp++) { - sp = vca_kev(kp); - if (sp != NULL) { - vca_kq_sess(sp, EV_DELETE); - SES_Delete(sp); - for (i = j; i < n; i++) - if (ke[i].udata == sp) - ke[i].udata = NULL; - } + if (kp->filter == EVFILT_TIMER) + continue; + assert(kp->filter == EVFILT_READ); + vca_kev(kp); } + clock_gettime(CLOCK_REALTIME, &ts); + ts.tv_sec -= params->sess_timeout; + for (;;) { + sp = TAILQ_FIRST(&sesshead); + if (sp == NULL) + break; + if (sp->t_open.tv_sec > ts.tv_sec) + break; + if (sp->t_open.tv_sec == ts.tv_sec && + sp->t_open.tv_nsec > ts.tv_nsec) + break; + TAILQ_REMOVE(&sesshead, sp, list); + vca_close_session(sp, "timeout"); + SES_Delete(sp); + } } - INCOMPL(); } -static void * -vca_kqueue_acct(void *arg) -{ - struct sess *sp; - - (void)arg; - while (1) { - sp = vca_accept_sess(heritage.socket); - if (sp == NULL) - continue; - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - http_RecvPrep(sp->http); - vca_kq_sess(sp, EV_ADD); - } -} - /*--------------------------------------------------------------------*/ static void vca_kqueue_recycle(struct sess *sp) { - if (sp->fd < 0) { + if (sp->fd < 0) SES_Delete(sp); - return; - } - (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); - VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); - if (http_RecvPrepAgain(sp->http)) - vca_handover(sp, 0); - else - vca_kq_sess(sp, EV_ENABLE); + else + assert(write(pipes[1], &sp, sizeof sp) == sizeof sp); } static void vca_kqueue_init(void) { - AZ(pthread_create(&vca_kqueue_thread1, NULL, vca_kqueue_main, NULL)); - AZ(pthread_create(&vca_kqueue_thread2, NULL, vca_kqueue_acct, NULL)); + + AZ(pipe(pipes)); + AZ(pthread_create(&vca_kqueue_thread, NULL, vca_kqueue_main, NULL)); } struct acceptor acceptor_kqueue = { From phk at projects.linpro.no Mon Aug 21 19:05:57 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 21:05:57 +0200 (CEST) Subject: r876 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821190557.008B41EC96F@projects.linpro.no> Author: phk Date: 2006-08-21 21:05:57 +0200 (Mon, 21 Aug 2006) New Revision: 876 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Add asserts. Return if we pass on directly. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 18:55:24 UTC (rev 875) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 19:05:57 UTC (rev 876) @@ -161,11 +161,15 @@ { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + assert(sp->obj == NULL); + assert(sp->vcl == NULL); if (sp->fd >= 0) { VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); - if (http_RecvPrepAgain(sp->http)) + if (http_RecvPrepAgain(sp->http)) { vca_handover(sp, 0); + return; + } } vca_acceptors[0]->recycle(sp); } From phk at projects.linpro.no Mon Aug 21 20:23:14 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 22:23:14 +0200 (CEST) Subject: r877 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821202314.5DAC81EC971@projects.linpro.no> Author: phk Date: 2006-08-21 22:23:14 +0200 (Mon, 21 Aug 2006) New Revision: 877 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c Log: Remove unused #includes Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-21 19:05:57 UTC (rev 876) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-21 20:23:14 UTC (rev 877) @@ -10,13 +10,9 @@ #include #include -#include #include #include -#include -#include -#include #include #include "heritage.h" From phk at projects.linpro.no Mon Aug 21 20:23:48 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 22:23:48 +0200 (CEST) Subject: r878 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821202348.14E2C1EC973@projects.linpro.no> Author: phk Date: 2006-08-21 22:23:47 +0200 (Mon, 21 Aug 2006) New Revision: 878 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: Make it easier to experiement with acceptors by having a single pointer to the one in use. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 20:23:14 UTC (rev 877) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 20:23:47 UTC (rev 878) @@ -39,6 +39,8 @@ NULL, }; +static struct acceptor *vca_act; + static unsigned xids; static pthread_t vca_thread_acct; @@ -171,7 +173,7 @@ return; } } - vca_acceptors[0]->recycle(sp); + vca_act->recycle(sp); } /*--------------------------------------------------------------------*/ @@ -202,10 +204,12 @@ xids = random(); /* XXX: Add selector mechanism at some point */ - if (vca_acceptors[0]->name == NULL) { + vca_act = vca_acceptors[0]; + + if (vca_act->name == NULL) { fprintf(stderr, "No acceptor in program\n"); exit (2); } - vca_acceptors[0]->init(); + vca_act->init(); AZ(pthread_create(&vca_thread_acct, NULL, vca_acct, NULL)); } From phk at projects.linpro.no Mon Aug 21 20:25:28 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 22:25:28 +0200 (CEST) Subject: r879 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821202528.70ABF1EC972@projects.linpro.no> Author: phk Date: 2006-08-21 22:25:28 +0200 (Mon, 21 Aug 2006) New Revision: 879 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c Log: Fix these two up to current standard. Poll is tested, epoll isn't. While the three implementations share a lot of identical code right now, I will wait a bit before unifying more of them, at least until performance proves that this is the right way for kqueue. XXX: they're really not acceptors any more, they're herders. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c 2006-08-21 20:23:47 UTC (rev 878) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c 2006-08-21 20:25:28 UTC (rev 879) @@ -14,15 +14,8 @@ #include #include -#include -#include -#include #include -#ifndef HAVE_SRANDOMDEV -#include "compat/srandomdev.h" -#endif - #include "heritage.h" #include "shmlog.h" #include "cache.h" @@ -52,28 +45,13 @@ { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - TAILQ_INSERT_TAIL(&sesshead, sp, list); - vca_add(sp->fd, sp); } -static void -accept_f(int fd) -{ - struct sess *sp; - - sp = vca_accept_sess(fd); - if (sp == NULL) - return; - http_RecvPrep(sp->http); - vca_rcvhdev(sp); -} - static void * vca_main(void *arg) { struct epoll_event ev; - struct timespec t; + struct timespec ts; struct sess *sp, *sp2; int i; @@ -82,49 +60,45 @@ epfd = epoll_create(16); assert(epfd >= 0); - AZ(pipe(pipes)); vca_add(pipes[0], pipes); - if (heritage.socket >= 0) - vca_add(heritage.socket, accept_f); - while (1) { - if (epoll_wait(epfd, &ev, 1, 5000) > 0) { + if (epoll_wait(epfd, &ev, 1, 100) > 0) { if (ev.data.ptr == pipes) { i = read(pipes[0], &sp, sizeof sp); assert(i == sizeof sp); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (http_RecvPrepAgain(sp->http)) - vca_handover(sp, 0); - else - vca_rcvhdev(sp); - } else if (ev.data.ptr == accept_f) { - accept_f(heritage.socket); + TAILQ_INSERT_TAIL(&sesshead, sp, list); + vca_add(sp->fd, sp); } else { CAST_OBJ_NOTNULL(sp, ev.data.ptr, SESS_MAGIC); - i = http_RecvSome(sp->fd, sp->http); - if (i != -1) { + i = vca_pollsession(sp); + if (i >= 0) { TAILQ_REMOVE(&sesshead, sp, list); vca_del(sp->fd); - vca_handover(sp, i); + if (i == 0) + vca_handover(sp, i); + else + SES_Delete(sp); } } } /* check for timeouts */ - clock_gettime(CLOCK_MONOTONIC, &t); + clock_gettime(CLOCK_REALTIME, &ts); + ts.tv_sec -= params->sess_timeout; TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (sp->t_idle.tv_sec + params->sess_timeout < t.tv_sec) { - TAILQ_REMOVE(&sesshead, sp, list); - vca_del(sp->fd); - vca_close_session(sp, "timeout"); - vca_return_session(sp); + if (sp->t_open.tv_sec > ts.tv_sec) continue; - } + if (sp->t_open.tv_sec == ts.tv_sec && + sp->t_open.tv_nsec > ts.tv_nsec) + continue; + TAILQ_REMOVE(&sesshead, sp, list); + vca_del(sp->fd); + vca_close_session(sp, "timeout"); + SES_Delete(sp); } } - - INCOMPL(); } /*--------------------------------------------------------------------*/ @@ -133,18 +107,17 @@ vca_epoll_recycle(struct sess *sp) { - if (sp->fd < 0) { + if (sp->fd < 0) SES_Delete(sp); - return; - } - (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); - VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); - assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); + else + assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); } static void vca_epoll_init(void) { + + AZ(pipe(pipes)); AZ(pthread_create(&vca_epoll_thread, NULL, vca_main, NULL)); } Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2006-08-21 20:23:47 UTC (rev 878) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2006-08-21 20:25:28 UTC (rev 879) @@ -15,14 +15,6 @@ #include #include -#include -#include -#include - -#ifndef HAVE_SRANDOMDEV -#include "compat/srandomdev.h" -#endif - #include "heritage.h" #include "shmlog.h" #include "cache.h" @@ -80,89 +72,58 @@ /*--------------------------------------------------------------------*/ -static void -vca_rcvhdev(struct sess *sp) -{ - - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - clock_gettime(CLOCK_MONOTONIC, &sp->t_idle); - TAILQ_INSERT_TAIL(&sesshead, sp, list); - vca_poll(sp->fd); -} - -static void -accept_f(int fd) -{ - struct sess *sp; - - sp = vca_accept_sess(fd); - if (sp == NULL) - return; - - http_RecvPrep(sp->http); - vca_rcvhdev(sp); -} - static void * vca_main(void *arg) { unsigned v; struct sess *sp, *sp2; - struct timespec t; + struct timespec ts; int i; (void)arg; - AZ(pipe(pipes)); vca_poll(pipes[0]); - if (heritage.socket >= 0) - vca_poll(heritage.socket); - while (1) { - v = poll(pollfd, npoll, 5000); + v = poll(pollfd, npoll, 100); if (v && pollfd[pipes[0]].revents) { v--; i = read(pipes[0], &sp, sizeof sp); assert(i == sizeof sp); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (http_RecvPrepAgain(sp->http)) - vca_handover(sp, 0); - else - vca_rcvhdev(sp); + TAILQ_INSERT_TAIL(&sesshead, sp, list); + vca_poll(sp->fd); } - if (heritage.socket >= 0 && - pollfd[heritage.socket].revents) { - accept_f(heritage.socket); - v--; - } - clock_gettime(CLOCK_MONOTONIC, &t); + clock_gettime(CLOCK_REALTIME, &ts); + ts.tv_sec -= params->sess_timeout; TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) { + if (v == 0) + break; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); if (pollfd[sp->fd].revents) { v--; - i = http_RecvSome(sp->fd, sp->http); + i = vca_pollsession(sp); if (i < 0) continue; - - vca_unpoll(sp->fd); TAILQ_REMOVE(&sesshead, sp, list); - vca_handover(sp, i); - continue; - } - if (sp->t_idle.tv_sec + params->sess_timeout < t.tv_sec) { - TAILQ_REMOVE(&sesshead, sp, list); vca_unpoll(sp->fd); - vca_close_session(sp, "timeout"); - vca_return_session(sp); + if (i == 0) + vca_handover(sp, i); + else + SES_Delete(sp); continue; } - if (v == 0) - break; + if (sp->t_open.tv_sec > ts.tv_sec) + continue; + if (sp->t_open.tv_sec == ts.tv_sec && + sp->t_open.tv_nsec > ts.tv_nsec) + continue; + TAILQ_REMOVE(&sesshead, sp, list); + vca_unpoll(sp->fd); + vca_close_session(sp, "timeout"); + SES_Delete(sp); } } - - INCOMPL(); } /*--------------------------------------------------------------------*/ @@ -171,18 +132,16 @@ vca_poll_recycle(struct sess *sp) { - if (sp->fd < 0) { + if (sp->fd < 0) SES_Delete(sp); - return; - } - (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); - VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); - assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); + else + assert(sizeof sp == write(pipes[1], &sp, sizeof sp)); } static void vca_poll_init(void) { + AZ(pipe(pipes)); AZ(pthread_create(&vca_poll_thread, NULL, vca_main, NULL)); } From phk at projects.linpro.no Mon Aug 21 20:30:29 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 22:30:29 +0200 (CEST) Subject: r880 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821203029.728DF1EC972@projects.linpro.no> Author: phk Date: 2006-08-21 22:30:29 +0200 (Mon, 21 Aug 2006) New Revision: 880 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_fetch.c trunk/varnish-cache/bin/varnishd/cache_pass.c trunk/varnish-cache/bin/varnishd/cache_pipe.c Log: Give VBE_ClosedFd() an argument to tell if the fd has already been closed. Pipe does this and would panic otherwise. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-21 20:25:28 UTC (rev 879) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-21 20:30:29 UTC (rev 880) @@ -305,7 +305,7 @@ /* cache_backend.c */ void VBE_Init(void); struct vbe_conn *VBE_GetFd(struct backend *bp, unsigned xid); -void VBE_ClosedFd(struct vbe_conn *vc); +void VBE_ClosedFd(struct vbe_conn *vc, int already); void VBE_RecycleFd(struct vbe_conn *vc); /* cache_ban.c */ Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-21 20:25:28 UTC (rev 879) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-21 20:30:29 UTC (rev 880) @@ -209,7 +209,7 @@ pfd.revents = 0; if (!poll(&pfd, 1, 0)) break; - VBE_ClosedFd(vc); + VBE_ClosedFd(vc, 0); } if (vc == NULL) { @@ -252,14 +252,15 @@ /* Close a connection ------------------------------------------------*/ void -VBE_ClosedFd(struct vbe_conn *vc) +VBE_ClosedFd(struct vbe_conn *vc, int already) { CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); assert(vc->fd >= 0); assert(vc->backend != NULL); VSL(SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name); - AZ(close(vc->fd)); + if (!already) + AZ(close(vc->fd)); vc->fd = -1; vc->backend = NULL; AZ(pthread_mutex_lock(&vbemtx)); Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-21 20:25:28 UTC (rev 879) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-21 20:30:29 UTC (rev 880) @@ -258,7 +258,7 @@ cls = 1; if (cls) - VBE_ClosedFd(vc); + VBE_ClosedFd(vc, 0); else VBE_RecycleFd(vc); Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-21 20:25:28 UTC (rev 879) +++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-21 20:30:29 UTC (rev 880) @@ -179,7 +179,7 @@ cls = 1; if (cls) - VBE_ClosedFd(vc); + VBE_ClosedFd(vc, 0); else VBE_RecycleFd(vc); } Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-21 20:25:28 UTC (rev 879) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-21 20:30:29 UTC (rev 880) @@ -68,7 +68,7 @@ if (WRK_Flush(w)) { vca_close_session(sp, "pipe"); - VBE_ClosedFd(vc); + VBE_ClosedFd(vc, 0); return; } @@ -92,5 +92,6 @@ rdf(fds, 1); } vca_close_session(sp, "pipe"); - VBE_ClosedFd(vc); + (void)close (vc->fd); + VBE_ClosedFd(vc, 1); } From phk at projects.linpro.no Mon Aug 21 20:42:47 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 21 Aug 2006 22:42:47 +0200 (CEST) Subject: r881 - trunk/varnish-cache/bin/varnishd Message-ID: <20060821204247.67D461EC974@projects.linpro.no> Author: phk Date: 2006-08-21 22:42:47 +0200 (Mon, 21 Aug 2006) New Revision: 881 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_acceptor.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c Log: Flexelint inpired cleanups Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 20:30:29 UTC (rev 880) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-21 20:42:47 UTC (rev 881) @@ -44,7 +44,7 @@ static unsigned xids; static pthread_t vca_thread_acct; -struct sess * +static struct sess * vca_accept_sess(int fd) { socklen_t l; @@ -119,16 +119,6 @@ WRK_QueueSession(sp); } -void -vca_handfirst(struct sess *sp) -{ - sp->step = STP_FIRST; - VSL_stats->client_req++; - sp->xid = xids++; - VSL(SLT_ReqStart, sp->fd, "XID %u", sp->xid); - WRK_QueueSession(sp); -} - /*--------------------------------------------------------------------*/ int @@ -189,7 +179,11 @@ if (sp == NULL) continue; http_RecvPrep(sp->http); - vca_handfirst(sp); + sp->step = STP_FIRST; + VSL_stats->client_req++; + sp->xid = xids++; + VSL(SLT_ReqStart, sp->fd, "XID %u", sp->xid); + WRK_QueueSession(sp); } } Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2006-08-21 20:30:29 UTC (rev 880) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2006-08-21 20:42:47 UTC (rev 881) @@ -26,8 +26,6 @@ #endif /* vca_acceptor.c */ -struct sess *vca_accept_sess(int fd); void vca_handover(struct sess *sp, int bad); -void vca_handfirst(struct sess *sp); int vca_pollsession(struct sess *sp); Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-21 20:30:29 UTC (rev 880) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-21 20:42:47 UTC (rev 881) @@ -40,7 +40,7 @@ CH_DIED = 4 } child_state = CH_STOPPED; -const char *ch_state[] = { +static const char *ch_state[] = { [CH_STOPPED] = "stopped", [CH_STARTING] = "starting", [CH_RUNNING] = "running", @@ -49,8 +49,8 @@ }; struct evbase *mgt_evb; -struct ev *ev_poker; -struct ev *ev_listen; +static struct ev *ev_poker; +static struct ev *ev_listen; /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-21 20:30:29 UTC (rev 880) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-21 20:42:47 UTC (rev 881) @@ -122,7 +122,6 @@ { char *addr, *port; char *buf, *vf; - const char *p, *q; struct vsb *sb; struct vclprog *vp; From des at linpro.no Tue Aug 22 06:59:23 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Tue, 22 Aug 2006 08:59:23 +0200 Subject: r872 - trunk/varnish-cache/bin/varnishd References: <26311.1156182810@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > So how do I say "ANY_IPV4:80" ? 0:80 DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at projects.linpro.no Tue Aug 22 07:11:59 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 22 Aug 2006 09:11:59 +0200 (CEST) Subject: r882 - in trunk/varnish-cache: . bin/varnishd include include/compat lib/libcompat Message-ID: <20060822071159.5768E1EC932@projects.linpro.no> Author: des Date: 2006-08-22 09:11:59 +0200 (Tue, 22 Aug 2006) New Revision: 882 Added: trunk/varnish-cache/include/compat/strndup.h trunk/varnish-cache/lib/libcompat/strndup.c Modified: trunk/varnish-cache/bin/varnishd/tcp.c trunk/varnish-cache/configure.ac trunk/varnish-cache/include/Makefile.am trunk/varnish-cache/lib/libcompat/Makefile.am Log: Add strndup() to libcompat. Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-21 20:42:47 UTC (rev 881) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-22 07:11:59 UTC (rev 882) @@ -17,6 +17,10 @@ #ifndef HAVE_STRLCPY #include "compat/strlcpy.h" #endif +#ifndef HAVE_STRNDUP +#include "compat/strndup.h" +#endif + #include "mgt.h" /*--------------------------------------------------------------------*/ @@ -75,19 +79,6 @@ } #endif -static char * -strndup(const char *p, unsigned n) -{ - char *q; - - q = malloc(n + 1); - if (q != NULL) { - memcpy(q, p, n); - q[n] = '\0'; - } - return (q); -} - int TCP_parse(const char *str, char **addr, char **port) { Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2006-08-21 20:42:47 UTC (rev 881) +++ trunk/varnish-cache/configure.ac 2006-08-22 07:11:59 UTC (rev 882) @@ -71,6 +71,7 @@ AC_CHECK_FUNCS([setproctitle]) AC_CHECK_FUNCS([srandomdev]) AC_CHECK_FUNCS([strlcat strlcpy]) +AC_CHECK_FUNCS([strndup]) AC_CHECK_FUNCS([vis strvis strvisx]) # On some systems, clock_gettime is in librt rather than libc Modified: trunk/varnish-cache/include/Makefile.am =================================================================== --- trunk/varnish-cache/include/Makefile.am 2006-08-21 20:42:47 UTC (rev 881) +++ trunk/varnish-cache/include/Makefile.am 2006-08-22 07:11:59 UTC (rev 882) @@ -10,6 +10,7 @@ compat/srandomdev.h \ compat/strlcat.h \ compat/strlcpy.h \ + compat/strndup.h \ compat/vasprintf.h \ compat/vis.h \ hash.h \ Added: trunk/varnish-cache/include/compat/strndup.h =================================================================== --- trunk/varnish-cache/include/compat/strndup.h 2006-08-21 20:42:47 UTC (rev 881) +++ trunk/varnish-cache/include/compat/strndup.h 2006-08-22 07:11:59 UTC (rev 882) @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_STRNDUP_H_INCLUDED +#define COMPAT_STRNDUP_H_INCLUDED + +#ifndef HAVE_STRNDUP +char *strndup(const char *str, size_t len); +#endif + +#endif Property changes on: trunk/varnish-cache/include/compat/strndup.h ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/lib/libcompat/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-21 20:42:47 UTC (rev 881) +++ trunk/varnish-cache/lib/libcompat/Makefile.am 2006-08-22 07:11:59 UTC (rev 882) @@ -11,6 +11,7 @@ srandomdev.c \ strlcat.c \ strlcpy.c \ + strndup.c \ vis.c libcompat_a_CFLAGS = -include config.h Added: trunk/varnish-cache/lib/libcompat/strndup.c =================================================================== --- trunk/varnish-cache/lib/libcompat/strndup.c 2006-08-21 20:42:47 UTC (rev 881) +++ trunk/varnish-cache/lib/libcompat/strndup.c 2006-08-22 07:11:59 UTC (rev 882) @@ -0,0 +1,24 @@ +/* + * $Id$ + * + */ + +#ifndef HAVE_STRNDUP + +#include +#include + +#include "compat/strndup.h" + +char * +strndup(const char *str, size_t len) +{ + char *dup; + + /* wasteful if len is large and str is short */ + if ((dup = calloc(len + 1, 1)) != NULL) + strncpy(dup, str, len); + return (dup); +} + +#endif Property changes on: trunk/varnish-cache/lib/libcompat/strndup.c ___________________________________________________________________ Name: svn:keywords + Id From des at projects.linpro.no Tue Aug 22 07:24:08 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 22 Aug 2006 09:24:08 +0200 (CEST) Subject: r883 - trunk/varnish-cache/bin/varnishd Message-ID: <20060822072408.1BF931EC932@projects.linpro.no> Author: des Date: 2006-08-22 09:24:07 +0200 (Tue, 22 Aug 2006) New Revision: 883 Modified: trunk/varnish-cache/bin/varnishd/Makefile.am Log: Add cache_acceptor.h to noinst_HEADERS. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-22 07:11:59 UTC (rev 882) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-22 07:24:07 UTC (rev 883) @@ -45,6 +45,7 @@ noinst_HEADERS = \ cache.h \ + cache_acceptor.h \ common.h \ hash_slinger.h \ heritage.h \ From phk at phk.freebsd.dk Tue Aug 22 07:33:52 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Tue, 22 Aug 2006 07:33:52 +0000 Subject: r872 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Tue, 22 Aug 2006 08:59:23 +0200." Message-ID: <39712.1156232032@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >"Poul-Henning Kamp" writes: >> So how do I say "ANY_IPV4:80" ? > >0:80 As far as I know that is not portable. The value of IF_ADDR_ANY is not a universal zero constant but implementation dependent. But if you add -p back I can live with it. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From phk at projects.linpro.no Tue Aug 22 07:52:33 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 22 Aug 2006 09:52:33 +0200 (CEST) Subject: r884 - trunk/varnish-cache/bin/varnishd Message-ID: <20060822075233.9E4541EC97E@projects.linpro.no> Author: phk Date: 2006-08-22 09:52:33 +0200 (Tue, 22 Aug 2006) New Revision: 884 Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c Log: Rework the classic hasher to reduce lock contention and CPU usage. Make nbuckets=nhash mandatory. Order hash lists by the length of key instead of the key contents, comparing the length is much faster. Also compare disgest before we take the expensive content compare. Use memcmp() for content compare instead of strcmp(). Use a two-pass algorithm for inserts to lower mutex contention. Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-22 07:24:07 UTC (rev 883) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-22 07:52:33 UTC (rev 884) @@ -11,6 +11,7 @@ #include #include +#include #include #if defined(HASH_CLASSIC_MD5) && !defined(HAVE_MD5) @@ -28,20 +29,24 @@ unsigned magic; #define HCL_ENTRY_MAGIC 0x0ba707bf TAILQ_ENTRY(hcl_entry) list; - char *key1; - char *key2; + struct hcl_hd *head; + char *key; + unsigned klen; struct objhead *oh; unsigned refcnt; + unsigned digest; unsigned hash; - unsigned mtx; }; -TAILQ_HEAD(hcl_head, hcl_entry); +struct hcl_hd { + unsigned magic; +#define HCL_HEAD_MAGIC 0x0f327016 + TAILQ_HEAD(, hcl_entry) head; + pthread_mutex_t mtx; +}; -static struct hcl_head *hcl_head; -static unsigned hcl_nhash = 4096; -static unsigned hcl_nmtx = 4096; -static pthread_mutex_t *hcl_mutex; +static unsigned hcl_nhash = 4096; +static struct hcl_hd *hcl_head; /*--------------------------------------------------------------------*/ @@ -118,30 +123,13 @@ hcl_init(const char *p) { int i; - unsigned u1, u2; + unsigned u; - i = sscanf(p, "%u,%u", &u1, &u2); - if (i <= 0) + i = sscanf(p, "%u", &u); + if (i <= 0 || u == 0) return (0); - if (u1 == 0 || (i == 2 && (u2 == 0 || u2 > u1))) { - fprintf(stderr, "Invallid parameters to hash \"classic\":\n"); - fprintf(stderr, - "\t-h classic,[,]\n"); - return (1); - } - hcl_nhash = u1; - if (i == 1) { - hcl_nmtx = hcl_nhash; - if (hcl_nmtx < 1) - hcl_nmtx = 1; - return(0); - } else { - hcl_nmtx = hcl_nhash / u2; - if (hcl_nmtx < 1) - hcl_nmtx = 1; - } - fprintf(stderr, "Classic hash: %u buckets %u mutexes\n", - hcl_nhash, hcl_nmtx); + hcl_nhash = u; + fprintf(stderr, "Classic hash: %u buckets\n", hcl_nhash); return (0); } @@ -157,15 +145,12 @@ hcl_head = calloc(sizeof *hcl_head, hcl_nhash); assert(hcl_head != NULL); - hcl_mutex = calloc(sizeof *hcl_mutex, hcl_nmtx); - assert(hcl_mutex != NULL); - - for (u = 0; u < hcl_nhash; u++) - TAILQ_INIT(&hcl_head[u]); - - for (u = 0; u < hcl_nmtx; u++) - AZ(pthread_mutex_init(&hcl_mutex[u], NULL)); + for (u = 0; u < hcl_nhash; u++) { + TAILQ_INIT(&hcl_head[u].head); + AZ(pthread_mutex_init(&hcl_head[u].mtx, NULL)); + hcl_head[u].magic = HCL_HEAD_MAGIC; + } } /*-------------------------------------------------------------------- @@ -173,13 +158,16 @@ * If nobj != NULL and the lookup does not find key, nobj is inserted. * If nobj == NULL and the lookup does not find key, NULL is returned. * A reference to the returned object is held. + * We use a two-pass algorithm to handle inserts as they are quite + * rare and collisions even rarer. */ static struct objhead * hcl_lookup(const char *key1, const char *key2, struct objhead *noh) { struct hcl_entry *he, *he2; - unsigned u1, u2; + struct hcl_hd *hp; + unsigned u1, digest, kl1, kl2, kl, r; int i; #ifdef HASH_CLASSIC_MD5 MD5_CTX c; @@ -194,60 +182,72 @@ MD5Update(&c, "", 1); MD5Update(&c, key2, strlen(key2)); MD5Final(md5, &c); - memcpy(&u1, md5, sizeof u1); - memcpy(&u2, md5 + sizeof u1, sizeof u2); + memcpy(&digest, md5, sizeof digest); #else - u1 = u2 = crc32(key1, key2); + digest = crc32(key1, key2); #endif - u1 %= hcl_nhash; - u2 %= hcl_nmtx; + u1 = digest % hcl_nhash; + hp = &hcl_head[u1]; + kl1 = strlen(key1) + 1; /* Incl '/0' */ + kl2 = strlen(key2); + kl = kl1 + kl2; + he2 = NULL; - AZ(pthread_mutex_lock(&hcl_mutex[u2])); - TAILQ_FOREACH(he, &hcl_head[u1], list) { - CHECK_OBJ_NOTNULL(he, HCL_ENTRY_MAGIC); - i = strcmp(key1, he->key1); - if (i < 0) - continue; - if (i > 0) - break; - i = strcmp(key2, he->key2); - if (i < 0) - continue; - if (i > 0) - break; - he->refcnt++; - noh = he->oh; - noh->hashpriv = he; - AZ(pthread_mutex_unlock(&hcl_mutex[u2])); - return (noh); - } - if (noh == NULL) { - AZ(pthread_mutex_unlock(&hcl_mutex[u2])); - return (NULL); - } - i = sizeof *he2 + strlen(key1) + 1 + strlen(key2) + 1; - he2 = calloc(i, 1); - assert(he2 != NULL); - he2->magic = HCL_ENTRY_MAGIC; - he2->oh = noh; - he2->refcnt = 1; - he2->hash = u1; - he2->mtx = u2; + for (r = 0; r < 2; r++ ) { + AZ(pthread_mutex_lock(&hp->mtx)); + TAILQ_FOREACH(he, &hp->head, list) { + CHECK_OBJ_NOTNULL(he, HCL_ENTRY_MAGIC); + if (kl < he->klen) + continue; + if (kl > he->klen) + break; + if (he->digest != digest) + continue; + if (memcmp(he->key, key1, kl1)) + continue; + if (memcmp(he->key + kl1, key2, kl2)) + continue; + he->refcnt++; + noh = he->oh; + AZ(pthread_mutex_unlock(&hp->mtx)); + if (he2 != NULL) + free(he2); + return (noh); + } + if (noh == NULL) { + AZ(pthread_mutex_unlock(&hp->mtx)); + return (NULL); + } + if (he2 != NULL) { + if (he != NULL) + TAILQ_INSERT_BEFORE(he, he2, list); + else + TAILQ_INSERT_TAIL(&hp->head, he2, list); + he2->refcnt++; + noh = he2->oh; + AZ(pthread_mutex_unlock(&hp->mtx)); + return (noh); + } + AZ(pthread_mutex_unlock(&hp->mtx)); - he2->key1 = (void*)(he2 + 1); - strcpy(he2->key1, key1); - he2->key2 = strchr(he2->key1, '\0'); - he2->key2++; - strcpy(he2->key2, key2); + i = sizeof *he2 + kl; + he2 = calloc(i, 1); + assert(he2 != NULL); + he2->magic = HCL_ENTRY_MAGIC; + he2->oh = noh; + he2->digest = digest; + he2->hash = u1; + he2->head = hp; + he2->klen = kl; + noh->hashpriv = he2; - noh->hashpriv = he2; - if (he != NULL) - TAILQ_INSERT_BEFORE(he, he2, list); - else - TAILQ_INSERT_TAIL(&hcl_head[u1], he2, list); - AZ(pthread_mutex_unlock(&hcl_mutex[u2])); - return (noh); + he2->key = (void*)(he2 + 1); + memcpy(he2->key, key1, kl1); + memcpy(he2->key + kl1, key2, kl2); + } + assert(he2 == NULL); /* FlexeLint */ + INCOMPL(); } /*-------------------------------------------------------------------- @@ -258,20 +258,21 @@ hcl_deref(struct objhead *oh) { struct hcl_entry *he; - unsigned mtx; + struct hcl_hd *hp; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); CAST_OBJ_NOTNULL(he, oh->hashpriv, HCL_ENTRY_MAGIC); + hp = he->head; + CHECK_OBJ_NOTNULL(hp, HCL_HEAD_MAGIC); assert(he->refcnt > 0); - assert(he->mtx < hcl_nmtx); assert(he->hash < hcl_nhash); - mtx = he->mtx; - AZ(pthread_mutex_lock(&hcl_mutex[mtx])); + assert(hp == &hcl_head[he->hash]); + AZ(pthread_mutex_lock(&hp->mtx)); if (--he->refcnt == 0) - TAILQ_REMOVE(&hcl_head[he->hash], he, list); + TAILQ_REMOVE(&hp->head, he, list); else he = NULL; - AZ(pthread_mutex_unlock(&hcl_mutex[mtx])); + AZ(pthread_mutex_unlock(&hp->mtx)); if (he == NULL) return (1); free(he); From des at linpro.no Tue Aug 22 07:58:08 2006 From: des at linpro.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) Date: Tue, 22 Aug 2006 09:58:08 +0200 Subject: r872 - trunk/varnish-cache/bin/varnishd In-Reply-To: <39712.1156232032@critter.freebsd.dk> (Poul-Henning Kamp's message of "Tue, 22 Aug 2006 07:33:52 +0000") References: <39712.1156232032@critter.freebsd.dk> Message-ID: "Poul-Henning Kamp" writes: > As far as I know that is not portable. The value of IF_ADDR_ANY is > not a universal zero constant but implementation dependent. Show me a platform where it isn't... If you prefer, I can change TCP_parse() to accept :80 instead. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From phk at projects.linpro.no Tue Aug 22 08:06:46 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 22 Aug 2006 10:06:46 +0200 (CEST) Subject: r885 - trunk/varnish-cache/bin/varnishd Message-ID: <20060822080646.7F7AE1EC978@projects.linpro.no> Author: phk Date: 2006-08-22 10:06:46 +0200 (Tue, 22 Aug 2006) New Revision: 885 Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c Log: Additional marginal improvement: Sort on length of key, then on digest. Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-22 07:52:33 UTC (rev 884) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-22 08:06:46 UTC (rev 885) @@ -202,8 +202,10 @@ continue; if (kl > he->klen) break; - if (he->digest != digest) + if (he->digest < digest) continue; + if (he->digest > digest) + break; if (memcmp(he->key, key1, kl1)) continue; if (memcmp(he->key + kl1, key2, kl2)) From phk at phk.freebsd.dk Tue Aug 22 08:14:54 2006 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Tue, 22 Aug 2006 08:14:54 +0000 Subject: r872 - trunk/varnish-cache/bin/varnishd In-Reply-To: Your message of "Tue, 22 Aug 2006 09:58:08 +0200." Message-ID: <54375.1156234494@critter.freebsd.dk> In message , Dag-Erling =?iso-8859-1?Q?Sm=F8rgra v?= writes: >"Poul-Henning Kamp" writes: >> As far as I know that is not portable. The value of IF_ADDR_ANY is >> not a universal zero constant but implementation dependent. > >Show me a platform where it isn't... > >If you prefer, I can change TCP_parse() to accept :80 instead. That would make much more sense to me. But I still would like the intuitive -p argument as an alternative. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From des at projects.linpro.no Tue Aug 22 08:17:54 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 22 Aug 2006 10:17:54 +0200 (CEST) Subject: r886 - trunk/varnish-cache/bin/varnishd Message-ID: <20060822081754.9BC661EC982@projects.linpro.no> Author: des Date: 2006-08-22 10:17:54 +0200 (Tue, 22 Aug 2006) New Revision: 886 Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/tcp.c Log: Allow an empty address if a port is specified; thus ":80" is a valid listening address ("port 80 on all interfaces") Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-22 08:06:46 UTC (rev 885) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-22 08:17:54 UTC (rev 886) @@ -136,7 +136,7 @@ * XXX: a bug for a backend to not reply at that time, so then * XXX: again: we should check it here in the "trivial" case. */ - if (TCP_parse(b_arg, &addr, &port) != 0) { + if (TCP_parse(b_arg, &addr, &port) != 0 || addr == NULL) { fprintf(stderr, "invalid backend address\n"); return (1); } Modified: trunk/varnish-cache/bin/varnishd/tcp.c =================================================================== --- trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-22 08:06:46 UTC (rev 885) +++ trunk/varnish-cache/bin/varnishd/tcp.c 2006-08-22 08:17:54 UTC (rev 886) @@ -101,9 +101,8 @@ if (p == NULL) { *addr = strdup(str); } else { - if (p == str) - return (-1); - *addr = strndup(str, p - str); + if (p > str) + *addr = strndup(str, p - str); *port = strdup(p + 1); } } From des at projects.linpro.no Tue Aug 22 08:18:16 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 22 Aug 2006 10:18:16 +0200 (CEST) Subject: r887 - in trunk/varnish-cache: bin/varnishd bin/varnishstat bin/varnishtester bin/varnishtop include lib/libvarnish lib/libvarnishapi Message-ID: <20060822081816.3FD9C1EC983@projects.linpro.no> Author: des Date: 2006-08-22 10:18:15 +0200 (Tue, 22 Aug 2006) New Revision: 887 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.h trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c trunk/varnish-cache/bin/varnishd/mgt_event.h trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/bin/varnishstat/varnishstat.c trunk/varnish-cache/bin/varnishtester/varnishtester.c trunk/varnish-cache/bin/varnishtop/varnishtop.c trunk/varnish-cache/include/vcl_returns.h trunk/varnish-cache/include/vrt_obj.h trunk/varnish-cache/lib/libvarnish/assert.c trunk/varnish-cache/lib/libvarnish/cli_common.c trunk/varnish-cache/lib/libvarnishapi/shmlog.c Log: Expand keywords. Property changes on: trunk/varnish-cache/bin/varnishd/cache_acceptor.h ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c 2006-08-22 08:17:54 UTC (rev 886) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c 2006-08-22 08:18:15 UTC (rev 887) @@ -1,5 +1,5 @@ /* - * $Id: cache_acceptor.c 860 2006-08-21 09:49:43Z phk $ + * $Id$ * * XXX: We need to pass sessions back into the event engine when they are * reused. Not sure what the most efficient way is for that. For now Property changes on: trunk/varnish-cache/bin/varnishd/cache_acceptor_epoll.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-22 08:17:54 UTC (rev 886) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-22 08:18:15 UTC (rev 887) @@ -1,5 +1,5 @@ /* - * $Id: cache_acceptor.c 860 2006-08-21 09:49:43Z phk $ + * $Id$ * * XXX: We need to pass sessions back into the event engine when they are * reused. Not sure what the most efficient way is for that. For now Property changes on: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2006-08-22 08:17:54 UTC (rev 886) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2006-08-22 08:18:15 UTC (rev 887) @@ -1,5 +1,5 @@ /* - * $Id: cache_acceptor.c 860 2006-08-21 09:49:43Z phk $ + * $Id$ * * XXX: We need to pass sessions back into the event engine when they are * reused. Not sure what the most efficient way is for that. For now Property changes on: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/mgt_event.h ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/mgt_param.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.c =================================================================== --- trunk/varnish-cache/bin/varnishstat/varnishstat.c 2006-08-22 08:17:54 UTC (rev 886) +++ trunk/varnish-cache/bin/varnishstat/varnishstat.c 2006-08-22 08:18:15 UTC (rev 887) @@ -1,5 +1,5 @@ /* - * $Id: varnishlog.c 153 2006-04-25 08:17:43Z phk $ + * $Id$ * * Log tailer for Varnish */ Property changes on: trunk/varnish-cache/bin/varnishstat/varnishstat.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtester/varnishtester.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-22 08:17:54 UTC (rev 886) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.c 2006-08-22 08:18:15 UTC (rev 887) @@ -1,5 +1,5 @@ /* - * $Id: varnishlog.c 412 2006-07-10 20:27:52Z phk $ + * $Id$ * * Log tailer for Varnish */ Property changes on: trunk/varnish-cache/bin/varnishtop/varnishtop.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/include/vcl_returns.h =================================================================== --- trunk/varnish-cache/include/vcl_returns.h 2006-08-22 08:17:54 UTC (rev 886) +++ trunk/varnish-cache/include/vcl_returns.h 2006-08-22 08:18:15 UTC (rev 887) @@ -1,5 +1,5 @@ /* - * $Id: /mirror/varnish/trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 30751 2006-08-04T10:54:30.556113Z phk $ + * $Id$ * * NB: This file is machine generated, DO NOT EDIT! * Property changes on: trunk/varnish-cache/include/vcl_returns.h ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/include/vrt_obj.h =================================================================== --- trunk/varnish-cache/include/vrt_obj.h 2006-08-22 08:17:54 UTC (rev 886) +++ trunk/varnish-cache/include/vrt_obj.h 2006-08-22 08:18:15 UTC (rev 887) @@ -1,5 +1,5 @@ /* - * $Id: /mirror/varnish/trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 30980 2006-08-09T11:24:39.011200Z des $ + * $Id$ * * NB: This file is machine generated, DO NOT EDIT! * Property changes on: trunk/varnish-cache/include/vrt_obj.h ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvarnish/assert.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-22 08:17:54 UTC (rev 886) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-22 08:18:15 UTC (rev 887) @@ -1,5 +1,5 @@ /* - * $Id: cli_event.c 466 2006-07-12 23:30:49Z phk $ + * $Id$ */ #include Property changes on: trunk/varnish-cache/lib/libvarnish/cli_common.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-22 08:17:54 UTC (rev 886) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-08-22 08:18:15 UTC (rev 887) @@ -1,5 +1,5 @@ /* - * $Id: varnishlog.c 153 2006-04-25 08:17:43Z phk $ + * $Id$ */ #include Property changes on: trunk/varnish-cache/lib/libvarnishapi/shmlog.c ___________________________________________________________________ Name: svn:keywords + Id From phk at projects.linpro.no Tue Aug 22 08:55:15 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 22 Aug 2006 10:55:15 +0200 (CEST) Subject: r888 - trunk/varnish-cache/bin/varnishd Message-ID: <20060822085515.C0B9B1EC983@projects.linpro.no> Author: phk Date: 2006-08-22 10:55:15 +0200 (Tue, 22 Aug 2006) New Revision: 888 Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c Log: Eliminate the MD5 optional code. There is no sufficiently strong statistical basis for using MD5 that will outweigh the performance penalty or "IT USES THE BR0K3N MD5 ALGORITM" cries on slashdot. The only known artifact in CRC32 is that hashing it with a power of two is slightly inefficient (a few percent in bucket length standard deviation) if you have URLs with fixed width fields of a limited charset (such as numeric) fields in them. Avoid this by checking the hash width specified for power of two, and reduce it by one telling the user why. Using a hash width that is a prime number does provable advantage over just not using power-of-two width. I have heard a mathematician say that this is inherent in the design of the polynomia chosen for CRC algorithms error (optimized for bit error detection) but the actual math is way beyond me. Increase default hash width to 16383, which is probably still smaller than it should be. Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-22 08:18:15 UTC (rev 887) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-22 08:55:15 UTC (rev 888) @@ -14,15 +14,6 @@ #include #include -#if defined(HASH_CLASSIC_MD5) && !defined(HAVE_MD5) -/* MD5 is not available */ -#undef HASH_CLASSIC_MD5 -#endif - -#ifdef HASH_CLASSIC_MD5 -#include -#endif - /*--------------------------------------------------------------------*/ struct hcl_entry { @@ -45,12 +36,11 @@ pthread_mutex_t mtx; }; -static unsigned hcl_nhash = 4096; +static unsigned hcl_nhash = 16383; static struct hcl_hd *hcl_head; /*--------------------------------------------------------------------*/ -#ifndef HASH_CLASSIC_MD5 static uint32_t crc32bits[] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, @@ -113,7 +103,6 @@ return (crc ^ ~0U); } -#endif /* HASH_CLASSIC_MD5 */ /*-------------------------------------------------------------------- * The ->init method allows the management process to pass arguments @@ -128,6 +117,15 @@ i = sscanf(p, "%u", &u); if (i <= 0 || u == 0) return (0); + if (u > 2 && !(u & (u - 1))) { + fprintf(stderr, + "NOTE:\n" + "\tA power of two number of hash buckets is " + "marginally less efficient\n" + "\twith systematic URLs. Reducing by one" + " hash bucket.\n"); + u--; + } hcl_nhash = u; fprintf(stderr, "Classic hash: %u buckets\n", hcl_nhash); return (0); @@ -169,23 +167,10 @@ struct hcl_hd *hp; unsigned u1, digest, kl1, kl2, kl, r; int i; -#ifdef HASH_CLASSIC_MD5 - MD5_CTX c; - unsigned char md5[MD5_DIGEST_LENGTH]; -#endif CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC); -#ifdef HASH_CLASSIC_MD5 - MD5Init(&c); - MD5Update(&c, key1, strlen(key1)); - MD5Update(&c, "", 1); - MD5Update(&c, key2, strlen(key2)); - MD5Final(md5, &c); - memcpy(&digest, md5, sizeof digest); -#else digest = crc32(key1, key2); -#endif u1 = digest % hcl_nhash; hp = &hcl_head[u1]; From phk at projects.linpro.no Tue Aug 22 09:16:33 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 22 Aug 2006 11:16:33 +0200 (CEST) Subject: r889 - trunk/varnish-cache/bin/varnishhist Message-ID: <20060822091633.993EA1EC985@projects.linpro.no> Author: phk Date: 2006-08-22 11:16:33 +0200 (Tue, 22 Aug 2006) New Revision: 889 Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c Log: Use different marks for hit & miss Autoscale vertical axis. Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-22 08:55:15 UTC (rev 888) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-22 09:16:33 UTC (rev 889) @@ -22,11 +22,14 @@ #define HIST_LOW -50 #define HIST_HIGH 25 #define HIST_W (1 + (HIST_HIGH - HIST_LOW)) -#define HIST_N 10000 +#define HIST_N 2000 -static unsigned char rr_hist[HIST_N]; +static char rr_hist[HIST_N]; static unsigned next_hist; -static unsigned bucket_hist[HIST_W]; +static unsigned bucket_miss[HIST_W]; +static unsigned bucket_hit[HIST_W]; +static unsigned char hh[65536]; +static double scale = 10; static double c_hist; static void @@ -43,22 +46,32 @@ tl = t; m = 0; r = 0; - for (x = 0; x < HIST_W; x++) { - if (bucket_hist[x] > m) - m = bucket_hist[x]; - r += bucket_hist[x]; + for (x = 1; x < HIST_W; x++) { + if (bucket_hit[x] + bucket_miss[x] > m) + m = bucket_hit[x] + bucket_miss[x]; + r += bucket_hit[x]; + r += bucket_miss[x]; } - mvprintw(0, 0, "Max %.0f Scale %u Tot: %.0f", m, HIST_N, r); - m = HIST_N / (LINES - 3); + while (m > HIST_N / scale) + scale--; + + mvprintw(0, 0, "Max %.0f Scale %.0f Tot: %.0f", m, HIST_N / scale, r); + m = (HIST_N / scale) / (LINES - 3); move(1,0); for (y = LINES - 3; y > 0; y--) { if (y == 1) r = 0; else r = y * m; - for (x = 0; x < HIST_W; x++) - addch(bucket_hist[x] > r ? '#' : ' '); + for (x = 0; x < HIST_W; x++) { + if (bucket_miss[x] > r) + addch('|'); + else if (bucket_hit[x] + bucket_miss[x] > r) + addch('#'); + else + addch(' '); + } addch('\n'); } refresh(); @@ -68,15 +81,19 @@ h_hist(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) { double b; - int i; + int i, j; (void)priv; (void)fd; (void)len; (void)spec; + if (tag == SLT_Hit) { + hh[fd] = 1; + return (0); + } if (tag != SLT_ReqEnd) return (0); -#if 0 +#if 1 i = sscanf(ptr, "%*d %*f %*f %*f %lf", &b); #else i = sscanf(ptr, "%*d %*f %*f %lf", &b); @@ -88,14 +105,30 @@ if (i > HIST_HIGH) i = HIST_HIGH; i -= HIST_LOW; - bucket_hist[rr_hist[next_hist]]--; - rr_hist[next_hist] = i; - bucket_hist[rr_hist[next_hist]]++; + assert(i < HIST_W); + + j = rr_hist[next_hist]; + if (j < 0) { + assert(bucket_miss[-j] > 0); + bucket_miss[-j]--; + } else { + assert(bucket_hit[j] > 0); + bucket_hit[j]--; + } + + if (hh[fd] || i == 0) { + bucket_hit[i]++; + rr_hist[next_hist] = i; + } else { + bucket_miss[i]++; + rr_hist[next_hist] = -i; + } if (++next_hist == HIST_N) { next_hist = 0; } if (!(next_hist % 100)) r_hist(); + hh[fd] = 0; return (0); } @@ -133,7 +166,7 @@ initscr(); erase(); - bucket_hist[0] = HIST_N; + bucket_hit[0] = HIST_N; move(LINES - 2, 0); for (x = 0; x < HIST_W; x++) addch('-'); From phk at projects.linpro.no Tue Aug 22 09:30:23 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 22 Aug 2006 11:30:23 +0200 (CEST) Subject: r890 - trunk/varnish-cache/bin/varnishhist Message-ID: <20060822093023.2893D1EC984@projects.linpro.no> Author: phk Date: 2006-08-22 11:30:23 +0200 (Tue, 22 Aug 2006) New Revision: 890 Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c Log: Swap the '|' and '#' symbols so '#' means "miss", that's much more graphically useful. Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-22 09:16:33 UTC (rev 889) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-22 09:30:23 UTC (rev 890) @@ -66,9 +66,9 @@ r = y * m; for (x = 0; x < HIST_W; x++) { if (bucket_miss[x] > r) + addch('#'); + else if (bucket_hit[x] + bucket_miss[x] > r) addch('|'); - else if (bucket_hit[x] + bucket_miss[x] > r) - addch('#'); else addch(' '); } From des at projects.linpro.no Tue Aug 22 09:31:34 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 22 Aug 2006 11:31:34 +0200 (CEST) Subject: r891 - trunk/varnish-cache/lib/libcompat Message-ID: <20060822093134.B38941EC986@projects.linpro.no> Author: des Date: 2006-08-22 11:31:34 +0200 (Tue, 22 Aug 2006) New Revision: 891 Modified: trunk/varnish-cache/lib/libcompat/strndup.c Log: Slight optimization: use strlcpy() to avoid calloc(). Modified: trunk/varnish-cache/lib/libcompat/strndup.c =================================================================== --- trunk/varnish-cache/lib/libcompat/strndup.c 2006-08-22 09:30:23 UTC (rev 890) +++ trunk/varnish-cache/lib/libcompat/strndup.c 2006-08-22 09:31:34 UTC (rev 891) @@ -8,6 +8,10 @@ #include #include +#ifndef HAVE_STRLCPY +#include "compat/strlcpy.h" +#endif + #include "compat/strndup.h" char * @@ -16,8 +20,8 @@ char *dup; /* wasteful if len is large and str is short */ - if ((dup = calloc(len + 1, 1)) != NULL) - strncpy(dup, str, len); + if ((dup = malloc(len + 1)) != NULL) + strlcpy(dup, str, len + 1); return (dup); } From des at projects.linpro.no Tue Aug 22 09:37:58 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 22 Aug 2006 11:37:58 +0200 (CEST) Subject: r892 - trunk/varnish-cache/bin/varnishlog Message-ID: <20060822093758.D6FAE1EC987@projects.linpro.no> Author: des Date: 2006-08-22 11:37:58 +0200 (Tue, 22 Aug 2006) New Revision: 892 Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c Log: Correct the error check for write(). Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-22 09:31:34 UTC (rev 891) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2006-08-22 09:37:58 UTC (rev 892) @@ -193,8 +193,10 @@ break; if (i > 0) { i = write(fd, p, 5 + p[1]); - if (i != 1) + if (i < 0) { perror(w_opt); + exit(1); + } } } exit (0); From des at projects.linpro.no Tue Aug 22 10:14:39 2006 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 22 Aug 2006 12:14:39 +0200 (CEST) Subject: r893 - trunk/varnish-cache/bin/varnishhist Message-ID: <20060822101439.CAA8F1EC98A@projects.linpro.no> Author: des Date: 2006-08-22 12:14:39 +0200 (Tue, 22 Aug 2006) New Revision: 893 Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c Log: Allow the delay between screen updates to be specified with -w. Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-22 09:37:58 UTC (rev 892) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-22 10:14:39 UTC (rev 893) @@ -4,14 +4,15 @@ * Log tailer for Varnish */ +#include +#include +#include +#include +#include #include -#include +#include #include -#include #include -#include -#include -#include #include "compat/vis.h" @@ -24,6 +25,8 @@ #define HIST_W (1 + (HIST_HIGH - HIST_LOW)) #define HIST_N 2000 +static int delay = 1; +static volatile sig_atomic_t redraw; static char rr_hist[HIST_N]; static unsigned next_hist; static unsigned bucket_miss[HIST_W]; @@ -33,17 +36,19 @@ static double c_hist; static void +sigalrm(int sig) +{ + + (void)sig; + redraw = 1; +} + +static void r_hist(void) { int x, y; double m, r; - time_t t; - static time_t tl; - t = time(NULL); - if (t == tl) - return; - tl = t; m = 0; r = 0; for (x = 1; x < HIST_W; x++) { @@ -75,6 +80,8 @@ addch('\n'); } refresh(); + redraw = 0; + alarm(delay); } static int @@ -126,8 +133,6 @@ if (++next_hist == HIST_N) { next_hist = 0; } - if (!(next_hist % 100)) - r_hist(); hh[fd] = 0; return (0); } @@ -150,8 +155,11 @@ vd = VSL_New(); - while ((c = getopt(argc, argv, VSL_ARGS)) != -1) { + while ((c = getopt(argc, argv, VSL_ARGS "w:")) != -1) { switch (c) { + case 'w': + delay = atoi(optarg); + break; default: if (VSL_Arg(vd, c, optarg) > 0) break; @@ -178,11 +186,13 @@ mvprintw(LINES - 1, x, "|1e%d", (x + HIST_LOW) / 10); } + signal(SIGALRM, sigalrm); + redraw = 1; while (1) { i = VSL_Dispatch(vd, h_hist, NULL); if (i < 0) break; - if (i == 0) + if (redraw) r_hist(); } From phk at projects.linpro.no Tue Aug 22 10:40:56 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 22 Aug 2006 12:40:56 +0200 (CEST) Subject: r894 - trunk/varnish-cache/bin/varnishd Message-ID: <20060822104056.3FAE21EC982@projects.linpro.no> Author: phk Date: 2006-08-22 12:40:55 +0200 (Tue, 22 Aug 2006) New Revision: 894 Modified: trunk/varnish-cache/bin/varnishd/shmlog.c Log: Consistent naming of mutex Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-22 10:14:39 UTC (rev 893) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-22 10:40:55 UTC (rev 894) @@ -27,7 +27,7 @@ struct varnish_stats *VSL_stats; static struct shmloghead *loghead; static unsigned char *logstart; -static pthread_mutex_t vsl_mutex; +static pthread_mutex_t vsl_mtx; /* * This variant copies a byte-range directly to the log, without @@ -61,7 +61,7 @@ e = b + l; } - AZ(pthread_mutex_lock(&vsl_mutex)); + AZ(pthread_mutex_lock(&vsl_mtx)); assert(loghead->ptr < loghead->size); /* Wrap if necessary */ @@ -78,7 +78,7 @@ loghead->ptr += 5 + l; assert(loghead->ptr < loghead->size); - AZ(pthread_mutex_unlock(&vsl_mutex)); + AZ(pthread_mutex_unlock(&vsl_mtx)); } @@ -91,7 +91,7 @@ va_start(ap, fmt); - AZ(pthread_mutex_lock(&vsl_mutex)); + AZ(pthread_mutex_lock(&vsl_mtx)); assert(loghead->ptr < loghead->size); /* Wrap if we cannot fit a full size record */ @@ -115,7 +115,7 @@ loghead->ptr += 5 + n; assert(loghead->ptr < loghead->size); - AZ(pthread_mutex_unlock(&vsl_mutex)); + AZ(pthread_mutex_unlock(&vsl_mtx)); va_end(ap); } @@ -128,7 +128,7 @@ assert(loghead->hdrsize == sizeof *loghead); /* XXX more check sanity of loghead ? */ logstart = (unsigned char *)loghead + loghead->start; - AZ(pthread_mutex_init(&vsl_mutex, NULL)); + AZ(pthread_mutex_init(&vsl_mtx, NULL)); loghead->starttime = time(NULL); memset(VSL_stats, 0, sizeof *VSL_stats); } From phk at projects.linpro.no Tue Aug 22 10:46:16 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 22 Aug 2006 12:46:16 +0200 (CEST) Subject: r895 - trunk/varnish-cache/bin/varnishd Message-ID: <20060822104616.39DA81EC982@projects.linpro.no> Author: phk Date: 2006-08-22 12:46:16 +0200 (Tue, 22 Aug 2006) New Revision: 895 Modified: trunk/varnish-cache/bin/varnishd/shmlog.c Log: Optimize shmlog writing: If we know the record length, only hold the mutex while we reserve the space. Until we change the first byte, nothing bad can happen. XXX: a memory barrier is strictly speaking necessary before we assign the first byte. If there are no '%' in the format string, treat as fixed length for speed. Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-22 10:40:55 UTC (rev 894) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-22 10:46:16 UTC (rev 895) @@ -61,6 +61,7 @@ e = b + l; } + /* Only hold the lock while we find our space */ AZ(pthread_mutex_lock(&vsl_mtx)); assert(loghead->ptr < loghead->size); @@ -68,17 +69,18 @@ if (loghead->ptr + 5 + l + 1 > loghead->size) vsl_wrap(); p = logstart + loghead->ptr; + loghead->ptr += 5 + l; + p[5 + l] = SLT_ENDMARKER; + assert(loghead->ptr < loghead->size); + AZ(pthread_mutex_unlock(&vsl_mtx)); + p[1] = l & 0xff; p[2] = (id >> 8) & 0xff; p[3] = id & 0xff; memcpy(p + 4, b, l); p[4 + l] = '\0'; - p[5 + l] = SLT_ENDMARKER; + /* XXX: memory barrier */ p[0] = tag; - - loghead->ptr += 5 + l; - assert(loghead->ptr < loghead->size); - AZ(pthread_mutex_unlock(&vsl_mtx)); } @@ -91,6 +93,12 @@ va_start(ap, fmt); + p = strchr(fmt, '%'); + if (p == NULL) { + VSLR(tag, id, fmt, NULL); + return; + } + AZ(pthread_mutex_lock(&vsl_mtx)); assert(loghead->ptr < loghead->size); From phk at projects.linpro.no Tue Aug 22 10:56:11 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 22 Aug 2006 12:56:11 +0200 (CEST) Subject: r896 - trunk/varnish-cache/bin/varnishhist Message-ID: <20060822105611.36B3A1EC98C@projects.linpro.no> Author: phk Date: 2006-08-22 12:56:06 +0200 (Tue, 22 Aug 2006) New Revision: 896 Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c Log: Redraw must be checked when we update, we cannot trust that we will actually have a timeout. Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-22 10:46:16 UTC (rev 895) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2006-08-22 10:56:06 UTC (rev 896) @@ -134,6 +134,8 @@ next_hist = 0; } hh[fd] = 0; + if (redraw) + r_hist(); return (0); } @@ -192,8 +194,6 @@ i = VSL_Dispatch(vd, h_hist, NULL); if (i < 0) break; - if (redraw) - r_hist(); } return (0); From phk at projects.linpro.no Tue Aug 22 19:14:01 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 22 Aug 2006 21:14:01 +0200 (CEST) Subject: r897 - trunk/varnish-cache/bin/varnishd Message-ID: <20060822191401.57FF11EC97A@projects.linpro.no> Author: phk Date: 2006-08-22 21:14:01 +0200 (Tue, 22 Aug 2006) New Revision: 897 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: Implement "error" in vcl_hit() Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-22 10:56:06 UTC (rev 896) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-22 19:14:01 UTC (rev 897) @@ -323,8 +323,12 @@ return (0); } - if (sp->handling == VCL_RET_ERROR) - INCOMPL(); + if (sp->handling == VCL_RET_ERROR) { + HSH_Deref(sp->obj); + sp->obj = NULL; + sp->step = STP_ERROR; + return (0); + } if (sp->handling == VCL_RET_LOOKUP) INCOMPL(); From phk at projects.linpro.no Wed Aug 23 06:53:28 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 08:53:28 +0200 (CEST) Subject: r898 - trunk/varnish-cache/lib/libvarnish Message-ID: <20060823065328.B2F1A1EC990@projects.linpro.no> Author: phk Date: 2006-08-23 08:53:28 +0200 (Wed, 23 Aug 2006) New Revision: 898 Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c Log: If CLI is NULL, use stdout. Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-22 19:14:01 UTC (rev 897) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2006-08-23 06:53:28 UTC (rev 898) @@ -29,23 +29,30 @@ va_list ap; va_start(ap, fmt); - vsb_vprintf(cli->sb, fmt, ap); + if (cli != NULL) + vsb_vprintf(cli->sb, fmt, ap); + else + vfprintf(stdout, fmt, ap); va_end(ap); } void -cli_param(struct cli *cli) +cli_result(struct cli *cli, unsigned res) { - cli->result = CLIS_PARAM; - cli_out(cli, "Parameter error, use \"help [command]\" for more info.\n"); + if (cli != NULL) + cli->result = res; + else + printf("CLI result = %d\n", res); } + void -cli_result(struct cli *cli, unsigned res) +cli_param(struct cli *cli) { - cli->result = res; + cli_result(cli, CLIS_PARAM); + cli_out(cli, "Parameter error, use \"help [command]\" for more info.\n"); } int From phk at projects.linpro.no Wed Aug 23 06:55:18 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 08:55:18 +0200 (CEST) Subject: r899 - trunk/varnish-cache/bin/varnishd Message-ID: <20060823065518.D8BC11EC991@projects.linpro.no> Author: phk Date: 2006-08-23 08:55:18 +0200 (Wed, 23 Aug 2006) New Revision: 899 Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: Move defaults from varnishd.c to mgt_param.c and use regular functions for setting them. Collapse all the 'timeout' functions. Add pipe_timeout parameter. Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-23 06:53:28 UTC (rev 898) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-23 06:55:18 UTC (rev 899) @@ -12,6 +12,7 @@ #include #include "shmlog.h" +#include "heritage.h" #include "cache.h" static void @@ -83,7 +84,7 @@ while (fds[0].events || fds[1].events) { fds[0].revents = 0; fds[1].revents = 0; - i = poll(fds, 2, 600000); + i = poll(fds, 2, params->pipe_timeout * 1000); if (i != 1) break; if (fds[0].revents) Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-23 06:53:28 UTC (rev 898) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2006-08-23 06:55:18 UTC (rev 899) @@ -42,6 +42,7 @@ /* Acceptor hints */ unsigned sess_timeout; + unsigned pipe_timeout; unsigned send_timeout; /* Management hints */ Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-23 06:53:28 UTC (rev 898) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2006-08-23 06:55:18 UTC (rev 899) @@ -22,6 +22,9 @@ void mgt_cli_stop_child(void); int mgt_cli_telnet(const char *T_arg); +/* mgt_param.c */ +void MCF_ParamInit(void); + /* mgt_vcc.c */ void mgt_vcc_init(void); int mgt_vcc_default(const char *bflag, const char *fflag); Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-23 06:53:28 UTC (rev 898) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-23 06:55:18 UTC (rev 899) @@ -22,17 +22,41 @@ const char *name; tweak_t *func; const char *expl; + const char *def; }; /*--------------------------------------------------------------------*/ static void +tweak_generic_timeout(struct cli *cli, unsigned *dst, const char *arg) +{ + unsigned u; + + if (arg != NULL) { + u = strtoul(arg, NULL, 0); + if (u == 0) { + cli_out(cli, "Timeout must be greater than zero\n"); + cli_result(cli, CLIS_PARAM); + return; + } + *dst = u; + } + if (cli == NULL) + return; + cli_out(cli, "%u [seconds]\n", *dst); +} + +/*--------------------------------------------------------------------*/ + +static void tweak_default_ttl(struct cli *cli, struct parspec *par, const char *arg) { (void)par; if (arg != NULL) params->default_ttl = strtoul(arg, NULL, 0); + if (cli == NULL) + return; cli_out(cli, "%u [seconds]\n", params->default_ttl); } @@ -53,6 +77,8 @@ } params->wthread_min = u; } + if (cli == NULL) + return; cli_out(cli, "%u [threads]\n", params->wthread_min); } @@ -73,6 +99,8 @@ } params->wthread_max = u; } + if (cli == NULL) + return; if (params->wthread_max == UINT_MAX) cli_out(cli, "unlimited\n"); else @@ -84,20 +112,11 @@ static void tweak_thread_pool_timeout(struct cli *cli, struct parspec *par, const char *arg) { - unsigned u; (void)par; - if (arg != NULL) { - u = strtoul(arg, NULL, 0); - if (u == 0) { - cli_out(cli, "Timeout must be greater than zero\n"); - cli_result(cli, CLIS_PARAM); - return; - } - params->wthread_timeout = u; - } - cli_out(cli, "%u [seconds]\n", params->wthread_timeout); + tweak_generic_timeout(cli, ¶ms->wthread_timeout, arg); } + /*--------------------------------------------------------------------*/ static void @@ -115,6 +134,8 @@ } params->mem_workspace = u; } + if (cli == NULL) + return; cli_out(cli, "%u [bytes]\n", params->mem_workspace); } @@ -123,19 +144,17 @@ static void tweak_sess_timeout(struct cli *cli, struct parspec *par, const char *arg) { - unsigned u; + (void)par; + tweak_generic_timeout(cli, ¶ms->sess_timeout, arg); +} +/*--------------------------------------------------------------------*/ + +static void +tweak_pipe_timeout(struct cli *cli, struct parspec *par, const char *arg) +{ (void)par; - if (arg != NULL) { - u = strtoul(arg, NULL, 0); - if (u == 0) { - cli_out(cli, "Timeout must be greater than zero\n"); - cli_result(cli, CLIS_PARAM); - return; - } - params->sess_timeout = u; - } - cli_out(cli, "%u [seconds]\n", params->sess_timeout); + tweak_generic_timeout(cli, ¶ms->pipe_timeout, arg); } /*--------------------------------------------------------------------*/ @@ -143,19 +162,8 @@ static void tweak_send_timeout(struct cli *cli, struct parspec *par, const char *arg) { - unsigned u; - (void)par; - if (arg != NULL) { - u = strtoul(arg, NULL, 0); - if (u == 0) { - cli_out(cli, "Timeout must be greater than zero\n"); - cli_result(cli, CLIS_PARAM); - return; - } - params->send_timeout = u; - } - cli_out(cli, "%u [seconds]\n", params->send_timeout); + tweak_generic_timeout(cli, ¶ms->send_timeout, arg); } /*--------------------------------------------------------------------*/ @@ -175,6 +183,8 @@ } params->auto_restart = u; } + if (cli == NULL) + return; cli_out(cli, "%u {1 = yes, 0 = no}\n", params->auto_restart); } @@ -205,46 +215,48 @@ "made until they are fetched from the backend again.\n" "To force an immediate effect at the expense of a total " "flush of the cache use \"url.purge .\"\n" - "Default is 120 seconds. " }, + "Default is 120 seconds. ", "120" }, + { "thread_pool_max", tweak_thread_pool_max, + "The maximum number of threads in the worker pool.\n" + DELAYED_EFFECT + "Default is no limit.", "-1" }, { "thread_pool_min", tweak_thread_pool_min, "The minimum number of threads in the worker pool.\n" DELAYED_EFFECT "Default is 1 thread. " - "Minimum is 1 thread. " }, - { "thread_pool_max", tweak_thread_pool_max, - "The maximum number of threads in the worker pool.\n" - DELAYED_EFFECT - "Default is no limit." }, + "Minimum is 1 thread. ", "1" }, { "thread_pool_timeout", tweak_thread_pool_timeout, "Thread dies after this many seconds of inactivity.\n" "Default is 10 seconds. " - "Minimum is 1 second. " }, + "Minimum is 1 second. ", "10" }, { "http_workspace", tweak_http_workspace, "Bytes of HTTP protocol workspace allocated. " "This space must be big enough for the entire HTTP protocol " "header and any edits done to it in the VCL code.\n" SHOULD_RESTART "Default is 4096 bytes. " - "Minimum is 1024 bytes. " }, + "Minimum is 1024 bytes. ", "4096" }, { "sess_timeout", tweak_sess_timeout, "Idle timeout for persistent sessions. " "If a HTTP request has not been received in this many " "seconds, the session is closed.\n" -#ifdef HAVE_ACCEPT_FILTERS - DELAYED_EFFECT -#endif - "Default is 15 seconds. " }, + "Default is 5 seconds. ", "5" }, + { "pipe_timeout", tweak_pipe_timeout, + "Idle timeout for PIPE sessions. " + "If nothing have been received in either directoin for " + "this many seconds, the session is closed.\n" + "Default is 60 seconds. ", "60" }, { "send_timeout", tweak_send_timeout, "Send timeout for client connections. " "If no data has been sent to the client in this many seconds, " "the session is closed.\n" DELAYED_EFFECT "See getopt(3) under SO_SNDTIMEO for more information.\n" - "Default is 600 seconds. " }, + "Default is 600 seconds. ", "600" }, { "auto_restart", tweak_auto_restart, "Restart child process automatically if it dies. " "1 = yes, 0 = no.\n" - "Default is 1. " }, + "Default is 1. ", "1" }, { NULL, NULL, NULL } }; @@ -325,3 +337,13 @@ } } +/*--------------------------------------------------------------------*/ + +void +MCF_ParamInit(void) +{ + struct parspec *pp; + + for (pp = parspec; pp->name != NULL; pp++) + pp->func(NULL, pp, pp->def); +} Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-23 06:53:28 UTC (rev 898) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-23 06:55:18 UTC (rev 899) @@ -336,15 +336,7 @@ params = ¶m; mgt_vcc_init(); - /* XXX: move this to mgt_params.c ?? */ - params->default_ttl = 120; - params->wthread_min = 1; - params->wthread_max = UINT_MAX; - params->wthread_timeout = 60; - params->mem_workspace = 4096; - params->sess_timeout = 5; - params->send_timeout = 600; - params->auto_restart = 1; + MCF_ParamInit(); while ((o = getopt(argc, argv, "a:b:df:h:s:t:T:Vw:")) != -1) switch (o) { From phk at projects.linpro.no Wed Aug 23 07:16:03 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 09:16:03 +0200 (CEST) Subject: r900 - in trunk/varnish-cache: bin/varnishd include lib/libvcl Message-ID: <20060823071603.874821EC976@projects.linpro.no> Author: phk Date: 2006-08-23 09:16:03 +0200 (Wed, 23 Aug 2006) New Revision: 900 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_pipe.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/include/vrt.h trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Teach RES_Error() about the canonical response code texts from RFC2616. Add the XID as "guru meditation" in the error HTML. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-23 06:55:18 UTC (rev 899) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-23 07:16:03 UTC (rev 900) @@ -256,7 +256,6 @@ unsigned handling; unsigned char wantbody; int err_code; - const char *err_msg; const char *err_expl; TAILQ_ENTRY(sess) list; @@ -408,7 +407,7 @@ #endif /* cache_response.c */ -void RES_Error(struct sess *sp, int code, const char *msg, const char *expl); +void RES_Error(struct sess *sp, int code, const char *expl); void RES_WriteObj(struct sess *sp); /* cache_vcl.c */ Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-23 06:55:18 UTC (rev 899) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-23 07:16:03 UTC (rev 900) @@ -134,9 +134,8 @@ cnt_error(struct sess *sp) { - RES_Error(sp, sp->err_code, sp->err_msg, sp->err_expl); + RES_Error(sp, sp->err_code, sp->err_expl); sp->err_code = 0; - sp->err_msg = NULL; sp->err_expl = NULL; sp->step = STP_DONE; return (0); @@ -593,7 +592,7 @@ sp->wrk->acct.req++; done = http_DissectRequest(sp->http, sp->fd); if (done != 0) { - RES_Error(sp, done, NULL, NULL); + RES_Error(sp, done, NULL); sp->step = STP_DONE; return (0); } Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-23 06:55:18 UTC (rev 899) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-23 07:16:03 UTC (rev 900) @@ -54,6 +54,10 @@ w = sp->wrk; vc = VBE_GetFd(sp->backend, sp->xid); + if (vc == NULL) { + RES_Error(sp, 503, "Backend did not reply"); + return; + } assert(vc != NULL); VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name); vc->http->logtag = HTTP_Tx; Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-23 06:55:18 UTC (rev 899) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-23 07:16:03 UTC (rev 900) @@ -10,15 +10,73 @@ #include "shmlog.h" #include "cache.h" +/*--------------------------------------------------------------------*/ +/* List of canonical HTTP response code names from RFC2616 */ +static struct http_msg { + unsigned nbr; + const char *txt; +} http_msg[] = { + { 101, "Switching Protocols" }, + { 200, "OK" }, + { 201, "Created" }, + { 202, "Accepted" }, + { 203, "Non-Authoritative Information" }, + { 204, "No Content" }, + { 205, "Reset Content" }, + { 206, "Partial Content" }, + { 300, "Multiple Choices" }, + { 301, "Moved Permanently" }, + { 302, "Found" }, + { 303, "See Other" }, + { 304, "Not Modified" }, + { 305, "Use Proxy" }, + { 306, "(Unused)" }, + { 307, "Temporary Redirect" }, + { 400, "Bad Request" }, + { 401, "Unauthorized" }, + { 402, "Payment Required" }, + { 403, "Forbidden" }, + { 404, "Not Found" }, + { 405, "Method Not Allowed" }, + { 406, "Not Acceptable" }, + { 407, "Proxy Authentication Required" }, + { 408, "Request Timeout" }, + { 409, "Conflict" }, + { 410, "Gone" }, + { 411, "Length Required" }, + { 412, "Precondition Failed" }, + { 413, "Request Entity Too Large" }, + { 414, "Request-URI Too Long" }, + { 415, "Unsupported Media Type" }, + { 416, "Requested Range Not Satisfiable" }, + { 417, "Expectation Failed" }, + { 500, "Internal Server Error" }, + { 501, "Not Implemented" }, + { 502, "Bad Gateway" }, + { 503, "Service Unavailable" }, + { 504, "Gateway Timeout" }, + { 505, "HTTP Version Not Supported" }, + { 0, NULL } +}; + /*--------------------------------------------------------------------*/ void -RES_Error(struct sess *sp, int code, const char *msg, const char *expl) +RES_Error(struct sess *sp, int code, const char *expl) { char buf[40]; struct vsb *sb; + struct http_msg *mp; + const char *msg; + msg = "Unknown error"; + for (mp = http_msg; mp->nbr != 0 && mp->nbr <= code; mp++) + if (mp->nbr == code) { + msg = mp->txt; + break; + } + sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); assert(sb != NULL); assert(code >= 100 && code <= 999); @@ -56,6 +114,8 @@ " \r\n"); vsb_printf(sb, "

Error %03d %s

\r\n", code, msg); vsb_printf(sb, "

%s

\r\n", expl); + vsb_printf(sb, "

Guru Meditation:

\r\n", expl); + vsb_printf(sb, "

XID: %u

\r\n", sp->xid); vsb_cat(sb, " Varnish\r\n" " \r\n" Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-23 06:55:18 UTC (rev 899) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-23 07:16:03 UTC (rev 900) @@ -18,13 +18,12 @@ /*--------------------------------------------------------------------*/ void -VRT_error(struct sess *sp, unsigned code, const char *msg, const char *expl) +VRT_error(struct sess *sp, unsigned code, const char *expl) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - VSL(SLT_Debug, 0, "VCL_error(%u, %s, %s)", code, msg, expl); + VSL(SLT_Debug, 0, "VCL_error(%u, %s)", code, expl); sp->err_code = code; - sp->err_msg = msg; sp->err_expl = expl; } Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2006-08-23 06:55:18 UTC (rev 899) +++ trunk/varnish-cache/include/vrt.h 2006-08-23 07:16:03 UTC (rev 900) @@ -42,7 +42,7 @@ void VRT_count(struct sess *, unsigned); int VRT_rewrite(const char *, const char *); -void VRT_error(struct sess *, unsigned, const char *, const char *); +void VRT_error(struct sess *, unsigned, const char *); int VRT_switch_config(const char *); char *VRT_GetHdr(struct sess *, const char *); Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-23 06:55:18 UTC (rev 899) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-23 07:16:03 UTC (rev 900) @@ -732,13 +732,11 @@ else a = 0; Fc(tl, 1, "VRT_error(sp, %u", a); - for (i = 0; i < 2; ++i) { - if (tl->t->tok == CSTR) { - Fc(tl, 0, ", %.*s", PF(tl->t)); - vcc_NextToken(tl); - } else { - Fc(tl, 0, ", (const char *)0"); - } + if (tl->t->tok == CSTR) { + Fc(tl, 0, ", %.*s", PF(tl->t)); + vcc_NextToken(tl); + } else { + Fc(tl, 0, ", (const char *)0"); } Fc(tl, 0, ");\n"); Fc(tl, 1, "VRT_done(sp, VCL_RET_ERROR);\n"); Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2006-08-23 06:55:18 UTC (rev 899) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2006-08-23 07:16:03 UTC (rev 900) @@ -510,7 +510,7 @@ fputs("\n", f); fputs("void VRT_count(struct sess *, unsigned);\n", f); fputs("int VRT_rewrite(const char *, const char *);\n", f); - fputs("void VRT_error(struct sess *, unsigned, const char *, const char *);\n", f); + fputs("void VRT_error(struct sess *, unsigned, const char *);\n", f); fputs("int VRT_switch_config(const char *);\n", f); fputs("\n", f); fputs("char *VRT_GetHdr(struct sess *, const char *);\n", f); From phk at projects.linpro.no Wed Aug 23 07:22:28 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 09:22:28 +0200 (CEST) Subject: r901 - trunk/varnish-cache/bin/varnishd Message-ID: <20060823072228.7D0AC1EC977@projects.linpro.no> Author: phk Date: 2006-08-23 09:22:28 +0200 (Wed, 23 Aug 2006) New Revision: 901 Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c Log: grammar police. Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-23 07:16:03 UTC (rev 900) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-23 07:22:28 UTC (rev 901) @@ -55,7 +55,7 @@ vc = VBE_GetFd(sp->backend, sp->xid); if (vc == NULL) { - RES_Error(sp, 503, "Backend did not reply"); + RES_Error(sp, 503, "Backend did not respond."); return; } assert(vc != NULL); From phk at projects.linpro.no Wed Aug 23 07:29:29 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 09:29:29 +0200 (CEST) Subject: r902 - trunk/varnish-cache/bin/varnishd Message-ID: <20060823072929.129C31EC979@projects.linpro.no> Author: phk Date: 2006-08-23 09:29:28 +0200 (Wed, 23 Aug 2006) New Revision: 902 Modified: trunk/varnish-cache/bin/varnishd/cache_response.c Log: Fill shmem log with the reply Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-23 07:22:28 UTC (rev 901) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-23 07:29:28 UTC (rev 902) @@ -124,7 +124,10 @@ WRK_Reset(sp->wrk, &sp->fd); WRK_Write(sp->wrk, vsb_data(sb), vsb_len(sb)); WRK_Flush(sp->wrk); - vca_close_session(sp, msg); + VSL(SLT_TxResponse, sp->id, "%d", code); + VSL(SLT_TxProtocol, sp->id, "HTTP/1.1"); + VSL(SLT_TxStatus, sp->id, msg); + vca_close_session(sp, expl); vsb_delete(sb); } From phk at projects.linpro.no Wed Aug 23 07:30:42 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 09:30:42 +0200 (CEST) Subject: r903 - trunk/varnish-cache/bin/varnishd Message-ID: <20060823073042.900001EC996@projects.linpro.no> Author: phk Date: 2006-08-23 09:30:42 +0200 (Wed, 23 Aug 2006) New Revision: 903 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_pass.c Log: Handle backend connection error in pass mode with a 503 Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-23 07:29:28 UTC (rev 902) +++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-23 07:30:42 UTC (rev 903) @@ -368,7 +368,7 @@ #undef HTTPH /* cache_pass.c */ -void PassSession(struct sess *sp); +int PassSession(struct sess *sp); void PassBody(struct sess *sp); /* cache_pipe.c */ Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-23 07:29:28 UTC (rev 902) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-23 07:30:42 UTC (rev 903) @@ -492,9 +492,11 @@ { assert(sp->vbc == NULL); - PassSession(sp); - assert(sp->vbc != NULL); - sp->step = STP_PASSBODY; + if (!PassSession(sp)) { + assert(sp->vbc != NULL); + sp->step = STP_PASSBODY; + } else + sp->step = STP_DONE; return (0); } Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-23 07:29:28 UTC (rev 902) +++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-23 07:30:42 UTC (rev 903) @@ -187,7 +187,7 @@ /*--------------------------------------------------------------------*/ -void +int PassSession(struct sess *sp) { int i; @@ -199,6 +199,10 @@ w = sp->wrk; vc = VBE_GetFd(sp->backend, sp->xid); + if (vc == NULL) { + RES_Error(sp, 503, "Backend did not respond."); + return (1); + } assert(vc != NULL); VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name); @@ -218,4 +222,5 @@ assert(sp->vbc == NULL); sp->vbc = vc; + return (0); } From phk at projects.linpro.no Wed Aug 23 07:32:19 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 09:32:19 +0200 (CEST) Subject: r904 - trunk/varnish-cache/lib/libvcl Message-ID: <20060823073219.3556D1EC997@projects.linpro.no> Author: phk Date: 2006-08-23 09:32:19 +0200 (Wed, 23 Aug 2006) New Revision: 904 Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c Log: unused variable. Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-23 07:30:42 UTC (rev 903) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2006-08-23 07:32:19 UTC (rev 904) @@ -708,7 +708,6 @@ unsigned a; struct var *vp; struct token *at; - int i; at = tl->t; vcc_NextToken(tl); From phk at projects.linpro.no Wed Aug 23 11:27:54 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 13:27:54 +0200 (CEST) Subject: r905 - trunk/varnish-cache/bin/varnishd Message-ID: <20060823112754.E1AA31EC944@projects.linpro.no> Author: phk Date: 2006-08-23 13:27:54 +0200 (Wed, 23 Aug 2006) New Revision: 905 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: Implement error in miss also Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-23 07:32:19 UTC (rev 904) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-23 11:27:54 UTC (rev 905) @@ -450,8 +450,14 @@ { VCL_miss_method(sp); - if (sp->handling == VCL_RET_ERROR) - INCOMPL(); + if (sp->handling == VCL_RET_ERROR) { + sp->obj->cacheable = 0; + HSH_Unbusy(sp->obj); + HSH_Deref(sp->obj); + sp->obj = NULL; + sp->step = STP_ERROR; + return (0); + } if (sp->handling == VCL_RET_PASS) { sp->obj->cacheable = 0; HSH_Unbusy(sp->obj); From phk at projects.linpro.no Wed Aug 23 11:42:16 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 13:42:16 +0200 (CEST) Subject: r906 - trunk/varnish-cache/bin/varnishd Message-ID: <20060823114216.71D431EC977@projects.linpro.no> Author: phk Date: 2006-08-23 13:42:16 +0200 (Wed, 23 Aug 2006) New Revision: 906 Modified: trunk/varnish-cache/bin/varnishd/cache_response.c Log: Set response timestamp when we emit an error. Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-23 11:27:54 UTC (rev 905) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-23 11:42:16 UTC (rev 906) @@ -70,6 +70,10 @@ struct http_msg *mp; const char *msg; + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + + clock_gettime(CLOCK_REALTIME, &sp->t_resp); + msg = "Unknown error"; for (mp = http_msg; mp->nbr != 0 && mp->nbr <= code; mp++) if (mp->nbr == code) { From phk at projects.linpro.no Wed Aug 23 12:10:11 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 14:10:11 +0200 (CEST) Subject: r907 - trunk/varnish-cache/bin/varnishd Message-ID: <20060823121011.BC5C61EC999@projects.linpro.no> Author: phk Date: 2006-08-23 14:10:11 +0200 (Wed, 23 Aug 2006) New Revision: 907 Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c Log: don't service cached objects the last second of their lifetime. Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-23 11:42:16 UTC (rev 906) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-23 12:10:11 UTC (rev 907) @@ -107,7 +107,7 @@ /* ignore */ } else if (o->ttl == 0) { /* Object banned but not reaped yet */ - } else if (o->ttl < sp->t_req.tv_sec) { + } else if (o->ttl <= sp->t_req.tv_sec) { /* Object expired */ } else if (BAN_CheckObject(o, url)) { o->ttl = 0; From phk at projects.linpro.no Wed Aug 23 13:11:14 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 15:11:14 +0200 (CEST) Subject: r908 - trunk/varnish-cache/lib/libvarnishapi Message-ID: <20060823131114.3D2701EC995@projects.linpro.no> Author: phk Date: 2006-08-23 15:11:14 +0200 (Wed, 23 Aug 2006) New Revision: 908 Removed: trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c trunk/varnish-cache/lib/libvarnishapi/varnish_log.c trunk/varnish-cache/lib/libvarnishapi/varnish_util.c Log: These are not used. Deleted: trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c 2006-08-23 12:10:11 UTC (rev 907) +++ trunk/varnish-cache/lib/libvarnishapi/varnish_debug.c 2006-08-23 13:11:14 UTC (rev 908) @@ -1,25 +0,0 @@ -/* - * $Id$ - */ - -#include "config.h" - -#include - -#include -#include -#include - -#include - -void -varnish_panic(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - fprintf(stderr, fmt, ap); - va_end(ap); - signal(SIGABRT, SIG_DFL); - raise(SIGABRT); -} Deleted: trunk/varnish-cache/lib/libvarnishapi/varnish_log.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/varnish_log.c 2006-08-23 12:10:11 UTC (rev 907) +++ trunk/varnish-cache/lib/libvarnishapi/varnish_log.c 2006-08-23 13:11:14 UTC (rev 908) @@ -1,293 +0,0 @@ -/* - * $Id$ - */ - -#include "config.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#define VLO_MAGIC 0x564c4f00 - -typedef struct vlo_control vlo_control_t; - -/* should this be part of the exported API? */ -struct vlo_control { - uint32_t magic; -#if 0 - uuid_t uuid; -#endif - uint32_t size; - uint32_t head; - uint32_t tail; -}; - -struct vlo_buffer { - int mode; - int cfd; - vlo_control_t *ctl; - int bfd; - unsigned char *buf; - uint32_t rpos; -}; - -/* - * Open a log file for writing; create it if necessary. If the control - * file already exists, try to preserve its state, in case someone is - * already listening. - */ -vlo_buffer_t * -vlo_open(const char *name, size_t size, int perm) -{ - char ctlname[PATH_MAX]; - vlo_buffer_t *vb; - int page_size; - int i, serr; - - page_size = getpagesize(); - - V_ASSERT(size > 0); - V_ASSERT(size % page_size == 0); - - if (snprintf(ctlname, sizeof ctlname, "%s.ctl", name) >= sizeof ctlname) { - errno = ENAMETOOLONG; - return (NULL); - } - if ((vb = malloc(sizeof *vb)) == NULL) - goto out; - vb->mode = O_RDWR; - vb->cfd = -1; - vb->ctl = NULL; - vb->bfd = -1; - vb->buf = NULL; - vb->rpos = 0; - - /* open, lock and mmap the control file */ - if ((vb->cfd = vut_open_lock(ctlname, O_RDWR|O_CREAT, - LOCK_EX|LOCK_NB, perm)) == -1 || - ftruncate(vb->cfd, page_size) == -1 || - (vb->ctl = mmap(NULL, page_size, PROT_READ|PROT_WRITE, - MAP_SHARED, vb->cfd, 0)) == NULL || - mlock(vb->ctl, page_size) == -1) - goto out; - - /* open, lock and mmap the buffer file */ - if ((vb->bfd = open(name, O_RDWR|O_CREAT, perm)) == -1 || - flock(vb->bfd, LOCK_EX) == -1 || - ftruncate(vb->bfd, size) == -1 || - (vb->buf = mmap(NULL, size, PROT_READ|PROT_WRITE, - MAP_SHARED, vb->bfd, 0)) == NULL || - mlock(vb->ctl, size) == -1) - goto out; - - /* initialize control structures */ - if (vb->ctl->magic != VLO_MAGIC || - vb->ctl->size != size || - vb->ctl->head >= size || - vb->ctl->tail >= size) { - vb->ctl->magic = VLO_MAGIC; -#if 0 - vb->ctl->uuid = /* XXX */; -#endif - vb->ctl->size = size; - vb->ctl->head = size - page_size; /* early wraparound */ - vb->ctl->tail = vb->ctl->head; - vb->rpos = vb->ctl->tail; - } - - /* pre-fault buffer */ - for (i = 0; i < size; i += page_size) - vb->buf[i] = '\0'; - - return (vb); - out: - serr = errno; - if (vb != NULL) { - if (vb->buf != NULL) { - munlock(vb->buf, size); - munmap(vb->buf, size); - } - if (vb->bfd != -1) - close(vb->bfd); - if (vb->ctl != NULL) { - munlock(vb->ctl, page_size); - munmap(vb->ctl, page_size); - } - if (vb->cfd != -1) - close(vb->cfd); - free(vb); - } - errno = serr; - return (NULL); -} - -/* - * Write to a log file. - */ -ssize_t -vlo_write(vlo_buffer_t *vb, const void *data, size_t len) -{ - ssize_t result; - size_t copylen; - - V_ASSERT(vb != NULL); - V_ASSERT(vb->mode == O_WRONLY || vb->mode == O_RDWR); - V_ASSERT(vb->cfd != -1 && vb->ctl != NULL); - V_ASSERT(vb->bfd != -1 && vb->buf != NULL); - V_ASSERT(vb->ctl->magic == VLO_MAGIC); - - for (result = 0; len > 0; len -= copylen, result += copylen) { - if (vb->ctl->head + len > vb->ctl->size) - copylen = vb->ctl->size - vb->ctl->head; - else - copylen = len; - if (vb->ctl->tail > vb->ctl->head && - vb->ctl->tail <= vb->ctl->head + copylen) - vb->ctl->tail = - (vb->ctl->head + copylen + 1) % vb->ctl->size; - memcpy(vb->buf + vb->ctl->head, data, copylen); - vb->ctl->head = (vb->ctl->head + copylen) % vb->ctl->size; - } - return (result); -} - -/* - * Attach to an existing log buffer. - */ -vlo_buffer_t * -vlo_attach(const char *name) -{ - char ctlname[PATH_MAX]; - vlo_buffer_t *vb; - int page_size; - int serr; - - page_size = getpagesize(); - - if (snprintf(ctlname, sizeof ctlname, "%s.ctl", name) >= sizeof ctlname) { - errno = ENAMETOOLONG; - return (NULL); - } - if ((vb = malloc(sizeof *vb)) == NULL) - goto out; - vb->mode = O_RDONLY; - vb->cfd = -1; - vb->ctl = NULL; - vb->bfd = -1; - vb->buf = NULL; - vb->rpos = 0; - - /* open, lock and mmap the control file */ - if ((vb->cfd = open(ctlname, O_RDONLY)) == -1 || - (vb->ctl = mmap(NULL, page_size, PROT_READ, - MAP_SHARED, vb->cfd, 0)) == NULL || - mlock(vb->ctl, page_size) == -1) - goto out; - - /* verify control structure */ - if (vb->ctl->magic != VLO_MAGIC || - !(vb->ctl->size > 0 && (vb->ctl->size % page_size) == 0)) { - errno = EINVAL; /* XXX document */ - goto out; - } - - /* open, lock and mmap the buffer file */ - if ((vb->bfd = open(name, O_RDONLY)) == -1 || - (vb->buf = mmap(NULL, vb->ctl->size, PROT_READ, - MAP_SHARED, vb->bfd, 0)) == NULL || - mlock(vb->ctl, vb->ctl->size) == -1) - goto out; - - vb->rpos = vb->ctl->tail; - - return (vb); - out: - serr = errno; - if (vb != NULL) { - if (vb->buf != NULL) { - munlock(vb->buf, vb->ctl->size); - munmap(vb->buf, vb->ctl->size); - } - if (vb->bfd != -1) - close(vb->bfd); - if (vb->ctl != NULL) { - munlock(vb->ctl, page_size); - munmap(vb->ctl, page_size); - } - if (vb->cfd != -1) - close(vb->cfd); - free(vb); - } - errno = serr; - return (NULL); -} - -/* - * Read from a log file. - */ -ssize_t -vlo_read(vlo_buffer_t *vb, const void *data, size_t len) -{ - V_ASSERT(vb != NULL); - V_ASSERT(vb->mode == O_RDONLY || vb->mode == O_RDWR); - V_ASSERT(vb->cfd != -1 && vb->ctl != NULL); - V_ASSERT(vb->bfd != -1 && vb->buf != NULL); - V_ASSERT(vb->ctl->magic == VLO_MAGIC); - - /* not implemented */ - return (-1); -} - -#if 0 -/* - * Return the UUID of the process writing to the log file. - */ -uuid_t -vlo_get_uuid(vlo_buffer *vb) -{ - V_ASSERT(vb != NULL); - V_ASSERT(vb->cfd != -1 && vb->ctl != NULL); - V_ASSERT(vb->bfd != -1 && vb->buf != NULL); - V_ASSERT(vb->ctl->magic == VLO_MAGIC); - - return (vb->ctl->uuid); -} -#endif - -/* - * Close a log file. - */ -int -vlo_close(vlo_buffer_t *vb) -{ - int page_size; - - page_size = getpagesize(); - - V_ASSERT(vb != NULL); - V_ASSERT(vb->cfd != -1 && vb->ctl != NULL); - V_ASSERT(vb->bfd != -1 && vb->buf != NULL); - V_ASSERT(vb->ctl->magic == VLO_MAGIC); - - munlock(vb->buf, vb->ctl->size); - munmap(vb->buf, vb->ctl->size); - close(vb->bfd); - munlock(vb->ctl, page_size); - munmap(vb->ctl, page_size); - close(vb->cfd); - free(vb); - return (0); -} Deleted: trunk/varnish-cache/lib/libvarnishapi/varnish_util.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/varnish_util.c 2006-08-23 12:10:11 UTC (rev 907) +++ trunk/varnish-cache/lib/libvarnishapi/varnish_util.c 2006-08-23 13:11:14 UTC (rev 908) @@ -1,61 +0,0 @@ -/* - * $Id$ - */ - -#include "config.h" - -#include -#include -#include - -#include -#include -#include - -#include - -/** - * Open and lock a file. - */ -int -vut_open_lock(const char *name, int mode, int lockop, int perm) -{ - struct stat sb, fsb; - int fd, serr; - - for (;;) { - if ((fd = open(name, mode, perm)) == -1) - /* not much we can do about that */ - return (-1); - while (flock(fd, lockop) == -1) { - if (errno != EINTR) { - serr = errno; - close(fd); - errno = serr; - return (-1); - } - } - if (stat(name, &sb) == -1) { - serr = errno; - close(fd); - errno = serr; - - if (errno == ENOENT && (mode & O_CREAT)) - /* file was deleted from under our nose */ - continue; - return (-1); - } - if (fstat(fd, &fsb) == -1) { - /* serious voodoo is going on*/ - serr = errno; - close(fd); - errno = serr; - return (-1); - } - if (sb.st_dev == fsb.st_dev && sb.st_ino == fsb.st_ino) - /* we have the correct file */ - return (fd); - close(fd); - } - /* not reached */ -} From phk at projects.linpro.no Wed Aug 23 14:30:06 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 23 Aug 2006 16:30:06 +0200 (CEST) Subject: r909 - trunk/varnish-cache/bin/varnishd Message-ID: <20060823143006.6A1E21EC98D@projects.linpro.no> Author: phk Date: 2006-08-23 16:30:06 +0200 (Wed, 23 Aug 2006) New Revision: 909 Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c Log: Handle backend failure in pass mode Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-23 13:11:14 UTC (rev 908) +++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-23 14:30:06 UTC (rev 909) @@ -45,6 +45,10 @@ i = http_Read(hp, fd, buf, c); if (i == 0 && bi == NULL) return (1); + if (i <= 0) { + vca_close_session(sp, "backend closed"); + return (1); + } assert(i > 0); sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, buf, i); if (WRK_Flush(sp->wrk)) From phk at projects.linpro.no Thu Aug 24 06:15:13 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 24 Aug 2006 08:15:13 +0200 (CEST) Subject: r910 - trunk/varnish-cache/bin/varnishd Message-ID: <20060824061513.A34791EC03C@projects.linpro.no> Author: phk Date: 2006-08-24 08:15:13 +0200 (Thu, 24 Aug 2006) New Revision: 910 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c Log: This is a workaround for what is probably a race in FreeBSD RELENG_6 socket dismantling. There is no way that close(2) should ever be able to return EINVAL, but we've seen it. Specifically assert on EBADF which is the check we're really after. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-23 14:30:06 UTC (rev 909) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-24 06:15:13 UTC (rev 910) @@ -141,10 +141,13 @@ void vca_close_session(struct sess *sp, const char *why) { + int i; VSL(SLT_SessionClose, sp->fd, why); - if (sp->fd >= 0) - AZ(close(sp->fd)); + if (sp->fd >= 0) { + i = close(sp->fd); + assert(i == 0 || errno != EBADF); /* XXX EINVAL seen */ + } sp->fd = -1; } From phk at projects.linpro.no Thu Aug 24 06:58:37 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 24 Aug 2006 08:58:37 +0200 (CEST) Subject: r911 - trunk/varnish-cache/include Message-ID: <20060824065837.B80021EC040@projects.linpro.no> Author: phk Date: 2006-08-24 08:58:37 +0200 (Thu, 24 Aug 2006) New Revision: 911 Modified: trunk/varnish-cache/include/libvarnish.h Log: Split assert into "static check" and "missing code" variants. The "missing code" variants have xxx prefix Introduce AN() (assert non-null) variant as well. Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2006-08-24 06:15:13 UTC (rev 910) +++ trunk/varnish-cache/include/libvarnish.h 2006-08-24 06:58:37 UTC (rev 911) @@ -5,6 +5,10 @@ #include #include +#ifndef NULL +#define NULL ((void*)0) +#endif + /* from libvarnish/argv.c */ void FreeArgv(char **argv); char **ParseArgv(const char *s, int comment); @@ -17,6 +21,12 @@ void varnish_version(const char *); /* from libvarnish/assert.c */ + +/* + * assert(), AN() and AZ() are static checks that should not happen. + * xxxassert(), XXXAN() and XXXAZ() are markers for missing code. + */ + #ifdef WITHOUT_ASSERTS #define assert(e) ((void)0) #else /* WITH_ASSERTS */ @@ -27,7 +37,16 @@ } while (0) #endif +#define xxxassert(e) \ +do { \ + if (!(e)) \ + lbv_assert("XXX:" __func__, __FILE__, __LINE__, #e, errno); \ +} while (0) + void lbv_assert(const char *, const char *, int, const char *, int); /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0) +#define AN(foo) do { assert((foo) != NULL); } while (0) +#define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0) +#define XXXAN(foo) do { xxxassert((foo) != NULL); } while (0) From phk at projects.linpro.no Thu Aug 24 07:10:35 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 24 Aug 2006 09:10:35 +0200 (CEST) Subject: r912 - in trunk/varnish-cache: include lib/libvarnish Message-ID: <20060824071035.DAE0D1EC040@projects.linpro.no> Author: phk Date: 2006-08-24 09:10:35 +0200 (Thu, 24 Aug 2006) New Revision: 912 Modified: trunk/varnish-cache/include/libvarnish.h trunk/varnish-cache/lib/libvarnish/assert.c Log: Give xxxasserts their own backend with a different message. Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2006-08-24 06:58:37 UTC (rev 911) +++ trunk/varnish-cache/include/libvarnish.h 2006-08-24 07:10:35 UTC (rev 912) @@ -40,10 +40,11 @@ #define xxxassert(e) \ do { \ if (!(e)) \ - lbv_assert("XXX:" __func__, __FILE__, __LINE__, #e, errno); \ + lbv_xxxassert(__func__, __FILE__, __LINE__, #e, errno); \ } while (0) void lbv_assert(const char *, const char *, int, const char *, int); +void lbv_xxxassert(const char *, const char *, int, const char *, int); /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0) Modified: trunk/varnish-cache/lib/libvarnish/assert.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/assert.c 2006-08-24 06:58:37 UTC (rev 911) +++ trunk/varnish-cache/lib/libvarnish/assert.c 2006-08-24 07:10:35 UTC (rev 912) @@ -10,6 +10,17 @@ #include "libvarnish.h" void +lbv_xxxassert(const char *func, const char *file, int line, const char *cond, int err) +{ + + fprintf(stderr, + "Missing errorhandling code in %s(), %s line %d:\n" + " Condition(%s) not true.\n" + " errno = %d (%s)\n", func, file, line, cond, err, strerror(err)); + abort(); +} + +void lbv_assert(const char *func, const char *file, int line, const char *cond, int err) { From phk at projects.linpro.no Thu Aug 24 07:17:35 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 24 Aug 2006 09:17:35 +0200 (CEST) Subject: r913 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20060824071735.D6F751EC04D@projects.linpro.no> Author: phk Date: 2006-08-24 09:17:35 +0200 (Thu, 24 Aug 2006) New Revision: 913 Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_expire.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_pool.c trunk/varnish-cache/bin/varnishd/cache_session.c trunk/varnish-cache/bin/varnishd/cache_vcl.c trunk/varnish-cache/bin/varnishd/hash_classic.c trunk/varnish-cache/bin/varnishd/hash_simple_list.c trunk/varnish-cache/bin/varnishd/shmlog.c trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/include/libvarnish.h Log: Introduce LOCK() and UNLOCK() macros which does the right thing with pthread_mutex_{lock,unlock}() Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-24 07:17:35 UTC (rev 913) @@ -187,7 +187,7 @@ * (if any) while we have the lock anyway. */ vc2 = NULL; - AZ(pthread_mutex_lock(&vbemtx)); + LOCK(&vbemtx); vc = TAILQ_FIRST(&bp->connlist); if (vc != NULL) { assert(vc->fd >= 0); @@ -199,7 +199,7 @@ TAILQ_REMOVE(&vbe_head, vc2, list); } } - AZ(pthread_mutex_unlock(&vbemtx)); + UNLOCK(&vbemtx); if (vc == NULL) break; @@ -226,7 +226,7 @@ if (vc->fd < 0) { assert(vc->backend == NULL); vc->fd = vbe_connect(bp); - AZ(pthread_mutex_lock(&vbemtx)); + LOCK(&vbemtx); if (vc->fd < 0) { vc->backend = NULL; TAILQ_INSERT_HEAD(&vbe_head, vc, list); @@ -235,7 +235,7 @@ } else { vc->backend = bp; } - AZ(pthread_mutex_unlock(&vbemtx)); + UNLOCK(&vbemtx); } else { assert(vc->fd >= 0); assert(vc->backend == bp); @@ -263,10 +263,10 @@ AZ(close(vc->fd)); vc->fd = -1; vc->backend = NULL; - AZ(pthread_mutex_lock(&vbemtx)); + LOCK(&vbemtx); TAILQ_INSERT_HEAD(&vbe_head, vc, list); VSL_stats->backend_unused++; - AZ(pthread_mutex_unlock(&vbemtx)); + UNLOCK(&vbemtx); } /* Recycle a connection ----------------------------------------------*/ @@ -280,9 +280,9 @@ assert(vc->backend != NULL); VSL_stats->backend_recycle++; VSL(SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name); - AZ(pthread_mutex_lock(&vbemtx)); + LOCK(&vbemtx); TAILQ_INSERT_HEAD(&vc->backend->connlist, vc, list); - AZ(pthread_mutex_unlock(&vbemtx)); + UNLOCK(&vbemtx); } /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-08-24 07:17:35 UTC (rev 913) @@ -32,19 +32,19 @@ { assert(o->heap_idx == 0); - AZ(pthread_mutex_lock(&exp_mtx)); + LOCK(&exp_mtx); binheap_insert(exp_heap, o); - AZ(pthread_mutex_unlock(&exp_mtx)); + UNLOCK(&exp_mtx); } void EXP_TTLchange(struct object *o) { assert(o->heap_idx != 0); - AZ(pthread_mutex_lock(&exp_mtx)); + LOCK(&exp_mtx); binheap_delete(exp_heap, o->heap_idx); binheap_insert(exp_heap, o); - AZ(pthread_mutex_unlock(&exp_mtx)); + UNLOCK(&exp_mtx); } /*-------------------------------------------------------------------- @@ -61,7 +61,7 @@ while (1) { t = time(NULL); - AZ(pthread_mutex_lock(&exp_mtx)); + LOCK(&exp_mtx); TAILQ_FOREACH(o, &exp_deathrow, deathrow) { CHECK_OBJ(o, OBJECT_MAGIC); if (o->ttl >= t) { @@ -77,14 +77,14 @@ break; } if (o == NULL) { - AZ(pthread_mutex_unlock(&exp_mtx)); + UNLOCK(&exp_mtx); AZ(sleep(1)); continue; } TAILQ_REMOVE(&exp_deathrow, o, deathrow); VSL_stats->n_deathrow--; VSL_stats->n_expired++; - AZ(pthread_mutex_unlock(&exp_mtx)); + UNLOCK(&exp_mtx); VSL(SLT_ExpKill, 0, "%u %d", o->xid, (int)(o->ttl - t)); HSH_Deref(o); } @@ -113,12 +113,12 @@ assert(sp != NULL); while (1) { t = time(NULL); - AZ(pthread_mutex_lock(&exp_mtx)); + LOCK(&exp_mtx); o = binheap_root(exp_heap); if (o != NULL) CHECK_OBJ(o, OBJECT_MAGIC); if (o == NULL || o->ttl > t + expearly) { - AZ(pthread_mutex_unlock(&exp_mtx)); + UNLOCK(&exp_mtx); AZ(sleep(1)); continue; } @@ -129,7 +129,7 @@ if (o2 != NULL) assert(o2->ttl >= o->ttl); - AZ(pthread_mutex_unlock(&exp_mtx)); + UNLOCK(&exp_mtx); VSL(SLT_ExpPick, 0, "%u", o->xid); sp->vcl = VCL_Get(); @@ -138,10 +138,10 @@ VCL_Rel(sp->vcl); if (sp->handling == VCL_RET_DISCARD) { - AZ(pthread_mutex_lock(&exp_mtx)); + LOCK(&exp_mtx); TAILQ_INSERT_TAIL(&exp_deathrow, o, deathrow); VSL_stats->n_deathrow++; - AZ(pthread_mutex_unlock(&exp_mtx)); + UNLOCK(&exp_mtx); continue; } assert(sp->handling == VCL_RET_DISCARD); Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-24 07:17:35 UTC (rev 913) @@ -85,20 +85,20 @@ o = sp->obj; oh = o->objhead; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); - AZ(pthread_mutex_lock(&oh->mtx)); + LOCK(&oh->mtx); goto were_back; } oh = hash->lookup(url, host, w->nobjhead); CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); if (oh == w->nobjhead) w->nobjhead = NULL; - AZ(pthread_mutex_lock(&oh->mtx)); + LOCK(&oh->mtx); TAILQ_FOREACH(o, &oh->objects, list) { o->refcnt++; if (o->busy) { TAILQ_INSERT_TAIL(&o->waitinglist, sp, list); sp->obj = o; - AZ(pthread_mutex_unlock(&oh->mtx)); + UNLOCK(&oh->mtx); return (NULL); } were_back: @@ -118,7 +118,7 @@ o->refcnt--; } if (o != NULL) { - AZ(pthread_mutex_unlock(&oh->mtx)); + UNLOCK(&oh->mtx); (void)hash->deref(oh); return (o); } @@ -129,7 +129,7 @@ o->objhead = oh; TAILQ_INSERT_TAIL(&oh->objects, o, list); /* NB: do not deref objhead the new object inherits our reference */ - AZ(pthread_mutex_unlock(&oh->mtx)); + UNLOCK(&oh->mtx); BAN_NewObj(o); return (o); } @@ -144,9 +144,9 @@ assert(o->refcnt > 0); if (o->cacheable) EXP_Insert(o); - AZ(pthread_mutex_lock(&o->objhead->mtx)); + LOCK(&o->objhead->mtx); o->busy = 0; - AZ(pthread_mutex_unlock(&o->objhead->mtx)); + UNLOCK(&o->objhead->mtx); while (1) { sp = TAILQ_FIRST(&o->waitinglist); if (sp == NULL) @@ -164,10 +164,10 @@ CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); oh = o->objhead; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); - AZ(pthread_mutex_lock(&oh->mtx)); + LOCK(&oh->mtx); assert(o->refcnt > 0); o->refcnt++; - AZ(pthread_mutex_unlock(&oh->mtx)); + UNLOCK(&oh->mtx); } void @@ -182,12 +182,12 @@ CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); /* drop ref on object */ - AZ(pthread_mutex_lock(&oh->mtx)); + LOCK(&oh->mtx); assert(o->refcnt > 0); r = --o->refcnt; if (!r) TAILQ_REMOVE(&oh->objects, o, list); - AZ(pthread_mutex_unlock(&oh->mtx)); + UNLOCK(&oh->mtx); /* If still referenced, done */ if (r != 0) Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-24 07:17:35 UTC (rev 913) @@ -132,7 +132,7 @@ VSL_stats->n_wrk_busy++; TAILQ_REMOVE(&wrk_reqhead, wrq, list); VSL_stats->n_wrk_queue--; - AZ(pthread_mutex_unlock(&wrk_mtx)); + UNLOCK(&wrk_mtx); CHECK_OBJ_NOTNULL(wrq->sess, SESS_MAGIC); wrq->sess->wrk = w; w->wrq = wrq; @@ -150,7 +150,7 @@ if (w->nobjhead != NULL) CHECK_OBJ(w->nobjhead, OBJHEAD_MAGIC); w->wrq = NULL; - AZ(pthread_mutex_lock(&wrk_mtx)); + LOCK(&wrk_mtx); VSL_stats->n_wrk_busy--; } @@ -167,7 +167,7 @@ AZ(pthread_cond_init(&w->cv, NULL)); - AZ(pthread_mutex_lock(&wrk_mtx)); + LOCK(&wrk_mtx); w->nbr = VSL_stats->n_wrk; VSL_stats->n_wrk_create++; VSL(SLT_WorkThread, 0, "%u born", w->nbr); @@ -195,7 +195,7 @@ if (pthread_cond_timedwait(&w->cv, &wrk_mtx, &ts)) { VSL_stats->n_wrk--; TAILQ_REMOVE(&wrk_idle, w, list); - AZ(pthread_mutex_unlock(&wrk_mtx)); + UNLOCK(&wrk_mtx); VSL(SLT_WorkThread, 0, "%u suicide", w->nbr); AZ(pthread_cond_destroy(&w->cv)); return (NULL); @@ -219,7 +219,7 @@ sp->workreq.sess = sp; - AZ(pthread_mutex_lock(&wrk_mtx)); + LOCK(&wrk_mtx); TAILQ_INSERT_TAIL(&wrk_reqhead, &sp->workreq, list); VSL_stats->n_wrk_queue++; @@ -229,7 +229,7 @@ AZ(pthread_cond_signal(&w->cv)); TAILQ_REMOVE(&wrk_idle, w, list); TAILQ_INSERT_TAIL(&wrk_busy, w, list); - AZ(pthread_mutex_unlock(&wrk_mtx)); + UNLOCK(&wrk_mtx); return; } @@ -238,13 +238,13 @@ /* Can we create more threads ? */ if (VSL_stats->n_wrk >= params->wthread_max) { VSL_stats->n_wrk_max++; - AZ(pthread_mutex_unlock(&wrk_mtx)); + UNLOCK(&wrk_mtx); return; } /* Try to create a thread */ VSL_stats->n_wrk++; - AZ(pthread_mutex_unlock(&wrk_mtx)); + UNLOCK(&wrk_mtx); if (!pthread_create(&tp, NULL, wrk_thread, NULL)) { AZ(pthread_detach(tp)); @@ -255,10 +255,10 @@ errno, strerror(errno)); /* Register overflow */ - AZ(pthread_mutex_lock(&wrk_mtx)); + LOCK(&wrk_mtx); VSL_stats->n_wrk--; VSL_stats->n_wrk_failed++; - AZ(pthread_mutex_unlock(&wrk_mtx)); + UNLOCK(&wrk_mtx); } @@ -293,7 +293,7 @@ (void)av; (void)priv; struct worker *w; - AZ(pthread_mutex_lock(&wrk_mtx)); + LOCK(&wrk_mtx); t = time(NULL); TAILQ_FOREACH(w, &wrk_busy, list) { cli_out(cli, "\n"); @@ -313,5 +313,5 @@ TAILQ_FOREACH(w, &wrk_idle, list) u++; cli_out(cli, "%u idle workers\n", u); - AZ(pthread_mutex_unlock(&wrk_mtx)); + UNLOCK(&wrk_mtx); } Modified: trunk/varnish-cache/bin/varnishd/cache_session.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-24 07:17:35 UTC (rev 913) @@ -79,7 +79,7 @@ ch = &srcaddr_hash[v]; now = time(NULL); - AZ(pthread_mutex_lock(&ses_mtx)); + LOCK(&ses_mtx); c3 = NULL; TAILQ_FOREACH_SAFE(c, ch, list, c2) { if (c->hash == u && !strcmp(c->addr, sp->addr)) { @@ -95,7 +95,7 @@ VSL_stats->n_srcaddr--; free(c3); } - AZ(pthread_mutex_unlock(&ses_mtx)); + UNLOCK(&ses_mtx); return; } if (c->nref > 0 || c->ttl > now) @@ -128,7 +128,7 @@ TAILQ_INSERT_TAIL(ch, c3, list); sp->srcaddr = c3; } - AZ(pthread_mutex_unlock(&ses_mtx)); + UNLOCK(&ses_mtx); } static void @@ -152,7 +152,7 @@ ses_sum_acct(&sp->acct, a); - AZ(pthread_mutex_lock(&ses_mtx)); + LOCK(&ses_mtx); ses_sum_acct(b, a); VSL(SLT_StatAddr, 0, "%s 0 %d %ju %ju %ju %ju %ju %ju %ju", sp->srcaddr->addr, time(NULL) - b->first, @@ -165,7 +165,7 @@ VSL_stats->s_fetch += a->fetch; VSL_stats->s_hdrbytes += a->hdrbytes; VSL_stats->s_bodybytes += a->bodybytes; - AZ(pthread_mutex_unlock(&ses_mtx)); + UNLOCK(&ses_mtx); memset(a, 0, sizeof *a); } @@ -178,13 +178,13 @@ return; } assert(sp->srcaddr != NULL); - AZ(pthread_mutex_lock(&ses_mtx)); + LOCK(&ses_mtx); assert(sp->srcaddr->nref > 0); sp->srcaddr->nref--; if (sp->srcaddr->nref == 0) VSL_stats->n_srcaddr_act--; sp->srcaddr = NULL; - AZ(pthread_mutex_unlock(&ses_mtx)); + UNLOCK(&ses_mtx); } /*--------------------------------------------------------------------*/ @@ -207,9 +207,9 @@ * If that queue is empty, flip queues holding the lock * and try the new unlocked queue. */ - AZ(pthread_mutex_lock(&ses_mem_mtx)); + LOCK(&ses_mem_mtx); ses_qp = 1 - ses_qp; - AZ(pthread_mutex_unlock(&ses_mem_mtx)); + UNLOCK(&ses_mem_mtx); sm = TAILQ_FIRST(&ses_free_mem[ses_qp]); } if (sm != NULL) { @@ -271,9 +271,9 @@ VSL_stats->n_sess_mem--; free(sm); } else { - AZ(pthread_mutex_lock(&ses_mem_mtx)); + LOCK(&ses_mem_mtx); TAILQ_INSERT_HEAD(&ses_free_mem[1 - ses_qp], sm, list); - AZ(pthread_mutex_unlock(&ses_mem_mtx)); + UNLOCK(&ses_mem_mtx); } } Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-24 07:17:35 UTC (rev 913) @@ -46,12 +46,12 @@ { struct VCL_conf *vc; - AZ(pthread_mutex_lock(&vcl_mtx)); + LOCK(&vcl_mtx); assert(vcl_active != NULL); vc = vcl_active->conf; assert(vc != NULL); vc->busy++; - AZ(pthread_mutex_unlock(&vcl_mtx)); + UNLOCK(&vcl_mtx); return (vc); } @@ -60,7 +60,7 @@ { struct vcls *vcl; - AZ(pthread_mutex_lock(&vcl_mtx)); + LOCK(&vcl_mtx); assert(vc->busy > 0); vc->busy--; vcl = vc->priv; /* XXX miniobj */ @@ -72,7 +72,7 @@ } else { vcl = NULL; } - AZ(pthread_mutex_unlock(&vcl_mtx)); + UNLOCK(&vcl_mtx); if (vcl != NULL) { /* XXX: dispose of vcl */ } @@ -142,10 +142,10 @@ vcl->name = strdup(name); assert(vcl->name != NULL); TAILQ_INSERT_TAIL(&vcl_head, vcl, list); - AZ(pthread_mutex_lock(&vcl_mtx)); + LOCK(&vcl_mtx); if (vcl_active == NULL) vcl_active = vcl; - AZ(pthread_mutex_unlock(&vcl_mtx)); + UNLOCK(&vcl_mtx); if (cli == NULL) fprintf(stderr, "Loaded \"%s\" as \"%s\"\n", fn , name); else @@ -200,9 +200,9 @@ cli_out(cli, "VCL %s already discarded", av[2]); return; } - AZ(pthread_mutex_lock(&vcl_mtx)); + LOCK(&vcl_mtx); if (vcl == vcl_active) { - AZ(pthread_mutex_unlock(&vcl_mtx)); + UNLOCK(&vcl_mtx); cli_result(cli, CLIS_PARAM); cli_out(cli, "VCL %s is the active VCL", av[2]); return; @@ -212,7 +212,7 @@ TAILQ_REMOVE(&vcl_head, vcl, list); else vcl = NULL; - AZ(pthread_mutex_unlock(&vcl_mtx)); + UNLOCK(&vcl_mtx); if (vcl != NULL) { /* XXX dispose of vcl */ } @@ -236,9 +236,9 @@ cli_result(cli, CLIS_PARAM); return; } - AZ(pthread_mutex_lock(&vcl_mtx)); + LOCK(&vcl_mtx); vcl_active = vcl; - AZ(pthread_mutex_unlock(&vcl_mtx)); + UNLOCK(&vcl_mtx); } /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-24 07:17:35 UTC (rev 913) @@ -180,7 +180,7 @@ he2 = NULL; for (r = 0; r < 2; r++ ) { - AZ(pthread_mutex_lock(&hp->mtx)); + LOCK(&hp->mtx); TAILQ_FOREACH(he, &hp->head, list) { CHECK_OBJ_NOTNULL(he, HCL_ENTRY_MAGIC); if (kl < he->klen) @@ -197,13 +197,13 @@ continue; he->refcnt++; noh = he->oh; - AZ(pthread_mutex_unlock(&hp->mtx)); + UNLOCK(&hp->mtx); if (he2 != NULL) free(he2); return (noh); } if (noh == NULL) { - AZ(pthread_mutex_unlock(&hp->mtx)); + UNLOCK(&hp->mtx); return (NULL); } if (he2 != NULL) { @@ -213,10 +213,10 @@ TAILQ_INSERT_TAIL(&hp->head, he2, list); he2->refcnt++; noh = he2->oh; - AZ(pthread_mutex_unlock(&hp->mtx)); + UNLOCK(&hp->mtx); return (noh); } - AZ(pthread_mutex_unlock(&hp->mtx)); + UNLOCK(&hp->mtx); i = sizeof *he2 + kl; he2 = calloc(i, 1); @@ -254,12 +254,12 @@ assert(he->refcnt > 0); assert(he->hash < hcl_nhash); assert(hp == &hcl_head[he->hash]); - AZ(pthread_mutex_lock(&hp->mtx)); + LOCK(&hp->mtx); if (--he->refcnt == 0) TAILQ_REMOVE(&hp->head, he, list); else he = NULL; - AZ(pthread_mutex_unlock(&hp->mtx)); + UNLOCK(&hp->mtx); if (he == NULL) return (1); free(he); Modified: trunk/varnish-cache/bin/varnishd/hash_simple_list.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_simple_list.c 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/bin/varnishd/hash_simple_list.c 2006-08-24 07:17:35 UTC (rev 913) @@ -48,7 +48,7 @@ struct hsl_entry *he, *he2; int i; - AZ(pthread_mutex_lock(&hsl_mutex)); + LOCK(&hsl_mutex); TAILQ_FOREACH(he, &hsl_head, list) { i = strcmp(key1, he->key1); if (i < 0) @@ -63,11 +63,11 @@ he->refcnt++; nobj = he->obj; nobj->hashpriv = he; - AZ(pthread_mutex_unlock(&hsl_mutex)); + UNLOCK(&hsl_mutex); return (nobj); } if (nobj == NULL) { - AZ(pthread_mutex_unlock(&hsl_mutex)); + UNLOCK(&hsl_mutex); return (NULL); } he2 = calloc(sizeof *he2, 1); @@ -83,7 +83,7 @@ TAILQ_INSERT_BEFORE(he, he2, list); else TAILQ_INSERT_TAIL(&hsl_head, he2, list); - AZ(pthread_mutex_unlock(&hsl_mutex)); + UNLOCK(&hsl_mutex); return (nobj); } @@ -99,7 +99,7 @@ assert(obj->hashpriv != NULL); he = obj->hashpriv; - AZ(pthread_mutex_lock(&hsl_mutex)); + LOCK(&hsl_mutex); if (--he->refcnt == 0) { free(he->key1); free(he->key2); @@ -108,7 +108,7 @@ ret = 0; } else ret = 1; - AZ(pthread_mutex_unlock(&hsl_mutex)); + UNLOCK(&hsl_mutex); return (ret); } Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-24 07:17:35 UTC (rev 913) @@ -62,7 +62,7 @@ } /* Only hold the lock while we find our space */ - AZ(pthread_mutex_lock(&vsl_mtx)); + LOCK(&vsl_mtx); assert(loghead->ptr < loghead->size); /* Wrap if necessary */ @@ -72,7 +72,7 @@ loghead->ptr += 5 + l; p[5 + l] = SLT_ENDMARKER; assert(loghead->ptr < loghead->size); - AZ(pthread_mutex_unlock(&vsl_mtx)); + UNLOCK(&vsl_mtx); p[1] = l & 0xff; p[2] = (id >> 8) & 0xff; @@ -99,7 +99,7 @@ return; } - AZ(pthread_mutex_lock(&vsl_mtx)); + LOCK(&vsl_mtx); assert(loghead->ptr < loghead->size); /* Wrap if we cannot fit a full size record */ @@ -123,7 +123,7 @@ loghead->ptr += 5 + n; assert(loghead->ptr < loghead->size); - AZ(pthread_mutex_unlock(&vsl_mtx)); + UNLOCK(&vsl_mtx); va_end(ap); } Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-24 07:17:35 UTC (rev 913) @@ -511,10 +511,10 @@ size += (sc->pagesize - 1); size &= ~(sc->pagesize - 1); - AZ(pthread_mutex_lock(&sc->mtx)); + LOCK(&sc->mtx); smf = alloc_smf(sc, size); CHECK_OBJ_NOTNULL(smf, SMF_MAGIC); - AZ(pthread_mutex_unlock(&sc->mtx)); + UNLOCK(&sc->mtx); assert(smf != NULL); assert(smf->size == size); smf->s.space = size; @@ -549,10 +549,10 @@ size += (sc->pagesize - 1); size &= ~(sc->pagesize - 1); if (smf->size > size) { - AZ(pthread_mutex_lock(&sc->mtx)); + LOCK(&sc->mtx); trim_smf(smf, size); assert(smf->size == size); - AZ(pthread_mutex_unlock(&sc->mtx)); + UNLOCK(&sc->mtx); smf->s.space = size; } } @@ -568,9 +568,9 @@ CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC); CAST_OBJ_NOTNULL(smf, s->priv, SMF_MAGIC); sc = smf->sc; - AZ(pthread_mutex_lock(&sc->mtx)); + LOCK(&sc->mtx); free_smf(smf); - AZ(pthread_mutex_unlock(&sc->mtx)); + UNLOCK(&sc->mtx); } /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2006-08-24 07:10:35 UTC (rev 912) +++ trunk/varnish-cache/include/libvarnish.h 2006-08-24 07:17:35 UTC (rev 913) @@ -51,3 +51,6 @@ #define AN(foo) do { assert((foo) != NULL); } while (0) #define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0) #define XXXAN(foo) do { xxxassert((foo) != NULL); } while (0) + +#define LOCK(foo) AZ(pthread_mutex_lock(foo)) +#define UNLOCK(foo) AZ(pthread_mutex_unlock(foo)) From phk at projects.linpro.no Thu Aug 24 07:57:08 2006 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 24 Aug 2006 09:57:08 +0200 (CEST) Subject: r914 - trunk/varnish-cache/bin/varnishd Message-ID: <20060824075708.3DC4E1EC04E@projects.linpro.no> Author: phk Date: 2006-08-24 09:57:07 +0200 (Thu, 24 Aug 2006) New Revision: 914 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_ban.c trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_expire.c trunk/varnish-cache/bin/varnishd/cache_fetch.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_http.c trunk/varnish-cache/bin/varnishd/cache_pass.c trunk/varnish-cache/bin/varnishd/cache_pipe.c trunk/varnish-cache/bin/varnishd/cache_pool.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/cache_session.c trunk/varnish-cache/bin/varnishd/cache_vcl.c trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c trunk/varnish-cache/bin/varnishd/cache_vrt_re.c trunk/varnish-cache/bin/varnishd/flint.lnt trunk/varnish-cache/bin/varnishd/hash_classic.c trunk/varnish-cache/bin/varnishd/hash_simple_list.c trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/shmlog.c trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/bin/varnishd/storage_malloc.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: Go through all asserts and mark those which indicate missing code with xxx or XXX. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-24 07:57:07 UTC (rev 914) @@ -63,7 +63,7 @@ return (NULL); } sp = SES_New(addr, l); - assert(sp != NULL); /* XXX handle */ + XXXAN(sp); (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); sp->fd = i; @@ -156,8 +156,8 @@ { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - assert(sp->obj == NULL); - assert(sp->vcl == NULL); + AZ(sp->obj); + AZ(sp->vcl); if (sp->fd >= 0) { VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port); (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2006-08-24 07:57:07 UTC (rev 914) @@ -32,14 +32,12 @@ vca_kq_sess(struct sess *sp, int arm) { struct kevent ke; - int i; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); if (sp->fd < 0) return; EV_SET(&ke, sp->fd, EVFILT_READ, arm, 0, 0, sp); - i = kevent(kq, &ke, 1, NULL, 0, NULL); - assert(i == 0); + AZ(kevent(kq, &ke, 1, NULL, 0, NULL)); } static void @@ -48,7 +46,7 @@ int i; struct sess *sp; - assert(kp->udata != NULL); + AN(kp->udata); if (kp->udata == pipes) { while (kp->data > 0) { i = read(pipes[0], &sp, sizeof sp); @@ -89,7 +87,7 @@ vca_kqueue_main(void *arg) { struct kevent ke[NKEV], *kp; - int i, j, n; + int j, n; struct timespec ts; struct sess *sp; @@ -101,8 +99,7 @@ j = 0; EV_SET(&ke[j++], 0, EVFILT_TIMER, EV_ADD, 0, 100, NULL); EV_SET(&ke[j++], pipes[0], EVFILT_READ, EV_ADD, 0, 0, pipes); - i = kevent(kq, ke, j, NULL, 0, NULL); - assert(i == 0); + AZ(kevent(kq, ke, j, NULL, 0, NULL)); while (1) { n = kevent(kq, NULL, 0, ke, NKEV, NULL); Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c 2006-08-24 07:57:07 UTC (rev 914) @@ -44,7 +44,7 @@ u += u; VSL(SLT_Debug, 0, "Acceptor Pollspace %u", u); p = realloc(pollfd, u * sizeof *p); - assert(p != NULL); + XXXAN(p); /* close offending fd */ memset(p + npoll, 0, (u - npoll) * sizeof *p); for (v = npoll ; v <= u; v++) p->fd = -1; Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-24 07:57:07 UTC (rev 914) @@ -151,8 +151,8 @@ char pbuf1[TCP_PORTBUFSIZE], pbuf2[TCP_PORTBUFSIZE]; struct addrinfo *ai; - assert(bp != NULL); - assert(bp->hostname != NULL); + CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); + AN(bp->hostname); s = vbe_conn_try(bp, &ai); if (s < 0) @@ -217,14 +217,14 @@ vc = vbe_new_conn(); else vc = vc2; - assert(vc != NULL); + AN(vc); assert(vc->fd == -1); - assert(vc->backend == NULL); + AZ(vc->backend); } /* If not connected yet, do so */ if (vc->fd < 0) { - assert(vc->backend == NULL); + AZ(vc->backend); vc->fd = vbe_connect(bp); LOCK(&vbemtx); if (vc->fd < 0) { @@ -244,7 +244,7 @@ assert(vc->fd >= 0); VSL_stats->backend_conn++; VSL(SLT_BackendXID, vc->fd, "%u", xid); - assert(vc->backend != NULL); + AN(vc->backend); } return (vc); } @@ -257,7 +257,7 @@ CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); assert(vc->fd >= 0); - assert(vc->backend != NULL); + AN(vc->backend); VSL(SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name); if (!already) AZ(close(vc->fd)); @@ -277,7 +277,7 @@ CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); assert(vc->fd >= 0); - assert(vc->backend != NULL); + AN(vc->backend); VSL_stats->backend_recycle++; VSL(SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name); LOCK(&vbemtx); Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ban.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_ban.c 2006-08-24 07:57:07 UTC (rev 914) @@ -30,7 +30,7 @@ int i; b = calloc(sizeof *b, 1); - assert(b != NULL); + XXXAN(b); i = regcomp(&b->regexp, regexp, REG_EXTENDED | REG_NOSUB); if (i) { Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-24 07:57:07 UTC (rev 914) @@ -95,8 +95,8 @@ double dh, dp, da; struct timespec te; - assert(sp->obj == NULL); - assert(sp->vbc == NULL); + AZ(sp->obj); + AZ(sp->vbc); if (sp->fd >= 0 && sp->doclose != NULL) vca_close_session(sp, sp->doclose); sp->backend = NULL; @@ -194,7 +194,7 @@ cnt_fetch(struct sess *sp) { - assert(sp->vbc != NULL); + CHECK_OBJ_NOTNULL(sp->vbc, VBE_CONN_MAGIC); RFC2616_cache_policy(sp, sp->vbc->http); VCL_fetch_method(sp); @@ -220,9 +220,8 @@ } if (sp->handling == VCL_RET_INSERT) { sp->obj->cacheable = 1; - assert(sp->vbc != NULL); FetchBody(sp); - assert(sp->vbc == NULL); + AZ(sp->vbc); HSH_Ref(sp->obj); /* get another, STP_DELIVER will deref */ HSH_Unbusy(sp->obj); sp->wrk->acct.fetch++; @@ -362,7 +361,7 @@ cnt_lookup(struct sess *sp) { - assert(sp->obj == NULL); + AZ(sp->obj); sp->step = STP_LOOKUP2; return (0); } @@ -469,10 +468,10 @@ if (sp->handling == VCL_RET_LOOKUP) INCOMPL(); if (sp->handling == VCL_RET_FETCH) { - assert(sp->vbc == NULL); + AZ(sp->vbc); FetchHeaders(sp); sp->step = STP_FETCH; - assert(sp->vbc != NULL); + AN(sp->vbc); return (0); } INCOMPL(); @@ -497,9 +496,9 @@ cnt_pass(struct sess *sp) { - assert(sp->vbc == NULL); + AZ(sp->vbc); if (!PassSession(sp)) { - assert(sp->vbc != NULL); + AN(sp->vbc); sp->step = STP_PASSBODY; } else sp->step = STP_DONE; @@ -526,9 +525,9 @@ { sp->wrk->acct.pass++; - assert(sp->vbc != NULL); + AN(sp->vbc); PassBody(sp); - assert(sp->vbc == NULL); + AZ(sp->vbc); sp->step = STP_DONE; return (0); } @@ -591,11 +590,11 @@ int done; sp->t0 = time(NULL); - assert(sp->vcl == NULL); + AZ(sp->vcl); sp->vcl = VCL_Get(); - assert(sp->obj == NULL); - assert(sp->vbc == NULL); + AZ(sp->obj); + AZ(sp->vbc); sp->wrk->acct.req++; done = http_DissectRequest(sp->http, sp->fd); Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2006-08-24 07:57:07 UTC (rev 914) @@ -65,10 +65,10 @@ memset(cli, 0, sizeof *cli); cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); - assert(cli->sb != NULL); + XXXAN(cli->sb); lbuf = 4096; buf = malloc(lbuf); - assert(buf != NULL); + XXXAN(buf); nbuf = 0; while (1) { pfd[0].fd = heritage.fds[2]; @@ -79,7 +79,7 @@ if ((nbuf + 2) >= lbuf) { lbuf += lbuf; buf = realloc(buf, lbuf); - assert(buf != NULL); + XXXAN(buf); } i = read(heritage.fds[2], buf + nbuf, lbuf - nbuf); if (i <= 0) { Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-08-24 07:57:07 UTC (rev 914) @@ -110,7 +110,7 @@ (void)arg; sp = SES_New(NULL, 0); - assert(sp != NULL); + XXXAN(sp); while (1) { t = time(NULL); LOCK(&exp_mtx); @@ -179,7 +179,7 @@ AZ(pthread_mutex_init(&exp_mtx, NULL)); exp_heap = binheap_new(NULL, object_cmp, object_update); - assert(exp_heap != NULL); + XXXAN(exp_heap); AZ(pthread_create(&exp_thread, NULL, exp_prefetch, NULL)); AZ(pthread_create(&exp_thread, NULL, exp_hangman, NULL)); } Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-08-24 07:57:07 UTC (rev 914) @@ -40,7 +40,7 @@ cl = strtoumax(b, NULL, 0); st = stevedore->alloc(stevedore, cl); - assert(st->stevedore != NULL); + XXXAN(st->stevedore); TAILQ_INSERT_TAIL(&sp->obj->store, st, list); st->len = cl; sp->obj->len = cl; @@ -52,7 +52,7 @@ while (cl > 0) { i = http_Read(hp, fd, p, cl); - assert(i > 0); /* XXX seen */ + xxxassert(i > 0); /* XXX seen */ p += i; cl -= i; } @@ -82,18 +82,18 @@ st = NULL; while (1) { i = http_Read(hp, fd, bp, be - bp); - assert(i >= 0); + xxxassert(i >= 0); bp += i; *bp = '\0'; u = strtoul(buf, &q, 16); if (q == NULL || q == buf) continue; - assert(isspace(*q)); + xxxassert(isspace(*q)); while (*q == '\t' || *q == ' ') q++; if (*q == '\r') q++; - assert(*q == '\n'); + xxxassert(*q == '\n'); q++; if (u == 0) break; @@ -105,7 +105,7 @@ } else { st = stevedore->alloc(stevedore, stevedore->trim == NULL ? u : CHUNK_PREALLOC); - assert(st->stevedore != NULL); + XXXAN(st->stevedore); TAILQ_INSERT_TAIL(&sp->obj->store, st, list); p = st->ptr; } @@ -114,9 +114,9 @@ v = u; i = bp - q; + assert(i >= 0); if (i == 0) { } else if (v > i) { - assert(i > 0); memcpy(p, q, i); p += i; st->len += i; @@ -141,7 +141,6 @@ continue; while (v > 0) { i = http_Read(hp, fd, p, v); - assert(i > 0); st->len += i; v -= i; u -= i; @@ -178,15 +177,15 @@ while (1) { if (v == 0) { st = stevedore->alloc(stevedore, CHUNK_PREALLOC); - assert(st->stevedore != NULL); + XXXAN(st->stevedore); TAILQ_INSERT_TAIL(&sp->obj->store, st, list); p = st->ptr + st->len; v = st->space - st->len; } - assert(p != NULL); - assert(st != NULL); + AN(p); + AN(st); i = http_Read(hp, fd, p, v); - assert(i >= 0); + xxxassert(i >= 0); if (i == 0) break; p += i; @@ -286,7 +285,7 @@ vc = VBE_GetFd(sp->backend, sp->xid); if (vc == NULL) vc = VBE_GetFd(sp->backend, sp->xid); - assert(vc != NULL); /* XXX: handle this */ + XXXAN(vc); VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name); http_ClrHeader(vc->http); @@ -302,19 +301,19 @@ WRK_Reset(w, &vc->fd); http_Write(w, vc->http, 0); i = WRK_Flush(w); - assert(i == 0); + xxxassert(i == 0); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); i = http_RecvHead(vc->http, vc->fd); - assert(i == 0); - assert(http_DissectResponse(vc->http, vc->fd) == 0); + xxxassert(i == 0); + xxxassert(http_DissectResponse(vc->http, vc->fd) == 0); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); - assert(sp->vbc == NULL); + AZ(sp->vbc); sp->vbc = vc; sp->obj->entered = time(NULL); Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2006-08-24 07:57:07 UTC (rev 914) @@ -50,14 +50,14 @@ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(sp->http, HTTP_MAGIC); - assert(hash != NULL); + AN(hash); w = sp->wrk; h = sp->http; /* Precreate an objhead and object in case we need them */ if (w->nobjhead == NULL) { w->nobjhead = calloc(sizeof *w->nobjhead, 1); - assert(w->nobjhead != NULL); + XXXAN(w->nobjhead); w->nobjhead->magic = OBJHEAD_MAGIC; TAILQ_INIT(&w->nobjhead->objects); AZ(pthread_mutex_init(&w->nobjhead->mtx, NULL)); @@ -66,7 +66,7 @@ CHECK_OBJ_NOTNULL(w->nobjhead, OBJHEAD_MAGIC); if (w->nobj == NULL) { w->nobj = calloc(sizeof *w->nobj, 1); - assert(w->nobj != NULL); + XXXAN(w->nobj); w->nobj->magic = OBJECT_MAGIC; w->nobj->http.magic = HTTP_MAGIC; w->nobj->busy = 1; @@ -139,7 +139,7 @@ { struct sess *sp; - assert(o != NULL); + CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); assert(o->busy); assert(o->refcnt > 0); if (o->cacheable) Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2006-08-24 07:57:07 UTC (rev 914) @@ -87,9 +87,9 @@ { unsigned l; - assert(hh->b != NULL); - assert(hh->e != NULL); - assert(hdr != NULL); + AN(hh->b); + AN(hh->e); + AN(hdr); l = hdr[0]; assert(l == strlen(hdr + 1)); assert(hdr[l] == ':'); @@ -105,8 +105,8 @@ unsigned u; for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) { - assert(hp->hd[u].b != NULL); - assert(hp->hd[u].e != NULL); + AN(hp->hd[u].b); + AN(hp->hd[u].e); if (hp->hd[u].e < hp->hd[u].b + l + 1) continue; if (hp->hd[u].b[l] != ':') @@ -221,7 +221,7 @@ if (!http_GetHdr(hp, hdr, &p)) return (0); - assert(p != NULL); + AN(p); if (!strcasecmp(p, val)) return (1); return (0); @@ -285,7 +285,7 @@ http_GetStatus(struct http *hp) { - assert(hp->hd[HTTP_HDR_STATUS].b != NULL); + AN(hp->hd[HTTP_HDR_STATUS].b); return (strtoul(hp->hd[HTTP_HDR_STATUS].b, NULL /* XXX */, 10)); } @@ -346,7 +346,8 @@ { char *p; - assert(hp->t != NULL); + CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); + AN(hp->t); assert(hp->s < hp->t); assert(hp->t <= hp->v); hp->logtag = HTTP_Rx; @@ -412,7 +413,8 @@ { char *p, *q; - assert(hp->t != NULL); + CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); + AN(hp->t); assert(hp->s < hp->t); assert(hp->t <= hp->v); hp->logtag = HTTP_Rx; @@ -462,6 +464,7 @@ { char *p; + CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); assert(hp->v <= hp->e); assert(*hp->v == '\0'); /* Skip any leading white space */ @@ -595,17 +598,17 @@ for (u = 0; u < fm->nhd; u++) { if (fm->hd[u].b == NULL) continue; - assert(fm->hd[u].e != NULL); + AN(fm->hd[u].e); l += (fm->hd[u].e - fm->hd[u].b) + 1; } to->s = malloc(l); - assert(to->s != NULL); + XXXAN(to->s); to->e = to->s + l; to->f = to->s; for (u = 0; u < fm->nhd; u++) { if (fm->hd[u].b == NULL) continue; - assert(fm->hd[u].e != NULL); + AN(fm->hd[u].e); assert(*fm->hd[u].e == '\0'); l = fm->hd[u].e - fm->hd[u].b; assert(l == strlen(fm->hd[u].b)); @@ -623,8 +626,9 @@ static void http_seth(int fd, struct http *to, unsigned n, enum httptag tag, const char *fm) { + assert(n < HTTP_HDR_MAX); - assert(fm != NULL); + AN(fm); to->hd[n].b = (void*)(uintptr_t)fm; to->hd[n].e = (void*)(uintptr_t)strchr(fm, '\0'); to->hdf[n] = 0; @@ -636,7 +640,7 @@ { assert(n < HTTP_HDR_MAX); - assert(fm->hd[n].b != NULL); + AN(fm->hd[n].b); to->hd[n].b = fm->hd[n].b; to->hd[n].e = fm->hd[n].e; to->hdf[n] = fm->hdf[n]; @@ -693,7 +697,7 @@ CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); assert(n < HTTP_HDR_MAX); - assert(fm->hd[n].b != NULL); + AN(fm->hd[n].b); if (to->nhd < HTTP_HDR_MAX) { to->hd[to->nhd].b = fm->hd[n].b; to->hd[to->nhd].e = fm->hd[n].e; @@ -788,19 +792,19 @@ unsigned u, l; if (resp) { - assert(hp->hd[HTTP_HDR_STATUS].b != NULL); + AN(hp->hd[HTTP_HDR_STATUS].b); l = WRK_WriteH(w, &hp->hd[HTTP_HDR_PROTO], " "); l += WRK_WriteH(w, &hp->hd[HTTP_HDR_STATUS], " "); l += WRK_WriteH(w, &hp->hd[HTTP_HDR_RESPONSE], "\r\n"); } else { - assert(hp->hd[HTTP_HDR_URL].b != NULL); + AN(hp->hd[HTTP_HDR_URL].b); l = WRK_WriteH(w, &hp->hd[HTTP_HDR_REQ], " "); l += WRK_WriteH(w, &hp->hd[HTTP_HDR_URL], " "); l += WRK_WriteH(w, &hp->hd[HTTP_HDR_PROTO], "\r\n"); } for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) { - assert(hp->hd[u].b != NULL); - assert(hp->hd[u].e != NULL); + AN(hp->hd[u].b); + AN(hp->hd[u].e); l += WRK_WriteH(w, &hp->hd[u], "\r\n"); } l += WRK_Write(w, "\r\n", -1); Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-24 07:57:07 UTC (rev 914) @@ -49,7 +49,6 @@ vca_close_session(sp, "backend closed"); return (1); } - assert(i > 0); sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, buf, i); if (WRK_Flush(sp->wrk)) vca_close_session(sp, "remote closed"); @@ -79,7 +78,7 @@ p = buf; while (1) { i = http_Read(hp, fd, bp, be - bp); - assert(i >= 0); + xxxassert(i >= 0); if (i == 0 && p == bp) break; bp += i; @@ -131,7 +130,7 @@ if (j > be - bp) j = be - bp; i = http_Read(hp, fd, bp, j); - assert(i > 0); + xxxassert(i > 0); bp += i; } } @@ -150,8 +149,9 @@ char *b; int cls; + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(sp->vbc, VBE_CONN_MAGIC); vc = sp->vbc; - assert(vc != NULL); sp->vbc = NULL; clock_gettime(CLOCK_REALTIME, &sp->t_resp); @@ -207,7 +207,6 @@ RES_Error(sp, 503, "Backend did not respond."); return (1); } - assert(vc != NULL); VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name); http_CopyReq(vc->fd, vc->http, sp->http); @@ -216,12 +215,12 @@ WRK_Reset(w, &vc->fd); http_Write(w, vc->http, 0); i = WRK_Flush(w); - assert(i == 0); + xxxassert(i == 0); /* XXX: copy any contents */ i = http_RecvHead(vc->http, vc->fd); - assert(i == 0); + xxxassert(i == 0); http_DissectResponse(vc->http, vc->fd); assert(sp->vbc == NULL); Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-24 07:57:07 UTC (rev 914) @@ -58,7 +58,6 @@ RES_Error(sp, 503, "Backend did not respond."); return; } - assert(vc != NULL); VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name); vc->http->logtag = HTTP_Tx; Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-24 07:57:07 UTC (rev 914) @@ -69,10 +69,10 @@ unsigned u; CHECK_OBJ_NOTNULL(w, WORKER_MAGIC); - assert(w != NULL); - assert(hh != NULL); - assert(hh->b != NULL); - assert(hh->e != NULL); + AN(w); + AN(hh); + AN(hh->b); + AN(hh->e); u = WRK_Write(w, hh->b, hh->e - hh->b); if (suf != NULL) u += WRK_Write(w, suf, -1); @@ -128,7 +128,7 @@ struct workreq *wrq; wrq = TAILQ_FIRST(&wrk_reqhead); - assert(wrq != NULL); + AN(wrq); VSL_stats->n_wrk_busy++; TAILQ_REMOVE(&wrk_reqhead, wrq, list); VSL_stats->n_wrk_queue--; Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-24 07:57:07 UTC (rev 914) @@ -82,7 +82,7 @@ } sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); - assert(sb != NULL); + XXXAN(sb); assert(code >= 100 && code <= 999); if (msg == NULL) { @@ -226,7 +226,7 @@ TAILQ_FOREACH(st, &sp->obj->store, list) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); - assert(st->stevedore != NULL); + AN(st->stevedore); u += st->len; sp->wrk->acct.bodybytes += st->len; #ifdef HAVE_SENDFILE Modified: trunk/varnish-cache/bin/varnishd/cache_session.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-24 07:57:07 UTC (rev 914) @@ -72,7 +72,7 @@ struct srcaddrhead *ch; time_t now; - assert(sp->srcaddr == NULL); + AZ(sp->srcaddr); for (u = 0, p = sp->addr; *p; p++) u += u + *p; v = u % CLIENT_HASH; @@ -110,12 +110,12 @@ } if (c3 == NULL) { c3 = malloc(sizeof *c3); - assert(c3 != NULL); + XXXAN(c3); if (c3 != NULL) VSL_stats->n_srcaddr++; } else TAILQ_REMOVE(ch, c3, list); - assert (c3 != NULL); + AN(c3); if (c3 != NULL) { memset(c3, 0, sizeof *c3); strcpy(c3->addr, sp->addr); @@ -177,7 +177,7 @@ /* If we never get to work pool (illegal req) */ return; } - assert(sp->srcaddr != NULL); + AN(sp->srcaddr); LOCK(&ses_mtx); assert(sp->srcaddr->nref > 0); sp->srcaddr->nref--; @@ -236,7 +236,7 @@ sm->sess.http = &sm->http; sm->sess.sockaddr = sm->sockaddr; - assert(len < sizeof(sm->sockaddr)); + assert(len < sizeof(sm->sockaddr)); if (addr != NULL) { memcpy(sm->sess.sockaddr, addr, len); sm->sess.sockaddrlen = len; @@ -259,8 +259,8 @@ sm = sp->mem; CHECK_OBJ_NOTNULL(sm, SESSMEM_MAGIC); - assert(sp->obj == NULL); - assert(sp->vcl == NULL); + AZ(sp->obj); + AZ(sp->vcl); VSL_stats->n_sess--; ses_relsrcaddr(sp); VSL(SLT_StatSess, sp->id, "%s %s %d %ju %ju %ju %ju %ju %ju %ju", Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2006-08-24 07:57:07 UTC (rev 914) @@ -47,9 +47,9 @@ struct VCL_conf *vc; LOCK(&vcl_mtx); - assert(vcl_active != NULL); + AN(vcl_active); vc = vcl_active->conf; - assert(vc != NULL); + AN(vc); vc->busy++; UNLOCK(&vcl_mtx); return (vc); @@ -106,7 +106,7 @@ } vcl = calloc(sizeof *vcl, 1); - assert(vcl != NULL); + XXXAN(vcl); vcl->dlh = dlopen(fn, RTLD_NOW | RTLD_LOCAL); @@ -140,7 +140,7 @@ } vcl->conf->priv = vcl; vcl->name = strdup(name); - assert(vcl->name != NULL); + XXXAN(vcl->name); TAILQ_INSERT_TAIL(&vcl_head, vcl, list); LOCK(&vcl_mtx); if (vcl_active == NULL) Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-08-24 07:57:07 UTC (rev 914) @@ -47,8 +47,7 @@ char *p; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - assert(sp != NULL); - assert(sp->http != NULL); + AN(sp->http); if (!http_GetHdr(sp->http, n, &p)) return (NULL); return (p); @@ -80,10 +79,10 @@ int i; cp->backend = calloc(sizeof *cp->backend, cp->nbackend); - assert(cp->backend != NULL); + XXXAN(cp->backend); for (i = 0; i < cp->nbackend; i++) { cp->backend[i] = calloc(sizeof *cp->backend[i], 1); - assert(cp->backend[i] != NULL); + XXXAN(cp->backend[i]); cp->backend[i]->magic = BACKEND_MAGIC; TAILQ_INIT(&cp->backend[i]->connlist); } Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c 2006-08-24 07:57:07 UTC (rev 914) @@ -34,7 +34,7 @@ vrt_acl_vsl(struct sess *sp, const char *acl, struct vrt_acl *ap, int r) { - assert(ap != NULL); + AN(ap); if (ap->name == NULL) { assert(r == 0); VSL(SLT_VCL_acl, sp->fd, "NO_MATCH %s", acl); Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_re.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2006-08-24 07:57:07 UTC (rev 914) @@ -20,12 +20,11 @@ VRT_re_init(void **rep, const char *re) { regex_t *t; - int i; t = calloc(sizeof *t, 1); - assert(t != NULL); - i = regcomp(t, re, REG_EXTENDED | REG_NOSUB); - assert(i == 0); + XXXAN(t); + /* This was already check-compiled by the VCL compiler */ + AZ(regcomp(t, re, REG_EXTENDED | REG_NOSUB)); *rep = t; } @@ -45,7 +44,7 @@ if (s == NULL) return (0); - assert(re != NULL); + AN(re); t = re; i = regexec(t, s, 0, NULL, 0); if (i == 0) Modified: trunk/varnish-cache/bin/varnishd/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/flint.lnt 2006-08-24 07:57:07 UTC (rev 914) @@ -8,6 +8,7 @@ -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) -sem(lbv_assert, r_no) +-sem(lbv_xxxassert, r_no) -ffc // No automatic custody Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2006-08-24 07:57:07 UTC (rev 914) @@ -142,7 +142,7 @@ unsigned u; hcl_head = calloc(sizeof *hcl_head, hcl_nhash); - assert(hcl_head != NULL); + XXXAN(hcl_head); for (u = 0; u < hcl_nhash; u++) { TAILQ_INIT(&hcl_head[u].head); @@ -220,7 +220,7 @@ i = sizeof *he2 + kl; he2 = calloc(i, 1); - assert(he2 != NULL); + XXXAN(he2); he2->magic = HCL_ENTRY_MAGIC; he2->oh = noh; he2->digest = digest; Modified: trunk/varnish-cache/bin/varnishd/hash_simple_list.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_simple_list.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/hash_simple_list.c 2006-08-24 07:57:07 UTC (rev 914) @@ -71,13 +71,13 @@ return (NULL); } he2 = calloc(sizeof *he2, 1); - assert(he2 != NULL); + XXXAN(he2); he2->obj = nobj; he2->refcnt = 1; he2->key1 = strdup(key1); - assert(he2->key1 != NULL); + XXXAN(he2->key1); he2->key2 = strdup(key2); - assert(he2->key2 != NULL); + XXXAN(he2->key2); nobj->hashpriv = he2; if (he != NULL) TAILQ_INSERT_BEFORE(he, he2, list); @@ -97,7 +97,7 @@ struct hsl_entry *he; int ret; - assert(obj->hashpriv != NULL); + AN(obj->hashpriv); he = obj->hashpriv; LOCK(&hsl_mutex); if (--he->refcnt == 0) { Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-24 07:57:07 UTC (rev 914) @@ -114,7 +114,7 @@ /* Redirect stdin/out/err */ AZ(close(0)); i = open("/dev/null", O_RDONLY); - assert(i == 0); + xxxassert(i == 0); assert(dup2(child_fds[1], 1) == 1); assert(dup2(child_fds[1], 2) == 2); AZ(close(child_fds[0])); @@ -137,9 +137,9 @@ AZ(close(child_fds[1])); child_fds[1] = -1; - assert(ev_listen == NULL); + AZ(ev_listen); e = ev_new(); - assert(e != NULL); + XXXAN(e); e->fd = child_fds[0]; e->fd_flags = EV_RD; e->name = "Child listener"; @@ -147,9 +147,9 @@ AZ(ev_add(mgt_evb, e)); ev_listen = e; - assert(ev_poker == NULL); + AZ(ev_poker); e = ev_new(); - assert(e != NULL); + XXXAN(e); e->timeout = 3.0; e->callback = child_poker; e->name = "child poker"; @@ -287,7 +287,7 @@ mgt_pid = getpid(); mgt_evb = ev_new_base(); - assert(mgt_evb != NULL); + XXXAN(mgt_evb); if (dflag) mgt_cli_setup(0, 1, 1); @@ -296,21 +296,21 @@ mgt_cli_telnet(T_arg); e = ev_new(); - assert(e != NULL); + XXXAN(e); e->sig = SIGTERM; e->callback = mgt_sigint; e->name = "mgt_sigterm"; AZ(ev_add(mgt_evb, e)); e = ev_new(); - assert(e != NULL); + XXXAN(e); e->sig = SIGINT; e->callback = mgt_sigint; e->name = "mgt_sigint"; AZ(ev_add(mgt_evb, e)); e = ev_new(); - assert(e != NULL); + XXXAN(e); e->sig = SIGCHLD; e->sig_flags = SA_NOCLDSTOP; e->callback = mgt_sigchld; Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-24 07:57:07 UTC (rev 914) @@ -40,7 +40,7 @@ (void)av; (void)priv; - assert (VSL_stats != NULL); + AN(VSL_stats); #define MAC_STAT(n,t,f,d) \ cli_out(cli, "%12ju " d "\n", (VSL_stats->n)); #include "stat_field.h" @@ -72,7 +72,7 @@ for (u = 1; av[u] != NULL; u++) v += strlen(av[u]) + 3; p = malloc(v); - assert(p != NULL); + XXXAN(p); q = p; for (u = 1; av[u] != NULL; u++) { *q++ = '"'; @@ -90,7 +90,7 @@ *q++ = '\n'; v = q - p; i = write(cli_o, p, v); - assert(i == v); + xxxassert(i == v); free(p); i = cli_readres(cli_i, &u, &p, 3.0); @@ -149,7 +149,7 @@ for (cp = CLI_cmds; cp->request != NULL; cp++) u++; cli_proto = calloc(sizeof *cli_proto, u + 1); - assert(cli_proto != NULL); + XXXAN(cli_proto); u = 0; for (cp = mgt_cli_proto; cp->request != NULL; cp++) cli_proto[u++] = *cp; @@ -268,7 +268,7 @@ if (cp->nbuf == cp->lbuf) { cp->lbuf += cp->lbuf; cp->buf = realloc(cp->buf, cp->lbuf); - assert(cp->buf != NULL); + XXXAN(cp->buf); } i = read(cp->fdi, cp->buf + cp->nbuf, cp->lbuf - cp->nbuf); if (i <= 0) @@ -313,7 +313,7 @@ struct cli_port *cp; cp = calloc(sizeof *cp, 1); - assert(cp != NULL); + XXXAN(cp); sprintf(cp->name, "cli %d->%d", fdi, fdo); cp->magic = CLI_PORT_MAGIC; @@ -324,10 +324,10 @@ cp->lbuf = 4096; cp->buf = malloc(cp->lbuf); - assert(cp->buf != NULL); + XXXAN(cp->buf); cp->cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); - assert(cp->cli->sb != NULL); + XXXAN(cp->cli->sb); cp->ev = calloc(sizeof *cp->ev, 1); cp->ev->name = cp->name; @@ -370,7 +370,7 @@ exit (2); } telnet_ev = ev_new(); - assert(telnet_ev != NULL); + XXXAN(telnet_ev); telnet_ev->fd = telnet_sock; telnet_ev->fd_flags = POLLIN; telnet_ev->callback = telnet_accept; Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-24 07:57:07 UTC (rev 914) @@ -292,12 +292,11 @@ q = strchr(p, '\n'); if (q == NULL) q = strchr(p, '\0'); - assert(q != NULL); if (q > p + 52) { q = p + 52; while (q > p && *q != ' ') q--; - assert(q != NULL); + AN(q); } cli_out(cli, "%20s %.*s\n", "", q - p, p); p = q; Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2006-08-24 07:57:07 UTC (rev 914) @@ -83,7 +83,7 @@ struct vclprog *vp; vp = calloc(sizeof *vp, 1); - assert(vp != NULL); + XXXAN(vp); vp->name = strdup(name); vp->fname = file; TAILQ_INSERT_TAIL(&vclhead, vp, list); @@ -95,7 +95,7 @@ { TAILQ_REMOVE(&vclhead, vp, list); printf("unlink %s\n", vp->fname); - AZ(unlink(vp->fname)); /* XXX assert for now */ + XXXAZ(unlink(vp->fname)); free(vp->fname); free(vp->name); free(vp); @@ -126,7 +126,7 @@ struct vclprog *vp; sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); - assert(sb != NULL); + XXXAN(sb); if (b_arg != NULL) { /* * XXX: should do a "HEAD /" on the -b argument to see that @@ -149,7 +149,7 @@ "}\n", addr, port ? port : "http"); free(addr); free(port); - assert(buf != NULL); + AN(buf); vf = VCC_Compile(sb, buf, NULL); free(buf); } else { @@ -231,7 +231,7 @@ (void)priv; sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); - assert(sb != NULL); + XXXAN(sb); vf = VCC_Compile(sb, av[3], NULL); vsb_finish(sb); if (vsb_len(sb) > 0) { @@ -262,7 +262,7 @@ (void)priv; sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); - assert(sb != NULL); + XXXAN(sb); vf = VCC_CompileFile(sb, av[3]); vsb_finish(sb); if (vsb_len(sb) > 0) { Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2006-08-24 07:57:07 UTC (rev 914) @@ -52,7 +52,6 @@ assert(b != NULL); if (e == NULL) e = strchr(b, '\0'); - assert(e != NULL); /* Truncate */ l = e - b; @@ -185,7 +184,7 @@ slh.ptr = 0; slh.start = sizeof slh + sizeof *params; i = write(heritage.vsl_fd, &slh, sizeof slh); - assert(i == sizeof slh); + xxxassert(i == sizeof slh); heritage.vsl_size = slh.start + size; AZ(ftruncate(heritage.vsl_fd, (off_t)heritage.vsl_size)); } @@ -210,7 +209,7 @@ PROT_READ|PROT_WRITE, MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED, heritage.vsl_fd, 0); - assert(loghead != MAP_FAILED); + xxxassert(loghead != MAP_FAILED); VSL_stats = &loghead->stats; pp = (void *)(loghead + 1); memcpy(pp, params, sizeof *pp); Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2006-08-24 07:57:07 UTC (rev 914) @@ -92,7 +92,7 @@ if (bs < fsst.f_bsize) bs = fsst.f_bsize; - assert(S_ISREG(st.st_mode)); + xxxassert(S_ISREG(st.st_mode)); i = sscanf(size, "%ju%1s", &l, suff); /* can return -1, 0, 1 or 2 */ @@ -202,7 +202,7 @@ struct smf_sc *sc; sc = calloc(sizeof *sc, 1); - assert(sc != NULL); + XXXAN(sc); TAILQ_INIT(&sc->order); TAILQ_INIT(&sc->free); TAILQ_INIT(&sc->used); @@ -218,9 +218,9 @@ asprintf(&p, "%s,", spec); else p = strdup(spec); - assert(p != NULL); + XXXAN(p); size = strchr(p, ','); - assert(size != NULL); + XXXAN(size); *size++ = '\0'; @@ -269,7 +269,7 @@ } asprintf(&q, "%s/varnish.XXXXXX", p); - assert(q != NULL); + XXXAN(q); sc->fd = mkstemp(q); if (sc->fd < 0) { fprintf(stderr, @@ -279,7 +279,7 @@ } AZ(unlink(q)); asprintf(&sc->filename, "%s (unlinked)", q); - assert(sc->filename != NULL); + XXXAN(sc->filename); free(q); smf_initfile(sc, size, 1); } @@ -310,7 +310,7 @@ /* Split from front */ sp2 = malloc(sizeof *sp2); - assert(sp2 != NULL); + XXXAN(sp2); VSL_stats->n_smf++; *sp2 = *sp; @@ -390,7 +390,7 @@ assert(bytes > 0); CHECK_OBJ_NOTNULL(sp, SMF_MAGIC); sp2 = malloc(sizeof *sp2); - assert(sp2 != NULL); + XXXAN(sp2); VSL_stats->n_smf++; *sp2 = *sp; @@ -413,7 +413,7 @@ struct smf *sp, *sp2; sp = calloc(sizeof *sp, 1); - assert(sp != NULL); + XXXAN(sp); sp->magic = SMF_MAGIC; sp->s.magic = STORAGE_MAGIC; VSL_stats->n_smf++; @@ -515,7 +515,7 @@ smf = alloc_smf(sc, size); CHECK_OBJ_NOTNULL(smf, SMF_MAGIC); UNLOCK(&sc->mtx); - assert(smf != NULL); + XXXAN(smf); assert(smf->size == size); smf->s.space = size; smf->s.priv = smf; @@ -542,7 +542,7 @@ return; } assert(size <= s->space); - assert(size > 0); /* XXX: seen */ + xxxassert(size > 0); /* XXX: seen */ CAST_OBJ_NOTNULL(smf, s->priv, SMF_MAGIC); assert(size <= smf->size); sc = smf->sc; Modified: trunk/varnish-cache/bin/varnishd/storage_malloc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_malloc.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/storage_malloc.c 2006-08-24 07:57:07 UTC (rev 914) @@ -18,10 +18,10 @@ struct sma *sma; sma = calloc(sizeof *sma, 1); - assert(sma != NULL); + XXXAN(sma); sma->s.priv = sma; sma->s.ptr = malloc(size); - assert(sma->s.ptr != NULL); + XXXAN(sma->s.ptr); sma->s.len = 0; sma->s.space = size; sma->s.fd = -1; Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-24 07:17:35 UTC (rev 913) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-08-24 07:57:07 UTC (rev 914) @@ -57,8 +57,8 @@ q = p = strchr(s_arg, '\0'); else q = p + 1; - assert(p != NULL); - assert(q != NULL); + xxxassert(p != NULL); + xxxassert(q != NULL); if (!cmp_hash(&hcl_slinger, s_arg, p)) { hp = &hcl_slinger; } else if (!cmp_hash(&hsl_slinger, s_arg, p)) { @@ -102,8 +102,8 @@ q = p = strchr(s_arg, '\0'); else q = p + 1; - assert(p != NULL); - assert(q != NULL); + xxxassert(p != NULL); + xxxassert(q != NULL); if (!cmp_storage(&sma_stevedore, s_arg, p)) { stp = &sma_stevedore; } else if (!cmp_storage(&smf_stevedore, s_arg, p)) { @@ -267,12 +267,12 @@ i = read(pipes[1][0], buf, sizeof buf - 1); buf[i] = '\0'; d_child = strtoul(buf, &p, 0); - assert(p != NULL); + xxxassert(p != NULL); printf("New Pid %d\n", d_child); - assert(d_child != 0); + xxxassert(d_child != 0); i = strlen(p); j = write(pipes[1][1], p, i); - assert(j == i); + xxxassert(j == i); while (1) { if (pfd[0].fd == -1 && pfd[1].fd == -1)