Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
2d49712f
Commit
2d49712f
authored
Feb 14, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change FetchError() to take busyobj as arg.
parent
f33a076b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
28 deletions
+30
-28
cache.h
bin/varnishd/cache/cache.h
+2
-2
cache_esi_fetch.c
bin/varnishd/cache/cache_esi_fetch.c
+3
-3
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+16
-17
cache_gzip.c
bin/varnishd/cache/cache_gzip.c
+9
-6
No files found.
bin/varnishd/cache/cache.h
View file @
2d49712f
...
@@ -757,8 +757,8 @@ int EXP_NukeOne(struct worker *w, struct lru *lru);
...
@@ -757,8 +757,8 @@ int EXP_NukeOne(struct worker *w, struct lru *lru);
/* cache_fetch.c */
/* cache_fetch.c */
struct
storage
*
FetchStorage
(
struct
worker
*
w
,
ssize_t
sz
);
struct
storage
*
FetchStorage
(
struct
worker
*
w
,
ssize_t
sz
);
int
FetchError
(
const
struct
worker
*
w
,
const
char
*
error
);
int
FetchError
(
struct
busyobj
*
,
const
char
*
error
);
int
FetchError2
(
const
struct
worker
*
w
,
const
char
*
error
,
const
char
*
more
);
int
FetchError2
(
struct
busyobj
*
,
const
char
*
error
,
const
char
*
more
);
int
FetchHdr
(
struct
sess
*
sp
,
int
need_host_hdr
,
int
sendbody
);
int
FetchHdr
(
struct
sess
*
sp
,
int
need_host_hdr
,
int
sendbody
);
int
FetchBody
(
struct
worker
*
w
,
struct
object
*
obj
);
int
FetchBody
(
struct
worker
*
w
,
struct
object
*
obj
);
int
FetchReqBody
(
const
struct
sess
*
sp
,
int
sendbody
);
int
FetchReqBody
(
const
struct
sess
*
sp
,
int
sendbody
);
...
...
bin/varnishd/cache/cache_esi_fetch.c
View file @
2d49712f
...
@@ -387,7 +387,7 @@ vfp_esi_end(struct worker *wrk)
...
@@ -387,7 +387,7 @@ vfp_esi_end(struct worker *wrk)
retval
=
bo
->
fetch_failed
;
retval
=
bo
->
fetch_failed
;
if
(
bo
->
vgz_rx
!=
NULL
&&
VGZ_Destroy
(
&
bo
->
vgz_rx
,
-
1
)
!=
VGZ_END
)
if
(
bo
->
vgz_rx
!=
NULL
&&
VGZ_Destroy
(
&
bo
->
vgz_rx
,
-
1
)
!=
VGZ_END
)
retval
=
FetchError
(
wrk
,
"Gunzip+ESI Failed at the very end"
);
retval
=
FetchError
(
bo
,
"Gunzip+ESI Failed at the very end"
);
vsb
=
VEP_Finish
(
wrk
);
vsb
=
VEP_Finish
(
wrk
);
...
@@ -402,7 +402,7 @@ vfp_esi_end(struct worker *wrk)
...
@@ -402,7 +402,7 @@ vfp_esi_end(struct worker *wrk)
VSB_data
(
vsb
),
l
);
VSB_data
(
vsb
),
l
);
bo
->
fetch_obj
->
esidata
->
len
=
l
;
bo
->
fetch_obj
->
esidata
->
len
=
l
;
}
else
{
}
else
{
retval
=
FetchError
(
wrk
,
retval
=
FetchError
(
bo
,
"Could not allocate storage for esidata"
);
"Could not allocate storage for esidata"
);
}
}
}
}
...
@@ -415,7 +415,7 @@ vfp_esi_end(struct worker *wrk)
...
@@ -415,7 +415,7 @@ vfp_esi_end(struct worker *wrk)
if
(
vef
->
vgz
!=
NULL
)
{
if
(
vef
->
vgz
!=
NULL
)
{
VGZ_UpdateObj
(
vef
->
vgz
,
bo
->
fetch_obj
);
VGZ_UpdateObj
(
vef
->
vgz
,
bo
->
fetch_obj
);
if
(
VGZ_Destroy
(
&
vef
->
vgz
,
-
1
)
!=
VGZ_END
)
if
(
VGZ_Destroy
(
&
vef
->
vgz
,
-
1
)
!=
VGZ_END
)
retval
=
FetchError
(
wrk
,
retval
=
FetchError
(
bo
,
"ESI+Gzip Failed at the very end"
);
"ESI+Gzip Failed at the very end"
);
}
}
if
(
vef
->
ibuf
!=
NULL
)
if
(
vef
->
ibuf
!=
NULL
)
...
...
bin/varnishd/cache/cache_fetch.c
View file @
2d49712f
...
@@ -52,25 +52,24 @@ static unsigned fetchfrag;
...
@@ -52,25 +52,24 @@ static unsigned fetchfrag;
*/
*/
int
int
FetchError2
(
const
struct
worker
*
wrk
,
const
char
*
error
,
const
char
*
more
)
FetchError2
(
struct
busyobj
*
bo
,
const
char
*
error
,
const
char
*
more
)
{
{
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER
_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ
_MAGIC
);
if
(
!
wrk
->
busyobj
->
fetch_failed
)
{
if
(
!
bo
->
fetch_failed
)
{
if
(
more
==
NULL
)
if
(
more
==
NULL
)
VSLB
(
wrk
->
busyobj
,
SLT_FetchError
,
"%s"
,
error
);
VSLB
(
bo
,
SLT_FetchError
,
"%s"
,
error
);
else
else
VSLB
(
wrk
->
busyobj
,
SLT_FetchError
,
"%s: %s"
,
error
,
VSLB
(
bo
,
SLT_FetchError
,
"%s: %s"
,
error
,
more
);
more
);
}
}
wrk
->
busyobj
->
fetch_failed
=
1
;
bo
->
fetch_failed
=
1
;
return
(
-
1
);
return
(
-
1
);
}
}
int
int
FetchError
(
const
struct
worker
*
wrk
,
const
char
*
error
)
FetchError
(
struct
busyobj
*
bo
,
const
char
*
error
)
{
{
return
(
FetchError2
(
wrk
,
error
,
NULL
));
return
(
FetchError2
(
bo
,
error
,
NULL
));
}
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
...
@@ -192,7 +191,7 @@ FetchStorage(struct worker *wrk, ssize_t sz)
...
@@ -192,7 +191,7 @@ FetchStorage(struct worker *wrk, ssize_t sz)
l
=
cache_param
->
fetch_chunksize
;
l
=
cache_param
->
fetch_chunksize
;
st
=
STV_alloc
(
wrk
,
l
);
st
=
STV_alloc
(
wrk
,
l
);
if
(
st
==
NULL
)
{
if
(
st
==
NULL
)
{
(
void
)
FetchError
(
wrk
,
"Could not get storage"
);
(
void
)
FetchError
(
wrk
->
busyobj
,
"Could not get storage"
);
return
(
NULL
);
return
(
NULL
);
}
}
AZ
(
st
->
len
);
AZ
(
st
->
len
);
...
@@ -233,13 +232,13 @@ fetch_straight(struct worker *wrk, struct http_conn *htc, ssize_t cl)
...
@@ -233,13 +232,13 @@ fetch_straight(struct worker *wrk, struct http_conn *htc, ssize_t cl)
assert
(
wrk
->
busyobj
->
body_status
==
BS_LENGTH
);
assert
(
wrk
->
busyobj
->
body_status
==
BS_LENGTH
);
if
(
cl
<
0
)
{
if
(
cl
<
0
)
{
return
(
FetchError
(
wrk
,
"straight length field bogus"
));
return
(
FetchError
(
wrk
->
busyobj
,
"straight length field bogus"
));
}
else
if
(
cl
==
0
)
}
else
if
(
cl
==
0
)
return
(
0
);
return
(
0
);
i
=
wrk
->
busyobj
->
vfp
->
bytes
(
wrk
,
htc
,
cl
);
i
=
wrk
->
busyobj
->
vfp
->
bytes
(
wrk
,
htc
,
cl
);
if
(
i
<=
0
)
if
(
i
<=
0
)
return
(
FetchError
(
wrk
,
"straight insufficient bytes"
));
return
(
FetchError
(
wrk
->
busyobj
,
"straight insufficient bytes"
));
return
(
0
);
return
(
0
);
}
}
...
@@ -266,7 +265,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
...
@@ -266,7 +265,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
}
while
(
vct_islws
(
buf
[
0
]));
}
while
(
vct_islws
(
buf
[
0
]));
if
(
!
vct_ishex
(
buf
[
0
]))
if
(
!
vct_ishex
(
buf
[
0
]))
return
(
FetchError
(
wrk
,
"chunked header non-hex"
));
return
(
FetchError
(
wrk
->
busyobj
,
"chunked header non-hex"
));
/* Collect hex digits, skipping leading zeros */
/* Collect hex digits, skipping leading zeros */
for
(
u
=
1
;
u
<
sizeof
buf
;
u
++
)
{
for
(
u
=
1
;
u
<
sizeof
buf
;
u
++
)
{
...
@@ -279,7 +278,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
...
@@ -279,7 +278,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
}
}
if
(
u
>=
sizeof
buf
)
if
(
u
>=
sizeof
buf
)
return
(
FetchError
(
wrk
,
"chunked header too long"
));
return
(
FetchError
(
wrk
->
busyobj
,
"chunked header too long"
));
/* Skip trailing white space */
/* Skip trailing white space */
while
(
vct_islws
(
buf
[
u
])
&&
buf
[
u
]
!=
'\n'
)
while
(
vct_islws
(
buf
[
u
])
&&
buf
[
u
]
!=
'\n'
)
...
@@ -287,12 +286,12 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
...
@@ -287,12 +286,12 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
return
(
-
1
);
return
(
-
1
);
if
(
buf
[
u
]
!=
'\n'
)
if
(
buf
[
u
]
!=
'\n'
)
return
(
FetchError
(
wrk
,
"chunked header no NL"
));
return
(
FetchError
(
wrk
->
busyobj
,
"chunked header no NL"
));
buf
[
u
]
=
'\0'
;
buf
[
u
]
=
'\0'
;
cl
=
fetch_number
(
buf
,
16
);
cl
=
fetch_number
(
buf
,
16
);
if
(
cl
<
0
)
if
(
cl
<
0
)
return
(
FetchError
(
wrk
,
"chunked header number syntax"
));
return
(
FetchError
(
wrk
->
busyobj
,
"chunked header number syntax"
));
if
(
cl
>
0
&&
wrk
->
busyobj
->
vfp
->
bytes
(
wrk
,
htc
,
cl
)
<=
0
)
if
(
cl
>
0
&&
wrk
->
busyobj
->
vfp
->
bytes
(
wrk
,
htc
,
cl
)
<=
0
)
return
(
-
1
);
return
(
-
1
);
...
@@ -303,7 +302,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
...
@@ -303,7 +302,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
if
(
buf
[
0
]
==
'\r'
&&
HTC_Read
(
htc
,
buf
,
1
)
<=
0
)
if
(
buf
[
0
]
==
'\r'
&&
HTC_Read
(
htc
,
buf
,
1
)
<=
0
)
return
(
-
1
);
return
(
-
1
);
if
(
buf
[
0
]
!=
'\n'
)
if
(
buf
[
0
]
!=
'\n'
)
return
(
FetchError
(
wrk
,
"chunked tail no NL"
));
return
(
FetchError
(
wrk
->
busyobj
,
"chunked tail no NL"
));
}
while
(
cl
>
0
);
}
while
(
cl
>
0
);
return
(
0
);
return
(
0
);
}
}
...
...
bin/varnishd/cache/cache_gzip.c
View file @
2d49712f
...
@@ -482,7 +482,7 @@ vfp_gunzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
...
@@ -482,7 +482,7 @@ vfp_gunzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
return
(
-
1
);
return
(
-
1
);
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
if
(
i
!=
VGZ_OK
&&
i
!=
VGZ_END
)
if
(
i
!=
VGZ_OK
&&
i
!=
VGZ_END
)
return
(
FetchError
(
wrk
,
"Gunzip data error"
));
return
(
FetchError
(
wrk
->
busyobj
,
"Gunzip data error"
));
wrk
->
busyobj
->
fetch_obj
->
len
+=
dl
;
wrk
->
busyobj
->
fetch_obj
->
len
+=
dl
;
if
(
wrk
->
busyobj
->
do_stream
)
if
(
wrk
->
busyobj
->
do_stream
)
RES_StreamPoll
(
wrk
);
RES_StreamPoll
(
wrk
);
...
@@ -506,7 +506,8 @@ vfp_gunzip_end(struct worker *wrk)
...
@@ -506,7 +506,8 @@ vfp_gunzip_end(struct worker *wrk)
return
(
0
);
return
(
0
);
}
}
if
(
VGZ_Destroy
(
&
vg
,
-
1
)
!=
VGZ_END
)
if
(
VGZ_Destroy
(
&
vg
,
-
1
)
!=
VGZ_END
)
return
(
FetchError
(
wrk
,
"Gunzip error at the very end"
));
return
(
FetchError
(
wrk
->
busyobj
,
"Gunzip error at the very end"
));
return
(
0
);
return
(
0
);
}
}
...
@@ -599,7 +600,7 @@ vfp_gzip_end(struct worker *wrk)
...
@@ -599,7 +600,7 @@ vfp_gzip_end(struct worker *wrk)
RES_StreamPoll
(
wrk
);
RES_StreamPoll
(
wrk
);
VGZ_UpdateObj
(
vg
,
wrk
->
busyobj
->
fetch_obj
);
VGZ_UpdateObj
(
vg
,
wrk
->
busyobj
->
fetch_obj
);
if
(
VGZ_Destroy
(
&
vg
,
-
1
)
!=
VGZ_END
)
if
(
VGZ_Destroy
(
&
vg
,
-
1
)
!=
VGZ_END
)
return
(
FetchError
(
wrk
,
"Gzip error at the very end"
));
return
(
FetchError
(
wrk
->
busyobj
,
"Gzip error at the very end"
));
return
(
0
);
return
(
0
);
}
}
...
@@ -664,9 +665,10 @@ vfp_testgzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
...
@@ -664,9 +665,10 @@ vfp_testgzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
if
(
i
==
VGZ_END
&&
!
VGZ_IbufEmpty
(
vg
))
if
(
i
==
VGZ_END
&&
!
VGZ_IbufEmpty
(
vg
))
return
(
FetchError
(
wrk
,
"Junk after gzip data"
));
return
(
FetchError
(
wrk
->
busyobj
,
"Junk after gzip data"
));
if
(
i
!=
VGZ_OK
&&
i
!=
VGZ_END
)
if
(
i
!=
VGZ_OK
&&
i
!=
VGZ_END
)
return
(
FetchError2
(
wrk
,
return
(
FetchError2
(
wrk
->
busyobj
,
"Invalid Gzip data"
,
vg
->
vz
.
msg
));
"Invalid Gzip data"
,
vg
->
vz
.
msg
));
}
}
}
}
...
@@ -690,7 +692,8 @@ vfp_testgzip_end(struct worker *wrk)
...
@@ -690,7 +692,8 @@ vfp_testgzip_end(struct worker *wrk)
}
}
VGZ_UpdateObj
(
vg
,
wrk
->
busyobj
->
fetch_obj
);
VGZ_UpdateObj
(
vg
,
wrk
->
busyobj
->
fetch_obj
);
if
(
VGZ_Destroy
(
&
vg
,
-
1
)
!=
VGZ_END
)
if
(
VGZ_Destroy
(
&
vg
,
-
1
)
!=
VGZ_END
)
return
(
FetchError
(
wrk
,
"TestGunzip error at the very end"
));
return
(
FetchError
(
wrk
->
busyobj
,
"TestGunzip error at the very end"
));
return
(
0
);
return
(
0
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment