| 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
|
|
|