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

Resumable Uploads: POST for appending data? #2962

Open
Acconut opened this issue Nov 25, 2024 · 9 comments
Open

Resumable Uploads: POST for appending data? #2962

Acconut opened this issue Nov 25, 2024 · 9 comments

Comments

@Acconut
Copy link
Member

Acconut commented Nov 25, 2024

In https://mailarchive.ietf.org/arch/msg/httpbisa/m-iXTJQGdb8XpxGjZWxXGj6Siic/, Roy Fielding suggests POST to be used instead of PATCH + application/octet-stream for appending data to an upload resource:

For example, use of the method PATCH for appending opaque data is incorrect. PATCH already has a defined semantic that could be used in parallel (e.g., another extension might use PATCH correctly). The resumable upload extension does not use a patch format, so both use of PATCH and creation of a new media type "application/partial-upload” are inappropriate.

POST should be used for appending data to the upload resource. This matches the semantics of POST and is easier to deploy in practice. Each POST can use “application/octet-stream” (or not send any Content-Type, since it has no role to play in processing).

Since we define the upload resource in the first place, we can also specify the meaning of a POST request against it and don't have to use PATCH with a custom media type to define the message's semantics.

Personally, I think both methods (POST or PATCH) are fine. What do others think about this?

@LPardue
Copy link
Contributor

LPardue commented Nov 25, 2024

I'd rather not do both.

Avoiding creating a media type has the positive of saving some effort.

I tried to trace back the history of using PATCH in the first place and could not find a good answer. Does anyone have one?

@guoye-zhang
Copy link
Contributor

I believe that @reschke suggested using PATCH and defining a new media type initially.

Personally I don't have a preference, either.

@reschke
Copy link
Contributor

reschke commented Nov 26, 2024 via email

@mnot
Copy link
Member

mnot commented Nov 26, 2024

Right, if we're going to use PATCH, the media type should describe how to handle the request content in a generic way. E.g., application/append-these-bytes.

That implies that it might be good to do so in a separate document, so it can be reused by other applications, rather than being perceived as specific to resumable uploads.

If that's thought of as too much work, POST is probably the right answer (with the semantics being defined by the specific resource type that's being baked into the resumable uploads spec).

But how could you resist creating a media type with a name like that?

@LPardue
Copy link
Contributor

LPardue commented Nov 26, 2024

If its worth doing, it's worth doing right

@LPardue
Copy link
Contributor

LPardue commented Nov 26, 2024

But also, didn't we have some of this discussion in the WG wrt https://datatracker.ietf.org/doc/draft-ietf-httpapi-patch-byterange/

@smatsson
Copy link

@LPardue We did. Both on the mailing list and on Github.

#2501 (byte range patch discussions)

https://mailarchive.ietf.org/arch/msg/httpbisa/UXTmMZaDNgtkMyA7broHeKL6vhg/ (contains discussions on POST vs PATCH)

https://mailarchive.ietf.org/arch/msg/httpbisa/aAfI1cZZDHnqhykFx4DoFClFocw/ (content type of PATCH and discussions if we can use it at all)

@Acconut
Copy link
Member Author

Acconut commented Nov 26, 2024

Right, if we're going to use PATCH, the media type should describe how to handle the request content in a generic way. E.g., application/append-these-bytes.

That implies that it might be good to do so in a separate document, so it can be reused by other applications, rather than being perceived as specific to resumable uploads.

The current draft (-05) intents to define the application/partial-upload media type (https://www.ietf.org/archive/id/draft-ietf-httpbis-resumable-upload-05.html#name-media-type-application-part) for use in PATCH requests when appending data, but this media type is specific to uploads and not very generic. We can consider renaming the media type and update its description to make it usable in other situations as well.

@mnot
Copy link
Member

mnot commented Nov 26, 2024

If it's spec-specific, that's good enough, I think.

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

No branches or pull requests

6 participants