Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvfp-brotli
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvfp-brotli
Commits
63193e97
Unverified
Commit
63193e97
authored
Jan 25, 2022
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt to post 7.0 filter API changes
parent
b4f010e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
vfp_brotli.c
src/vfp_brotli.c
+22
-16
No files found.
src/vfp_brotli.c
View file @
63193e97
...
@@ -304,13 +304,14 @@ static const struct vfp vfp_br, vfp_unbr;
...
@@ -304,13 +304,14 @@ static const struct vfp vfp_br, vfp_unbr;
/* init and fini methods for both br and unbr */
/* init and fini methods for both br and unbr */
static
enum
vfp_status
v_matchproto_
(
vfp_init_f
)
static
enum
vfp_status
v_matchproto_
(
vfp_init_f
)
vfp_br_init
(
struct
vfp_ctx
*
ctx
,
struct
vfp_entry
*
ent
)
vfp_br_init
(
VRT_CTX
,
struct
vfp_ctx
*
vc
,
struct
vfp_entry
*
ent
)
{
{
struct
vbr
*
vbr
;
struct
vbr
*
vbr
;
const
struct
vfp_priv
*
priv
;
const
struct
vfp_priv
*
priv
;
const
struct
vbr_settings
*
settings
;
const
struct
vbr_settings
*
settings
;
CHECK_OBJ_NOTNULL
(
ctx
,
VFP_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
vc
,
VFP_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ent
,
VFP_ENTRY_MAGIC
);
CHECK_OBJ_NOTNULL
(
ent
,
VFP_ENTRY_MAGIC
);
AN
(
ent
->
vfp
);
AN
(
ent
->
vfp
);
CAST_OBJ_NOTNULL
(
priv
,
ent
->
vfp
->
priv1
,
VFP_PRIV_MAGIC
);
CAST_OBJ_NOTNULL
(
priv
,
ent
->
vfp
->
priv1
,
VFP_PRIV_MAGIC
);
...
@@ -321,19 +322,19 @@ vfp_br_init(struct vfp_ctx *ctx, struct vfp_entry *ent)
...
@@ -321,19 +322,19 @@ vfp_br_init(struct vfp_ctx *ctx, struct vfp_entry *ent)
* Ignore partial responses to range requests (as Varnish does for
* Ignore partial responses to range requests (as Varnish does for
* gzip and gunzip).
* gzip and gunzip).
*/
*/
if
(
http_GetStatus
(
ctx
->
resp
)
==
206
)
if
(
http_GetStatus
(
vc
->
resp
)
==
206
)
return
(
VFP_NULL
);
return
(
VFP_NULL
);
if
(
priv
->
stats
!=
NULL
)
if
(
priv
->
stats
!=
NULL
)
priv
->
stats
->
ops
++
;
priv
->
stats
->
ops
++
;
if
(
settings
->
which
==
ENC
)
{
if
(
settings
->
which
==
ENC
)
{
if
(
http_GetHdr
(
ctx
->
resp
,
H_Content_Encoding
,
NULL
))
if
(
http_GetHdr
(
vc
->
resp
,
H_Content_Encoding
,
NULL
))
return
(
VFP_NULL
);
return
(
VFP_NULL
);
vbr
=
newVBR
(
ENC
);
vbr
=
newVBR
(
ENC
);
}
}
else
{
else
{
if
(
!
http_HdrIs
(
ctx
->
resp
,
H_Content_Encoding
,
"br"
))
if
(
!
http_HdrIs
(
vc
->
resp
,
H_Content_Encoding
,
"br"
))
return
(
VFP_NULL
);
return
(
VFP_NULL
);
vbr
=
newVBR
(
DEC
);
vbr
=
newVBR
(
DEC
);
}
}
...
@@ -346,14 +347,14 @@ vfp_br_init(struct vfp_ctx *ctx, struct vfp_entry *ent)
...
@@ -346,14 +347,14 @@ vfp_br_init(struct vfp_ctx *ctx, struct vfp_entry *ent)
setInputBuf
(
vbr
,
vbr
->
buf
,
0
);
setInputBuf
(
vbr
,
vbr
->
buf
,
0
);
AZ
(
vbr
->
buflen
);
AZ
(
vbr
->
buflen
);
http_Unset
(
ctx
->
resp
,
H_Content_Encoding
);
http_Unset
(
vc
->
resp
,
H_Content_Encoding
);
http_Unset
(
ctx
->
resp
,
H_Content_Length
);
http_Unset
(
vc
->
resp
,
H_Content_Length
);
RFC2616_Weaken_Etag
(
ctx
->
resp
);
RFC2616_Weaken_Etag
(
vc
->
resp
);
ctx
->
obj_flags
|=
OF_CHGCE
;
vc
->
obj_flags
|=
OF_CHGCE
;
if
(
settings
->
which
==
ENC
)
{
if
(
settings
->
which
==
ENC
)
{
http_SetHeader
(
ctx
->
resp
,
"Content-Encoding: br"
);
http_SetHeader
(
vc
->
resp
,
"Content-Encoding: br"
);
RFC2616_Vary_AE
(
ctx
->
resp
);
RFC2616_Vary_AE
(
vc
->
resp
);
}
}
return
(
VFP_OK
);
return
(
VFP_OK
);
...
@@ -569,6 +570,7 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
...
@@ -569,6 +570,7 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
struct
custom_vfp_head
*
vfph
;
struct
custom_vfp_head
*
vfph
;
struct
custom_vfp_entry
*
vfpe
;
struct
custom_vfp_entry
*
vfpe
;
struct
vfp_priv
*
vfp_priv
;
struct
vfp_priv
*
vfp_priv
;
const
char
*
err
;
ASSERT_CLI
();
ASSERT_CLI
();
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
...
@@ -578,8 +580,12 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
...
@@ -578,8 +580,12 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
switch
(
e
)
{
switch
(
e
)
{
case
VCL_EVENT_LOAD
:
case
VCL_EVENT_LOAD
:
VRT_AddVFP
(
ctx
,
&
vfp_br
);
err
=
VRT_AddFilter
(
ctx
,
&
vfp_br
,
NULL
);
VRT_AddVFP
(
ctx
,
&
vfp_unbr
);
if
(
err
!=
NULL
)
return
(
1
);
err
=
VRT_AddFilter
(
ctx
,
&
vfp_unbr
,
NULL
);
if
(
err
!=
NULL
)
return
(
1
);
CAST_OBJ_NOTNULL
(
vfp_priv
,
TRUST_ME
(
vfp_br
.
priv1
),
CAST_OBJ_NOTNULL
(
vfp_priv
,
TRUST_ME
(
vfp_br
.
priv1
),
VFP_PRIV_MAGIC
);
VFP_PRIV_MAGIC
);
if
(
vfp_priv
->
stats
==
NULL
)
if
(
vfp_priv
->
stats
==
NULL
)
...
@@ -594,8 +600,8 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
...
@@ -594,8 +600,8 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
"unbr"
);
"unbr"
);
return
(
0
);
return
(
0
);
case
VCL_EVENT_DISCARD
:
case
VCL_EVENT_DISCARD
:
VRT_Remove
VFP
(
ctx
,
&
vfp_br
);
VRT_Remove
Filter
(
ctx
,
&
vfp_br
,
NULL
);
VRT_Remove
VFP
(
ctx
,
&
vfp_unbr
);
VRT_Remove
Filter
(
ctx
,
&
vfp_unbr
,
NULL
);
while
(
!
VSLIST_EMPTY
(
vfph
))
{
while
(
!
VSLIST_EMPTY
(
vfph
))
{
vfpe
=
VSLIST_FIRST
(
vfph
);
vfpe
=
VSLIST_FIRST
(
vfph
);
CHECK_OBJ_NOTNULL
(
vfpe
,
CUSTOM_VFP_MAGIC
);
CHECK_OBJ_NOTNULL
(
vfpe
,
CUSTOM_VFP_MAGIC
);
...
...
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