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

[pull] master from hyperium:master #7

Open
wants to merge 135 commits into
base: master
Choose a base branch
from

Conversation

pull[bot]
Copy link

@pull pull bot commented May 8, 2020

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

sbosnick added 5 commits May 7, 2020 14:57
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.
@pull pull bot added the ⤵️ pull label May 8, 2020
sbosnick and others added 12 commits May 14, 2020 07:58
* 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
@pull pull bot added the merge-conflict Resolve conflicts manually label Dec 30, 2020
seanmonstar and others added 11 commits January 8, 2021 10:43
`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.
tottoto and others added 30 commits February 19, 2024 10:09
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]
* Allow characters `#`, `$`, `%,` `&,` `'` in HTTP method
* Update method character docomentation to RFC 9110
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
Labels
⤵️ pull merge-conflict Resolve conflicts manually
Projects
None yet
Development

Successfully merging this pull request may close these issues.