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
92e77b87
Commit
92e77b87
authored
Feb 15, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce WS_Inside() to reduce the amount of grubbing around
inside struct ws.
parent
c1cf8d37
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
3 deletions
+19
-3
cache.h
bin/varnishd/cache/cache.h
+1
-0
cache_http.c
bin/varnishd/cache/cache_http.c
+1
-1
cache_ws.c
bin/varnishd/cache/cache_ws.c
+15
-0
cache_http2_deliver.c
bin/varnishd/http2/cache_http2_deliver.c
+2
-2
No files found.
bin/varnishd/cache/cache.h
View file @
92e77b87
...
...
@@ -1068,6 +1068,7 @@ void *WS_Copy(struct ws *ws, const void *str, int len);
uintptr_t
WS_Snapshot
(
struct
ws
*
ws
);
int
WS_Overflowed
(
const
struct
ws
*
ws
);
void
*
WS_Printf
(
struct
ws
*
ws
,
const
char
*
fmt
,
...)
__v_printflike
(
2
,
3
);
int
WS_Inside
(
const
struct
ws
*
,
const
void
*
,
const
void
*
);
/* cache_rfc2616.c */
void
RFC2616_Ttl
(
struct
busyobj
*
,
double
now
,
double
*
t_origin
,
...
...
bin/varnishd/cache/cache_http.c
View file @
92e77b87
...
...
@@ -1097,7 +1097,7 @@ http_CopyHome(const struct http *hp)
assert
(
u
<
HTTP_HDR_FIRST
);
continue
;
}
if
(
hp
->
hd
[
u
].
b
>=
hp
->
ws
->
s
&&
hp
->
hd
[
u
].
e
<=
hp
->
ws
->
e
)
if
(
WS_Inside
(
hp
->
ws
,
hp
->
hd
[
u
].
b
,
hp
->
hd
[
u
].
e
)
)
continue
;
l
=
Tlen
(
hp
->
hd
[
u
]);
...
...
bin/varnishd/cache/cache_ws.c
View file @
92e77b87
...
...
@@ -59,6 +59,21 @@ WS_Assert(const struct ws *ws)
assert
(
*
ws
->
e
==
0x15
);
}
int
WS_Inside
(
const
struct
ws
*
ws
,
const
void
*
bb
,
const
void
*
ee
)
{
const
char
*
b
=
bb
;
const
char
*
e
=
ee
;
WS_Assert
(
ws
);
if
(
b
<
ws
->
s
||
b
>=
ws
->
e
)
return
(
0
);
if
(
e
!=
NULL
&&
(
e
<
b
||
e
>
ws
->
e
))
return
(
0
);
return
(
1
);
}
/*
* NB: The id must be max 3 char and lower-case.
* (upper-case the first char to indicate overflow)
...
...
bin/varnishd/http2/cache_http2_deliver.c
View file @
92e77b87
...
...
@@ -137,7 +137,7 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
hp
=
req
->
resp
;
for
(
u
=
HTTP_HDR_FIRST
;
u
<
hp
->
nhd
;
u
++
)
{
assert
(
(
char
*
)
p
<
req
->
ws
->
e
);
assert
(
WS_Inside
(
req
->
ws
,
p
,
NULL
)
);
r
=
strchr
(
hp
->
hd
[
u
].
b
,
':'
);
AN
(
r
);
...
...
@@ -194,7 +194,7 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
memcpy
(
p
,
r
,
sz
);
p
+=
sz
;
assert
(
(
char
*
)
p
<
req
->
ws
->
e
);
assert
(
WS_Inside
(
req
->
ws
,
p
,
NULL
)
);
}
sz
=
(
char
*
)
p
-
req
->
ws
->
f
;
...
...
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