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

Implement req.request properly



git-svn-id: http://www.varnish-cache.org/svn/trunk@202 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent cc37f38e
......@@ -83,6 +83,7 @@ struct http *http_New(void);
void http_Delete(struct http *hp);
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_GetReq(struct http *hp, char **b);
int http_GetStatus(struct http *hp);
int http_HdrIs(struct http *hp, const char *hdr, const char *val);
int http_GetTail(struct http *hp, unsigned len, char **b, char **e);
......
......@@ -147,6 +147,15 @@ http_HdrIs(struct http *hp, const char *hdr, const char *val)
return (0);
}
int
http_GetReq(struct http *hp, char **b)
{
if (hp->req == NULL)
return (0);
*b = hp->req;
return (1);
}
int
http_GetURL(struct http *hp, char **b)
{
......
......@@ -273,3 +273,14 @@ VCL_GetHdr(VCL_FARGS, const char *n)
return (NULL);
return (p);
}
char *
VCL_GetReq(VCL_FARGS)
{
char *p;
assert(sess != NULL);
assert(sess->http != NULL);
assert(http_GetReq(sess->http, &p));
return (p);
}
......@@ -101,6 +101,7 @@ void VCL_error(VCL_FARGS, unsigned, const char *);
int VCL_switch_config(const char *);
char *VCL_GetHdr(VCL_FARGS, const char *);
char *VCL_GetReq(VCL_FARGS);
typedef void vcl_init_f(void);
typedef void vcl_func_f(VCL_FARGS);
......
......@@ -122,7 +122,7 @@ static struct var be_vars[] = {
static struct var vars[] = {
{ "req.request", STRING, 0, "\"GET\"" },
{ "req.request", STRING, 0, "VCL_GetReq(VCL_PASS_ARGS)" },
{ "obj.valid", BOOL, 0, "sess->obj->valid" },
{ "obj.cacheable", BOOL, 0, "sess->obj->cacheable" },
{ "req.http.", HEADER, 0, NULL },
......
......@@ -500,6 +500,7 @@ vcl_output_lang_h(FILE *f)
fputs("int VCL_switch_config(const char *);\n", f);
fputs("\n", f);
fputs("char *VCL_GetHdr(VCL_FARGS, const char *);\n", f);
fputs("char *VCL_GetReq(VCL_FARGS);\n", f);
fputs("\n", f);
fputs("typedef void vcl_init_f(void);\n", f);
fputs("typedef void vcl_func_f(VCL_FARGS);\n", f);
......
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