Commit 35123c72 authored by David Schinazi's avatar David Schinazi Committed by Commit Bot

Add --force_version_negotiation to quic_client

Change-Id: Iccb464ea241b504faa07fbf2dfb588fdfbbfb568
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1612323
Commit-Queue: David Schinazi <dschinazi@chromium.org>
Commit-Queue: Zhongyi Shi <zhongyi@chromium.org>
Auto-Submit: David Schinazi <dschinazi@chromium.org>
Reviewed-by: default avatarZhongyi Shi <zhongyi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659667}
parent 0629444e
...@@ -96,6 +96,9 @@ int32_t FLAGS_quic_ietf_draft = 0; ...@@ -96,6 +96,9 @@ int32_t FLAGS_quic_ietf_draft = 0;
// If true, a version mismatch in the handshake is not considered a failure. // If true, a version mismatch in the handshake is not considered a failure.
// Useful for probing a server to determine if it speaks any version of QUIC. // Useful for probing a server to determine if it speaks any version of QUIC.
bool FLAGS_version_mismatch_ok = false; bool FLAGS_version_mismatch_ok = false;
// If true, start by proposing a version that is reserved for version
// negotiation.
bool FLAGS_force_version_negotiation = false;
// If true, an HTTP response code of 3xx is considered to be a successful // If true, an HTTP response code of 3xx is considered to be a successful
// response, otherwise a failure. // response, otherwise a failure.
bool FLAGS_redirect_is_success = true; bool FLAGS_redirect_is_success = true;
...@@ -169,6 +172,8 @@ int main(int argc, char* argv[]) { ...@@ -169,6 +172,8 @@ int main(int argc, char* argv[]) {
"This also enables required internal QUIC flags.\n" "This also enables required internal QUIC flags.\n"
"--version_mismatch_ok if specified a version mismatch in the " "--version_mismatch_ok if specified a version mismatch in the "
"handshake is not considered a failure\n" "handshake is not considered a failure\n"
"--force_version_negotiation if specified start by proposing a version "
"that is reserved for version negotiation\n"
"--redirect_is_success if specified an HTTP response code of 3xx " "--redirect_is_success if specified an HTTP response code of 3xx "
"is considered to be a successful response, otherwise a failure\n" "is considered to be a successful response, otherwise a failure\n"
"--initial_mtu=<initial_mtu> specify the initial MTU of the connection" "--initial_mtu=<initial_mtu> specify the initial MTU of the connection"
...@@ -211,6 +216,9 @@ int main(int argc, char* argv[]) { ...@@ -211,6 +216,9 @@ int main(int argc, char* argv[]) {
if (line->HasSwitch("version_mismatch_ok")) { if (line->HasSwitch("version_mismatch_ok")) {
FLAGS_version_mismatch_ok = true; FLAGS_version_mismatch_ok = true;
} }
if (line->HasSwitch("force_version_negotiation")) {
FLAGS_force_version_negotiation = true;
}
if (line->HasSwitch("redirect_is_success")) { if (line->HasSwitch("redirect_is_success")) {
FLAGS_redirect_is_success = true; FLAGS_redirect_is_success = true;
} }
...@@ -228,6 +236,7 @@ int main(int argc, char* argv[]) { ...@@ -228,6 +236,7 @@ int main(int argc, char* argv[]) {
<< " quic_version: " << FLAGS_quic_version << " quic_version: " << FLAGS_quic_version
<< " quic_ietf_draft: " << FLAGS_quic_ietf_draft << " quic_ietf_draft: " << FLAGS_quic_ietf_draft
<< " version_mismatch_ok: " << FLAGS_version_mismatch_ok << " version_mismatch_ok: " << FLAGS_version_mismatch_ok
<< " force_version_negotiation: " << FLAGS_force_version_negotiation
<< " redirect_is_success: " << FLAGS_redirect_is_success << " redirect_is_success: " << FLAGS_redirect_is_success
<< " initial_mtu: " << FLAGS_initial_mtu; << " initial_mtu: " << FLAGS_initial_mtu;
...@@ -290,6 +299,11 @@ int main(int argc, char* argv[]) { ...@@ -290,6 +299,11 @@ int main(int argc, char* argv[]) {
quic::QuicEnableVersion(parsed_quic_version); quic::QuicEnableVersion(parsed_quic_version);
} }
if (FLAGS_force_version_negotiation) {
versions.insert(versions.begin(),
quic::QuicVersionReservedForNegotiation());
}
// For secure QUIC we need to verify the cert chain. // For secure QUIC we need to verify the cert chain.
std::unique_ptr<CertVerifier> cert_verifier( std::unique_ptr<CertVerifier> cert_verifier(
CertVerifier::CreateDefault(/*cert_net_fetcher=*/nullptr)); CertVerifier::CreateDefault(/*cert_net_fetcher=*/nullptr));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment