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
86a62bbe
Commit
86a62bbe
authored
Feb 27, 2018
by
Emmanuel Hocdet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add VPX_tlv interface to extract PROXY tlv attributes.
parent
cc4a99f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
cache_proxy.h
bin/varnishd/proxy/cache_proxy.h
+2
-0
cache_proxy_proto.c
bin/varnishd/proxy/cache_proxy_proto.c
+54
-0
No files found.
bin/varnishd/proxy/cache_proxy.h
View file @
86a62bbe
...
...
@@ -37,3 +37,5 @@
#define PP2_SUBTYPE_SSL_SIG_ALG 0x24
#define PP2_SUBTYPE_SSL_KEY_ALG 0x25
#define PP2_SUBTYPE_SSL_MAX 0x25
int
VPX_tlv
(
const
struct
req
*
req
,
int
tlv
,
void
**
dst
,
int
*
len
);
bin/varnishd/proxy/cache_proxy_proto.c
View file @
86a62bbe
...
...
@@ -250,6 +250,60 @@ static uint32_t crc32c(const uint8_t *buf, int len)
return
(
crc
^
0xffffffff
);
}
int
VPX_tlv
(
const
struct
req
*
req
,
int
tlv
,
void
**
dst
,
int
*
len
)
{
uintptr_t
*
p
;
uint16_t
l
;
char
*
d
;
int
ssltlv
=
0
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
sp
,
SESS_MAGIC
);
if
(
SES_Get_xport_priv
(
req
->
sp
,
&
p
)
!=
0
)
{
*
dst
=
NULL
;
return
(
-
1
);
}
d
=
(
char
*
)
*
p
;
l
=
*
(
uint16_t
*
)
d
;
d
+=
2
;
if
(
tlv
>
PP2_TYPE_SSL
&&
tlv
<=
PP2_SUBTYPE_SSL_MAX
)
{
ssltlv
=
tlv
;
tlv
=
PP2_TYPE_SSL
;
}
while
(
l
>
sizeof
(
struct
pp2_tlv
))
{
uint16_t
v_len
=
vbe16dec
(
d
+
1
);
if
(
d
[
0
]
==
tlv
)
{
if
(
ssltlv
)
{
char
*
sd
;
int
sl
;
sd
=
d
+
sizeof
(
struct
pp2_tlv
)
+
sizeof
(
struct
pp2_tlv_ssl
);
sl
=
l
-
sizeof
(
struct
pp2_tlv
)
-
sizeof
(
struct
pp2_tlv_ssl
);
while
(
sl
>
sizeof
(
struct
pp2_tlv
))
{
uint16_t
subv_len
=
vbe16dec
(
sd
+
1
);
if
(
sd
[
0
]
==
ssltlv
)
{
*
dst
=
sd
+
3
;
*
len
=
subv_len
;
return
(
0
);
}
sd
+=
(
subv_len
+
3
);
sl
-=
(
subv_len
+
3
);
}
}
else
{
*
dst
=
d
+
3
;
*
len
=
v_len
;
return
(
0
);
}
}
d
+=
(
v_len
+
3
);
l
-=
(
v_len
+
3
);
}
*
dst
=
NULL
;
return
(
-
1
);
}
static
int
vpx_proto2
(
const
struct
worker
*
wrk
,
struct
req
*
req
)
{
...
...
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