]> err.no Git - varnish/commitdiff
Always use GET and HTTP/1.1 against the backend for fetch
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 22 Jul 2006 16:15:17 +0000 (16:15 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 22 Jul 2006 16:15:17 +0000 (16:15 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@561 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_fetch.c
varnish-cache/bin/varnishd/cache_http.c

index 38dc3e2b80db1caa2e5f59de66370ff05c368326..ce289610627fa5b3b91b36c51190b947ebd5d48f 100644 (file)
@@ -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);
index cb84c1b47ca6102be611769210ea549dbf28417b..66dc8d367a14d3527001d29ddfc26cbd3e0593d1 100644 (file)
@@ -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);
 
index 4850c441c9cac54d1aa5c46057997925032ee467..5bcd6576872495369f1dd3f66b9e6c37bfd14169 100644 (file)
@@ -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)
 {