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

Unified Diff: net/quic/spdy_utils.cc

Issue 1561383002: relnote: add new unused functions for client side of QUIC server push. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@21_CL_111427940
Patch Set: port spdy_utils_test.cc Created 4 years, 11 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/spdy_utils.h ('k') | net/quic/spdy_utils_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/spdy_utils.cc
diff --git a/net/quic/spdy_utils.cc b/net/quic/spdy_utils.cc
index 3ff15270a162065fb7437fef2f2e6fd5de13766c..6f2d29f423a2cb88478b994258980044b7c26216 100644
--- a/net/quic/spdy_utils.cc
+++ b/net/quic/spdy_utils.cc
@@ -13,6 +13,7 @@
#include "net/spdy/spdy_frame_builder.h"
#include "net/spdy/spdy_framer.h"
#include "net/spdy/spdy_protocol.h"
+#include "url/gurl.h"
using std::string;
using std::vector;
@@ -105,4 +106,31 @@ bool SpdyUtils::ParseTrailers(const char* data,
return true;
}
+// static
+string SpdyUtils::GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers) {
+ SpdyHeaderBlock::const_iterator it = headers.find(":scheme");
+ if (it == headers.end())
+ return "";
+ std::string url = it->second.as_string();
+
+ url.append("://");
+
+ it = headers.find(":authority");
+ if (it == headers.end())
+ return "";
+ url.append(it->second.as_string());
+
+ it = headers.find(":path");
+ if (it == headers.end())
+ return "";
+ url.append(it->second.as_string());
+ return url;
+}
+
+// static
+bool SpdyUtils::UrlIsValid(const SpdyHeaderBlock& headers) {
+ string url(GetUrlFromHeaderBlock(headers));
+ return url != "" && GURL(url).is_valid();
+}
+
} // namespace net
« no previous file with comments | « net/quic/spdy_utils.h ('k') | net/quic/spdy_utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698