Commit 6875d5dd authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Rework the fetch code, to use a common function for feeding bytes into

storage slabs.  Pretty soon we will not be doing that directly and
we want only one place to know about the gzip/gunzip magic.

Overhaul the chunked encoding fetcher code, to be much simpler and 
much more robust.

Sort out some 4GB issues while we where here anyway.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5702 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 27dbdb05
...@@ -90,6 +90,7 @@ struct director; ...@@ -90,6 +90,7 @@ struct director;
struct object; struct object;
struct objhead; struct objhead;
struct objcore; struct objcore;
struct storage;
struct workreq; struct workreq;
struct esidata; struct esidata;
struct vrt_backend; struct vrt_backend;
...@@ -250,7 +251,6 @@ struct worker { ...@@ -250,7 +251,6 @@ struct worker {
struct http *beresp; struct http *beresp;
struct http *resp; struct http *resp;
enum body_status body_status;
unsigned cacheable; unsigned cacheable;
double age; double age;
double entered; double entered;
...@@ -261,6 +261,10 @@ struct worker { ...@@ -261,6 +261,10 @@ struct worker {
/* This is only here so VRT can find it */ /* This is only here so VRT can find it */
char *storage_hint; char *storage_hint;
/* Fetch stuff */
enum body_status body_status;
struct storage *storage;
/* Timeouts */ /* Timeouts */
double connect_timeout; double connect_timeout;
double first_byte_timeout; double first_byte_timeout;
...@@ -649,7 +653,7 @@ void http_CollectHdr(struct http *hp, const char *hdr); ...@@ -649,7 +653,7 @@ void http_CollectHdr(struct http *hp, const char *hdr);
void HTC_Init(struct http_conn *htc, struct ws *ws, int fd); void HTC_Init(struct http_conn *htc, struct ws *ws, int fd);
int HTC_Reinit(struct http_conn *htc); int HTC_Reinit(struct http_conn *htc);
int HTC_Rx(struct http_conn *htc); int HTC_Rx(struct http_conn *htc);
int HTC_Read(struct http_conn *htc, void *d, unsigned len); ssize_t HTC_Read(struct http_conn *htc, void *d, size_t len);
int HTC_Complete(struct http_conn *htc); int HTC_Complete(struct http_conn *htc);
#define HTTPH(a, b, c, d, e, f, g) extern char b[]; #define HTTPH(a, b, c, d, e, f, g) extern char b[];
......
...@@ -1296,6 +1296,7 @@ CNT_Session(struct sess *sp) ...@@ -1296,6 +1296,7 @@ CNT_Session(struct sess *sp)
CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC); CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC);
WS_Assert(w->ws); WS_Assert(w->ws);
AZ(sp->wrk->storage_hint); AZ(sp->wrk->storage_hint);
AZ(sp->wrk->storage);
switch (sp->step) { switch (sp->step) {
#define STEP(l,u) \ #define STEP(l,u) \
......
This diff is collapsed.
...@@ -178,12 +178,12 @@ HTC_Rx(struct http_conn *htc) ...@@ -178,12 +178,12 @@ HTC_Rx(struct http_conn *htc)
return (HTC_Complete(htc)); return (HTC_Complete(htc));
} }
int ssize_t
HTC_Read(struct http_conn *htc, void *d, unsigned len) HTC_Read(struct http_conn *htc, void *d, size_t len)
{ {
unsigned l; size_t l;
unsigned char *p; unsigned char *p;
int i; ssize_t i;
l = 0; l = 0;
p = d; p = d;
......
...@@ -182,11 +182,13 @@ wrk_thread_real(struct wq *qp, unsigned shm_workspace, unsigned sess_workspace, ...@@ -182,11 +182,13 @@ wrk_thread_real(struct wq *qp, unsigned shm_workspace, unsigned sess_workspace,
w->beresp = NULL; w->beresp = NULL;
w->resp = NULL; w->resp = NULL;
w->storage_hint = NULL; w->storage_hint = NULL;
w->storage = NULL;
w->wrq->func(w, w->wrq->priv); w->wrq->func(w, w->wrq->priv);
AZ(w->bereq); AZ(w->bereq);
AZ(w->beresp1); AZ(w->beresp1);
AZ(w->beresp); AZ(w->beresp);
AZ(w->resp); AZ(w->resp);
AZ(w->storage);
WS_Assert(w->ws); WS_Assert(w->ws);
AZ(w->wfd); AZ(w->wfd);
AZ(w->storage_hint); AZ(w->storage_hint);
......
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