implement other Putmodes for Http Client - #845
Open
giridher-art wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #844.
Rationale for this change
HttpStore::put_optscurrently only supportsPutMode::Overwrite;PutMode::CreateandPutMode::UpdatereturnError::NotImplemented. This meansHttpStorecan't be used for optimistic-concurrency writes (create-if-absent, update-if-unchanged), unlike every other backend (aws,azure,gcp), which already support both modes.What changes are included in this PR?
PutMode::CreateandPutMode::UpdateinHttpStore::put_opts/Client::put, using standard HTTP conditional request headers (RFC 7232) rather than the WebDAVIfheader (RFC 2518 §9.4), since only ETag/existence conditions are needed and not lock-token semantics:PutMode::Create→If-None-Match: *PutMode::Update(v)→If-Match: "<v.e_tag>"PutMode::Create+412 Precondition Failedor304 Not Modified(some servers return 304 instead of 412 for a failedIf-None-Matchon PUT) →Error::AlreadyExistsPutMode::Update+412 Precondition Failed→Error::PreconditionClient::putnow takesmode: &PutModeto build the appropriate header before sending the request.PutMode::Updatewithout ane_tagset onUpdateVersionreturns an error rather than sending an unconditional request.Are there any user-facing changes?
Yes —
HttpStore::put_optsnow succeeds forPutMode::CreateandPutMode::Updateinstead of returningError::NotImplemented. No breaking changes to public APIs; this only adds previously-unsupported behavior.Note: not all HTTP/WebDAV servers honor conditional headers on PUT (this is optional server-side behavior). Against a server that ignores
If-Match/If-None-Match, a write may silently succeed unconditionally instead of returning the expected error — this is a server capability limitation, not something the client can detect in advance.