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

Make default VersionNegotiation more conservative #164

Merged
merged 1 commit into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,17 +510,25 @@ impl Default for VersionNegotiation {
}

impl VersionNegotiation {
/// Always prefer the latest supported version with a preference for old
/// versions if necessary in order to connect. This is the default.
///
/// Typically negotiation will begin with an HTTP/1.1 request, upgrading to
/// HTTP/2 if possible, then to HTTP/3 if possible, etc.
/// Always prefer the latest supported version announced by the server,
/// falling back to older versions if not explicitly listed as supported.
/// This is the default.
///
/// Secure connections will begin with a TLS handshake, after which the
/// highest supported HTTP version listed by the server via ALPN will be
/// used. Once connected, additional upgrades to newer versions may also
/// occur if the server lists support for it. In the future, headers such as
/// `Alt-Svc` will be used.
///
/// Insecure connections always use HTTP/1.x since there is no standard
/// mechanism for a server to declare support for insecure HTTP versions,
/// and only HTTP/1.x and HTTP/2 support insecure transfers.
pub const fn latest_compatible() -> Self {
Self {
// In curl land, this basically the most lenient option. Alt-Svc is
// used to upgrade to newer versions, and old versions are used if
// the server doesn't respond to the HTTP/1.1 -> HTTP/2 upgrade.
flag: curl::easy::HttpVersion::V2,
// the server doesn't list HTTP/2 via ALPN.
flag: curl::easy::HttpVersion::V2TLS,
strict: false,
}
}
Expand Down
24 changes: 0 additions & 24 deletions tests/version.rs

This file was deleted.