Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(970)

Unified Diff: net/spdy/spdy_alt_svc_wire_format.cc

Issue 1420783002: Add quotation marks around probability value in Alternative Services. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2526
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_network_transaction_unittest.cc ('k') | net/spdy/spdy_alt_svc_wire_format_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_alt_svc_wire_format.cc
diff --git a/net/spdy/spdy_alt_svc_wire_format.cc b/net/spdy/spdy_alt_svc_wire_format.cc
index a418cd73e2df91c7bf7188ad529de882f2aebc1f..c8f26afaf3ac4f4058062aebfa9852aac426d5f5 100644
--- a/net/spdy/spdy_alt_svc_wire_format.cc
+++ b/net/spdy/spdy_alt_svc_wire_format.cc
@@ -119,7 +119,11 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
return false;
}
} else if (parameter_name.compare("p") == 0) {
- if (!ParseProbability(parameter_value_begin, c, &p)) {
+ // Probability value is enclosed in quotation marks.
+ if (*parameter_value_begin != '"' || *(c - 1) != '"') {
+ return false;
+ }
+ if (!ParseProbability(parameter_value_begin + 1, c - 1, &p)) {
return false;
}
}
@@ -186,7 +190,7 @@ std::string SpdyAltSvcWireFormat::SerializeHeaderFieldValue(
base::StringAppendF(&value, "; ma=%d", altsvc.max_age);
}
if (altsvc.p != 1.0) {
- base::StringAppendF(&value, "; p=%.2f", altsvc.p);
+ base::StringAppendF(&value, "; p=\"%.2f\"", altsvc.p);
}
}
return value;
« no previous file with comments | « net/quic/quic_network_transaction_unittest.cc ('k') | net/spdy/spdy_alt_svc_wire_format_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698