Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting of Upload-Length with empty PATCH request? #8

Closed
nh2 opened this issue Apr 5, 2022 · 1 comment
Closed

Setting of Upload-Length with empty PATCH request? #8

nh2 opened this issue Apr 5, 2022 · 1 comment

Comments

@nh2
Copy link

nh2 commented Apr 5, 2022

Hi, I noticed this:

tus.py/tus.py

Lines 245 to 246 in 73437c8

headers['Upload-Length'] = str(offset)
_upload_chunk('', offset, file_endpoint, headers=headers)

Here, an empty sequence of bytes is uploaded, and the Upload-Length header is added to a PATCH request.

This usage of setting Upload-Length for PATCH isn't mentioned in the TUS spec (https://tus.io/protocols/resumable-upload.html); the only use of Upload-Length mentioned in the core protocol is in the server's response to the HEAD request, and in protocol extensions (which aren't about PATCH).

So I wanted to ask if that was intentional, and if yes, what effect it has. Are you using it to signal to some server (which one) that no more PATCHes will follow?

It seems the change was added here: 522bda4#diff-c3f5c01a348e29bf07085b011c57af115f1d1da912541d97d57db0783dad43b0R224

@nh2
Copy link
Author

nh2 commented Apr 5, 2022

Looking more into it, I suspect this code is intended to implement the Upload-Defer-Length part of the spec in the Creation extension:

Once it is known the Client MUST set the Upload-Length header in the next PATCH request.

So that makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant