Validate Tus-Resumable

parent 0ec19bd5
...@@ -245,6 +245,12 @@ tus_request(VRT_CTX, struct VPFX(tus_server) *tussrv, ...@@ -245,6 +245,12 @@ tus_request(VRT_CTX, struct VPFX(tus_server) *tussrv,
return (0); return (0);
} }
if (! http_GetHdr(ctx->http_req, hdr_resum, &p) ||
strcmp(p, "1.0.0") != 0) {
r->status = 412;
return (0);
}
if (http_GetHdr(ctx->http_req, hdr_concat, &concat)) { if (http_GetHdr(ctx->http_req, hdr_concat, &concat)) {
if (strcmp(concat, "partial") == 0) { if (strcmp(concat, "partial") == 0) {
type = TUS_PARTIAL; type = TUS_PARTIAL;
......
...@@ -497,6 +497,20 @@ client c10 { ...@@ -497,6 +497,20 @@ client c10 {
expect resp.status == 400 expect resp.status == 400
} -start } -start
# missing / bad version
client c11 {
txreq -method POST \
-hdr "Tus-Resumable: 1.0.1" \
-hdr "Content-Type: application/offset+octet-stream"
rxresp
expect resp.status == 412
txreq -method POST \
-hdr "Content-Type: application/offset+octet-stream"
rxresp
expect resp.status == 412
} -start
client c1 -wait client c1 -wait
client c2 -wait client c2 -wait
client c3 -wait client c3 -wait
...@@ -507,3 +521,4 @@ client c7 -wait ...@@ -507,3 +521,4 @@ client c7 -wait
client c8 -wait client c8 -wait
client c9 -wait client c9 -wait
client c10 -wait client c10 -wait
client c11 -wait
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment