Skip to content

[pull] master from hyperium:master#7

Open
pull[bot] wants to merge 165 commits intomesalock-linux:masterfrom
hyperium:master
Open

[pull] master from hyperium:master#7
pull[bot] wants to merge 165 commits intomesalock-linux:masterfrom
hyperium:master

Conversation

@pull
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 <quininer@live.com>
Co-authored-by: David Kellum <dek-oss@gravitext.com>
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 <sean@seanmonstar.com>
    AuthorDate: Mon Nov 25 17:34:30 2019 -0800
    Commit:     Sean McArthur <sean@seanmonstar.com>
    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 January 27, 2025 08:29
Small change for readability, alongside some minor documentation
touchups for consistency.
Avoid "dangerous" implicit autoref creation.
* Avoid unnecessary .expect()s for empty HeaderMap

This change removes the Result::expect() calls in the constructors for
an empty HeaderMap. These calls were provably not going to fail at
runtime but rustc's inliner wasn't smart enough to figure that out:
strings analysis of compiled binaries showed that the error message to
the expect() still showed up in generated code.

There are no behavioral differences as a result of this change.

* Move new_empty() body into `Default` impl

This gives us one fewer named method since we can use default() in place
of new_empty(). It preserves the property that `HeaderMap::new()`
constrains the generic type to `T=HeaderValue`.
Co-authored-by: Sean McArthur <sean@seanmonstar.com>
Signed-off-by: claudecodering <claudecoder@outlook.com>
Revert "tests: updated rand dependency to v0.9.1 (#763)"

This reverts commit 4304e60.
Motivation: to improve panic messages in const fns, which without this are a
horrible experience for users. As we make more `from_static` constructors
usable in a const context, this is worth the increase.

We're still able to build on Debian oldstable.
Signed-off-by: Mateus Devino <mdevino@ibm.com>
Partially automated with cargo clippy --fix.
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.