Commit 251c5aeb authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix #320: All esi:includes should be picked up with GET,

also if the original request was a PASS'ed POST.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3225 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent b0662190
......@@ -473,6 +473,7 @@ void http_PutResponse(struct worker *w, int fd, struct http *to, const char *res
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_SetH(struct http *to, unsigned n, const char *fm);
void http_ForceGet(struct http *to);
void http_Setup(struct http *ht, struct ws *ws);
int http_GetHdr(const struct http *hp, const char *hdr, char **ptr);
int http_GetHdrField(const struct http *hp, const char *hdr, const char *field, char **ptr);
......
......@@ -576,6 +576,13 @@ http_copyreq(struct http *to, const struct http *fm, int how)
http_copyh(to, fm, HTTP_HDR_URL);
}
void
http_ForceGet(struct http *to)
{
if (strcmp(http_GetReq(to), "GET"))
http_SetH(to, HTTP_HDR_REQ, "GET");
}
void
http_CopyResp(struct http *to, const struct http *fm)
{
......
......@@ -829,6 +829,7 @@ ESI_Deliver(struct sess *sp)
http_SetHeader(sp->wrk, sp->fd, sp->http, eb->host.b);
}
sp->step = STP_RECV;
http_ForceGet(sp->http);
CNT_Session(sp);
sp->esis--;
sp->obj = obj;
......
# $Id$
test "Make sure that PASS'ed ESI requests use GET for includes"
server s1 {
rxreq
expect req.request == POST
expect req.url == /foobar
txresp -body {<HTML>
FOO
<esi:include src="/bar">
}
rxreq
expect req.request == GET
txresp -body {
BAR
}
} -start
varnish v1 -vcl+backend {
sub vcl_fetch {
esi;
}
} -start
client c1 {
txreq -req POST -url /foobar
rxresp
expect resp.status == 200
expect resp.bodylen == 25
} -run
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