Commit 1d89a323 authored by Dianna Hu's avatar Dianna Hu Committed by Commit Bot

Minor code simplification in SpdyAltSvcWireFormat.

Change 'string.compare("xx") == 0' to 'string == "xx"'.
No behavior change.

This CL lands server change 173703711 by wangyix.

BUG=488484

Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I52bfa8ba9981608f46598c5978d7f7f48910151a
Reviewed-on: https://chromium-review.googlesource.com/746368Reviewed-by: default avatarBence Béky <bnc@chromium.org>
Commit-Queue: Dianna Hu <diannahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512966}
parent 2030987e
...@@ -78,7 +78,7 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue( ...@@ -78,7 +78,7 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
} }
// Check for IETF format for advertising QUIC: // Check for IETF format for advertising QUIC:
// hq=":443";quic=51303338;quic=51303334 // hq=":443";quic=51303338;quic=51303334
const bool is_ietf_format_quic = (protocol_id.compare("hq") == 0); const bool is_ietf_format_quic = (protocol_id == "hq");
c = percent_encoded_protocol_id_end; c = percent_encoded_protocol_id_end;
if (c == value.end()) { if (c == value.end()) {
return false; return false;
...@@ -145,11 +145,11 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue( ...@@ -145,11 +145,11 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
if (c == parameter_value_begin) { if (c == parameter_value_begin) {
return false; return false;
} }
if (parameter_name.compare("ma") == 0) { if (parameter_name == "ma") {
if (!ParsePositiveInteger32(parameter_value_begin, c, &max_age)) { if (!ParsePositiveInteger32(parameter_value_begin, c, &max_age)) {
return false; return false;
} }
} else if (!is_ietf_format_quic && parameter_name.compare("v") == 0) { } else if (!is_ietf_format_quic && parameter_name == "v") {
// Version is a comma separated list of positive integers enclosed in // Version is a comma separated list of positive integers enclosed in
// quotation marks. Since it can contain commas, which are not // quotation marks. Since it can contain commas, which are not
// delineating alternative service entries, |parameters_end| and |c| can // delineating alternative service entries, |parameters_end| and |c| can
...@@ -180,7 +180,7 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue( ...@@ -180,7 +180,7 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
return false; return false;
} }
} }
} else if (is_ietf_format_quic && parameter_name.compare("quic") == 0) { } else if (is_ietf_format_quic && parameter_name == "quic") {
// IETF format for advertising QUIC. Version is hex encoding of QUIC // IETF format for advertising QUIC. Version is hex encoding of QUIC
// version tag. Hex-encoded string should not include leading "0x" or // version tag. Hex-encoded string should not include leading "0x" or
// leading zeros. // leading zeros.
...@@ -223,7 +223,7 @@ SpdyString SpdyAltSvcWireFormat::SerializeHeaderFieldValue( ...@@ -223,7 +223,7 @@ SpdyString SpdyAltSvcWireFormat::SerializeHeaderFieldValue(
value.push_back(','); value.push_back(',');
} }
// Check for IETF format for advertising QUIC. // Check for IETF format for advertising QUIC.
const bool is_ietf_format_quic = (altsvc.protocol_id.compare("hq") == 0); const bool is_ietf_format_quic = (altsvc.protocol_id == "hq");
// Percent escape protocol id according to // Percent escape protocol id according to
// http://tools.ietf.org/html/rfc7230#section-3.2.6. // http://tools.ietf.org/html/rfc7230#section-3.2.6.
for (char c : altsvc.protocol_id) { for (char c : altsvc.protocol_id) {
......
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