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);
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)
{
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;
--- /dev/null
+# $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