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

Unified Diff: net/quic/core/spdy_utils.cc

Issue 2363393004: Remove usage of BalsaHeaders from QuicClient. Also move QuicDataToResend from QuicClient to QuicCli… (Closed)
Patch Set: Created 4 years, 3 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
Index: net/quic/core/spdy_utils.cc
diff --git a/net/quic/core/spdy_utils.cc b/net/quic/core/spdy_utils.cc
index 9ed8642a4aeca9f8307fa75a8f1253551e8ec79d..602f4b5308ca26cacdce271c201ff68d442f3dcc 100644
--- a/net/quic/core/spdy_utils.cc
+++ b/net/quic/core/spdy_utils.cc
@@ -261,4 +261,23 @@ bool SpdyUtils::UrlIsValid(const SpdyHeaderBlock& headers) {
return url != "" && GURL(url).is_valid();
}
+// static
+bool SpdyUtils::PopulateHeaderBlockFromUrl(const string url,
+ SpdyHeaderBlock* headers) {
+ (*headers)[":method"] = "GET";
+ size_t pos = url.find("://");
+ if (pos == string::npos) {
+ return false;
+ }
+ (*headers)[":scheme"] = url.substr(0, pos);
+ size_t start = pos + 3;
+ pos = url.find("/", start);
+ if (pos == string::npos) {
+ return false;
+ }
+ (*headers)[":authority"] = url.substr(start, pos - start);
+ (*headers)[":path"] = url.substr(pos);
+ return true;
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698