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
8f640bfc
Unverified
Commit
8f640bfc
authored
Sep 04, 2020
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send "done" location as Content-Location for non-301
see
https://httpwg.org/specs/rfc7231.html#header.content-location
parent
43c292fc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
9 deletions
+20
-9
tus_hdr.c
src/tus_hdr.c
+1
-0
tus_hdr.h
src/tus_hdr.h
+1
-0
tus_response.c
src/tus_response.c
+14
-6
vmod_tus.vcc
src/vmod_tus.vcc
+3
-2
done.vtc
src/vtc/done.vtc
+1
-1
No files found.
src/tus_hdr.c
View file @
8f640bfc
...
...
@@ -8,6 +8,7 @@ const char * const hdr_max = "\015Tus-Max-Size:";
const
char
*
const
hdr_defer
=
"
\024
Upload-Defer-Length:"
;
const
char
*
const
hdr_meta
=
"
\020
Upload-Metadata:"
;
const
char
*
const
hdr_exp
=
"
\017
Upload-Expires:"
;
const
char
*
const
hdr_cloc
=
"
\021
Content-Location:"
;
const
char
*
const
hdr_loc
=
"
\011
Location:"
;
const
char
*
const
hdr_method
=
"
\027
X-HTTP-Method-Override:"
;
const
char
*
const
hdr_off
=
"
\016
Upload-Offset:"
;
...
...
src/tus_hdr.h
View file @
8f640bfc
...
...
@@ -8,6 +8,7 @@ const char * const hdr_max;
const
char
*
const
hdr_defer
;
const
char
*
const
hdr_meta
;
const
char
*
const
hdr_exp
;
const
char
*
const
hdr_cloc
;
const
char
*
const
hdr_loc
;
const
char
*
const
hdr_method
;
const
char
*
const
hdr_off
;
...
...
src/tus_response.c
View file @
8f640bfc
#include "config.h"
#include <sys/statvfs.h>
#include <stdio.h>
#include <cache/cache.h>
#include <vrt_obj.h>
...
...
@@ -57,7 +58,7 @@ tus_cors(VCL_HTTP r, unsigned status, const char *origin)
http_ForceHeader
(
r
,
hdr_acma
,
"86400"
);
}
else
{
http_ForceHeader
(
r
,
hdr_aceh
,
"Upload-Offset, Location, Upload-Length, Tus-Version, "
"Upload-Offset,
Content-Location,
Location, Upload-Length, Tus-Version, "
"Tus-Resumable, Tus-Max-Size, Tus-Extension, "
"Upload-Metadata, Upload-Defer-Length, Upload-Concat"
);
}
...
...
@@ -72,6 +73,8 @@ tus_response(VRT_CTX, const struct VPFX(tus_server) *tussrv,
const
char
*
chksums
=
tus_checksums
();
VCL_HTTP
r
;
char
t
[
VTIM_FORMAT_SIZE
];
const
char
*
loc
;
char
buf
[
TUS_PATH_MAX
];
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
tussrv
,
VMOD_TUS_SERVER_MAGIC
);
...
...
@@ -93,15 +96,20 @@ tus_response(VRT_CTX, const struct VPFX(tus_server) *tussrv,
http_Unset
(
r
,
hdr_meta
);
http_Unset
(
r
,
hdr_exp
);
http_Unset
(
r
,
hdr_loc
);
http_Unset
(
r
,
hdr_cloc
);
if
(
fdisk
!=
NULL
&&
fdisk
->
location_length
>
0
)
{
/* cannot happen for creation */
assert
(
resp
->
status
!=
201
);
if
(
fdisk
->
location
[
0
]
==
'/'
)
http_PrintfHeader
(
r
,
"Location: %s%s"
,
resp
->
schemeauth
,
fdisk
->
location
);
else
http_ForceHeader
(
r
,
hdr_loc
,
fdisk
->
location
);
if
(
fdisk
->
location
[
0
]
==
'/'
)
{
bprintf
(
buf
,
"%s%s"
,
resp
->
schemeauth
,
fdisk
->
location
);
loc
=
buf
;
}
else
{
loc
=
fdisk
->
location
;
}
http_ForceHeader
(
r
,
resp
->
status
==
301
?
hdr_loc
:
hdr_cloc
,
loc
);
}
if
(
resp
->
status
==
301
)
{
...
...
src/vmod_tus.vcc
View file @
8f640bfc
...
...
@@ -167,11 +167,12 @@ $Method BOOL .done([STRING location])
Mark the upload as done. For simple (non concat) uploads, this frees
all storage except for information on the upload URL itself.
If the optional *location* string is provided, a ``Location:``
If the optional *location* string is provided, a ``
Content-
Location:``
response header with that location will be added to all future
responses querying the object.
For any ``GET`` access, a 301 response will be generated.
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.
...
...
src/vtc/done.vtc
View file @
8f640bfc
...
...
@@ -89,7 +89,7 @@ client c1 {
expect resp.http.Upload-Offset == 386550
expect resp.http.Upload-Length == 386550
expect resp.http.Upload-Expires ~ "GMT$"
expect resp.http.Location == "http://localhost/id"
expect resp.http.
Content-
Location == "http://localhost/id"
txreq -url "/id" \
-hdr "Tus-Resumable: 1.0.0"
...
...
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