fix(http): fail on non-success response status codes#298
Open
allamiro wants to merge 1 commit into
Open
Conversation
The HTTP db backend streamed whatever the server returned into the kdbx parser: a 404/500 error page surfaced as a confusing 'keepass db initialization failed'. Reads, keyfile reads and writes now check the response status via error_for_status.
3c03e80 to
46a5cef
Compare
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.
Fixes #274.
Problem
The HTTP db backend never checked response status codes. A 404/500 error page was streamed straight into the kdbx parser (reads) or silently treated as a successful upload (writes).
Changes
get_db_read,get_key_read:error_for_status()before streaming the bodyget_db_write: the upload result channel now reports non-success statuses as errorsTesting
cargo test: 11/11 pass in a rust:1.83 container.Summary by cubic
Make the HTTP db backend fail on non-success status codes instead of streaming error pages or treating failed writes as successful. This prevents confusing parser errors and surfaces clear HTTP failures.
error_for_status()inget_db_readandget_key_readbefore streaming.get_db_write.Written for commit 3c03e80. Summary will update on new commits.