Commit 3c407319 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Always use GET and HTTP/1.1 against the backend for fetch


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@561 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent adb6e68b
......@@ -303,6 +303,7 @@ void HSH_Init(void);
void HTTP_Init(void);
void http_CopyHttp(struct http *to, struct http *fm);
void http_Write(struct worker *w, struct http *hp, int resp);
void http_GetReq(int fd, struct http *to, struct http *fm);
void http_CopyReq(int fd, struct http *to, struct http *fm);
void http_CopyResp(int fd, struct http *to, struct http *fm);
void http_FilterHeader(int fd, struct http *to, struct http *fm, unsigned how);
......
......@@ -51,7 +51,7 @@ fetch_straight(const struct sess *sp, int fd, struct http *hp, char *b)
i &= ~O_NONBLOCK;
i = fcntl(fd, F_SETFL, i);
while (cl != 0) {
while (cl > 0) {
i = http_Read(hp, fd, p, cl);
assert(i > 0); /* XXX seen */
p += i;
......@@ -273,7 +273,7 @@ FetchHeaders(struct sess *sp)
assert(vc != NULL); /* XXX: handle this */
VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
http_CopyReq(vc->fd, vc->http, sp->http);
http_GetReq(vc->fd, vc->http, sp->http);
http_FilterHeader(vc->fd, vc->http, sp->http, HTTPH_R_FETCH);
http_PrintfHeader(vc->fd, vc->http, "X-Varnish: %u", sp->xid);
......
......@@ -516,6 +516,16 @@ http_CopyHttp(struct http *to, struct http *fm)
/*--------------------------------------------------------------------*/
static void
http_seth(int fd, struct http *to, unsigned n, enum shmlogtag tag, const char *fm)
{
assert(n < MAX_HTTP_HDRS);
assert(fm != NULL);
to->hd[n].b = (void*)(uintptr_t)fm;
to->hd[n].e = strchr(fm, '\0');
VSLH(tag, fd, to, n);
}
static void
http_copyh(int fd, struct http *to, struct http *fm, unsigned n, enum shmlogtag tag)
{
......@@ -527,6 +537,17 @@ http_copyh(int fd, struct http *to, struct http *fm, unsigned n, enum shmlogtag
VSLH(tag, fd, to, n);
}
void
http_GetReq(int fd, struct http *to, struct http *fm)
{
CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
http_seth(fd, to, HTTP_HDR_REQ, SLT_Request, "GET");
http_copyh(fd, to, fm, HTTP_HDR_URL, SLT_URL);
http_seth(fd, to, HTTP_HDR_PROTO, SLT_Protocol, "HTTP/1.1");
}
void
http_CopyReq(int fd, struct http *to, struct http *fm)
{
......
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