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
0d1e7837
Commit
0d1e7837
authored
Apr 04, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
And one more sweep over FreeBSD/Varnish sbuf/vsb differences.
parent
d4f532d2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
18 deletions
+25
-18
cache_panic.c
bin/varnishd/cache_panic.c
+4
-4
cache_vary.c
bin/varnishd/cache_vary.c
+2
-1
vtc_http.c
bin/varnishtest/vtc_http.c
+2
-2
vsb.h
include/vsb.h
+6
-6
cli_common.c
lib/libvarnish/cli_common.c
+1
-1
vsb.c
lib/libvarnish/vsb.c
+10
-4
No files found.
bin/varnishd/cache_panic.c
View file @
0d1e7837
...
...
@@ -71,15 +71,15 @@ pan_ws(const struct ws *ws, int indent)
vsb_printf
(
vsp
,
"%*sid =
\"
%s
\"
,
\n
"
,
indent
+
2
,
""
,
ws
->
id
);
vsb_printf
(
vsp
,
"%*s{s,f,r,e} = {%p"
,
indent
+
2
,
""
,
ws
->
s
);
if
(
ws
->
f
>
ws
->
s
)
vsb_printf
(
vsp
,
",+%d"
,
ws
->
f
-
ws
->
s
);
vsb_printf
(
vsp
,
",+%
l
d"
,
ws
->
f
-
ws
->
s
);
else
vsb_printf
(
vsp
,
",%p"
,
ws
->
f
);
if
(
ws
->
r
>
ws
->
s
)
vsb_printf
(
vsp
,
",+%d"
,
ws
->
r
-
ws
->
s
);
vsb_printf
(
vsp
,
",+%
l
d"
,
ws
->
r
-
ws
->
s
);
else
vsb_printf
(
vsp
,
",%p"
,
ws
->
r
);
if
(
ws
->
e
>
ws
->
s
)
vsb_printf
(
vsp
,
",+%d"
,
ws
->
e
-
ws
->
s
);
vsb_printf
(
vsp
,
",+%
l
d"
,
ws
->
e
-
ws
->
s
);
else
vsb_printf
(
vsp
,
",%p"
,
ws
->
e
);
vsb_printf
(
vsp
,
"},
\n
"
);
...
...
@@ -166,7 +166,7 @@ pan_object(const struct object *o)
vsb_printf
(
vsp
,
" xid = %u,
\n
"
,
o
->
xid
);
pan_ws
(
o
->
ws_o
,
4
);
pan_http
(
"obj"
,
o
->
http
,
4
);
vsb_printf
(
vsp
,
" len = %u,
\n
"
,
o
->
len
);
vsb_printf
(
vsp
,
" len = %
l
u,
\n
"
,
o
->
len
);
vsb_printf
(
vsp
,
" store = {
\n
"
);
VTAILQ_FOREACH
(
st
,
&
o
->
store
,
list
)
pan_storage
(
st
);
...
...
bin/varnishd/cache_vary.c
View file @
0d1e7837
...
...
@@ -96,7 +96,8 @@ VRY_Create(const struct sess *sp, const struct http *hp)
/* Build a header-matching string out of it */
vsb_clear
(
sbh
);
vsb_printf
(
sbh
,
"%c%.*s:%c"
,
1
+
(
q
-
p
),
q
-
p
,
p
,
0
);
vsb_printf
(
sbh
,
"%c%.*s:%c"
,
(
char
)(
1
+
(
q
-
p
)),
(
int
)(
q
-
p
),
p
,
0
);
AZ
(
vsb_finish
(
sbh
));
/* Append to vary matching string */
...
...
bin/varnishtest/vtc_http.c
View file @
0d1e7837
...
...
@@ -845,7 +845,7 @@ cmd_http_txreq(CMD_ARGS)
if
(
*
av
!=
NULL
)
vtc_log
(
hp
->
vl
,
0
,
"Unknown http txreq spec: %s
\n
"
,
*
av
);
if
(
body
!=
NULL
)
vsb_printf
(
hp
->
vsb
,
"Content-Length: %
d
%s"
,
strlen
(
body
),
nl
);
vsb_printf
(
hp
->
vsb
,
"Content-Length: %
lu
%s"
,
strlen
(
body
),
nl
);
vsb_cat
(
hp
->
vsb
,
nl
);
if
(
body
!=
NULL
)
{
vsb_cat
(
hp
->
vsb
,
body
);
...
...
@@ -890,7 +890,7 @@ cmd_http_chunked(CMD_ARGS)
AN
(
av
[
1
]);
AZ
(
av
[
2
]);
vsb_clear
(
hp
->
vsb
);
vsb_printf
(
hp
->
vsb
,
"%x%s%s%s"
,
strlen
(
av
[
1
]),
nl
,
av
[
1
],
nl
);
vsb_printf
(
hp
->
vsb
,
"%
l
x%s%s%s"
,
strlen
(
av
[
1
]),
nl
,
av
[
1
],
nl
);
http_write
(
hp
,
4
,
"chunked"
);
}
...
...
include/vsb.h
View file @
0d1e7837
...
...
@@ -39,12 +39,12 @@
struct
vsb
{
unsigned
s_magic
;
char
*
s_buf
;
/* storage buffer */
int
s_error
;
/* current error code */
ssize_t
s_size
;
/* size of storage buffer */
ssize_t
s_len
;
/* current length of string */
int
s_error
;
/* current error code */
#define VSB_FIXEDLEN 0x00000000
/* fixed length buffer (default) */
#define VSB_AUTOEXTEND 0x00000001
/* automatically extend buffer */
#define VSB_USRFLAGMSK
0x0000ffff
/* mask of flags the user may specify */
#define VSB_USRFLAGMSK
0x0000ffff
/* mask of flags the user may specify */
#define VSB_DYNAMIC 0x00010000
/* s_buf must be freed */
#define VSB_FINISHED 0x00020000
/* set by vsb_finish() */
#define VSB_DYNSTRUCT 0x00080000
/* vsb must be freed */
...
...
@@ -61,23 +61,23 @@ struct vsb *vsb_new(struct vsb *, char *, int, int);
#define vsb_new_auto() \
vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND)
void
vsb_clear
(
struct
vsb
*
);
int
vsb_setpos
(
struct
vsb
*
,
in
t
);
int
vsb_setpos
(
struct
vsb
*
,
ssize_
t
);
int
vsb_bcat
(
struct
vsb
*
,
const
void
*
,
size_t
);
int
vsb_bcpy
(
struct
vsb
*
,
const
void
*
,
size_t
);
int
vsb_cat
(
struct
vsb
*
,
const
char
*
);
int
vsb_cpy
(
struct
vsb
*
,
const
char
*
);
int
vsb_printf
(
struct
vsb
*
,
const
char
*
,
...)
/* __printflike(2, 3) */
;
__printflike
(
2
,
3
)
;
#ifdef va_start
int
vsb_vprintf
(
struct
vsb
*
,
const
char
*
,
va_list
)
/* __printflike(2, 0) */
;
__printflike
(
2
,
0
)
;
#endif
int
vsb_putc
(
struct
vsb
*
,
char
);
int
vsb_trim
(
struct
vsb
*
);
int
vsb_error
(
const
struct
vsb
*
);
int
vsb_finish
(
struct
vsb
*
);
char
*
vsb_data
(
struct
vsb
*
);
in
t
vsb_len
(
struct
vsb
*
);
ssize_
t
vsb_len
(
struct
vsb
*
);
int
vsb_done
(
const
struct
vsb
*
);
void
vsb_delete
(
struct
vsb
*
);
void
vsb_quote
(
struct
vsb
*
s
,
const
char
*
p
,
int
len
,
int
how
);
...
...
lib/libvarnish/cli_common.c
View file @
0d1e7837
...
...
@@ -100,7 +100,7 @@ cli_writeres(int fd, const struct cli *cli)
assert
(
cli
->
result
<=
999
);
/*lint !e650 const out of range */
i
=
snprintf
(
res
,
sizeof
res
,
"%-3d %-8
d
\n
"
,
cli
->
result
,
vsb_len
(
cli
->
sb
));
"%-3d %-8
ld
\n
"
,
cli
->
result
,
(
long
)
vsb_len
(
cli
->
sb
));
assert
(
i
==
CLI_LINE0_LEN
);
iov
[
0
].
iov_base
=
res
;
...
...
lib/libvarnish/vsb.c
View file @
0d1e7837
...
...
@@ -24,7 +24,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
__FBSDID("$FreeBSD: head/sys/kern/subr_
sbuf.c 181462 2008-08-09 10:26:21Z des $");
__FBSDID("$FreeBSD: head/sys/kern/subr_
vsb.c 212750 2010-09-16 16:13:12Z mdf $
*/
#include "config.h"
...
...
@@ -65,8 +65,13 @@ SVNID("$Id$")
#define VSB_CLEARFLAG(s, f) do { (s)->s_flags &= ~(f); } while (0)
#define VSB_MINEXTENDSIZE 16
/* Should be power of 2. */
#ifdef PAGE_SIZE
#define VSB_MAXEXTENDSIZE PAGE_SIZE
#define VSB_MAXEXTENDINCR PAGE_SIZE
#else
#define VSB_MAXEXTENDSIZE 4096
#define VSB_MAXEXTENDINCR 4096
#endif
/*
* Debugging support
...
...
@@ -158,8 +163,9 @@ vsb_newbuf(struct vsb *s, char *buf, int length, int flags)
{
memset
(
s
,
0
,
sizeof
(
*
s
));
s
->
s_magic
=
VSB_MAGIC
;
s
->
s_flags
=
flags
;
s
->
s_magic
=
VSB_MAGIC
;
if
(
buf
!=
NULL
)
{
KASSERT
(
length
>
0
,
(
"zero or negative length (%d)"
,
length
));
...
...
@@ -224,7 +230,7 @@ vsb_clear(struct vsb *s)
* Effectively truncates the vsb at the new position.
*/
int
vsb_setpos
(
struct
vsb
*
s
,
in
t
pos
)
vsb_setpos
(
struct
vsb
*
s
,
ssize_
t
pos
)
{
assert_vsb_integrity
(
s
);
...
...
@@ -476,7 +482,7 @@ vsb_data(struct vsb *s)
/*
* Return the length of the vsb data.
*/
in
t
ssize_
t
vsb_len
(
struct
vsb
*
s
)
{
...
...
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