Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-tus
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-tus
Commits
98401018
Unverified
Commit
98401018
authored
Jun 13, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use $Restrict
parent
373946de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
41 deletions
+30
-41
vmod_tus.c
src/vmod_tus.c
+6
-30
vmod_tus.vcc
src/vmod_tus.vcc
+24
-11
No files found.
src/vmod_tus.c
View file @
98401018
...
...
@@ -400,11 +400,7 @@ tus_server_recv(VRT_CTX, struct VPFX(tus_server) *tussrv,
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
tussrv
,
VMOD_TUS_SERVER_MAGIC
);
if
(
ctx
->
method
!=
VCL_MET_RECV
)
{
VRT_fail
(
ctx
,
"%s.recv() must only be called from vcl_recv{}"
,
tussrv
->
vcl_name
);
return
(
0
);
}
assert
(
ctx
->
method
==
VCL_MET_RECV
);
url
=
args
->
valid_url
?
args
->
url
:
VRT_r_req_url
(
ctx
);
...
...
@@ -431,11 +427,7 @@ tus_server_deliver(VRT_CTX, struct VPFX(tus_server) *tussrv)
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
tussrv
,
VMOD_TUS_SERVER_MAGIC
);
if
(
ctx
->
method
!=
VCL_MET_DELIVER
)
{
VRT_fail
(
ctx
,
"%s.deliver() must only be called "
"from vcl_deliver{}"
,
tussrv
->
vcl_name
);
return
(
0
);
}
assert
(
ctx
->
method
==
VCL_MET_DELIVER
);
r
=
tus_task_use
(
ctx
,
tussrv
);
if
(
r
==
NULL
)
...
...
@@ -453,11 +445,7 @@ tus_server_synth(VRT_CTX, struct VPFX(tus_server) *tussrv)
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
tussrv
,
VMOD_TUS_SERVER_MAGIC
);
if
(
ctx
->
method
!=
VCL_MET_SYNTH
)
{
VRT_fail
(
ctx
,
"%s.synth() must only be called "
"from vcl_synth{}"
,
tussrv
->
vcl_name
);
return
(
0
);
}
assert
(
ctx
->
method
==
VCL_MET_SYNTH
);
r
=
tus_task_use
(
ctx
,
tussrv
);
if
(
r
==
NULL
)
...
...
@@ -476,11 +464,7 @@ VCL_BOOL tus_server_done(VRT_CTX, struct VPFX(tus_server) *tussrv,
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
tussrv
,
VMOD_TUS_SERVER_MAGIC
);
if
((
ctx
->
method
&
VCL_MET_TASK_C
)
==
0
)
{
VRT_fail
(
ctx
,
"%s.done() must only be called "
"from client VCL subroutines"
,
tussrv
->
vcl_name
);
return
(
0
);
}
AN
(
ctx
->
method
&
VCL_MET_TASK_C
);
r
=
tus_task_use
(
ctx
,
tussrv
);
if
(
r
==
NULL
)
...
...
@@ -501,11 +485,7 @@ tus_server_has_metadata(VRT_CTX, struct VPFX(tus_server) *tussrv,
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
tussrv
,
VMOD_TUS_SERVER_MAGIC
);
if
((
ctx
->
method
&
VCL_MET_TASK_C
)
==
0
)
{
VRT_fail
(
ctx
,
"%s.has_metadata() must only be called "
"from client VCL subroutines"
,
tussrv
->
vcl_name
);
return
(
0
);
}
AN
(
ctx
->
method
&
VCL_MET_TASK_C
);
r
=
tus_task_use
(
ctx
,
tussrv
);
if
(
r
==
NULL
)
...
...
@@ -525,11 +505,7 @@ tus_server_metadata(VRT_CTX, struct VPFX(tus_server) *tussrv,
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
tussrv
,
VMOD_TUS_SERVER_MAGIC
);
if
((
ctx
->
method
&
VCL_MET_TASK_C
)
==
0
)
{
VRT_fail
(
ctx
,
"%s.metadata() must only be called "
"from client VCL subroutines"
,
tussrv
->
vcl_name
);
return
(
NULL
);
}
AN
(
ctx
->
method
&
VCL_MET_TASK_C
);
r
=
tus_task_use
(
ctx
,
tussrv
);
if
(
r
==
NULL
)
...
...
src/vmod_tus.vcc
View file @
98401018
...
...
@@ -191,18 +191,25 @@ Thus, the common call pattern is::
}
}
Must be called from ``vcl_recv {}``
$Restrict vcl_recv
$Method BOOL .deliver()
Generate a response to a tus request for which content was
stored. Must be called from ``vcl_deliver {}`` after `xserver.recv()`_
was called from ``vcl_recv {}``.
stored.
$Restrict vcl_deliver
Must be called after `xserver.recv()`_ was called from ``vcl_recv
{}``.
$Method BOOL .synth()
Generate a synthetic response to a tus request. Must be called from
``vcl_synth {}`` after `xserver.recv()`_ was called from ``vcl_recv {}``.
Generate a synthetic response to a tus request.
$Restrict vcl_synth
Must be called after `xserver.recv()`_ was called from ``vcl_recv {}``.
For the example above, the code would be::
...
...
@@ -225,22 +232,28 @@ responses querying the object.
For any ``GET`` access, a 301 response with the *location* in the
``Location:`` response header is generated.
May only be called from client methods. For anything but final concat
or single (non-concat) uploads, this operation is a noop.
$Restrict client
For anything but final concat or single (non-concat) uploads, this
operation is a noop.
$Method BOOL .has_metadata(STRING key)
Return true if *key* is present in the metadata.
Only available if vmod_blob is available (see `Hashes` _) and on the
client side after `xserver.recv()`_ was called from ``vcl_recv {}``.
$Restrict client
Only available if vmod_blob is available (see `Hashes` _) and after
`xserver.recv()`_ was called from ``vcl_recv {}``.
$Method BLOB .metadata(STRING key)
Extract *key* from metadata and return the corresponding value decoded.
Only available if vmod_blob is available (see `Hashes` _) and on the
client side after `xserver.recv()`_ was called from ``vcl_recv {}``.
$Restrict client
Only available if vmod_blob is available (see `Hashes` _) and after
`xserver.recv()`_ was called from ``vcl_recv {}``.
$Method VOID .sync()
...
...
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