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

Get "line1" request/reponse fields under control.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2848 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 60c4952f
...@@ -210,6 +210,14 @@ VRT_l_##obj##_##hdr(const struct sess *sp, const char *p, ...) \ ...@@ -210,6 +210,14 @@ VRT_l_##obj##_##hdr(const struct sess *sp, const char *p, ...) \
vrt_do_string(sp->wrk, sp->fd, \ vrt_do_string(sp->wrk, sp->fd, \
http, fld, #obj "." #hdr, p, ap); \ http, fld, #obj "." #hdr, p, ap); \
va_end(ap); \ va_end(ap); \
} \
\
const char * \
VRT_r_##obj##_##hdr(const struct sess *sp) \
{ \
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); \
CHECK_OBJ_NOTNULL(http, HTTP_MAGIC); \
return (http->hd[fld].b); \
} }
VRT_DO_HDR(req, request, sp->http, HTTP_HDR_REQ) VRT_DO_HDR(req, request, sp->http, HTTP_HDR_REQ)
...@@ -223,6 +231,10 @@ VRT_DO_HDR(obj, response, sp->obj->http, HTTP_HDR_RESPONSE) ...@@ -223,6 +231,10 @@ VRT_DO_HDR(obj, response, sp->obj->http, HTTP_HDR_RESPONSE)
VRT_DO_HDR(resp, proto, sp->http, HTTP_HDR_PROTO) VRT_DO_HDR(resp, proto, sp->http, HTTP_HDR_PROTO)
VRT_DO_HDR(resp, response, sp->http, HTTP_HDR_RESPONSE) VRT_DO_HDR(resp, response, sp->http, HTTP_HDR_RESPONSE)
/*--------------------------------------------------------------------*/
/* XXX: review this */
void void
VRT_l_obj_status(const struct sess *sp, int num) VRT_l_obj_status(const struct sess *sp, int num)
{ {
...@@ -262,6 +274,14 @@ VRT_l_resp_status(const struct sess *sp, int num) ...@@ -262,6 +274,14 @@ VRT_l_resp_status(const struct sess *sp, int num)
http_SetH(sp->http, HTTP_HDR_STATUS, p); http_SetH(sp->http, HTTP_HDR_STATUS, p);
} }
int
VRT_r_resp_status(const 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));
}
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
void void
...@@ -408,21 +428,6 @@ VRT_r_req_backend(struct sess *sp) ...@@ -408,21 +428,6 @@ VRT_r_req_backend(struct sess *sp)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
#define VREQ(n1, n2) \
const char * \
VRT_r_req_##n1(const struct sess *sp) \
{ \
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); \
CHECK_OBJ_NOTNULL(sp->http, HTTP_MAGIC); \
return (sp->http->hd[n2].b); \
}
VREQ(request, HTTP_HDR_REQ)
VREQ(url, HTTP_HDR_URL)
VREQ(proto, HTTP_HDR_PROTO)
/*--------------------------------------------------------------------*/
int int
VRT_r_req_restarts(const struct sess *sp) VRT_r_req_restarts(const struct sess *sp)
{ {
...@@ -456,32 +461,6 @@ VRT_r_req_grace(struct sess *sp) ...@@ -456,32 +461,6 @@ VRT_r_req_grace(struct sess *sp)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
const char *
VRT_r_resp_proto(const 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(const 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(const 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 * struct sockaddr *
VRT_r_client_ip(const struct sess *sp) VRT_r_client_ip(const struct sess *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