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_GetStatus(struct http *hp);
+const char *http_GetReq(struct http *hp);
const char *http_GetProto(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);
struct http *hp, *hp2;
struct storage *st;
struct bereq *bereq;
- int len, mklen;
+ int len, mklen, is_get;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
w = sp->wrk;
bereq = sp->bereq;
hp = bereq->http;
+ is_get = !strcasecmp(http_GetReq(hp), "get");
sp->obj->xid = sp->xid;
/* Determine if we have a body or not */
cls = 0;
mklen = 0;
- if (http_GetHdr(hp, H_Content_Length, &b)) {
+ if (!is_get) {
+ /* nothing */
+ } else if (http_GetHdr(hp, H_Content_Length, &b)) {
cls = fetch_straight(sp, vc->fd, hp, b);
mklen = 1;
} else if (http_HdrIs(hp, H_Transfer_Encoding, "chunked")) {
return (hp->hd[HTTP_HDR_PROTO].b);
}
+const char *
+http_GetReq(struct http *hp)
+{
+ AN(hp->hd[HTTP_HDR_REQ].b);
+ return (hp->hd[HTTP_HDR_REQ].b);
+}
+
/*--------------------------------------------------------------------
* Dissect the headers of the HTTP protocol message.
* Detect conditionals (headers which start with '^[Ii][Ff]-')
hp = bereq->http;
hp->logtag = HTTP_Tx;
- http_copyreq(hp, sp->http, how == HTTPH_R_PIPE);
+ http_copyreq(hp, sp->http,
+ (how == HTTPH_R_PIPE) || (how == HTTPH_R_PASS));
http_FilterFields(sp->wrk, sp->fd, hp, sp->http, how);
http_PrintfHeader(sp->wrk, sp->fd, hp, "X-Varnish: %u", sp->xid);
http_PrintfHeader(sp->wrk, sp->fd, hp,