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
30be1c80
Commit
30be1c80
authored
Oct 05, 2020
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start changing the calling convention for VDP to make it usable on bereq.
parent
86d92bca
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
59 deletions
+69
-59
cache_deliver_proc.c
bin/varnishd/cache/cache_deliver_proc.c
+17
-15
cache_esi_deliver.c
bin/varnishd/cache/cache_esi_deliver.c
+25
-23
cache_filter.h
bin/varnishd/cache/cache_filter.h
+7
-2
cache_gzip.c
bin/varnishd/cache/cache_gzip.c
+5
-5
cache_range.c
bin/varnishd/cache/cache_range.c
+4
-4
cache_http1_deliver.c
bin/varnishd/http1/cache_http1_deliver.c
+5
-5
cache_http2_deliver.c
bin/varnishd/http2/cache_http2_deliver.c
+6
-5
No files found.
bin/varnishd/cache/cache_deliver_proc.c
View file @
30be1c80
...
@@ -58,17 +58,16 @@
...
@@ -58,17 +58,16 @@
* r > 0: Stop, breaks out early without error condition
* r > 0: Stop, breaks out early without error condition
*/
*/
int
int
VDP_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
const
void
*
ptr
,
ssize_t
len
)
VDP_bytes
(
struct
vdp_ctx
*
vdx
,
enum
vdp_action
act
,
const
void
*
ptr
,
ssize_t
len
)
{
{
int
retval
;
int
retval
;
struct
vdp_entry
*
vdpe
;
struct
vdp_entry
*
vdpe
;
struct
vdp_ctx
*
vdc
;
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
CHECK_OBJ_NOTNULL
(
vdx
,
VDP_CTX
_MAGIC
);
vdc
=
req
->
vdc
;
CHECK_OBJ_NOTNULL
(
vdx
->
req
,
REQ_MAGIC
)
;
if
(
vd
c
->
retval
)
if
(
vd
x
->
retval
)
return
(
vd
c
->
retval
);
return
(
vd
x
->
retval
);
vdpe
=
vd
c
->
nxt
;
vdpe
=
vd
x
->
nxt
;
CHECK_OBJ_NOTNULL
(
vdpe
,
VDP_ENTRY_MAGIC
);
CHECK_OBJ_NOTNULL
(
vdpe
,
VDP_ENTRY_MAGIC
);
/* at most one VDP_END call */
/* at most one VDP_END call */
...
@@ -82,14 +81,14 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
...
@@ -82,14 +81,14 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
assert
(
act
==
VDP_FLUSH
);
assert
(
act
==
VDP_FLUSH
);
/* Call the present layer, while pointing to the next layer down */
/* Call the present layer, while pointing to the next layer down */
vd
c
->
nxt
=
VTAILQ_NEXT
(
vdpe
,
list
);
vd
x
->
nxt
=
VTAILQ_NEXT
(
vdpe
,
list
);
vdpe
->
calls
++
;
vdpe
->
calls
++
;
vdpe
->
bytes_in
+=
len
;
vdpe
->
bytes_in
+=
len
;
retval
=
vdpe
->
vdp
->
bytes
(
req
,
act
,
&
vdpe
->
priv
,
ptr
,
len
);
retval
=
vdpe
->
vdp
->
bytes
(
vdx
,
act
,
&
vdpe
->
priv
,
ptr
,
len
);
if
(
retval
&&
(
vd
c
->
retval
==
0
||
retval
<
vdc
->
retval
))
if
(
retval
&&
(
vd
x
->
retval
==
0
||
retval
<
vdx
->
retval
))
vd
c
->
retval
=
retval
;
/* Latch error value */
vd
x
->
retval
=
retval
;
/* Latch error value */
vd
c
->
nxt
=
vdpe
;
vd
x
->
nxt
=
vdpe
;
return
(
vd
c
->
retval
);
return
(
vd
x
->
retval
);
}
}
int
int
...
@@ -177,11 +176,14 @@ VDP_DeliverObj(struct req *req)
...
@@ -177,11 +176,14 @@ VDP_DeliverObj(struct req *req)
int
r
,
final
;
int
r
,
final
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
req
->
vdc
->
req
=
req
;
req
->
vdc
->
vsl
=
req
->
vsl
;
req
->
vdc
->
wrk
=
req
->
wrk
;
final
=
req
->
objcore
->
flags
&
(
OC_F_PRIVATE
|
OC_F_HFM
|
OC_F_HFP
)
final
=
req
->
objcore
->
flags
&
(
OC_F_PRIVATE
|
OC_F_HFM
|
OC_F_HFP
)
?
1
:
0
;
?
1
:
0
;
r
=
ObjIterate
(
req
->
wrk
,
req
->
objcore
,
req
,
vdp_objiterator
,
final
);
r
=
ObjIterate
(
req
->
wrk
,
req
->
objcore
,
req
->
vdc
,
vdp_objiterator
,
final
);
if
(
r
==
0
)
if
(
r
==
0
)
r
=
VDP_bytes
(
req
,
VDP_END
,
NULL
,
0
);
r
=
VDP_bytes
(
req
->
vdc
,
VDP_END
,
NULL
,
0
);
if
(
r
<
0
)
if
(
r
<
0
)
return
(
r
);
return
(
r
);
return
(
0
);
return
(
0
);
...
...
bin/varnishd/cache/cache_esi_deliver.c
View file @
30be1c80
...
@@ -222,7 +222,7 @@ ved_include(struct req *preq, const char *src, const char *host,
...
@@ -222,7 +222,7 @@ ved_include(struct req *preq, const char *src, const char *host,
#define Debug(fmt, ...)
/**/
#define Debug(fmt, ...)
/**/
static
ssize_t
static
ssize_t
ved_decode_len
(
struct
req
*
req
,
const
uint8_t
**
pp
)
ved_decode_len
(
struct
vsl_log
*
vsl
,
const
uint8_t
**
pp
)
{
{
const
uint8_t
*
p
;
const
uint8_t
*
p
;
ssize_t
l
;
ssize_t
l
;
...
@@ -242,7 +242,7 @@ ved_decode_len(struct req *req, const uint8_t **pp)
...
@@ -242,7 +242,7 @@ ved_decode_len(struct req *req, const uint8_t **pp)
p
+=
9
;
p
+=
9
;
break
;
break
;
default:
default:
VSLb
(
req
->
vsl
,
SLT_Error
,
VSLb
(
vsl
,
SLT_Error
,
"ESI-corruption: Illegal Length %d %d
\n
"
,
*
p
,
(
*
p
&
15
));
"ESI-corruption: Illegal Length %d %d
\n
"
,
*
p
,
(
*
p
&
15
));
WRONG
(
"ESI-codes: illegal length"
);
WRONG
(
"ESI-codes: illegal length"
);
}
}
...
@@ -300,7 +300,7 @@ ved_vdp_esi_fini(struct req *req, void **priv)
...
@@ -300,7 +300,7 @@ ved_vdp_esi_fini(struct req *req, void **priv)
}
}
static
int
v_matchproto_
(
vdp_bytes_f
)
static
int
v_matchproto_
(
vdp_bytes_f
)
ved_vdp_esi_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
**
priv
,
ved_vdp_esi_bytes
(
struct
vdp_ctx
*
vdx
,
enum
vdp_action
act
,
void
**
priv
,
const
void
*
ptr
,
ssize_t
len
)
const
void
*
ptr
,
ssize_t
len
)
{
{
uint8_t
*
q
,
*
r
;
uint8_t
*
q
,
*
r
;
...
@@ -312,13 +312,14 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -312,13 +312,14 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
int
retval
=
0
;
int
retval
=
0
;
AN
(
priv
);
AN
(
priv
);
CHECK_OBJ_NOTNULL
(
vdx
,
VDP_CTX_MAGIC
);
CAST_OBJ_NOTNULL
(
ecx
,
*
priv
,
ECX_MAGIC
);
CAST_OBJ_NOTNULL
(
ecx
,
*
priv
,
ECX_MAGIC
);
pp
=
ptr
;
pp
=
ptr
;
while
(
1
)
{
while
(
1
)
{
switch
(
ecx
->
state
)
{
switch
(
ecx
->
state
)
{
case
0
:
case
0
:
ecx
->
p
=
ObjGetAttr
(
req
->
wrk
,
req
->
objcore
,
ecx
->
p
=
ObjGetAttr
(
vdx
->
wrk
,
vdx
->
req
->
objcore
,
OA_ESIDATA
,
&
l
);
OA_ESIDATA
,
&
l
);
AN
(
ecx
->
p
);
AN
(
ecx
->
p
);
assert
(
l
>
0
);
assert
(
l
>
0
);
...
@@ -326,7 +327,7 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -326,7 +327,7 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
if
(
*
ecx
->
p
==
VEC_GZ
)
{
if
(
*
ecx
->
p
==
VEC_GZ
)
{
if
(
ecx
->
pecx
==
NULL
)
if
(
ecx
->
pecx
==
NULL
)
retval
=
VDP_bytes
(
req
,
VDP_NULL
,
retval
=
VDP_bytes
(
vdx
,
VDP_NULL
,
gzip_hdr
,
10
);
gzip_hdr
,
10
);
ecx
->
l_crc
=
0
;
ecx
->
l_crc
=
0
;
ecx
->
crc
=
crc32
(
0L
,
Z_NULL
,
0
);
ecx
->
crc
=
crc32
(
0L
,
Z_NULL
,
0
);
...
@@ -344,14 +345,14 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -344,14 +345,14 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
case
VEC_V1
:
case
VEC_V1
:
case
VEC_V2
:
case
VEC_V2
:
case
VEC_V8
:
case
VEC_V8
:
ecx
->
l
=
ved_decode_len
(
req
,
&
ecx
->
p
);
ecx
->
l
=
ved_decode_len
(
vdx
->
vsl
,
&
ecx
->
p
);
if
(
ecx
->
l
<
0
)
if
(
ecx
->
l
<
0
)
return
(
-
1
);
return
(
-
1
);
if
(
ecx
->
isgzip
)
{
if
(
ecx
->
isgzip
)
{
assert
(
*
ecx
->
p
==
VEC_C1
||
assert
(
*
ecx
->
p
==
VEC_C1
||
*
ecx
->
p
==
VEC_C2
||
*
ecx
->
p
==
VEC_C2
||
*
ecx
->
p
==
VEC_C8
);
*
ecx
->
p
==
VEC_C8
);
l
=
ved_decode_len
(
req
,
&
ecx
->
p
);
l
=
ved_decode_len
(
vdx
->
vsl
,
&
ecx
->
p
);
if
(
l
<
0
)
if
(
l
<
0
)
return
(
-
1
);
return
(
-
1
);
icrc
=
vbe32dec
(
ecx
->
p
);
icrc
=
vbe32dec
(
ecx
->
p
);
...
@@ -365,7 +366,7 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -365,7 +366,7 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
case
VEC_S1
:
case
VEC_S1
:
case
VEC_S2
:
case
VEC_S2
:
case
VEC_S8
:
case
VEC_S8
:
ecx
->
l
=
ved_decode_len
(
req
,
&
ecx
->
p
);
ecx
->
l
=
ved_decode_len
(
vdx
->
vsl
,
&
ecx
->
p
);
if
(
ecx
->
l
<
0
)
if
(
ecx
->
l
<
0
)
return
(
-
1
);
return
(
-
1
);
Debug
(
"SKIP1(%d)
\n
"
,
(
int
)
ecx
->
l
);
Debug
(
"SKIP1(%d)
\n
"
,
(
int
)
ecx
->
l
);
...
@@ -378,18 +379,18 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -378,18 +379,18 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
q
++
;
q
++
;
r
=
(
void
*
)
strchr
((
const
char
*
)
q
,
'\0'
);
r
=
(
void
*
)
strchr
((
const
char
*
)
q
,
'\0'
);
AN
(
r
);
AN
(
r
);
if
(
VDP_bytes
(
req
,
VDP_FLUSH
,
NULL
,
0
))
{
if
(
VDP_bytes
(
vdx
,
VDP_FLUSH
,
NULL
,
0
))
{
ecx
->
p
=
ecx
->
e
;
ecx
->
p
=
ecx
->
e
;
break
;
break
;
}
}
Debug
(
"INCL [%s][%s] BEGIN
\n
"
,
q
,
ecx
->
p
);
Debug
(
"INCL [%s][%s] BEGIN
\n
"
,
q
,
ecx
->
p
);
ved_include
(
req
,
ved_include
(
vdx
->
req
,
(
const
char
*
)
q
,
(
const
char
*
)
ecx
->
p
,
ecx
);
(
const
char
*
)
q
,
(
const
char
*
)
ecx
->
p
,
ecx
);
Debug
(
"INCL [%s][%s] END
\n
"
,
q
,
ecx
->
p
);
Debug
(
"INCL [%s][%s] END
\n
"
,
q
,
ecx
->
p
);
ecx
->
p
=
r
+
1
;
ecx
->
p
=
r
+
1
;
break
;
break
;
default:
default:
VSLb
(
req
->
vsl
,
SLT_Error
,
VSLb
(
vdx
->
vsl
,
SLT_Error
,
"ESI corruption line %d 0x%02x [%s]
\n
"
,
"ESI corruption line %d 0x%02x [%s]
\n
"
,
__LINE__
,
*
ecx
->
p
,
ecx
->
p
);
__LINE__
,
*
ecx
->
p
,
ecx
->
p
);
WRONG
(
"ESI-codes: Illegal code"
);
WRONG
(
"ESI-codes: Illegal code"
);
...
@@ -413,14 +414,14 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -413,14 +414,14 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
/* MOD(2^32) length */
/* MOD(2^32) length */
vle32enc
(
tailbuf
+
9
,
ecx
->
l_crc
);
vle32enc
(
tailbuf
+
9
,
ecx
->
l_crc
);
retval
=
VDP_bytes
(
req
,
VDP_END
,
tailbuf
,
13
);
retval
=
VDP_bytes
(
vdx
,
VDP_END
,
tailbuf
,
13
);
}
else
if
(
ecx
->
pecx
!=
NULL
)
{
}
else
if
(
ecx
->
pecx
!=
NULL
)
{
ecx
->
pecx
->
crc
=
crc32_combine
(
ecx
->
pecx
->
crc
,
ecx
->
pecx
->
crc
=
crc32_combine
(
ecx
->
pecx
->
crc
,
ecx
->
crc
,
ecx
->
l_crc
);
ecx
->
crc
,
ecx
->
l_crc
);
ecx
->
pecx
->
l_crc
+=
ecx
->
l_crc
;
ecx
->
pecx
->
l_crc
+=
ecx
->
l_crc
;
retval
=
VDP_bytes
(
req
,
VDP_FLUSH
,
NULL
,
0
);
retval
=
VDP_bytes
(
vdx
,
VDP_FLUSH
,
NULL
,
0
);
}
else
{
}
else
{
retval
=
VDP_bytes
(
req
,
VDP_END
,
NULL
,
0
);
retval
=
VDP_bytes
(
vdx
,
VDP_END
,
NULL
,
0
);
}
}
ecx
->
state
=
99
;
ecx
->
state
=
99
;
return
(
retval
);
return
(
retval
);
...
@@ -434,7 +435,7 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -434,7 +435,7 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
*/
*/
if
(
ecx
->
l
<=
len
)
{
if
(
ecx
->
l
<=
len
)
{
if
(
ecx
->
state
==
3
)
if
(
ecx
->
state
==
3
)
retval
=
VDP_bytes
(
req
,
act
,
retval
=
VDP_bytes
(
vdx
,
act
,
pp
,
ecx
->
l
);
pp
,
ecx
->
l
);
len
-=
ecx
->
l
;
len
-=
ecx
->
l
;
pp
+=
ecx
->
l
;
pp
+=
ecx
->
l
;
...
@@ -442,7 +443,7 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -442,7 +443,7 @@ ved_vdp_esi_bytes(struct req *req, enum vdp_action act, void **priv,
break
;
break
;
}
}
if
(
ecx
->
state
==
3
&&
len
>
0
)
if
(
ecx
->
state
==
3
&&
len
>
0
)
retval
=
VDP_bytes
(
req
,
act
,
pp
,
len
);
retval
=
VDP_bytes
(
vdx
,
act
,
pp
,
len
);
ecx
->
l
-=
len
;
ecx
->
l
-=
len
;
return
(
retval
);
return
(
retval
);
case
99
:
case
99
:
...
@@ -477,7 +478,7 @@ ved_bytes(struct ecx *ecx, enum vdp_action act,
...
@@ -477,7 +478,7 @@ ved_bytes(struct ecx *ecx, enum vdp_action act,
{
{
if
(
act
==
VDP_END
)
if
(
act
==
VDP_END
)
act
=
VDP_FLUSH
;
act
=
VDP_FLUSH
;
return
(
VDP_bytes
(
ecx
->
preq
,
act
,
ptr
,
len
));
return
(
VDP_bytes
(
ecx
->
preq
->
vdc
,
act
,
ptr
,
len
));
}
}
/*---------------------------------------------------------------------
/*---------------------------------------------------------------------
...
@@ -507,7 +508,7 @@ ved_pretend_gzip_fini(struct req *req, void **priv)
...
@@ -507,7 +508,7 @@ ved_pretend_gzip_fini(struct req *req, void **priv)
}
}
static
int
v_matchproto_
(
vdp_bytes_f
)
static
int
v_matchproto_
(
vdp_bytes_f
)
ved_pretend_gzip_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
**
priv
,
ved_pretend_gzip_bytes
(
struct
vdp_ctx
*
vdx
,
enum
vdp_action
act
,
void
**
priv
,
const
void
*
pv
,
ssize_t
l
)
const
void
*
pv
,
ssize_t
l
)
{
{
uint8_t
buf1
[
5
],
buf2
[
5
];
uint8_t
buf1
[
5
],
buf2
[
5
];
...
@@ -515,7 +516,8 @@ ved_pretend_gzip_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -515,7 +516,8 @@ ved_pretend_gzip_bytes(struct req *req, enum vdp_action act, void **priv,
uint16_t
lx
;
uint16_t
lx
;
struct
ecx
*
ecx
;
struct
ecx
*
ecx
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
vdx
,
VDP_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
vdx
->
req
,
REQ_MAGIC
);
CAST_OBJ_NOTNULL
(
ecx
,
*
priv
,
ECX_MAGIC
);
CAST_OBJ_NOTNULL
(
ecx
,
*
priv
,
ECX_MAGIC
);
(
void
)
priv
;
(
void
)
priv
;
...
@@ -614,7 +616,7 @@ ved_gzgz_init(struct req *req, void **priv)
...
@@ -614,7 +616,7 @@ ved_gzgz_init(struct req *req, void **priv)
}
}
static
int
v_matchproto_
(
vdp_bytes_f
)
static
int
v_matchproto_
(
vdp_bytes_f
)
ved_gzgz_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
**
priv
,
ved_gzgz_bytes
(
struct
vdp_ctx
*
vdx
,
enum
vdp_action
act
,
void
**
priv
,
const
void
*
ptr
,
ssize_t
len
)
const
void
*
ptr
,
ssize_t
len
)
{
{
struct
ved_foo
*
foo
;
struct
ved_foo
*
foo
;
...
@@ -622,7 +624,7 @@ ved_gzgz_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -622,7 +624,7 @@ ved_gzgz_bytes(struct req *req, enum vdp_action act, void **priv,
ssize_t
dl
;
ssize_t
dl
;
ssize_t
l
;
ssize_t
l
;
(
void
)
req
;
(
void
)
vdx
;
CAST_OBJ_NOTNULL
(
foo
,
*
priv
,
VED_FOO_MAGIC
);
CAST_OBJ_NOTNULL
(
foo
,
*
priv
,
VED_FOO_MAGIC
);
pp
=
ptr
;
pp
=
ptr
;
if
(
len
>
0
)
{
if
(
len
>
0
)
{
...
@@ -799,12 +801,12 @@ ved_vdp_fini(struct req *req, void **priv)
...
@@ -799,12 +801,12 @@ ved_vdp_fini(struct req *req, void **priv)
}
}
static
int
v_matchproto_
(
vdp_bytes_f
)
static
int
v_matchproto_
(
vdp_bytes_f
)
ved_vdp_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
**
priv
,
ved_vdp_bytes
(
struct
vdp_ctx
*
vdx
,
enum
vdp_action
act
,
void
**
priv
,
const
void
*
ptr
,
ssize_t
len
)
const
void
*
ptr
,
ssize_t
len
)
{
{
struct
ecx
*
ecx
;
struct
ecx
*
ecx
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
)
;
(
void
)
vdx
;
CAST_OBJ_NOTNULL
(
ecx
,
*
priv
,
ECX_MAGIC
);
CAST_OBJ_NOTNULL
(
ecx
,
*
priv
,
ECX_MAGIC
);
return
(
ved_bytes
(
ecx
,
act
,
ptr
,
len
));
return
(
ved_bytes
(
ecx
,
act
,
ptr
,
len
));
}
}
...
...
bin/varnishd/cache/cache_filter.h
View file @
30be1c80
...
@@ -110,8 +110,10 @@ typedef int vdp_init_f(struct req *, void **priv);
...
@@ -110,8 +110,10 @@ typedef int vdp_init_f(struct req *, void **priv);
* positive: Don't push this VDP anyway
* positive: Don't push this VDP anyway
*/
*/
struct
vdp_ctx
;
typedef
int
vdp_fini_f
(
struct
req
*
,
void
**
priv
);
typedef
int
vdp_fini_f
(
struct
req
*
,
void
**
priv
);
typedef
int
vdp_bytes_f
(
struct
req
*
,
enum
vdp_action
,
void
**
priv
,
typedef
int
vdp_bytes_f
(
struct
vdp_ctx
*
,
enum
vdp_action
,
void
**
priv
,
const
void
*
ptr
,
ssize_t
len
);
const
void
*
ptr
,
ssize_t
len
);
struct
vdp
{
struct
vdp
{
...
@@ -140,9 +142,12 @@ struct vdp_ctx {
...
@@ -140,9 +142,12 @@ struct vdp_ctx {
int
retval
;
int
retval
;
struct
vdp_entry_s
vdp
;
struct
vdp_entry_s
vdp
;
struct
vdp_entry
*
nxt
;
struct
vdp_entry
*
nxt
;
struct
worker
*
wrk
;
struct
vsl_log
*
vsl
;
struct
req
*
req
;
};
};
int
VDP_bytes
(
struct
req
*
,
enum
vdp_action
act
,
const
void
*
ptr
,
ssize_t
len
);
int
VDP_bytes
(
struct
vdp_ctx
*
,
enum
vdp_action
act
,
const
void
*
ptr
,
ssize_t
len
);
int
VDP_Push
(
struct
req
*
,
const
struct
vdp
*
,
void
*
priv
);
int
VDP_Push
(
struct
req
*
,
const
struct
vdp
*
,
void
*
priv
);
void
VRT_AddVDP
(
VRT_CTX
,
const
struct
vdp
*
);
void
VRT_AddVDP
(
VRT_CTX
,
const
struct
vdp
*
);
void
VRT_RemoveVDP
(
VRT_CTX
,
const
struct
vdp
*
);
void
VRT_RemoveVDP
(
VRT_CTX
,
const
struct
vdp
*
);
bin/varnishd/cache/cache_gzip.c
View file @
30be1c80
...
@@ -354,7 +354,7 @@ vdp_gunzip_fini(struct req *req, void **priv)
...
@@ -354,7 +354,7 @@ vdp_gunzip_fini(struct req *req, void **priv)
}
}
static
int
v_matchproto_
(
vdp_bytes_f
)
static
int
v_matchproto_
(
vdp_bytes_f
)
vdp_gunzip_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
**
priv
,
vdp_gunzip_bytes
(
struct
vdp_ctx
*
vdx
,
enum
vdp_action
act
,
void
**
priv
,
const
void
*
ptr
,
ssize_t
len
)
const
void
*
ptr
,
ssize_t
len
)
{
{
enum
vgzret_e
vr
;
enum
vgzret_e
vr
;
...
@@ -363,8 +363,8 @@ vdp_gunzip_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -363,8 +363,8 @@ vdp_gunzip_bytes(struct req *req, enum vdp_action act, void **priv,
struct
worker
*
wrk
;
struct
worker
*
wrk
;
struct
vgz
*
vg
;
struct
vgz
*
vg
;
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
CHECK_OBJ_NOTNULL
(
vdx
,
VDP_CTX
_MAGIC
);
wrk
=
req
->
wrk
;
wrk
=
vdx
->
wrk
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
(
void
)
act
;
(
void
)
act
;
...
@@ -386,8 +386,8 @@ vdp_gunzip_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -386,8 +386,8 @@ vdp_gunzip_bytes(struct req *req, enum vdp_action act, void **priv,
if
(
vr
<
VGZ_OK
)
if
(
vr
<
VGZ_OK
)
return
(
-
1
);
return
(
-
1
);
if
(
vg
->
m_len
==
vg
->
m_sz
||
vr
!=
VGZ_OK
)
{
if
(
vg
->
m_len
==
vg
->
m_sz
||
vr
!=
VGZ_OK
)
{
if
(
VDP_bytes
(
req
,
VDP_FLUSH
,
vg
->
m_buf
,
vg
->
m_len
))
if
(
VDP_bytes
(
vdx
,
VDP_FLUSH
,
vg
->
m_buf
,
vg
->
m_len
))
return
(
req
->
vdc
->
retval
);
return
(
vdx
->
retval
);
vg
->
m_len
=
0
;
vg
->
m_len
=
0
;
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
}
}
...
...
bin/varnishd/cache/cache_range.c
View file @
30be1c80
...
@@ -61,7 +61,7 @@ vrg_range_fini(struct req *req, void **priv)
...
@@ -61,7 +61,7 @@ vrg_range_fini(struct req *req, void **priv)
}
}
static
int
v_matchproto_
(
vdp_bytes_f
)
static
int
v_matchproto_
(
vdp_bytes_f
)
vrg_range_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
**
priv
,
vrg_range_bytes
(
struct
vdp_ctx
*
vdx
,
enum
vdp_action
act
,
void
**
priv
,
const
void
*
ptr
,
ssize_t
len
)
const
void
*
ptr
,
ssize_t
len
)
{
{
int
retval
=
0
;
int
retval
=
0
;
...
@@ -69,7 +69,7 @@ vrg_range_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -69,7 +69,7 @@ vrg_range_bytes(struct req *req, enum vdp_action act, void **priv,
const
char
*
p
=
ptr
;
const
char
*
p
=
ptr
;
struct
vrg_priv
*
vrg_priv
;
struct
vrg_priv
*
vrg_priv
;
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
CHECK_OBJ_NOTNULL
(
vdx
,
VDP_CTX
_MAGIC
);
AN
(
priv
);
AN
(
priv
);
CAST_OBJ_NOTNULL
(
vrg_priv
,
*
priv
,
VRG_PRIV_MAGIC
);
CAST_OBJ_NOTNULL
(
vrg_priv
,
*
priv
,
VRG_PRIV_MAGIC
);
...
@@ -88,9 +88,9 @@ vrg_range_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -88,9 +88,9 @@ vrg_range_bytes(struct req *req, enum vdp_action act, void **priv,
if
(
vrg_priv
->
range_off
>=
vrg_priv
->
range_high
)
if
(
vrg_priv
->
range_off
>=
vrg_priv
->
range_high
)
act
=
VDP_END
;
act
=
VDP_END
;
if
(
l
>
0
)
if
(
l
>
0
)
retval
=
VDP_bytes
(
req
,
act
,
p
,
l
);
retval
=
VDP_bytes
(
vdx
,
act
,
p
,
l
);
else
if
(
l
==
0
&&
act
>
VDP_NULL
)
else
if
(
l
==
0
&&
act
>
VDP_NULL
)
retval
=
VDP_bytes
(
req
,
act
,
p
,
0
);
retval
=
VDP_bytes
(
vdx
,
act
,
p
,
0
);
return
(
retval
||
act
==
VDP_END
?
1
:
0
);
return
(
retval
||
act
==
VDP_END
?
1
:
0
);
}
}
...
...
bin/varnishd/http1/cache_http1_deliver.c
View file @
30be1c80
...
@@ -38,19 +38,19 @@
...
@@ -38,19 +38,19 @@
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
static
int
v_matchproto_
(
vdp_bytes_f
)
static
int
v_matchproto_
(
vdp_bytes_f
)
v1d_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
**
priv
,
v1d_bytes
(
struct
vdp_ctx
*
vdx
,
enum
vdp_action
act
,
void
**
priv
,
const
void
*
ptr
,
ssize_t
len
)
const
void
*
ptr
,
ssize_t
len
)
{
{
ssize_t
wl
=
0
;
ssize_t
wl
=
0
;
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
CHECK_OBJ_NOTNULL
(
vdx
,
VDP_CTX
_MAGIC
);
(
void
)
priv
;
(
void
)
priv
;
AZ
(
req
->
vdc
->
nxt
);
/* always at the bottom of the pile */
AZ
(
vdx
->
nxt
);
/* always at the bottom of the pile */
if
(
len
>
0
)
if
(
len
>
0
)
wl
=
V1L_Write
(
req
->
wrk
,
ptr
,
len
);
wl
=
V1L_Write
(
vdx
->
wrk
,
ptr
,
len
);
if
(
act
>
VDP_NULL
&&
V1L_Flush
(
req
->
wrk
))
if
(
act
>
VDP_NULL
&&
V1L_Flush
(
vdx
->
wrk
))
return
(
-
1
);
return
(
-
1
);
if
(
len
!=
wl
)
if
(
len
!=
wl
)
return
(
-
1
);
return
(
-
1
);
...
...
bin/varnishd/http2/cache_http2_deliver.c
View file @
30be1c80
...
@@ -100,12 +100,13 @@ h2_fini(struct req *req, void **priv)
...
@@ -100,12 +100,13 @@ h2_fini(struct req *req, void **priv)
}
}
static
int
v_matchproto_
(
vdp_bytes_f
)
static
int
v_matchproto_
(
vdp_bytes_f
)
h2_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
**
priv
,
h2_bytes
(
struct
vdp_ctx
*
vdx
,
enum
vdp_action
act
,
void
**
priv
,
const
void
*
ptr
,
ssize_t
len
)
const
void
*
ptr
,
ssize_t
len
)
{
{
struct
h2_req
*
r2
;
struct
h2_req
*
r2
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
vdx
,
VDP_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
vdx
->
req
,
REQ_MAGIC
);
CAST_OBJ_NOTNULL
(
r2
,
*
priv
,
H2_REQ_MAGIC
);
CAST_OBJ_NOTNULL
(
r2
,
*
priv
,
H2_REQ_MAGIC
);
(
void
)
act
;
(
void
)
act
;
...
@@ -113,9 +114,9 @@ h2_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -113,9 +114,9 @@ h2_bytes(struct req *req, enum vdp_action act, void **priv,
return
(
-
1
);
return
(
-
1
);
if
(
len
==
0
)
if
(
len
==
0
)
return
(
0
);
return
(
0
);
H2_Send_Get
(
req
->
wrk
,
r2
->
h2sess
,
r2
);
H2_Send_Get
(
vdx
->
wrk
,
r2
->
h2sess
,
r2
);
H2_Send
(
req
->
wrk
,
r2
,
H2_F_DATA
,
H2FF_NONE
,
len
,
ptr
,
H2_Send
(
vdx
->
wrk
,
r2
,
H2_F_DATA
,
H2FF_NONE
,
len
,
ptr
,
&
req
->
acct
.
resp_bodybytes
);
&
vdx
->
req
->
acct
.
resp_bodybytes
);
H2_Send_Rel
(
r2
->
h2sess
,
r2
);
H2_Send_Rel
(
r2
->
h2sess
,
r2
);
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