Response headers in didFinishUpload delegate + data race fix (supersedes #167) - #231
Open
LefterisHaritou wants to merge 2 commits into
Open
Conversation
UploadDataTask now unpacks the upload result as (offset, responseHeaders) and saves responseHeaders into UploadMetadata. UploadMetadata decoding was made tolerant by using decodeIfPresent for responseHeaders so older metadata without that key won't fail decoding. This propagates server response headers into metadata and avoids crashes when the field is missing.
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.
Summary
Adds HTTP response header support to the
didFinishUploaddelegate callback, and fixes a data race inTUSAPI.This continues and fixes the work started in #167 (by @srvarma7), rebased on top of the latest
main(including the progress-wiring changes from #228).What's included
didFinishUpload(id:url:context:client:responseHeaders:)delegate method surfaces the server's response headers. The previous signature is kept as a deprecated compatibility shim that forwards to the new method, so existing conformers keep working without changes.HTTPURLResponse+Headersextension to extract headers into a[String: String]dictionary.UploadDataTasknow unpacks the upload result as(offset, responseHeaders)and storesresponseHeadersonUploadMetadata.UploadMetadatadecodesresponseHeaderswithdecodeIfPresent, so older persisted metadata without that key won't fail to decode.TUSAPIcallback handling was adjusted to avoid a data race on the shared callback state.Relationship to #167
This supersedes #167 with the missing fix applied and a clean rebase onto current
main. Happy to close #167 in favor of this if preferred.Testing
swift buildsucceeds (only the expected deprecation warning from the intentional compatibility shim).