Commit f9662fec authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make all protocol header fields writable, except obj.status and resp.status

(which are numeric, they'll follow shortly)

Unify the shmemlog tag used for failure to rewrite something, the Rx/Tx/Obj
distinction is not helpful enough to warrant the complexity of it.






git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1659 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent ff00010c
...@@ -412,6 +412,7 @@ void http_PutStatus(struct worker *w, int fd, struct http *to, int status); ...@@ -412,6 +412,7 @@ void http_PutStatus(struct worker *w, int fd, struct http *to, int status);
void http_PutResponse(struct worker *w, int fd, struct http *to, const char *response); void http_PutResponse(struct worker *w, int fd, struct http *to, const char *response);
void http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fmt, ...); void http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fmt, ...);
void http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr); void http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr);
void http_SetH(struct http *to, unsigned n, const char *fm);
void http_Setup(struct http *ht, void *space, unsigned len); void http_Setup(struct http *ht, void *space, unsigned len);
int http_GetHdr(struct http *hp, const char *hdr, char **ptr); int http_GetHdr(struct http *hp, const char *hdr, char **ptr);
int http_GetHdrField(struct http *hp, const char *hdr, const char *field, char **ptr); int http_GetHdrField(struct http *hp, const char *hdr, const char *field, char **ptr);
...@@ -428,7 +429,6 @@ int http_DissectResponse(struct worker *w, struct http *sp, int fd); ...@@ -428,7 +429,6 @@ int http_DissectResponse(struct worker *w, struct http *sp, int fd);
void http_DoConnection(struct sess *sp); void http_DoConnection(struct sess *sp);
void http_CopyHome(struct worker *w, int fd, struct http *hp); void http_CopyHome(struct worker *w, int fd, struct http *hp);
void http_Unset(struct http *hp, const char *hdr); void http_Unset(struct http *hp, const char *hdr);
void http_LogLostHeader(struct worker *w, int fd, struct http *hp, const char *hdr);
#define HTTPH(a, b, c, d, e, f, g) extern char b[]; #define HTTPH(a, b, c, d, e, f, g) extern char b[];
......
...@@ -58,7 +58,6 @@ enum httptag { ...@@ -58,7 +58,6 @@ enum httptag {
HTTP_T_URL, HTTP_T_URL,
HTTP_T_Protocol, HTTP_T_Protocol,
HTTP_T_Header, HTTP_T_Header,
HTTP_T_LostHeader,
}; };
#define LOGMTX2(ax, bx) \ #define LOGMTX2(ax, bx) \
...@@ -71,7 +70,6 @@ enum httptag { ...@@ -71,7 +70,6 @@ enum httptag {
LOGMTX2(ax, URL), \ LOGMTX2(ax, URL), \
LOGMTX2(ax, Protocol), \ LOGMTX2(ax, Protocol), \
LOGMTX2(ax, Header), \ LOGMTX2(ax, Header), \
LOGMTX2(ax, LostHeader) \
} }
static enum shmlogtag logmtx[3][7] = { static enum shmlogtag logmtx[3][7] = {
...@@ -86,7 +84,7 @@ http2shmlog(struct http *hp, enum httptag t) ...@@ -86,7 +84,7 @@ http2shmlog(struct http *hp, enum httptag t)
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
assert(/* hp->logtag >= HTTP_Rx && */hp->logtag <= HTTP_Obj); assert(/* hp->logtag >= HTTP_Rx && */hp->logtag <= HTTP_Obj);
assert(/* t >= HTTP_T_Request && */t <= HTTP_T_LostHeader); assert(/* t >= HTTP_T_Request && */t <= HTTP_T_Header);
return (logmtx[hp->logtag][t]); return (logmtx[hp->logtag][t]);
} }
...@@ -97,12 +95,6 @@ WSLH(struct worker *w, enum httptag t, unsigned fd, struct http *hp, int hdr) ...@@ -97,12 +95,6 @@ WSLH(struct worker *w, enum httptag t, unsigned fd, struct http *hp, int hdr)
WSLR(w, http2shmlog(hp, t), fd, hp->hd[hdr].b, hp->hd[hdr].e); WSLR(w, http2shmlog(hp, t), fd, hp->hd[hdr].b, hp->hd[hdr].e);
} }
void
http_LogLostHeader(struct worker *w, int fd, struct http *hp, const char *hdr)
{
WSLR(w, http2shmlog(hp, HTTP_T_LostHeader), fd, hdr + 1, hdr + hdr[0]);
}
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
/* List of canonical HTTP response code names from RFC2616 */ /* List of canonical HTTP response code names from RFC2616 */
...@@ -430,7 +422,7 @@ http_dissect_hdrs(struct worker *w, struct http *hp, int fd, char *p) ...@@ -430,7 +422,7 @@ http_dissect_hdrs(struct worker *w, struct http *hp, int fd, char *p)
hp->nhd++; hp->nhd++;
} else { } else {
VSL_stats->losthdr++; VSL_stats->losthdr++;
WSLR(w, http2shmlog(hp, HTTP_T_LostHeader), fd, p, q); WSLR(w, SLT_LostHeader, fd, p, q);
} }
} }
return (0); return (0);
...@@ -686,8 +678,8 @@ http_RecvHead(struct http *hp, int fd) ...@@ -686,8 +678,8 @@ http_RecvHead(struct http *hp, int fd)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static void void
http_seth(struct http *to, unsigned n, const char *fm) http_SetH(struct http *to, unsigned n, const char *fm)
{ {
assert(n < HTTP_HDR_MAX); assert(n < HTTP_HDR_MAX);
...@@ -715,11 +707,11 @@ http_copyreq(struct http *to, struct http *fm, int forceget) ...@@ -715,11 +707,11 @@ http_copyreq(struct http *to, struct http *fm, int forceget)
CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
if (forceget) if (forceget)
http_seth(to, HTTP_HDR_REQ, "GET"); http_SetH(to, HTTP_HDR_REQ, "GET");
else else
http_copyh(to, fm, HTTP_HDR_REQ); http_copyh(to, fm, HTTP_HDR_REQ);
http_copyh(to, fm, HTTP_HDR_URL); http_copyh(to, fm, HTTP_HDR_URL);
http_seth(to, HTTP_HDR_PROTO, "HTTP/1.1"); http_SetH(to, HTTP_HDR_PROTO, "HTTP/1.1");
} }
void void
...@@ -729,7 +721,7 @@ http_CopyResp(struct http *to, struct http *fm) ...@@ -729,7 +721,7 @@ http_CopyResp(struct http *to, struct http *fm)
CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
if (params->client_http11) if (params->client_http11)
http_seth(to, HTTP_HDR_PROTO, "HTTP/1.1"); http_SetH(to, HTTP_HDR_PROTO, "HTTP/1.1");
else else
http_copyh(to, fm, HTTP_HDR_PROTO); http_copyh(to, fm, HTTP_HDR_PROTO);
http_copyh(to, fm, HTTP_HDR_STATUS); http_copyh(to, fm, HTTP_HDR_STATUS);
...@@ -741,9 +733,9 @@ http_SetResp(struct http *to, const char *proto, const char *status, const char ...@@ -741,9 +733,9 @@ http_SetResp(struct http *to, const char *proto, const char *status, const char
{ {
CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
http_seth(to, HTTP_HDR_PROTO, proto); http_SetH(to, HTTP_HDR_PROTO, proto);
http_seth(to, HTTP_HDR_STATUS, status); http_SetH(to, HTTP_HDR_STATUS, status);
http_seth(to, HTTP_HDR_RESPONSE, response); http_SetH(to, HTTP_HDR_RESPONSE, response);
} }
static void static void
...@@ -760,7 +752,7 @@ http_copyheader(struct worker *w, int fd, struct http *to, struct http *fm, unsi ...@@ -760,7 +752,7 @@ http_copyheader(struct worker *w, int fd, struct http *to, struct http *fm, unsi
to->nhd++; to->nhd++;
} else { } else {
VSL_stats->losthdr++; VSL_stats->losthdr++;
WSLH(w, HTTP_T_LostHeader, fd, fm, n); WSLH(w, SLT_LostHeader, fd, fm, n);
} }
} }
...@@ -853,7 +845,7 @@ http_CopyHome(struct worker *w, int fd, struct http *hp) ...@@ -853,7 +845,7 @@ http_CopyHome(struct worker *w, int fd, struct http *hp)
hp->hd[u].b = p; hp->hd[u].b = p;
hp->hd[u].e = p + l; hp->hd[u].e = p + l;
} else { } else {
WSLH(w, HTTP_T_LostHeader, fd, hp, u); WSLH(w, SLT_LostHeader, fd, hp, u);
hp->hd[u].b = NULL; hp->hd[u].b = NULL;
hp->hd[u].e = NULL; hp->hd[u].e = NULL;
} }
...@@ -881,10 +873,10 @@ http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr) ...@@ -881,10 +873,10 @@ http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr)
CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
if (to->nhd >= HTTP_HDR_MAX) { if (to->nhd >= HTTP_HDR_MAX) {
VSL_stats->losthdr++; VSL_stats->losthdr++;
WSL(w, http2shmlog(to, HTTP_T_LostHeader), fd, "%s", hdr); WSL(w, SLT_LostHeader, fd, "%s", hdr);
return; return;
} }
http_seth(to, to->nhd++, hdr); http_SetH(to, to->nhd++, hdr);
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
...@@ -901,7 +893,7 @@ http_PutField(struct worker *w, int fd, struct http *to, int field, const char * ...@@ -901,7 +893,7 @@ http_PutField(struct worker *w, int fd, struct http *to, int field, const char *
l = (e - string); l = (e - string);
p = WS_Alloc(to->ws, l + 1); p = WS_Alloc(to->ws, l + 1);
if (p == NULL) { if (p == NULL) {
WSL(w, http2shmlog(to, HTTP_T_LostHeader), fd, "%s", string); WSL(w, SLT_LostHeader, fd, "%s", string);
to->hd[field].b = NULL; to->hd[field].b = NULL;
to->hd[field].e = NULL; to->hd[field].e = NULL;
} else { } else {
...@@ -948,7 +940,7 @@ http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fmt, .. ...@@ -948,7 +940,7 @@ http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fmt, ..
va_end(ap); va_end(ap);
if (n + 1 >= l || to->nhd >= HTTP_HDR_MAX) { if (n + 1 >= l || to->nhd >= HTTP_HDR_MAX) {
VSL_stats->losthdr++; VSL_stats->losthdr++;
WSL(w, http2shmlog(to, HTTP_T_LostHeader), fd, "%s", to->ws->f); WSL(w, SLT_LostHeader, fd, "%s", to->ws->f);
WS_Release(to->ws, 0); WS_Release(to->ws, 0);
} else { } else {
to->hd[to->nhd].b = to->ws->f; to->hd[to->nhd].b = to->ws->f;
......
...@@ -112,31 +112,15 @@ VRT_GetHdr(struct sess *sp, enum gethdr_e where, const char *n) ...@@ -112,31 +112,15 @@ VRT_GetHdr(struct sess *sp, enum gethdr_e where, const char *n)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
void static char *
VRT_SetHdr(struct sess *sp , enum gethdr_e where, const char *hdr, ...) vrt_assemble_string(struct http *hp, const char *p, va_list ap)
{ {
struct http *hp;
va_list ap;
const char *p;
char *b, *e; char *b, *e;
unsigned u, x; unsigned u, x;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
hp = vrt_selecthttp(sp, where);
va_start(ap, hdr);
p = va_arg(ap, const char *);
if (p == NULL) {
http_Unset(hp, hdr);
} else {
u = WS_Reserve(hp->ws, 0); u = WS_Reserve(hp->ws, 0);
e = b = hp->ws->f; e = b = hp->ws->f;
*e = '\0'; *e = '\0';
x = strlen(hdr + 1);
if (x + 1 < u)
memcpy(e, hdr + 1, x);
e += x;
if (1 + 1 < u)
*e++ = ' ';
while (p != NULL) { while (p != NULL) {
x = strlen(p); x = strlen(p);
if (x + 1 < u) if (x + 1 < u)
...@@ -146,11 +130,35 @@ VRT_SetHdr(struct sess *sp , enum gethdr_e where, const char *hdr, ...) ...@@ -146,11 +130,35 @@ VRT_SetHdr(struct sess *sp , enum gethdr_e where, const char *hdr, ...)
} }
*e = '\0'; *e = '\0';
if (e > b + u) { if (e > b + u) {
http_LogLostHeader(sp->wrk, sp->fd, hp, hdr);
WS_Release(hp->ws, 0); WS_Release(hp->ws, 0);
return (NULL);
} else { } else {
WS_Release(hp->ws, 1 + e - b); WS_Release(hp->ws, 1 + e - b);
return (b);
}
}
/*--------------------------------------------------------------------*/
void
VRT_SetHdr(struct sess *sp , enum gethdr_e where, const char *hdr, ...)
{
struct http *hp;
va_list ap;
const char *p;
char *b;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
hp = vrt_selecthttp(sp, where);
va_start(ap, hdr);
p = va_arg(ap, const char *);
if (p == NULL) {
http_Unset(hp, hdr);
} else {
b = vrt_assemble_string(hp, p, ap);
if (b == NULL) {
VSL(SLT_LostHeader, sp->fd, hdr + 1);
} else {
http_Unset(hp, hdr); http_Unset(hp, hdr);
http_SetHeader(sp->wrk, sp->fd, hp, b); http_SetHeader(sp->wrk, sp->fd, hp, b);
} }
...@@ -160,6 +168,52 @@ VRT_SetHdr(struct sess *sp , enum gethdr_e where, const char *hdr, ...) ...@@ -160,6 +168,52 @@ VRT_SetHdr(struct sess *sp , enum gethdr_e where, const char *hdr, ...)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static void
vrt_do_string(struct worker *w, int fd, struct http *hp, int fld, const char *err, const char *p, va_list ap)
{
char *b;
AN(p);
AN(hp);
b = vrt_assemble_string(hp, p, ap);
if (b == NULL) {
WSL(w, SLT_LostHeader, fd, err);
} else {
http_SetH(hp, fld, b);
}
va_end(ap);
}
#define VRT_DO_HDR(obj, hdr, http, fld) \
void \
VRT_l_##obj##_##hdr(struct sess *sp, const char *p, ...) \
{ \
va_list ap; \
\
AN(p); \
va_start(ap, p); \
vrt_do_string(sp->wrk, sp->fd, \
http, fld, #obj "." #hdr, p, ap); \
va_end(ap); \
}
VRT_DO_HDR(req, request, sp->http, HTTP_HDR_REQ)
VRT_DO_HDR(req, url, sp->http, HTTP_HDR_URL)
VRT_DO_HDR(req, proto, sp->http, HTTP_HDR_PROTO)
VRT_DO_HDR(bereq, request, sp->bereq->http, HTTP_HDR_REQ)
VRT_DO_HDR(bereq, url, sp->bereq->http, HTTP_HDR_URL)
VRT_DO_HDR(bereq, proto, sp->bereq->http, HTTP_HDR_PROTO)
VRT_DO_HDR(obj, proto, &sp->obj->http, HTTP_HDR_PROTO)
VRT_DO_HDR(obj, response, &sp->obj->http, HTTP_HDR_RESPONSE)
VRT_DO_HDR(resp, proto, sp->bereq->http, HTTP_HDR_PROTO)
VRT_DO_HDR(resp, response, sp->bereq->http, HTTP_HDR_RESPONSE)
#if 0
VRT_DO_HDR(obj, status, &sp->obj->http, HTTP_HDR_STATUS)
VRT_DO_HDR(resp, status, sp->bereq->http, HTTP_HDR_STATUS)
#endif
/*--------------------------------------------------------------------*/
void void
VRT_handling(struct sess *sp, unsigned hand) VRT_handling(struct sess *sp, unsigned hand)
{ {
......
...@@ -62,7 +62,6 @@ SLTM(RxStatus) ...@@ -62,7 +62,6 @@ SLTM(RxStatus)
SLTM(RxURL) SLTM(RxURL)
SLTM(RxProtocol) SLTM(RxProtocol)
SLTM(RxHeader) SLTM(RxHeader)
SLTM(RxLostHeader)
SLTM(TxRequest) SLTM(TxRequest)
SLTM(TxResponse) SLTM(TxResponse)
...@@ -70,7 +69,6 @@ SLTM(TxStatus) ...@@ -70,7 +69,6 @@ SLTM(TxStatus)
SLTM(TxURL) SLTM(TxURL)
SLTM(TxProtocol) SLTM(TxProtocol)
SLTM(TxHeader) SLTM(TxHeader)
SLTM(TxLostHeader)
SLTM(ObjRequest) SLTM(ObjRequest)
SLTM(ObjResponse) SLTM(ObjResponse)
...@@ -78,7 +76,8 @@ SLTM(ObjStatus) ...@@ -78,7 +76,8 @@ SLTM(ObjStatus)
SLTM(ObjURL) SLTM(ObjURL)
SLTM(ObjProtocol) SLTM(ObjProtocol)
SLTM(ObjHeader) SLTM(ObjHeader)
SLTM(ObjLostHeader)
SLTM(LostHeader)
SLTM(TTL) SLTM(TTL)
SLTM(VCL_acl) SLTM(VCL_acl)
......
...@@ -12,23 +12,26 @@ void VRT_l_backend_dnsttl(struct backend *, double); ...@@ -12,23 +12,26 @@ void VRT_l_backend_dnsttl(struct backend *, double);
struct sockaddr * VRT_r_client_ip(struct sess *); struct sockaddr * VRT_r_client_ip(struct sess *);
struct sockaddr * VRT_r_server_ip(struct sess *); struct sockaddr * VRT_r_server_ip(struct sess *);
const char * VRT_r_req_request(struct sess *); const char * VRT_r_req_request(struct sess *);
void VRT_l_req_request(struct sess *, const char *, ...);
const char * VRT_r_req_url(struct sess *); 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 *); const char * VRT_r_req_proto(struct sess *);
void VRT_l_req_proto(struct sess *, const char *, ...);
void VRT_l_req_hash(struct sess *, const char *); void VRT_l_req_hash(struct sess *, const char *);
struct backend * VRT_r_req_backend(struct sess *); struct backend * VRT_r_req_backend(struct sess *);
void VRT_l_req_backend(struct sess *, struct backend *); void VRT_l_req_backend(struct sess *, struct backend *);
const char * VRT_r_bereq_request(struct sess *); const char * VRT_r_bereq_request(struct sess *);
void VRT_l_bereq_request(struct sess *, const char *); void VRT_l_bereq_request(struct sess *, const char *, ...);
const char * VRT_r_bereq_url(struct sess *); const char * VRT_r_bereq_url(struct sess *);
void VRT_l_bereq_url(struct sess *, const char *); void VRT_l_bereq_url(struct sess *, const char *, ...);
const char * VRT_r_bereq_proto(struct sess *); const char * VRT_r_bereq_proto(struct sess *);
void VRT_l_bereq_proto(struct sess *, const char *); void VRT_l_bereq_proto(struct sess *, const char *, ...);
const char * VRT_r_obj_proto(struct sess *); const char * VRT_r_obj_proto(struct sess *);
void VRT_l_obj_proto(struct sess *, const char *); void VRT_l_obj_proto(struct sess *, const char *, ...);
int VRT_r_obj_status(struct sess *); int VRT_r_obj_status(struct sess *);
void VRT_l_obj_status(struct sess *, int); void VRT_l_obj_status(struct sess *, int);
const char * VRT_r_obj_response(struct sess *); const char * VRT_r_obj_response(struct sess *);
void VRT_l_obj_response(struct sess *, const char *); void VRT_l_obj_response(struct sess *, const char *, ...);
unsigned VRT_r_obj_valid(struct sess *); unsigned VRT_r_obj_valid(struct sess *);
void VRT_l_obj_valid(struct sess *, unsigned); void VRT_l_obj_valid(struct sess *, unsigned);
unsigned VRT_r_obj_cacheable(struct sess *); unsigned VRT_r_obj_cacheable(struct sess *);
...@@ -37,9 +40,9 @@ double VRT_r_obj_ttl(struct sess *); ...@@ -37,9 +40,9 @@ double VRT_r_obj_ttl(struct sess *);
void VRT_l_obj_ttl(struct sess *, double); void VRT_l_obj_ttl(struct sess *, double);
double VRT_r_obj_lastuse(struct sess *); double VRT_r_obj_lastuse(struct sess *);
const char * VRT_r_resp_proto(struct sess *); const char * VRT_r_resp_proto(struct sess *);
void VRT_l_resp_proto(struct sess *, const char *); void VRT_l_resp_proto(struct sess *, const char *, ...);
int VRT_r_resp_status(struct sess *); int VRT_r_resp_status(struct sess *);
void VRT_l_resp_status(struct sess *, int); void VRT_l_resp_status(struct sess *, int);
const char * VRT_r_resp_response(struct sess *); const char * VRT_r_resp_response(struct sess *);
void VRT_l_resp_response(struct sess *, const char *); void VRT_l_resp_response(struct sess *, const char *, ...);
double VRT_r_now(struct sess *); double VRT_r_now(struct sess *);
...@@ -208,14 +208,11 @@ parse_set(struct tokenlist *tl) ...@@ -208,14 +208,11 @@ parse_set(struct tokenlist *tl)
} }
vcc_NextToken(tl); vcc_NextToken(tl);
vcc_StringVal(tl); vcc_StringVal(tl);
if (vp->hdr != NULL) {
while (tl->t->tok != ';') { while (tl->t->tok != ';') {
Fb(tl, 0, ", "); Fb(tl, 0, ", ");
vcc_StringVal(tl); vcc_StringVal(tl);
} }
Fb(tl, 0, ", 0"); Fb(tl, 0, ", 0);\n");
}
Fb(tl, 0, ");\n");
break; break;
default: default:
vsb_printf(tl->sb, vsb_printf(tl->sb,
......
...@@ -461,23 +461,26 @@ vcl_output_lang_h(struct vsb *sb) ...@@ -461,23 +461,26 @@ vcl_output_lang_h(struct vsb *sb)
vsb_cat(sb, "struct sockaddr * VRT_r_client_ip(struct sess *);\n"); vsb_cat(sb, "struct sockaddr * VRT_r_client_ip(struct sess *);\n");
vsb_cat(sb, "struct sockaddr * VRT_r_server_ip(struct sess *);\n"); vsb_cat(sb, "struct sockaddr * VRT_r_server_ip(struct sess *);\n");
vsb_cat(sb, "const char * VRT_r_req_request(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_req_request(struct sess *);\n");
vsb_cat(sb, "void VRT_l_req_request(struct sess *, const char *, ...);\n");
vsb_cat(sb, "const char * VRT_r_req_url(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_req_url(struct sess *);\n");
vsb_cat(sb, "void VRT_l_req_url(struct sess *, const char *, ...);\n");
vsb_cat(sb, "const char * VRT_r_req_proto(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_req_proto(struct sess *);\n");
vsb_cat(sb, "void VRT_l_req_proto(struct sess *, const char *, ...);\n");
vsb_cat(sb, "void VRT_l_req_hash(struct sess *, const char *);\n"); vsb_cat(sb, "void VRT_l_req_hash(struct sess *, const char *);\n");
vsb_cat(sb, "struct backend * VRT_r_req_backend(struct sess *);\n"); vsb_cat(sb, "struct backend * VRT_r_req_backend(struct sess *);\n");
vsb_cat(sb, "void VRT_l_req_backend(struct sess *, struct backend *);\n"); vsb_cat(sb, "void VRT_l_req_backend(struct sess *, struct backend *);\n");
vsb_cat(sb, "const char * VRT_r_bereq_request(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_bereq_request(struct sess *);\n");
vsb_cat(sb, "void VRT_l_bereq_request(struct sess *, const char *);\n"); vsb_cat(sb, "void VRT_l_bereq_request(struct sess *, const char *, ...);\n");
vsb_cat(sb, "const char * VRT_r_bereq_url(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_bereq_url(struct sess *);\n");
vsb_cat(sb, "void VRT_l_bereq_url(struct sess *, const char *);\n"); vsb_cat(sb, "void VRT_l_bereq_url(struct sess *, const char *, ...);\n");
vsb_cat(sb, "const char * VRT_r_bereq_proto(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_bereq_proto(struct sess *);\n");
vsb_cat(sb, "void VRT_l_bereq_proto(struct sess *, const char *);\n"); vsb_cat(sb, "void VRT_l_bereq_proto(struct sess *, const char *, ...);\n");
vsb_cat(sb, "const char * VRT_r_obj_proto(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_obj_proto(struct sess *);\n");
vsb_cat(sb, "void VRT_l_obj_proto(struct sess *, const char *);\n"); vsb_cat(sb, "void VRT_l_obj_proto(struct sess *, const char *, ...);\n");
vsb_cat(sb, "int VRT_r_obj_status(struct sess *);\n"); vsb_cat(sb, "int VRT_r_obj_status(struct sess *);\n");
vsb_cat(sb, "void VRT_l_obj_status(struct sess *, int);\n"); vsb_cat(sb, "void VRT_l_obj_status(struct sess *, int);\n");
vsb_cat(sb, "const char * VRT_r_obj_response(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_obj_response(struct sess *);\n");
vsb_cat(sb, "void VRT_l_obj_response(struct sess *, const char *);\n"); vsb_cat(sb, "void VRT_l_obj_response(struct sess *, const char *, ...);\n");
vsb_cat(sb, "unsigned VRT_r_obj_valid(struct sess *);\n"); vsb_cat(sb, "unsigned VRT_r_obj_valid(struct sess *);\n");
vsb_cat(sb, "void VRT_l_obj_valid(struct sess *, unsigned);\n"); vsb_cat(sb, "void VRT_l_obj_valid(struct sess *, unsigned);\n");
vsb_cat(sb, "unsigned VRT_r_obj_cacheable(struct sess *);\n"); vsb_cat(sb, "unsigned VRT_r_obj_cacheable(struct sess *);\n");
...@@ -486,10 +489,10 @@ vcl_output_lang_h(struct vsb *sb) ...@@ -486,10 +489,10 @@ vcl_output_lang_h(struct vsb *sb)
vsb_cat(sb, "void VRT_l_obj_ttl(struct sess *, double);\n"); vsb_cat(sb, "void VRT_l_obj_ttl(struct sess *, double);\n");
vsb_cat(sb, "double VRT_r_obj_lastuse(struct sess *);\n"); vsb_cat(sb, "double VRT_r_obj_lastuse(struct sess *);\n");
vsb_cat(sb, "const char * VRT_r_resp_proto(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_resp_proto(struct sess *);\n");
vsb_cat(sb, "void VRT_l_resp_proto(struct sess *, const char *);\n"); vsb_cat(sb, "void VRT_l_resp_proto(struct sess *, const char *, ...);\n");
vsb_cat(sb, "int VRT_r_resp_status(struct sess *);\n"); vsb_cat(sb, "int VRT_r_resp_status(struct sess *);\n");
vsb_cat(sb, "void VRT_l_resp_status(struct sess *, int);\n"); vsb_cat(sb, "void VRT_l_resp_status(struct sess *, int);\n");
vsb_cat(sb, "const char * VRT_r_resp_response(struct sess *);\n"); vsb_cat(sb, "const char * VRT_r_resp_response(struct sess *);\n");
vsb_cat(sb, "void VRT_l_resp_response(struct sess *, const char *);\n"); vsb_cat(sb, "void VRT_l_resp_response(struct sess *, const char *, ...);\n");
vsb_cat(sb, "double VRT_r_now(struct sess *);\n"); vsb_cat(sb, "double VRT_r_now(struct sess *);\n");
} }
...@@ -56,15 +56,15 @@ set spobj { ...@@ -56,15 +56,15 @@ set spobj {
# Request paramters # Request paramters
{ req.request { req.request
RO STRING RW STRING
{recv pipe pass hash miss hit fetch } {recv pipe pass hash miss hit fetch }
} }
{ req.url { req.url
RO STRING RW STRING
{recv pipe pass hash miss hit fetch } {recv pipe pass hash miss hit fetch }
} }
{ req.proto { req.proto
RO STRING RW STRING
{recv pipe pass hash miss hit fetch } {recv pipe pass hash miss hit fetch }
} }
{ req.http. { req.http.
...@@ -231,7 +231,10 @@ proc vars {v ty pa} { ...@@ -231,7 +231,10 @@ proc vars {v ty pa} {
} }
if {$a == "WO" || $a == "RW"} { if {$a == "WO" || $a == "RW"} {
puts $fo "\t \"VRT_l_${m}($pa, \"," puts $fo "\t \"VRT_l_${m}($pa, \","
if {$t != "HEADER"} { if {$t == "HEADER"} {
} elseif {$t == "STRING"} {
puts $fp "void VRT_l_${m}($ty, $tt($t), ...);"
} else {
puts $fp "void VRT_l_${m}($ty, $tt($t));" puts $fp "void VRT_l_${m}($ty, $tt($t));"
} }
} else { } else {
......
...@@ -51,22 +51,22 @@ struct var vcc_vars[] = { ...@@ -51,22 +51,22 @@ struct var vcc_vars[] = {
}, },
{ "req.request", STRING, 11, { "req.request", STRING, 11,
"VRT_r_req_request(sp)", "VRT_r_req_request(sp)",
NULL, "VRT_l_req_request(sp, ",
V_RO, V_RW,
0, 0,
VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
}, },
{ "req.url", STRING, 7, { "req.url", STRING, 7,
"VRT_r_req_url(sp)", "VRT_r_req_url(sp)",
NULL, "VRT_l_req_url(sp, ",
V_RO, V_RW,
0, 0,
VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
}, },
{ "req.proto", STRING, 9, { "req.proto", STRING, 9,
"VRT_r_req_proto(sp)", "VRT_r_req_proto(sp)",
NULL, "VRT_l_req_proto(sp, ",
V_RO, V_RW,
0, 0,
VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment