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
cb016fe0
Commit
cb016fe0
authored
Jan 26, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
White-space cleanup
parent
a95a36f7
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
51 deletions
+50
-51
cache_center.c
bin/varnishd/cache_center.c
+8
-8
cache_esi_deliver.c
bin/varnishd/cache_esi_deliver.c
+6
-6
cache_esi_fetch.c
bin/varnishd/cache_esi_fetch.c
+1
-1
cache_esi_parse.c
bin/varnishd/cache_esi_parse.c
+23
-24
cache_fetch.c
bin/varnishd/cache_fetch.c
+1
-1
cache_gzip.c
bin/varnishd/cache_gzip.c
+6
-6
cache_response.c
bin/varnishd/cache_response.c
+3
-3
vtc_http.c
bin/varnishtest/vtc_http.c
+1
-1
inflate.c
lib/libvgz/inflate.c
+1
-1
No files found.
bin/varnishd/cache_center.c
View file @
cb016fe0
...
...
@@ -590,12 +590,12 @@ cnt_fetch(struct sess *sp)
* The VCL variables beresp.do_g[un]zip tells us how we want the
* object stored.
*
* The backend Content-Encoding header tells us what we are going
* The backend Content-Encoding header tells us what we are going
* to receive, which we classify in the following three classes:
*
*
"Content-Encoding: gzip" --> object is gzip'ed.
*
no Content-Encoding --> object is not gzip'ed.
*
anything else --> do nothing wrt gzip
* "Content-Encoding: gzip" --> object is gzip'ed.
* no Content-Encoding --> object is not gzip'ed.
* anything else --> do nothing wrt gzip
*
*/
...
...
@@ -603,10 +603,10 @@ cnt_fetch(struct sess *sp)
if
(
!
params
->
http_gzip_support
)
sp
->
wrk
->
do_gzip
=
sp
->
wrk
->
do_gunzip
=
0
;
sp
->
wrk
->
is_gzip
=
sp
->
wrk
->
is_gzip
=
http_HdrIs
(
sp
->
wrk
->
beresp
,
H_Content_Encoding
,
"gzip"
);
sp
->
wrk
->
is_gunzip
=
sp
->
wrk
->
is_gunzip
=
!
http_GetHdr
(
sp
->
wrk
->
beresp
,
H_Content_Encoding
,
NULL
);
/* It can't be both */
...
...
@@ -625,7 +625,7 @@ cnt_fetch(struct sess *sp)
sp
->
wrk
->
do_gzip
=
0
;
/* If we do gzip, add the C-E header */
if
(
sp
->
wrk
->
do_gzip
)
if
(
sp
->
wrk
->
do_gzip
)
http_PrintfHeader
(
sp
->
wrk
,
sp
->
fd
,
sp
->
wrk
->
beresp
,
"Content-Encoding: %s"
,
"gzip"
);
...
...
@@ -649,7 +649,7 @@ cnt_fetch(struct sess *sp)
l
+=
varyl
;
/*
* Space for producing a Content-Length: header including padding
* Space for producing a Content-Length: header including padding
* A billion gigabytes is enough for anybody.
*/
l
+=
strlen
(
"Content-Encoding: XxxXxxXxxXxxXxxXxx"
+
sizeof
(
void
*
));
...
...
bin/varnishd/cache_esi_deliver.c
View file @
cb016fe0
...
...
@@ -142,7 +142,7 @@ ved_sendchunk(const struct sess *sp, const void *cb, ssize_t cl,
(
void
)
WRW_Write
(
sp
->
wrk
,
ptr
,
l
);
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
{
(
void
)
WRW_Write
(
sp
->
wrk
,
"
\r\n
"
,
-
1
);
if
(
cb
==
NULL
)
if
(
cb
==
NULL
)
(
void
)
WRW_Flush
(
sp
->
wrk
);
}
}
...
...
@@ -215,7 +215,7 @@ ved_pretend_gzip(const struct sess *sp, const uint8_t *p, ssize_t l)
}
(
void
)
WRW_Write
(
sp
->
wrk
,
buf
,
sizeof
buf
);
(
void
)
WRW_Write
(
sp
->
wrk
,
p
,
lx
);
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
(
void
)
WRW_Write
(
sp
->
wrk
,
"
\r\n
"
,
-
1
);
(
void
)
WRW_Flush
(
sp
->
wrk
);
sp
->
wrk
->
crc
=
crc32
(
sp
->
wrk
->
crc
,
p
,
lx
);
...
...
@@ -269,7 +269,7 @@ ESI_Deliver(struct sess *sp)
if
(
isgzip
&&
!
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
))
{
sp
->
wrk
->
gzip_resp
=
1
;
sp
->
wrk
->
crc
=
crc32
(
0L
,
Z_NULL
,
0
);
}
else
}
else
sp
->
wrk
->
gzip_resp
=
0
;
}
...
...
@@ -280,7 +280,7 @@ ESI_Deliver(struct sess *sp)
st
=
VTAILQ_FIRST
(
&
sp
->
obj
->
store
);
off
=
0
;
while
(
p
<
e
)
{
switch
(
*
p
)
{
case
VEC_V1
:
...
...
@@ -375,7 +375,7 @@ ESI_Deliver(struct sess *sp)
}
}
if
(
vgz
!=
NULL
)
{
if
(
obufl
>
0
)
if
(
obufl
>
0
)
ved_sendchunk
(
sp
,
NULL
,
0
,
obuf
,
obufl
);
VGZ_Destroy
(
&
vgz
);
}
...
...
@@ -428,7 +428,7 @@ ved_deliver_byterange(const struct sess *sp, ssize_t low, ssize_t high)
lx
=
low
;
}
//printf("[1-] %jd %jd\n", lx, lx + l);
if
(
lx
+
l
>=
high
)
if
(
lx
+
l
>=
high
)
l
=
high
-
lx
;
//printf("[2-] %jd %jd\n", lx, lx + l);
assert
(
lx
>=
low
&&
lx
+
l
<=
high
);
...
...
bin/varnishd/cache_esi_fetch.c
View file @
cb016fe0
...
...
@@ -265,7 +265,7 @@ vfp_esi_bytes_gg(struct sess *sp, struct http_conn *htc, size_t bytes)
if
(
w
<=
0
)
return
(
w
);
bytes
-=
w
;
vef
->
bufp
=
ibuf
;
VGZ_Ibuf
(
sp
->
wrk
->
vgz_rx
,
ibuf
,
w
);
do
{
...
...
bin/varnishd/cache_esi_parse.c
View file @
cb016fe0
...
...
@@ -122,13 +122,13 @@ const char *hack_p;
/*---------------------------------------------------------------------*/
static
const
char
*
const
VEP_START
=
"[Start]"
;
static
const
char
*
const
VEP_TESTXML
=
"[TestXml]"
;
static
const
char
*
const
VEP_NOTXML
=
"[NotXml]"
;
static
const
char
*
const
VEP_TESTXML
=
"[TestXml]"
;
static
const
char
*
const
VEP_NOTXML
=
"[NotXml]"
;
static
const
char
*
const
VEP_NEXTTAG
=
"[NxtTag]"
;
static
const
char
*
const
VEP_NEXTTAG
=
"[NxtTag]"
;
static
const
char
*
const
VEP_NOTMYTAG
=
"[NotMyTag]"
;
static
const
char
*
const
VEP_STARTTAG
=
"[StartTag]"
;
static
const
char
*
const
VEP_STARTTAG
=
"[StartTag]"
;
static
const
char
*
const
VEP_COMMENT
=
"[Comment]"
;
static
const
char
*
const
VEP_CDATA
=
"[CDATA]"
;
static
const
char
*
const
VEP_ESITAG
=
"[ESITag]"
;
...
...
@@ -148,7 +148,7 @@ static const char * const VEP_ATTRGETVAL = "[AttrGetValue]";
static
const
char
*
const
VEP_ATTRVAL
=
"[AttrValue]"
;
static
const
char
*
const
VEP_UNTIL
=
"[Until]"
;
static
const
char
*
const
VEP_MATCHBUF
=
"[MatchBuf]"
;
static
const
char
*
const
VEP_MATCHBUF
=
"[MatchBuf]"
;
static
const
char
*
const
VEP_MATCH
=
"[Match]"
;
/*---------------------------------------------------------------------*/
...
...
@@ -189,7 +189,7 @@ vep_error(const struct vep_state *vep, const char *p)
l
=
(
intmax_t
)(
vep
->
ver_p
-
vep
->
hack_p
);
printf
(
"ERROR at %jd %s
\n
"
,
l
,
p
);
WSP
(
vep
->
sp
,
SLT_ESI_xmlerror
,
"ERR at %jd %s"
,
l
,
p
);
}
/*--------------------------------------------------------------------
...
...
@@ -205,7 +205,7 @@ vep_warn(const struct vep_state *vep, const char *p)
l
=
(
intmax_t
)(
vep
->
ver_p
-
vep
->
hack_p
);
printf
(
"WARNING at %jd %s
\n
"
,
l
,
p
);
WSP
(
vep
->
sp
,
SLT_ESI_xmlerror
,
"WARN at %jd %s"
,
l
,
p
);
}
/*---------------------------------------------------------------------
...
...
@@ -265,7 +265,7 @@ vep_emit_len(const struct vep_state *vep, ssize_t l, int m8, int m16, int m64)
assert
((
ssize_t
)
vbe64dec
(
buf
+
1
)
==
l
);
vsb_bcat
(
vep
->
vsb
,
buf
,
9
);
}
}
}
static
void
vep_emit_skip
(
const
struct
vep_state
*
vep
,
ssize_t
l
)
...
...
@@ -275,7 +275,7 @@ vep_emit_skip(const struct vep_state *vep, ssize_t l)
Debug
(
"---> SKIP(%jd)
\n
"
,
(
intmax_t
)
l
);
}
vep_emit_len
(
vep
,
l
,
VEC_S1
,
VEC_S2
,
VEC_S8
);
}
}
static
void
vep_emit_verbatim
(
const
struct
vep_state
*
vep
,
ssize_t
l
,
ssize_t
l_crc
)
...
...
@@ -293,7 +293,7 @@ vep_emit_verbatim(const struct vep_state *vep, ssize_t l, ssize_t l_crc)
vbe32enc
(
buf
,
vep
->
crc
);
vsb_bcat
(
vep
->
vsb
,
buf
,
sizeof
buf
);
}
}
}
static
void
vep_emit_common
(
struct
vep_state
*
vep
,
ssize_t
l
,
enum
vep_mark
mark
)
...
...
@@ -374,7 +374,7 @@ vep_mark_verbatim(struct vep_state *vep, const char *p)
vep_mark_common
(
vep
,
p
,
VERBATIM
);
vep
->
nm_verbatim
++
;
}
}
static
void
vep_mark_skip
(
struct
vep_state
*
vep
,
const
char
*
p
)
...
...
@@ -382,7 +382,7 @@ vep_mark_skip(struct vep_state *vep, const char *p)
vep_mark_common
(
vep
,
p
,
SKIP
);
vep
->
nm_skip
++
;
}
}
static
void
vep_mark_pending
(
struct
vep_state
*
vep
,
const
char
*
p
)
...
...
@@ -408,7 +408,7 @@ vep_do_comment(struct vep_state *vep, enum dowhat what)
{
Debug
(
"DO_COMMENT(%d)
\n
"
,
what
);
assert
(
what
==
DO_TAG
);
if
(
!
vep
->
emptytag
)
if
(
!
vep
->
emptytag
)
vep_error
(
vep
,
"ESI 1.0 <esi:comment> needs final '/'"
);
}
...
...
@@ -431,7 +431,7 @@ vep_do_remove(struct vep_state *vep, enum dowhat what)
else
if
(
!
vep
->
remove
&&
vep
->
endtag
)
vep_error
(
vep
,
"ESI 1.0 <esi:remove> not open"
);
else
else
vep
->
remove
=
!
vep
->
endtag
;
}
}
...
...
@@ -455,7 +455,7 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
return
;
}
assert
(
what
==
DO_TAG
);
if
(
!
vep
->
emptytag
)
if
(
!
vep
->
emptytag
)
vep_warn
(
vep
,
"ESI 1.0 <esi:include> lacks final '/'"
);
if
(
vep
->
include_src
==
NULL
)
{
...
...
@@ -499,7 +499,7 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
h
=
q
;
if
(
h
==
NULL
)
h
=
q
+
1
;
Debug
(
"INCL:: [%.*s]/[%s]
\n
"
,
(
int
)(
h
-
url
.
b
),
url
.
b
,
p
);
vsb_printf
(
vep
->
vsb
,
"%.*s/"
,
(
int
)(
h
-
url
.
b
),
url
.
b
);
...
...
@@ -533,7 +533,7 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
*
* This function is called with the input object piecemal so do not
* assume that we have more than one char available at at time, but
* optimize for getting huge chunks.
* optimize for getting huge chunks.
*
* NB: At the bottom of this source-file, there is a dot-diagram matching
* NB: the state-machine. Please maintain it along with the code.
...
...
@@ -586,7 +586,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
* If the first non-whitespace char is different
* from '<' we assume this is not XML.
*/
while
(
p
<
e
&&
vct_islws
(
*
p
))
while
(
p
<
e
&&
vct_islws
(
*
p
))
p
++
;
vep_mark_verbatim
(
vep
,
p
);
if
(
p
<
e
&&
*
p
==
'<'
)
{
...
...
@@ -679,7 +679,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
if
(
*
p
==
'/'
)
{
vep
->
endtag
=
1
;
p
++
;
}
}
vep
->
match
=
vep_match_starttag
;
vep
->
state
=
VEP_MATCH
;
}
...
...
@@ -692,7 +692,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
vep
->
esicmt_p
=
vep
->
esicmt
=
"esi"
;
while
(
p
<
e
)
{
if
(
*
p
!=
*
vep
->
esicmt_p
)
{
vep
->
esicmt_p
=
vep
->
esicmt
=
NULL
;
vep
->
esicmt_p
=
vep
->
esicmt
=
NULL
;
vep
->
until_p
=
vep
->
until
=
"-->"
;
vep
->
until_s
=
VEP_NEXTTAG
;
vep
->
state
=
VEP_UNTIL
;
...
...
@@ -766,7 +766,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
}
else
if
(
vep
->
state
==
VEP_INTAG
)
{
vep
->
tag_i
=
0
;
while
(
p
<
e
&&
vct_islws
(
*
p
)
&&
!
vep
->
emptytag
)
{
p
++
;
p
++
;
vep
->
canattr
=
1
;
}
if
(
p
<
e
&&
*
p
==
'/'
&&
!
vep
->
emptytag
)
{
...
...
@@ -850,7 +850,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
"XML 1.0 Illegal attribute delimiter"
);
vep
->
state
=
VEP_TAGERROR
;
}
}
else
if
(
vep
->
state
==
VEP_ATTRVAL
)
{
while
(
p
<
e
&&
*
p
!=
'>'
&&
*
p
!=
vep
->
attr_delim
&&
(
vep
->
attr_delim
!=
' '
||
!
vct_issp
(
*
p
)))
{
...
...
@@ -879,7 +879,6 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
}
vep
->
state
=
VEP_INTAG
;
}
/******************************************************
* Utility Section
...
...
@@ -955,7 +954,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
* in the most efficient way, in particular with respect to
* minimizing and limiting use of pending.
*/
if
(
p
==
vep
->
ver_p
)
if
(
p
==
vep
->
ver_p
)
;
else
if
(
vep
->
in_esi_tag
)
vep_mark_skip
(
vep
,
p
);
...
...
bin/varnishd/cache_fetch.c
View file @
cb016fe0
...
...
@@ -91,7 +91,7 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
struct
storage
*
st
;
while
(
bytes
>
0
)
{
if
(
FetchStorage
(
sp
))
if
(
FetchStorage
(
sp
))
return
(
-
1
);
st
=
sp
->
wrk
->
storage
;
l
=
st
->
space
-
st
->
len
;
...
...
bin/varnishd/cache_gzip.c
View file @
cb016fe0
...
...
@@ -38,7 +38,7 @@
* will be the following, so we need to be a bit careful with the scratch
* space we use:
*
*
Backend Tmp Input Output
* Backend Tmp Input Output
* | ----------------------
* v
* gunzip wrk stack ?
...
...
@@ -144,7 +144,7 @@ vgz_alloc_vgz(struct sess *sp)
break
;
default:
assert
(
0
==
__LINE__
);
}
}
return
(
vg
);
}
...
...
@@ -158,7 +158,7 @@ VGZ_NewUngzip(struct sess *sp)
/*
* Max memory usage according to zonf.h:
*
mem_needed = "a few kb" + (1 << (windowBits))
* mem_needed = "a few kb" + (1 << (windowBits))
* Since we don't control windowBits, we have to assume
* it is 15, so 34-35KB or so.
*/
...
...
@@ -178,7 +178,7 @@ VGZ_NewGzip(struct sess *sp)
/*
* From zconf.h:
*
*
mem_needed = "a few kb"
*
mem_needed = "a few kb"
* + (1 << (windowBits+2))
* + (1 << (memLevel+9))
*
...
...
@@ -245,7 +245,7 @@ VGZ_ObufStorage(const struct sess *sp, struct vgz *vg)
{
struct
storage
*
st
;
if
(
FetchStorage
(
sp
))
if
(
FetchStorage
(
sp
))
return
(
-
1
);
st
=
sp
->
wrk
->
storage
;
...
...
@@ -349,7 +349,7 @@ VGZ_Destroy(struct vgz **vg)
{
CHECK_OBJ_NOTNULL
(
*
vg
,
VGZ_MAGIC
);
if
((
*
vg
)
->
tmp
!=
NULL
)
if
((
*
vg
)
->
tmp
!=
NULL
)
WS_Reset
((
*
vg
)
->
tmp
,
(
*
vg
)
->
tmp_snapshot
);
*
vg
=
NULL
;
}
...
...
bin/varnishd/cache_response.c
View file @
cb016fe0
...
...
@@ -273,7 +273,7 @@ res_WriteGunzipObj(struct sess *sp)
(
void
)
WRW_Write
(
sp
->
wrk
,
lenbuf
,
-
1
);
}
(
void
)
WRW_Write
(
sp
->
wrk
,
dp
,
dl
);
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
(
void
)
WRW_Write
(
sp
->
wrk
,
"
\r\n
"
,
-
1
);
if
(
WRW_Flush
(
sp
->
wrk
))
break
;
...
...
@@ -344,7 +344,7 @@ res_WriteDirObj(struct sess *sp, char *lenbuf, size_t low, size_t high)
(
void
)
WRW_Write
(
sp
->
wrk
,
st
->
ptr
+
off
,
len
);
}
assert
(
u
==
sp
->
obj
->
len
);
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
(
void
)
WRW_Write
(
sp
->
wrk
,
"
\r\n
"
,
-
1
);
}
...
...
@@ -393,7 +393,7 @@ RES_WriteObj(struct sess *sp)
}
else
if
(
sp
->
wrk
->
res_mode
&
RES_ESI_CHILD
&&
sp
->
wrk
->
gzip_resp
)
{
ESI_DeliverChild
(
sp
);
}
else
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
)
{
res_WriteGunzipObj
(
sp
);
res_WriteGunzipObj
(
sp
);
}
else
{
res_WriteDirObj
(
sp
,
lenbuf
,
low
,
high
);
}
...
...
bin/varnishtest/vtc_http.c
View file @
cb016fe0
...
...
@@ -596,7 +596,7 @@ gzip_body(struct http *hp, const char *txt, char **body, int *bodylen)
hp
->
gziplevel
,
Z_DEFLATED
,
31
,
9
,
Z_DEFAULT_STRATEGY
));
assert
(
Z_STREAM_END
==
deflate
(
&
vz
,
Z_FINISH
));
i
=
vz
.
stop_bit
&
7
;
if
(
hp
->
gzipresidual
>=
0
&&
hp
->
gzipresidual
!=
i
)
if
(
hp
->
gzipresidual
>=
0
&&
hp
->
gzipresidual
!=
i
)
vtc_log
(
hp
->
vl
,
0
,
"Wrong gzip residual got %d wanted %d"
,
i
,
hp
->
gzipresidual
);
*
bodylen
=
vz
.
total_out
;
...
...
lib/libvgz/inflate.c
View file @
cb016fe0
...
...
@@ -811,7 +811,7 @@ int flush;
case
TYPE
:
if
(
flush
==
Z_BLOCK
||
flush
==
Z_TREES
)
goto
inf_leave
;
case
TYPEDO
:
if
(
strm
->
start_bit
==
0
)
if
(
strm
->
start_bit
==
0
)
strm
->
start_bit
=
8
*
(
strm
->
total_in
+
in
-
have
)
-
bits
;
if
(
state
->
last
)
{
strm
->
stop_bit
=
8
*
(
strm
->
total_in
+
in
-
have
)
-
bits
;
...
...
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