forked from hyperium/http
-
Notifications
You must be signed in to change notification settings - Fork 3
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
[pull] master from hyperium:master #7
Open
pull
wants to merge
135
commits into
mesalock-linux:master
Choose a base branch
from
hyperium:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
The tests for invalid methods test invalid byte sequences including invalid utf-8 and valid utf-8 that uses invalid characters for a Method. The tests for valid methods test both short and long extension methods. Also extract all of the unit tests into a "test" module.
Extract the inner types for ExtensionAllocated and ExtensionInline into a separate extension module that has the supporting functions as non-public elements. This refactoring moves the use of "unsafe" into this new "extension" module and provides a safe wrappers around the two uses of "unsafe".
The internal InlineExtension and AllocatedExtension types have invariants that ensure that the two uses of "unsafe" in the "extension" submodule of "method" are safe. This documents those invariants for future reference.
The tests include an [u8] that is invalid UTF-8.
The comments describe the postcondition on parse_exact() that makes the one use of "unsafe" in Scheme::try_from(&'a [u8]) sound.
* Add unit test for rejecting invalid UTF-8 * Add Authority::from_static() test * Refactor uri::Authority Extract the common code from three ways of creating an Authority into a private create_authority() function. * Add comments to explain the safety of Authority The comments describe the preconditions and postconditions that together ensure that the one use of 'unsafe' in uri/authority.rs is sound. * Fix typo
The "Build Status" markup badge had not been updated to refect the change of CI systems from TravisCI to GitHub Actions.
This change makes the alt tag for the badge image closer to what is shown in the immage itself (both are will show the name of the workflow: CI) and makes the badge a link to the summary page for the CI workflow in the GitHub Actions web interface.
While the documentation mentions that header values can be marked as sensitive in order to inform outside components that these header values may require special treatment, it was unclear to me whether doing that affects the behavior of this crate. This adds a short note to the documentation to clarify that the main purpose of the sensitivity flag is to make components building on this crate to be aware of sensitive data, such that it can be treated with special care for security purposes.
Add comments describing the invariant that makes the one use of unsafe sound.
Fixes #432. This eliminates an undocumented panic from the `HeaderName` creation functions, returning instead an `InvalidHeaderName` when the name length exceeds `MAX_HEADER_NAME_LEN`. I considered making `InvalidHeaderName` a richer error type, but since it was already used for another type of length error (rejecting zero-length names) I figured it was okay to reuse. I also redefined `MAX_HEADER_NAME_LEN` slightly, so that it is equal to the largest allowed header length, rather than one past that value. This was motivated by discovering a bug in my comparison logic when I went to write the new test exercising the wrong-length error conditions.
Additionally, reduces the size of the static memory included, and reduces some of the complicated macro usage resulting in faster compiles! Co-authored-by: quininer <[email protected]> Co-authored-by: David Kellum <[email protected]>
When building a URI, it is not possible to provide neither String nor &String, which is useful when adding a path_and_query from a string built using format!. This commit adds implementation of From<String> and From<&String> for PathAndQuery.
* add test case for OccupiedEntry::remove_entry_mult This is just a self contained test case, currently reproducing the panic of #446. * expand test cases for remove_entry_mult * add multiple remove_entry_mult call tests to show more issues * test repeated HeaderMap::remove for comparison * tests showing similar problem with remove_entry on extra values * fix remove_entry by moving remove_found after remove_all_extra_values * fix remove_entry_mult by eager collection of extras before remove_found In order to remove extra values prior to remove_found, we must collect them eagerly. Eager collection is based on: commit 8ffe094 Author: Sean McArthur <[email protected]> AuthorDate: Mon Nov 25 17:34:30 2019 -0800 Commit: Sean McArthur <[email protected]> CommitDate: Tue Nov 26 10:03:09 2019 -0800 Make ValueDrain eagerly collect its extra values ...which was reverted in 6c2b789. Closes #446
`HeaderValue` implements `TryFrom` over both reference and owned types, but `HeaderName` does not. This seemed like an accidental omission to me rather than something intentionally absent. Including this conversion slightly increases ergonomics by allowing you to create a `HeaderMap` from a `HashMap<String, String>` and in similar other constraints. See also sagebind/isahc#314.
Also fix PathAndQuery's TryFrom<String> impl to not copy the bytes into a new Bytes.
* HeaderValue::from_static can be const * bump MSRV to 1.46.0 for const loop
Using "res" for Response rather than "req".
This is needed to manually clone `Builder` instances reliably.
If a byte slice larger than 64 bytes is passed to `HeaderName::from_lowercase`, it could allow NUL bytes. This fixes the bug. Reported-by: [email protected]
…nst context workaround
Co-authored-by: Bastian Schubert <[email protected]>
This makes requests::Builder trait bound easily readable and consistent w/ stdlib recommendations. It also technically _increases_ the amount of types that could meet the bounds, because of how TryFrom/TryInto interact. Closes #727 Co-authored-by: rob <[email protected]>
…738) `HeaderValue` from integers `::bytes::BytesMut >= 1` has no inline optimization
This bug caused additional allocation when attempted to insert the requested number of entries. This commit fix that by converting capacity to raw capacity before allocation.
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.
See Commits and Changes for more details.
Created by pull[bot]
Can you help keep this open source service alive? 💖 Please sponsor : )