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

Implement resp.proto resp.status and resp.response.

Visible from vcl_fetch() only.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1560 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent a40a65f0
......@@ -253,6 +253,32 @@ VREQ(proto, HTTP_HDR_PROTO)
/*--------------------------------------------------------------------*/
const char *
VRT_r_resp_proto(struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
return (sp->obj->http.hd[HTTP_HDR_PROTO].b);
}
const char *
VRT_r_resp_response(struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
return (sp->obj->http.hd[HTTP_HDR_RESPONSE].b);
}
int
VRT_r_resp_status(struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
return (atoi(sp->obj->http.hd[HTTP_HDR_STATUS].b));
}
/*--------------------------------------------------------------------*/
struct sockaddr *
VRT_r_client_ip(struct sess *sp)
{
......
......@@ -36,5 +36,11 @@ unsigned VRT_r_obj_cacheable(struct sess *);
void VRT_l_obj_cacheable(struct sess *, unsigned);
double VRT_r_obj_ttl(struct sess *);
void VRT_l_obj_ttl(struct sess *, double);
const char * VRT_r_resp_proto(struct sess *);
void VRT_l_resp_proto(struct sess *, const char *);
int VRT_r_resp_status(struct sess *);
void VRT_l_resp_status(struct sess *, int);
const char * VRT_r_resp_response(struct sess *);
void VRT_l_resp_response(struct sess *, const char *);
const char * VRT_r_resp_http_(struct sess *);
void VRT_l_resp_http_(struct sess *, const char *);
......@@ -52,6 +52,9 @@ set spobj {
{ obj.valid BOOL { hit fetch discard timeout} }
{ obj.cacheable BOOL { hit fetch discard timeout} }
{ obj.ttl TIME { hit fetch discard timeout} }
{ resp.proto STRING { fetch } }
{ resp.status INT { fetch } }
{ resp.response STRING { fetch } }
{ resp.http. HEADER { fetch } }
}
......@@ -60,6 +63,7 @@ set tt(STRING) "const char *"
set tt(BOOL) "unsigned"
set tt(BACKEND) "struct backend *"
set tt(TIME) "double"
set tt(INT) "int"
set tt(HEADER) "const char *"
set tt(HOSTNAME) "const char *"
set tt(PORTNAME) "const char *"
......
......@@ -89,6 +89,21 @@ struct var vcc_vars[] = {
"VRT_l_obj_ttl(sp, ",
VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DISCARD | VCL_MET_TIMEOUT
},
{ "resp.proto", STRING, 10,
"VRT_r_resp_proto(sp)",
"VRT_l_resp_proto(sp, ",
VCL_MET_FETCH
},
{ "resp.status", INT, 11,
"VRT_r_resp_status(sp)",
"VRT_l_resp_status(sp, ",
VCL_MET_FETCH
},
{ "resp.response", STRING, 13,
"VRT_r_resp_response(sp)",
"VRT_l_resp_response(sp, ",
VCL_MET_FETCH
},
{ "resp.http.", HEADER, 10,
"VRT_r_resp_http_(sp)",
"VRT_l_resp_http_(sp, ",
......
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