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
9ac1c97a
Unverified
Commit
9ac1c97a
authored
Sep 17, 2020
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
metadata filetype -> Content-Type
parent
16e8d1e4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
+22
-11
tus_request.c
src/tus_request.c
+18
-8
plain.vtc
src/vtc/chksum/plain.vtc
+4
-3
No files found.
src/tus_request.c
View file @
9ac1c97a
...
...
@@ -84,20 +84,20 @@ static VCL_BOOL
tus_request_complete
(
VRT_CTX
,
const
struct
VPFX
(
tus_server
)
*
srv
,
struct
tus_concat
*
c
,
struct
tus_file_disk
*
fdisk
)
{
VCL_BLOB
hash
=
NULL
;
VCL_BLOB
b
=
NULL
;
struct
vsb
vsb
[
1
];
const
char
*
slash
;
const
char
*
p
;
tus_body_assign
(
ctx
->
req
,
c
);
http_ForceField
(
ctx
->
http_req
,
HTTP_HDR_METHOD
,
"PUT"
);
if
(
fdisk
->
type
==
TUS_SINGLE
)
hash
=
tus_concat_hash
(
ctx
,
srv
,
c
);
if
(
hash
!=
NULL
)
{
slash
=
strrchr
(
fdisk
->
url_path
,
'/'
);
AN
(
slash
);
b
=
tus_concat_hash
(
ctx
,
srv
,
c
);
if
(
b
!=
NULL
)
{
p
=
strrchr
(
fdisk
->
url_path
,
'/'
);
AN
(
p
);
WS_VSB_new
(
vsb
,
ctx
->
ws
);
VSB_bcat
(
vsb
,
fdisk
->
url_path
,
(
slash
-
fdisk
->
url_path
)
+
1
);
tus_vsbhex
(
vsb
,
hash
);
VSB_bcat
(
vsb
,
fdisk
->
url_path
,
(
p
-
fdisk
->
url_path
)
+
1
);
tus_vsbhex
(
vsb
,
b
);
http_ForceField
(
ctx
->
http_req
,
HTTP_HDR_URL
,
WS_VSB_finish
(
vsb
,
ctx
->
ws
,
NULL
));
}
else
{
...
...
@@ -107,6 +107,16 @@ tus_request_complete(VRT_CTX, const struct VPFX(tus_server) *srv,
http_PrintfHeader
(
ctx
->
http_req
,
"Content-Length: %zu"
,
fdisk
->
upload_length
);
// https://github.com/tus/tus-resumable-upload-protocol/pull/160
http_Unset
(
ctx
->
http_req
,
H_Content_Type
);
if
(
tus_file_meta
(
ctx
,
fdisk
,
"filetype"
,
&
b
))
{
WS_VSB_new
(
vsb
,
ctx
->
ws
);
VSB_bcat
(
vsb
,
b
->
blob
,
b
->
len
);
VSB_putc
(
vsb
,
'\0'
);
p
=
WS_VSB_finish
(
vsb
,
ctx
->
ws
,
NULL
);
if
(
validhdr
(
p
))
http_ForceHeader
(
ctx
->
http_req
,
H_Content_Type
,
p
);
}
// move to table?
http_Unset
(
ctx
->
http_req
,
hdr_resum
);
http_Unset
(
ctx
->
http_req
,
hdr_vers
);
...
...
src/vtc/chksum/plain.vtc
View file @
9ac1c97a
...
...
@@ -15,6 +15,7 @@ server s2 {
txresp
expect req.method == PUT
expect req.url == /vtc
expect req.http.Content-Type == application/pdf
expect req.bodylen == 100
} -start
...
...
@@ -151,7 +152,7 @@ client c2 {
# partial Upload with create
txreq -method POST \
-hdr "Upload-Metadata: filename d29ybGRfZG9taW5hdGlvbl9wbGFuLnBkZg==,is_confidential" \
-hdr "Upload-Metadata: filename d29ybGRfZG9taW5hdGlvbl9wbGFuLnBkZg==,is_confidential
,filetype YXBwbGljYXRpb24vcGRm
" \
-hdr "Upload-Length: 100" \
-hdr "Tus-Resumable: 1.0.0" \
-hdr "Content-Type: application/offset+octet-stream" \
...
...
@@ -169,7 +170,7 @@ client c2 {
expect resp.http.Upload-Length == 100
expect resp.http.Upload-Expires ~ "GMT$"
## XXX only for HEAD?
expect resp.http.Upload-Metadata == "filename d29ybGRfZG9taW5hdGlvbl9wbGFuLnBkZg==,is_confidential"
expect resp.http.Upload-Metadata == "filename d29ybGRfZG9taW5hdGlvbl9wbGFuLnBkZg==,is_confidential
,filetype YXBwbGljYXRpb24vcGRm
"
expect resp.http.Location == "http://localhost/vtc"
expect resp.http.has-filename == true
...
...
@@ -199,7 +200,7 @@ client c2 {
expect resp.http.Upload-Length == 100
expect resp.http.Upload-Expires ~ "GMT$"
## XXX only for HEAD?
expect resp.http.Upload-Metadata == "filename d29ybGRfZG9taW5hdGlvbl9wbGFuLnBkZg==,is_confidential"
expect resp.http.Upload-Metadata == "filename d29ybGRfZG9taW5hdGlvbl9wbGFuLnBkZg==,is_confidential
,filetype YXBwbGljYXRpb24vcGRm
"
expect resp.http.has-filename == true
expect resp.http.has-is_confidential == true
...
...
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