* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
/* -------------------------------------------------------------------*/
-struct object {
+struct object {
unsigned magic;
#define OBJECT_MAGIC 0x32851d42
unsigned refcnt;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* XXX: We need to pass sessions back into the event engine when they are
* 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$
*
+ * $Id$
*/
struct sess;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* XXX: We need to pass sessions back into the event engine when they are
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* XXX: We need to pass sessions back into the event engine when they are
continue;
if (kp->filter == EVFILT_TIMER) {
dotimer = 1;
- continue;
+ continue;
}
assert(kp->filter == EVFILT_READ);
vca_kev(kp);
sp = TAILQ_FIRST(&sesshead);
if (sp == NULL)
break;
- if (sp->t_open.tv_sec > ts.tv_sec)
+ 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)
i = fcntl(pipes[0], F_GETFL);
i |= O_NONBLOCK;
i = fcntl(pipes[0], F_SETFL, i);
-
+
AZ(pthread_create(&vca_kqueue_thread, NULL, vca_kqueue_main, NULL));
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* XXX: We need to pass sessions back into the event engine when they are
p = realloc(pollfd, u * sizeof *p);
XXXAN(p); /* close offending fd */
memset(p + npoll, 0, (u - npoll) * sizeof *p);
- for (v = npoll ; v <= u; v++)
+ for (v = npoll ; v <= u; v++)
p->fd = -1;
pollfd = p;
npoll = u;
break;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
fd = sp->fd;
- if (pollfd[fd].revents) {
+ if (pollfd[fd].revents) {
v--;
i = vca_pollsession(sp);
if (i < 0)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Manage backend connections.
int s;
s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
- if (s < 0)
+ if (s < 0)
return (s);
else if (connect(s, ai->ai_addr, ai->ai_addrlen)) {
AZ(close(s));
s = -1;
- }
+ }
return (s);
}
AN(bp->hostname);
s = vbe_conn_try(bp, &ai);
- if (s < 0)
+ if (s < 0)
return (s);
TCP_myname(s, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Ban processing
i = regcomp(&b->regexp, regexp, REG_EXTENDED | REG_NOSUB);
if (i) {
char buf[512];
-
+
(void)regerror(i, &b->regexp, buf, sizeof buf);
VSL(SLT_Debug, 0, "REGEX: <%s>", buf);
}
i = regexec(&b->regexp, url, 0, NULL, 0);
if (!i)
return (1);
- }
+ }
o->ban_seq = b0->gen;
return (0);
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* This file contains the central state machine for pushing requests.
* extract the DOT lines and run though dot(1), for instance with the
* command:
* sed -n '/^DOT/s///p' cache_center.c | dot -Tps > /tmp/_.ps
- *
*/
/*
assert(sp->xid == 0);
- do
+ do
i = http_RecvSome(sp->fd, sp->http);
while (i == -1);
if (i == 0) {
DOT vcl_fetch -> fetch_error [label="error"]
DOT }
DOT fetch_lookup -> LOOKUP [style=dotted, weight=0]
-DOT fetch_pass -> PASSBODY
-DOT fetch_ipass -> PASSBODY
+DOT fetch_pass -> PASSBODY
+DOT fetch_ipass -> PASSBODY
DOT fetch_insert -> DELIVER [style=bold]
DOT fetch_error -> ERROR
*/
sp->wrk->idle = sp->t_open.tv_sec;
sp->wrk->acct.sess++;
SES_RefSrcAddr(sp);
- do
+ do
i = http_RecvSome(sp->fd, sp->http);
while (i == -1);
if (i == 0) {
/*
* We don't assign to sp->obj directly because it is used
- * to cache state when we encounter a busy object.
+ * to cache state when we encounter a busy object.
*/
o = HSH_Lookup(sp);
if (!PassSession(sp)) {
AN(sp->vbc);
sp->step = STP_PASSBODY;
- } else
+ } else
sp->step = STP_DONE;
return (0);
}
/*--------------------------------------------------------------------
* Central state engine dispatcher.
- *
+ *
* We grab a VCL reference, and keeps kicking the session around until
* it has had enough.
*
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
cli = &clis;
memset(cli, 0, sizeof *cli);
-
+
cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
XXXAN(cli->sb);
lbuf = 4096;
}
VSL(SLT_CLI, 0, "Wr %d %d %s",
i, cli->result, vsb_data(cli->sb));
- i = ++p - buf;
+ i = ++p - buf;
assert(i <= nbuf);
if (i < nbuf)
memcpy(buf, p, nbuf - i);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Expiry of cached objects and execution of prefetcher
(void)arg;
- t = time(NULL);
+ t = time(NULL);
while (1) {
LOCK(&exp_mtx);
TAILQ_FOREACH(o, &exp_deathrow, deathrow) {
if (o == NULL) {
UNLOCK(&exp_mtx);
AZ(sleep(1));
- t = time(NULL);
+ t = time(NULL);
continue;
}
TAILQ_REMOVE(&exp_deathrow, o, deathrow);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
/* Get some storage if we don't have any */
if (st == NULL || st->len == st->space) {
v = u;
- if (u < params->fetch_chunksize * 1024 &&
+ if (u < params->fetch_chunksize * 1024 &&
stevedore->trim != NULL)
v = params->fetch_chunksize * 1024;
st = stevedore->alloc(stevedore, v);
hp->logtag = HTTP_Obj;
http_CopyResp(sp->wrk, sp->fd, hp, vc->http);
http_FilterHeader(sp->wrk, sp->fd, hp, vc->http, HTTPH_A_INS);
-
+
if (body) {
if (http_GetHdr(vc->http, H_Content_Length, &b))
cls = fetch_straight(sp, vc->fd, vc->http, b);
else if (http_HdrIs(vc->http, H_Transfer_Encoding, "chunked"))
cls = fetch_chunked(sp, vc->fd, vc->http);
- else
+ else
cls = fetch_eof(sp, vc->fd, vc->http);
http_PrintfHeader(sp->wrk, sp->fd, hp,
"Content-Length: %u", sp->obj->len);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* This is the central hash-table code, it relies on a chosen hash
*
* New objects are always marked busy, and they can go from busy to
* not busy only once.
- *
*/
#include <stdio.h>
o->ttl = 0;
VSL(SLT_ExpBan, 0, "%u was banned", o->xid);
EXP_TTLchange(o);
- } else
+ } else
break;
o->refcnt--;
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* HTTP request storage and manipulation
if (hp->t + len > hp->v)
len = hp->v - hp->t;
- if (len == 0)
+ if (len == 0)
return (0);
*b = hp->t;
*e = hp->t + len;
if ((p[0] == 'i' || p[0] == 'I') &&
(p[1] == 'f' || p[1] == 'F') &&
- p[2] == '-')
+ p[2] == '-')
hp->conds = 1;
if (hp->nhd < HTTP_HDR_MAX) {
if (http_header_complete(hp))
return(0);
return (-1);
- }
+ }
if (hp->v != hp->s) {
VSL(SLT_HttpError, fd,
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
http_RecvPrep(hp);
- do
+ do
i = http_RecvSome(fd, hp);
while (i == -1);
return (i);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* XXX: charge bytes to srcaddr
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* XXX: charge bytes to srcaddr
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* XXX: automatic thread-pool size adaptation.
WRK_WriteH(struct worker *w, struct http_hdr *hh, const char *suf)
{
unsigned u;
-
+
CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
AN(w);
AN(hh);
}
UNLOCK(&tmtx);
}
-
+
LOCK(&qp->mtx);
TAILQ_INSERT_HEAD(&qp->idle, w, list);
assert(w->idle != 0);
assert(1 == write(w->pipe[1], w, 1));
return;
}
-
+
UNLOCK(&qp->mtx);
LOCK(&tmtx);
}
/*
* XXX: If there are too many requests in the overflow queue
- * XXX: we should kill the request right here.
+ * XXX: we should kill the request right here.
* XXX: Not sure how though. Simply closing may be the better
* XXX: compromise.
*/
}
/*--------------------------------------------------------------------*/
-
+
static void *
wrk_reaperthread(void *priv)
{
wrk_addpools(params->wthread_pools);
sleep(1);
if (VSL_stats->n_wrk <= params->wthread_min)
- continue;
+ continue;
now = time(NULL);
for (u = 0; u < nwq; u++) {
qp = wq[u];
(w->idle + params->wthread_timeout < now ||
VSL_stats->n_wrk > params->wthread_max))
TAILQ_REMOVE(&qp->idle, w, list);
- else
+ else
w = NULL;
UNLOCK(&qp->mtx);
if (w == NULL)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
expl = mp->expl;
break;
}
- if (expl == NULL)
+ if (expl == NULL)
expl = msg;
AN(expl);
AN(msg);
{
struct storage *st;
unsigned u = 0;
-
+
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
clock_gettime(CLOCK_REALTIME, &sp->t_resp);
if (sp->obj->response == 200 && sp->http->conds && res_do_conds(sp))
return;
-
+
WSL(sp->wrk, SLT_Length, sp->fd, "%u", sp->obj->len);
http_ClrHeader(sp->http);
WRK_Reset(sp->wrk, &sp->fd);
sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-
+
if (sp->wantbody) {
TAILQ_FOREACH(st, &sp->obj->store, list) {
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Session and Client management.
* XXX: The two-list session management is actually not a good idea
* XXX: come to think of it, because we want the sessions reused in
* XXX: Most Recently Used order.
- * XXX: Another and maybe more interesting option would be to cache
- * XXX: free sessions in the worker threads and postpone session
+ * XXX: Another and maybe more interesting option would be to cache
+ * XXX: free sessions in the worker threads and postpone session
* XXX: allocation until then. This does not quite implment MRU order
* XXX: but it does save some locking, although not that much because
* XXX: we still have to do the source-addr lookup.
TAILQ_HEAD(,srcaddr) head;
MTX mtx;
} *srchash;
-
+
static unsigned nsrchash;
static MTX stat_mtx;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
sm = sp->mem;
CHECK_OBJ_NOTNULL(sm, SESSMEM_MAGIC);
-
+
AZ(sp->obj);
AZ(sp->vcl);
VSL_stats->n_sess--;
sp->addr, sp->port, sp->t_end.tv_sec - b->first,
b->sess, b->req, b->pipe, b->pass,
b->fetch, b->hdrbytes, b->bodybytes);
- if (sm->workspace != params->mem_workspace) {
+ if (sm->workspace != params->mem_workspace) {
VSL_stats->n_sess_mem--;
free(sm);
} else {
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Interface *to* compiled VCL code: Loading, unloading, calling into etc.
*
* The interface *from* the compiled VCL code is in cache_vrt.c.
- *
*/
#include <stdio.h>
if (vcl != NULL) {
if (cli == NULL)
fprintf(stderr, "Config '%s' already loaded", name);
- else
+ else
cli_out(cli, "Config '%s' already loaded", name);
return (1);
}
if (vcl->conf == NULL) {
if (cli == NULL)
fprintf(stderr, "No VCL_conf symbol\n");
- else
+ else
cli_out(cli, "No VCL_conf symbol\n");
(void)dlclose(vcl->dlh);
free(vcl);
}
if (vcl->conf->magic != VCL_CONF_MAGIC) {
- if (cli == NULL)
+ if (cli == NULL)
fprintf(stderr, "Wrong VCL_CONF_MAGIC\n");
else
cli_out(cli, "Wrong VCL_CONF_MAGIC\n");
UNLOCK(&vcl_mtx);
if (cli == NULL)
fprintf(stderr, "Loaded \"%s\" as \"%s\"\n", fn , name);
- else
+ else
cli_out(cli, "Loaded \"%s\" as \"%s\"\n", fn , name);
vcl->conf->init_func();
return (0);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Runtime support for compiled VCL programs
void
VRT_error(struct sess *sp, unsigned code, const char *expl)
-{
+{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
WSL(sp->wrk, SLT_Debug, 0, "VCL_error(%u, %s)", code, expl);
void
VRT_count(struct sess *sp, unsigned u)
{
-
+
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
if (params->vcl_trace)
WSL(sp->wrk, SLT_VCL_trace, sp->fd, "%u %d.%d", u,
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Runtime support for compiled VCL programs, ACLs
static uint32_t ipv4mask[] = {
[0] = 0xffffffff,
#define M(n) [n] = (uint32_t)((uint64_t)0xffffffff << (32 - n))
- M( 1), M( 2), M( 3), M( 4), M( 5), M( 6), M( 7), M( 8), M( 9), M(10),
- M(11), M(12), M(13), M(14), M(15), M(16), M(17), M(18), M(19), M(20),
- M(21), M(22), M(23), M(24), M(25), M(26), M(27), M(28), M(29), M(30),
- M(31), M(32)
+ M( 1), M( 2), M( 3), M( 4), M( 5), M( 6), M( 7), M( 8), M( 9), M(10),
+ M(11), M(12), M(13), M(14), M(15), M(16), M(17), M(18), M(19), M(20),
+ M(21), M(22), M(23), M(24), M(25), M(26), M(27), M(28), M(29), M(30),
+ M(31), M(32)
};
static int
VSL(SLT_VCL_acl, sp->fd, "FAIL %s %s", acl, ap->desc);
return (r);
}
-
+
VSL(SLT_VCL_acl, sp->fd, "%s %s %s",
r ? "MATCH" : "NEG_MATCH", acl, ap->desc);
return (r);
} else {
sin1 = NULL;
}
-
+
for ( ; ap->name != NULL; ap++) {
if (ap->priv == NULL && ap->paren)
continue;
if (i != 0) {
fprintf(stderr, "getaddrinfo(%s) = %s\n",
ap->name, gai_strerror(i));
- if (a1 != NULL)
+ if (a1 != NULL)
freeaddrinfo(a1);
a1 = NULL;
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Runtime support for compiled VCL programs, regexps
- *
*/
#include <stdio.h>
VRT_re_test(struct vsb *sb, const char *re)
{
int i;
- regex_t t;
+ regex_t t;
char buf[BUFSIZ];
memset(&t, 0, sizeof t);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* A classic bucketed hash
}
/*--------------------------------------------------------------------
- * The ->start method is called during cache process start and allows
+ * The ->start method is called during cache process start and allows
* initialization to happen before the first lookup.
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* This is the reference hash(/lookup) implementation
static MTX hsl_mutex;
/*--------------------------------------------------------------------
- * The ->init method is called during process start and allows
+ * The ->init method is called during process start and allows
* initialization to happen before the first lookup.
*/
i = strcmp(key1, he->key1);
if (i < 0)
continue;
- if (i > 0)
+ if (i > 0)
break;
i = strcmp(key2, he->key2);
if (i < 0)
continue;
- if (i > 0)
+ if (i > 0)
break;
he->refcnt++;
nobj = he->obj;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* This file contains the heritage passed when mgt forks cache
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* The mechanics of handling the child process
AZ(pipe(&heritage.fds[2]));
AZ(pipe(child_fds));
i = fork();
- if (i < 0)
+ if (i < 0)
errx(1, "Could not fork child");
if (i == 0) {
/* Redirect stdin/out/err */
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* The management process' CLI handling
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
unsigned u;
void *p;
- if (evb->lpfd < evb->npfd)
+ if (evb->lpfd < evb->npfd)
return (0);
if (evb->npfd > 256)
{
struct evsig *os;
- if (sig < ev_nsig)
+ if (sig < ev_nsig)
return (0);
os = calloc(sizeof *os, (sig + 1));
int i;
CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC);
- do
+ do
i = ev_schedule_one(evb);
while (i == 1);
return (i);
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];
* SUCH DAMAGE.
*
* $Id$
- *
*/
#include <poll.h>
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
u = strtoul(arg, NULL, 0);
if (u < min) {
cli_out(cli, "Must be at least %u", min);
- cli_result(cli, CLIS_PARAM);
+ cli_result(cli, CLIS_PARAM);
return;
}
if (u > max) {
cli_out(cli, "Must be no more than %u", max);
- cli_result(cli, CLIS_PARAM);
+ cli_result(cli, CLIS_PARAM);
return;
}
*dest = u;
AN(params->listen_address);
params->listen_host = a;
params->listen_port = p;
- } else
+ } else
cli_out(cli, "%s", params->listen_address);
}
{ "pipe_timeout", tweak_pipe_timeout,
"Idle timeout for PIPE sessions. "
"If nothing have been received in either direction for "
- "this many seconds, the session is closed.\n",
+ "this many seconds, the session is closed.\n",
"60", "seconds" },
{ "send_timeout", tweak_send_timeout,
"Send timeout for client connections. "
cli_out(cli, "%-20s ", pp->name);
if (pp->func == NULL) {
cli_out(cli, "Not implemented.\n");
- if (av[2] != NULL && !lfmt)
+ if (av[2] != NULL && !lfmt)
return;
else
continue;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* VCL compiler stuff
fprintf(stderr, "invalid backend address\n");
return (1);
}
-
+
buf = NULL;
asprintf(&buf,
"backend default {\n"
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
*/
#if PSEUDO_CODE
- /* Marker for no retirement age determined */
- retirement_age = INT_MAX
-
- /* If we have a max-age directive, respect it */
- if (max-age)
- retirement_age = max(0,min(retirement_age, max-age - Age:))
-
- /* If Date: is not in future and Expires: looks sensible, use it */
- if ((!date || date < our_clock) && expires > our_clock) {
- ttd = min(our_clock + retirement_age, Expires:)
-
- /* Otherwise we have clock-skew */
- } else {
- /* If we have both date and expires, infer max-age */
- if (date && expires)
- retirement_age =
- max(0, min(retirement_age, Expires: - Date:)
-
- /* Apply default_ttl if nothing better found */
- if (retirement_age == INT_MAX)
- retirement_age = default_ttl
-
- /* Apply the max-age we can up with */
- ttd = our_clock + retirement_age
- }
-
- /* Apply hard limits */
- ttd = max(ttd, our_clock + hard_lower_ttl)
- ttd = min(ttd, our_clock + hard_upper_ttl)
+ /* Marker for no retirement age determined */
+ retirement_age = INT_MAX
+
+ /* If we have a max-age directive, respect it */
+ if (max-age)
+ retirement_age = max(0,min(retirement_age, max-age - Age:))
+
+ /* If Date: is not in future and Expires: looks sensible, use it */
+ if ((!date || date < our_clock) && expires > our_clock) {
+ ttd = min(our_clock + retirement_age, Expires:)
+
+ /* Otherwise we have clock-skew */
+ } else {
+ /* If we have both date and expires, infer max-age */
+ if (date && expires)
+ retirement_age =
+ max(0, min(retirement_age, Expires: - Date:)
+
+ /* Apply default_ttl if nothing better found */
+ if (retirement_age == INT_MAX)
+ retirement_age = default_ttl
+
+ /* Apply the max-age we can up with */
+ ttd = our_clock + retirement_age
+ }
+
+ /* Apply hard limits */
+ ttd = max(ttd, our_clock + hard_lower_ttl)
+ ttd = min(ttd, our_clock + hard_upper_ttl)
#endif
static time_t
unsigned u1, u2;
time_t h_date, h_expires, ttd;
char *p;
-
+
retirement_age = INT_MAX;
u1 = u2 = 0;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
VSL_stats->shm_cont++; \
} \
} while (0);
-
+
#define UNLOCKSHM(foo) AZ(pthread_mutex_unlock(foo))
#ifndef MAP_HASSEMAPHORE
}
/*--------------------------------------------------------------------*/
-
+
void
VSLR(enum shmlogtag tag, unsigned id, const char *b, const char *e)
{
/* Only hold the lock while we find our space */
LOCKSHM(&vsl_mtx);
- VSL_stats->shm_writes++;
- VSL_stats->shm_records++;
+ VSL_stats->shm_writes++;
+ VSL_stats->shm_records++;
assert(loghead->ptr < loghead->size);
/* Wrap if necessary */
}
LOCKSHM(&vsl_mtx);
- VSL_stats->shm_writes++;
- VSL_stats->shm_records++;
+ VSL_stats->shm_writes++;
+ VSL_stats->shm_records++;
assert(loghead->ptr < loghead->size);
/* Wrap if we cannot fit a full size record */
- if (loghead->ptr + 5 + 255 + 1 >= loghead->size)
+ if (loghead->ptr + 5 + 255 + 1 >= loghead->size)
vsl_wrap();
p = logstart + loghead->ptr;
loghead->ptr += 5 + n;
assert(loghead->ptr < loghead->size);
-
+
UNLOCKSHM(&vsl_mtx);
va_end(ap);
return;
l = w->wlp - w->wlog;
LOCKSHM(&vsl_mtx);
- VSL_stats->shm_writes++;
+ VSL_stats->shm_writes++;
VSL_stats->shm_records += w->wlr;
if (loghead->ptr + l + 1 >= loghead->size)
vsl_wrap();
}
/*--------------------------------------------------------------------*/
-
+
void
WSLR(struct worker *w, enum shmlogtag tag, unsigned id, const char *b, const char *e)
{
* SUCH DAMAGE.
*
* $Id$
- *
*/
STEP(again, AGAIN)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Storage method based on mmap'ed file
/*
* Number of buckets on free-list.
- *
+ *
* Last bucket is "larger than" so choose number so that the second
* to last bucket matches the 128k CHUNKSIZE in cache_fetch.c when
* using the a 4K minimal page size
l = st.st_size;
/* We must have at least one block */
- if (l < bs) {
+ if (l < bs) {
if (i == -1) {
fprintf(stderr,
"Info: (-sfile) default to 80%% size\n");
}
/*--------------------------------------------------------------------
- * Free a range. Attemt merge forward and backward, then sort into
+ * Free a range. Attemt merge forward and backward, then sort into
* free list according to age.
*/
/*
* XXX: This may be too aggressive and soak up too much address room.
- * XXX: On the other hand, the user, directly or implicitly asked us to
+ * XXX: On the other hand, the user, directly or implicitly asked us to
* XXX: use this much storage, so we should make a decent effort.
* XXX: worst case (I think), malloc will fail.
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Storage method based on malloc(3)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* The management process and CLI handling
heritage.socket = -1;
memset(¶m, 0, sizeof param);
params = ¶m;
- mgt_vcc_init();
+ mgt_vcc_init();
MCF_ParamInit(cli);
cli_check(cli);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Log tailer for Varnish
alarm(delay);
}
-static int
+static int
h_hist(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
{
double b;
int i, j;
-
+
(void)priv;
(void)fd;
(void)len;
struct VSL_data *vd;
vd = VSL_New();
-
+
while ((c = getopt(argc, argv, VSL_ARGS "Vw:")) != -1) {
switch (c) {
case 'V':
i = VSL_Dispatch(vd, h_hist, NULL);
if (i < 0)
break;
- }
+ }
return (0);
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Log tailer for Varnish
}
}
-static int
+static int
h_order(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
{
}
else if (i < 0)
break;
- }
+ }
clean_order();
}
struct VSL_data *vd;
vd = VSL_New();
-
+
while ((c = getopt(argc, argv, VSL_ARGS "aoVw:")) != -1) {
switch (c) {
case 'a':
if (VSL_OpenLog(vd))
exit (1);
- if (w_opt != NULL)
+ if (w_opt != NULL)
do_write(vd, w_opt, a_flag);
if (o_flag)
fflush(stdout);
else if (i < 0)
break;
- }
+ }
return (0);
}
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Anders Berg <andersb@vgnett.no>
+ * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Initial implementation by Anders Berg <andersb@vgnett.no> and
- * Poul-Henning Kamp <phk@phk.freebsd.dk>
- *
* $Id$
*
* Program that will get data from the shared memory log. When it has the data
* in NCSA extended/combined access log format.
*
* "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
- *
+ *
* TODO: - Log in any format one wants
* - Maybe rotate/compress log
*/
lp->bogus_req = 1;
}
break;
-
+
case SLT_RxURL:
vsb_cat(lp->sb, " ");
vsb_bcat(lp->sb, ptr, len);
case SLT_RxHeader:
if (ispfx(ptr, len, "user-agent:"))
- lp->df_U = strdup(ptr + 12);
- else if (ispfx(ptr, len, "referer:"))
- lp->df_R = strdup(ptr + 9);
+ lp->df_U = strdup(ptr + 12);
+ else if (ispfx(ptr, len, "referer:"))
+ lp->df_R = strdup(ptr + 9);
break;
case SLT_Length:
int append = 0;
vd = VSL_New();
-
+
while ((c = getopt(argc, argv, VSL_ARGS "aVw:")) != -1) {
i = VSL_Arg(vd, c, optarg);
if (i < 0)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Log tailer for Varnish
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Log tailer for Varnish
vd = VSL_New();
-
+
while ((c = getopt(argc, argv, VSL_ARGS "1fV")) != -1) {
i = VSL_Arg(vd, c, optarg);
if (i < 0)
tp->count = 1.0;
tp->clen = q - p;
TAILQ_INSERT_TAIL(&top_head, tp, list);
- }
+ }
memcpy(tp->rec, p, 4 + p[1]);
while (1) {
tp2 = TAILQ_PREV(tp, tophead, list);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Binary Heap API (see: http://en.wikipedia.org/wiki/Binary_heap)
typedef int binheap_cmp_t(void *priv, void *a, void *b);
/*
* Comparison function.
- * Should return true if item 'a' should be closer to the root
+ * Should return true if item 'a' should be closer to the root
* than item 'b'
*/
/*
* Create Binary tree
* 'priv' is passed to cmp and update functions.
- */
+ */
void binheap_insert(struct binheap *, void *);
/*
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Public definition of the CLI protocol, part of the published Varnish-API.
*
- * The overall structure of the protocol is a command-line like
+ * The overall structure of the protocol is a command-line like
* "command+arguments" request and a IETF style "number + string" response.
*
* Arguments can contain arbitrary sequences of bytes which are encoded
* in back-slash notation in double-quoted, if necessary.
- *
*/
/*
"param.set", \
"param.set <param> <value>", \
"\tSet parameter value.", \
- 2,2
+ 2,2
#define CLI_SERVER_FREEZE \
"server.freeze", \
"server.freeze", \
"\tStop the clock, freeze object store.", \
- 0, 0
+ 0, 0
#define CLI_SERVER_THAW \
"thaw", \
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Varnish process internal CLI stuff.
*
* XXX: at a latter date we may want to move some to cli.h/libvarnishapi
- *
*/
#define CLI_PRIV_H
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* a Http header name
*
* see [RFC2616 13.5.1 End-to-end and Hop-by-hop Headers]
*
- * a b c d e f g
+ * a b c d e f g
*--------------------------------------------------------------------
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Define the layout of the shared memory log segment.
*
* NB: THIS IS NOT A PUBLIC API TO VARNISH!
- *
*/
#define SHMLOG_FILENAME "/tmp/_.vsl"
/*
* Byte offset into the file where the fifolog starts
- * This allows the header to expand later.
+ * This allows the header to expand later.
*/
unsigned start;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Define the tags in the shared memory in a reusable format.
* SUCH DAMAGE.
*
* $Id$
- *
*/
MAC_STAT(client_conn, uint64_t, "u", "Client connections accepted")
* SUCH DAMAGE.
*
* $Id$
- *
*/
#include <stdint.h>
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
unsigned magic;
#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */
- struct backend **backend;
- unsigned nbackend;
- struct vrt_ref *ref;
- unsigned nref;
- unsigned busy;
+ struct backend **backend;
+ unsigned nbackend;
+ struct vrt_ref *ref;
+ unsigned nref;
+ unsigned busy;
- void *priv;
+ void *priv;
- vcl_init_f *init_func;
- vcl_fini_f *fini_func;
+ vcl_init_f *init_func;
+ vcl_fini_f *fini_func;
vcl_func_f *recv_func;
vcl_func_f *miss_func;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Runtime support for compiled VCL programs.
* (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 $
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Initial implementation by Dag-Erling Smørgrav <des@des.no>
- *
* $Id$
*
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Initial implementation by Dag-Erling Smørgrav <des@des.no>
- *
* $Id$
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Initial implementation by Dag-Erling Smørgrav <des@des.no>
- *
* $Id$
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
*/
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * Initial implementation by Dag-Erling Smørgrav <des@des.no>
- *
* $Id$
*
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* const char **ParseArgv(const char *s, int comment)
FreeArgv(char **argv)
{
int i;
-
+
for (i = 1; argv[i] != NULL; i++)
free(argv[i]);
free(argv);
(void)argc;
(void)argv;
- register_printf_render_std("V");
+ register_printf_render_std("V");
while (fgets(buf, sizeof buf, stdin))
Test(buf);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Implementation of a binary heap API
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;
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Stuff for handling the CLI protocol
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* This CRC32 implementation is in the public domain.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Semi-trivial functions to handle HTTP header timestamps according to
* Copyright (c) 2006 Linpro AS
* All rights reserved.
*
+ * Author: Dag-Erling Smørgrav <des@linpro.no>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Display a standardized version message.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
*pp = p;
return (1);
}
- if (vd->map[p[0]] & M_SUPPRESS)
+ if (vd->map[p[0]] & M_SUPPRESS)
continue;
if (vd->b_opt && !(vd->map[u] & M_BACKEND))
continue;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
if (tl->t->tok == '(') {
para = 1;
vcc_NextToken(tl);
- }
+ }
if (tl->t->tok == '!') {
not = 1;
vcc_NextToken(tl);
- }
+ }
ExpectErr(tl, CSTR);
/* XXX: try to look it up, warn if failure */
vcc_NextToken(tl);
ExpectErr(tl, CNUM);
mask = UintVal(tl);
- }
+ }
Fc(tl, 1, "{ %u, %u, %u, ", not, mask, para);
EncString(tl->fc, t);
Fc(tl, 0, ", \"");
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
*
* XXX:
* Better error messages, throughout.
- * >It also accured to me that we could link the errors to the error
+ * >It also accured to me that we could link the errors to the error
* >documentation.
* >
* >Unreferenced function 'request_policy', first mention is
* > ------------#############------------
* >Read more about this type of error:
* >http://varnish/doc/error.html#Unknown%20variable
- *
+ *
* XXX:
* Create proper tmp filenames for .h, .c and .o
*
Fc(tl, 1, "VRT_count(sp, %u)%s\n", ++tl->cnt, sep); \
tl->t->cnt = tl->cnt; \
} while (0)
-
+
/*--------------------------------------------------------------------
* Printf output to the two vsbs, possibly indented
*/
d += *p - '0';
}
vcc_NextToken(tl);
- if (tl->t->tok != '.')
+ if (tl->t->tok != '.')
return (d);
vcc_NextToken(tl);
if (tl->t->tok != CNUM)
case STRING: L(tl, Cond_String(vp, tl)); break;
case TIME: L(tl, Cond_Int(vp, tl)); break;
case BACKEND: L(tl, Cond_Backend(vp, tl)); break;
- default:
+ default:
vsb_printf(tl->sb,
"Variable '%s'"
" has no conditions that can be checked\n",
case RATE:
case TIME:
case FLOAT:
- if (tl->t->tok != '=')
+ if (tl->t->tok != '=')
Fc(tl, 0, "%s %c ", vp->rname, *tl->t->b);
a = tl->t->tok;
vcc_NextToken(tl);
SizeVal(tl);
else if (vp->fmt == RATE)
RateVal(tl);
- else
+ else
Fc(tl, 0, "%g", DoubleVal(tl));
Fc(tl, 0, ");\n");
break;
hint.ai_family = PF_UNSPEC;
hint.ai_socktype = SOCK_STREAM;
error = getaddrinfo(host, port, &hint, &res);
- if (error)
+ if (error)
return (gai_strerror(error));
freeaddrinfo(res);
return (NULL);
return;
}
}
-
+
vcc_NextToken(tl);
Fc(tl, 1, "}\n");
Fc(tl, 0, "\n");
struct proc *p;
TAILQ_FOREACH(p, &tl->procs, list) {
- if (!vcc_Teq(p->name, t))
+ if (!vcc_Teq(p->name, t))
continue;
if (def)
p->name = t;
if (u & VCL_RET_##b) { \
vsb_printf(tl->sb, "Illegal return for method\n"); \
vcc_ErrWhere(tl, p->returnt[d]); \
- }
+ }
#include "vcl_returns.h"
#undef VCL_RET_MAC
vsb_printf(tl->sb, "In function\n");
if (vcc_IdIs(p->name, m->name))
break;
}
- if (m->name == NULL)
+ if (m->name == NULL)
continue;
if (Consist_Decend(tl, p, m->returns)) {
vsb_printf(tl->sb,
type, PF(r->name));
vcc_ErrWhere(tl, r->name);
continue;
- }
+ }
vsb_printf(tl->sb, "Unused %s %.*s, defined:\n",
type, PF(r->name));
struct token *t;
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");
pos += 8;
} else
pos++;
-
+
}
Fc(tl, 0, " [%3u] = { %d, %4u, %3u, 0, \"%.*s\" },\n",
t->cnt, fil, lin, pos + 1, PF(t));
assert(of != NULL);
mktemp(of);
- sprintf(buf,
+ sprintf(buf,
"tee /tmp/_.c |"
"cc -fpic -shared -Wl,-x -o %s -x c - ", of);
assert(0 == fstat(fd, &st));
f = malloc(st.st_size + 1);
assert(f != NULL);
- i = read(fd, f, st.st_size);
+ i = read(fd, f, st.st_size);
assert(i == st.st_size);
f[i] = '\0';
r = VCC_Compile(sb, f, NULL);
vcc_default_vcl_b = default_vcl;
vcc_default_vcl_e = strchr(default_vcl, '\0');
assert(vcc_default_vcl_e != NULL);
-
+
vcl_init_tnames();
for (v = vcc_vars; v->name != NULL; v++)
v->len = strlen(v->name);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
}
return (0);
case 'b':
- if (p[0] == 'b' && p[1] == 'a' && p[2] == 'c' &&
- p[3] == 'k' && p[4] == 'e' && p[5] == 'n' &&
+ if (p[0] == 'b' && p[1] == 'a' && p[2] == 'c' &&
+ p[3] == 'k' && p[4] == 'e' && p[5] == 'n' &&
p[6] == 'd' && !isvar(p[7])) {
*q = p + 7;
return (T_BACKEND);
}
return (0);
case 'c':
- if (p[0] == 'c' && p[1] == 'a' && p[2] == 'l' &&
+ if (p[0] == 'c' && p[1] == 'a' && p[2] == 'l' &&
p[3] == 'l' && !isvar(p[4])) {
*q = p + 4;
return (T_CALL);
}
return (0);
case 'd':
- if (p[0] == 'd' && p[1] == 'i' && p[2] == 's' &&
- p[3] == 'c' && p[4] == 'a' && p[5] == 'r' &&
+ if (p[0] == 'd' && p[1] == 'i' && p[2] == 's' &&
+ p[3] == 'c' && p[4] == 'a' && p[5] == 'r' &&
p[6] == 'd' && !isvar(p[7])) {
*q = p + 7;
return (T_DISCARD);
}
- if (p[0] == 'd' && p[1] == 'e' && p[2] == 'l' &&
- p[3] == 'i' && p[4] == 'v' && p[5] == 'e' &&
+ if (p[0] == 'd' && p[1] == 'e' && p[2] == 'l' &&
+ p[3] == 'i' && p[4] == 'v' && p[5] == 'e' &&
p[6] == 'r' && !isvar(p[7])) {
*q = p + 7;
return (T_DELIVER);
}
return (0);
case 'e':
- if (p[0] == 'e' && p[1] == 'r' && p[2] == 'r' &&
+ if (p[0] == 'e' && p[1] == 'r' && p[2] == 'r' &&
p[3] == 'o' && p[4] == 'r' && !isvar(p[5])) {
*q = p + 5;
return (T_ERROR);
}
- if (p[0] == 'e' && p[1] == 'l' && p[2] == 's' &&
+ if (p[0] == 'e' && p[1] == 'l' && p[2] == 's' &&
p[3] == 'i' && p[4] == 'f' && !isvar(p[5])) {
*q = p + 5;
return (T_ELSIF);
}
- if (p[0] == 'e' && p[1] == 'l' && p[2] == 's' &&
+ if (p[0] == 'e' && p[1] == 'l' && p[2] == 's' &&
p[3] == 'e' && p[4] == 'i' && p[5] == 'f'
&& !isvar(p[6])) {
*q = p + 6;
return (T_ELSEIF);
}
- if (p[0] == 'e' && p[1] == 'l' && p[2] == 's' &&
+ if (p[0] == 'e' && p[1] == 'l' && p[2] == 's' &&
p[3] == 'e' && !isvar(p[4])) {
*q = p + 4;
return (T_ELSE);
}
return (0);
case 'f':
- if (p[0] == 'f' && p[1] == 'u' && p[2] == 'n' &&
+ if (p[0] == 'f' && p[1] == 'u' && p[2] == 'n' &&
p[3] == 'c' && !isvar(p[4])) {
*q = p + 4;
return (T_FUNC);
}
- if (p[0] == 'f' && p[1] == 'e' && p[2] == 't' &&
+ if (p[0] == 'f' && p[1] == 'e' && p[2] == 't' &&
p[3] == 'c' && p[4] == 'h' && !isvar(p[5])) {
*q = p + 5;
return (T_FETCH);
}
return (0);
case 'i':
- if (p[0] == 'i' && p[1] == 'n' && p[2] == 's' &&
- p[3] == 'e' && p[4] == 'r' && p[5] == 't' &&
- p[6] == '_' && p[7] == 'p' && p[8] == 'a' &&
+ if (p[0] == 'i' && p[1] == 'n' && p[2] == 's' &&
+ p[3] == 'e' && p[4] == 'r' && p[5] == 't' &&
+ p[6] == '_' && p[7] == 'p' && p[8] == 'a' &&
p[9] == 's' && p[10] == 's' && !isvar(p[11])) {
*q = p + 11;
return (T_INSERT_PASS);
}
- if (p[0] == 'i' && p[1] == 'n' && p[2] == 's' &&
+ if (p[0] == 'i' && p[1] == 'n' && p[2] == 's' &&
p[3] == 'e' && p[4] == 'r' && p[5] == 't'
&& !isvar(p[6])) {
*q = p + 6;
}
return (0);
case 'l':
- if (p[0] == 'l' && p[1] == 'o' && p[2] == 'o' &&
+ if (p[0] == 'l' && p[1] == 'o' && p[2] == 'o' &&
p[3] == 'k' && p[4] == 'u' && p[5] == 'p'
&& !isvar(p[6])) {
*q = p + 6;
}
return (0);
case 'n':
- if (p[0] == 'n' && p[1] == 'o' && p[2] == '_' &&
- p[3] == 'n' && p[4] == 'e' && p[5] == 'w' &&
- p[6] == '_' && p[7] == 'c' && p[8] == 'a' &&
+ if (p[0] == 'n' && p[1] == 'o' && p[2] == '_' &&
+ p[3] == 'n' && p[4] == 'e' && p[5] == 'w' &&
+ p[6] == '_' && p[7] == 'c' && p[8] == 'a' &&
p[9] == 'c' && p[10] == 'h' && p[11] == 'e'
&& !isvar(p[12])) {
*q = p + 12;
return (T_NO_NEW_CACHE);
}
- if (p[0] == 'n' && p[1] == 'o' && p[2] == '_' &&
- p[3] == 'c' && p[4] == 'a' && p[5] == 'c' &&
+ if (p[0] == 'n' && p[1] == 'o' && p[2] == '_' &&
+ p[3] == 'c' && p[4] == 'a' && p[5] == 'c' &&
p[6] == 'h' && p[7] == 'e' && !isvar(p[8])) {
*q = p + 8;
return (T_NO_CACHE);
}
return (0);
case 'p':
- if (p[0] == 'p' && p[1] == 'r' && p[2] == 'o' &&
+ if (p[0] == 'p' && p[1] == 'r' && p[2] == 'o' &&
p[3] == 'c' && !isvar(p[4])) {
*q = p + 4;
return (T_PROC);
}
- if (p[0] == 'p' && p[1] == 'i' && p[2] == 'p' &&
+ if (p[0] == 'p' && p[1] == 'i' && p[2] == 'p' &&
p[3] == 'e' && !isvar(p[4])) {
*q = p + 4;
return (T_PIPE);
}
- if (p[0] == 'p' && p[1] == 'a' && p[2] == 's' &&
+ if (p[0] == 'p' && p[1] == 'a' && p[2] == 's' &&
p[3] == 's' && !isvar(p[4])) {
*q = p + 4;
return (T_PASS);
}
return (0);
case 'r':
- if (p[0] == 'r' && p[1] == 'e' && p[2] == 'w' &&
- p[3] == 'r' && p[4] == 'i' && p[5] == 't' &&
+ if (p[0] == 'r' && p[1] == 'e' && p[2] == 'w' &&
+ p[3] == 'r' && p[4] == 'i' && p[5] == 't' &&
p[6] == 'e' && !isvar(p[7])) {
*q = p + 7;
return (T_REWRITE);
}
return (0);
case 's':
- if (p[0] == 's' && p[1] == 'w' && p[2] == 'i' &&
- p[3] == 't' && p[4] == 'c' && p[5] == 'h' &&
- p[6] == '_' && p[7] == 'c' && p[8] == 'o' &&
- p[9] == 'n' && p[10] == 'f' && p[11] == 'i' &&
+ if (p[0] == 's' && p[1] == 'w' && p[2] == 'i' &&
+ p[3] == 't' && p[4] == 'c' && p[5] == 'h' &&
+ p[6] == '_' && p[7] == 'c' && p[8] == 'o' &&
+ p[9] == 'n' && p[10] == 'f' && p[11] == 'i' &&
p[12] == 'g' && !isvar(p[13])) {
*q = p + 13;
return (T_SWITCH_CONFIG);
{ NULL }
};
-const char *vrt_obj_h =
+const char *vrt_obj_h =
"/*\n"
" * $Id$\n"
" *\n"
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*
* Stuff shared between main.c and fixed_token.c
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- *
* $Id$
*/
{
unsigned lin, pos, x, y;
const char *p, *l, *f, *b, *e;
-
+
lin = 1;
pos = 0;
if (t->tok == METHOD)