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

Unified Diff: net/spdy/spdy_alt_svc_wire_format.cc

Issue 1407643005: Add quotation marks around probability value in Alternative Services. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. 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 fba2dc5fcaa1603e2629bd0867dca544b133ea07..cc68e87d1f8eeb2b16ec01d17a2b3bfba2927ff3 100644
--- a/net/spdy/spdy_alt_svc_wire_format.cc
+++ b/net/spdy/spdy_alt_svc_wire_format.cc
@@ -147,7 +147,11 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
return false;
}
} else if (parameter_name.compare("p") == 0) {
- if (!ParseProbability(parameter_value_begin, c, &probability)) {
+ // Probability value is enclosed in quotation marks.
+ if (*parameter_value_begin != '"' || *(c - 1) != '"') {
+ return false;
+ }
+ if (!ParseProbability(parameter_value_begin + 1, c - 1, &probability)) {
return false;
}
}
@@ -220,7 +224,7 @@ std::string SpdyAltSvcWireFormat::SerializeHeaderFieldValue(
base::StringAppendF(&value, "; ma=%d", altsvc.max_age);
}
if (altsvc.probability != 1.0) {
- base::StringAppendF(&value, "; p=%.2f", altsvc.probability);
+ base::StringAppendF(&value, "; p=\"%.2f\"", altsvc.probability);
}
}
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