Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-zipflow
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
libvmod-zipflow
Commits
052605f3
Unverified
Commit
052605f3
authored
Jul 25, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move zip owner to top
parent
9c9ed3ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
vmod_zipflow.c
src/vmod_zipflow.c
+22
-10
No files found.
src/vmod_zipflow.c
View file @
052605f3
...
...
@@ -71,8 +71,8 @@ struct zipflow_request {
VCL_STRING
name
;
unsigned
mode
;
uint32_t
atime
,
mtime
;
ZIP
*
zip
;
VSTAILQ_ENTRY
(
zipflow_request
)
list
;
struct
zipflow_top
*
top
;
};
VSTAILQ_HEAD
(
zipflow_head
,
zipflow_request
);
...
...
@@ -81,6 +81,7 @@ struct zipflow_top {
unsigned
magic
;
#define ZIPFLOW_TOP_MAGIC 0x5743145e
struct
zipflow_head
head
;
ZIP
*
zip
;
};
static
struct
zipflow_top
*
...
...
@@ -127,6 +128,7 @@ new_zipflow_request(VRT_CTX, struct zipflow_top *zft)
zfr
->
mode
=
0644
;
zfr
->
atime
=
ctx
->
now
;
zfr
->
mtime
=
ctx
->
now
;
zfr
->
top
=
zft
;
return
(
zfr
);
}
...
...
@@ -301,6 +303,7 @@ static int
vdp_zipflow_init
(
VRT_CTX
,
struct
vdp_ctx
*
vdc
,
void
**
priv
,
struct
objcore
*
oc
)
{
struct
zipflow_request
*
zfr
=
get_zipflow_request
(
ctx
);
struct
zipflow_top
*
zft
;
struct
req
*
req
;
if
(
zfr
==
NULL
)
...
...
@@ -308,15 +311,18 @@ vdp_zipflow_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
AN
(
zfr
->
name
);
AZ
(
zfr
->
zip
);
zfr
->
zip
=
zip_pipe
(
vdc
,
vdp_zipflow_put
,
zfr
->
level
);
if
(
zfr
->
zip
==
NULL
)
{
zft
=
zfr
->
top
;
CHECK_OBJ_NOTNULL
(
zft
,
ZIPFLOW_TOP_MAGIC
);
AZ
(
zft
->
zip
);
zft
->
zip
=
zip_pipe
(
vdc
,
vdp_zipflow_put
,
zfr
->
level
);
if
(
zft
->
zip
==
NULL
)
{
VSLb
(
vdc
->
vsl
,
SLT_Error
,
"zipflow: zip_pipe failed"
);
return
(
1
);
}
AZ
(
zip_log
(
zf
r
->
zip
,
vdc
->
vsl
,
vdp_zipflow_log
));
AZ
(
zip_log
(
zf
t
->
zip
,
vdc
->
vsl
,
vdp_zipflow_log
));
if
(
zfr
->
bundle
)
{
AZ
(
zip_meta
(
zf
r
->
zip
,
zfr
->
name
,
3
,
zfr
->
mode
,
AZ
(
zip_meta
(
zf
t
->
zip
,
zfr
->
name
,
3
,
zfr
->
mode
,
zfr
->
atime
,
zfr
->
mtime
));
}
...
...
@@ -337,6 +343,7 @@ static int
vdp_zipflow_fini
(
struct
vdp_ctx
*
vdc
,
void
**
priv
)
{
struct
zipflow_request
*
zfr
;
struct
zipflow_top
*
zft
;
int
r
;
AN
(
priv
);
...
...
@@ -344,7 +351,9 @@ vdp_zipflow_fini(struct vdp_ctx *vdc, void **priv)
*
priv
=
NULL
;
if
(
zfr
!=
NULL
)
{
CHECK_OBJ
(
zfr
,
ZIPFLOW_REQUEST_MAGIC
);
r
=
zip_close
(
zfr
->
zip
);
zft
=
zfr
->
top
;
CHECK_OBJ_NOTNULL
(
zft
,
ZIPFLOW_TOP_MAGIC
);
r
=
zip_close
(
zft
->
zip
);
if
(
r
)
VSLb
(
vdc
->
vsl
,
SLT_Error
,
"zip_close returned %d"
,
r
);
memset
(
zfr
,
0
,
sizeof
*
zfr
);
...
...
@@ -357,15 +366,18 @@ vdp_zipflow_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const
void
*
ptr
,
ssize_t
len
)
{
struct
zipflow_request
*
zfr
;
struct
zipflow_top
*
zft
;
int
r
;
AN
(
priv
);
CAST_OBJ_NOTNULL
(
zfr
,
*
priv
,
ZIPFLOW_REQUEST_MAGIC
);
zft
=
zfr
->
top
;
CHECK_OBJ_NOTNULL
(
zft
,
ZIPFLOW_TOP_MAGIC
);
if
(
zfr
->
bundle
==
0
)
{
(
void
)
zip_close
(
zf
r
->
zip
);
(
void
)
zip_close
(
zf
t
->
zip
);
return
(
1
);
}
r
=
zip_data
(
zf
r
->
zip
,
ptr
,
len
,
act
==
VDP_END
);
r
=
zip_data
(
zf
t
->
zip
,
ptr
,
len
,
act
==
VDP_END
);
if
(
r
)
{
VSLb
(
vdc
->
vsl
,
SLT_Error
,
"zip_data returned %d"
,
r
);
return
(
-
1
);
...
...
@@ -375,7 +387,7 @@ vdp_zipflow_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
return
(
0
);
*
priv
=
NULL
;
r
=
zip_close
(
zf
r
->
zip
);
r
=
zip_close
(
zf
t
->
zip
);
if
(
r
)
VSLb
(
vdc
->
vsl
,
SLT_Error
,
"zip_close returned %d"
,
r
);
memset
(
zfr
,
0
,
sizeof
*
zfr
);
...
...
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