Skip to content

Commit fca6469

Browse files
author
Ben Stahl
committed
HEAD must respond with Upload-Length and Upload-Offset
Closes #21
1 parent ba7ca7f commit fca6469

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/handlers/HeadHandler.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,18 @@ class HeadHandler extends BaseHandler {
2020
const file_name = match[1];
2121
return this.store.getOffset(file_name)
2222
.then((stats) => {
23-
// The Server MUST prevent the client and/or proxies from caching the response by adding the Cache-Control: no-store header to the response.
23+
// The Server MUST prevent the client and/or proxies from
24+
// caching the response by adding the Cache-Control: no-store
25+
// header to the response.
2426
res.setHeader('Cache-Control', 'no-store');
2527

26-
// If the size of the upload is known, the Server MUST include the Upload-Length header in the response.
27-
res.setHeader('Upload-Length', stats.size);
28+
// The Server MUST always include the Upload-Offset header in
29+
// the response for a HEAD request, even if the offset is 0
30+
res.setHeader('Upload-Offset', stats.size);
31+
32+
// If the size of the upload is known, the Server MUST include
33+
// the Upload-Length header in the response.
34+
res.setHeader('Upload-Length', stats.upload_length);
2835
return res.end();
2936
})
3037
.catch((error) => {

0 commit comments

Comments
 (0)