vrt_do_string(sp->wrk, sp->fd, \
http, fld, #obj "." #hdr, p, 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(resp, proto, sp->http, HTTP_HDR_PROTO)
VRT_DO_HDR(resp, response, sp->http, HTTP_HDR_RESPONSE)
+/*--------------------------------------------------------------------*/
+
+/* XXX: review this */
+
void
VRT_l_obj_status(const struct sess *sp, int num)
{
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
/*--------------------------------------------------------------------*/
-#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
VRT_r_req_restarts(const 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 *
VRT_r_client_ip(const struct sess *sp)
{