Index: net/spdy/spdy_stream.cc |
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc |
index a04016742cdbf391abf283e22a578411c3d30086..0fa6290161eddf94ea13135bd63d224205b9f988 100644 |
--- a/net/spdy/spdy_stream.cc |
+++ b/net/spdy/spdy_stream.cc |
@@ -9,6 +9,7 @@ |
#include "base/message_loop.h" |
#include "base/stringprintf.h" |
#include "base/values.h" |
+#include "net/spdy/spdy_http_utils.h" |
#include "net/spdy/spdy_session.h" |
namespace net { |
@@ -532,44 +533,8 @@ bool SpdyStream::HasUrl() const { |
GURL SpdyStream::GetUrl() const { |
DCHECK(HasUrl()); |
- if (pushed_) { |
- if (GetProtocolVersion() >= 3) { |
- return GetUrlFromHeaderBlock(response_); |
- } else { |
- // assemble from the response |
- std::string url; |
- SpdyHeaderBlock::const_iterator it; |
- it = response_->find("url"); |
- if (it != (*response_).end()) |
- url = it->second; |
- return GURL(url); |
- } |
- } |
- |
- return GetUrlFromHeaderBlock(request_); |
-} |
- |
-GURL SpdyStream::GetUrlFromHeaderBlock( |
- const linked_ptr<SpdyHeaderBlock>& headers) const { |
- const char* scheme_header = GetProtocolVersion() >= 3 ? ":scheme" : "scheme"; |
- const char* host_header = GetProtocolVersion() >= 3 ? ":host" : "host"; |
- const char* path_header = GetProtocolVersion() >= 3 ? ":path" : "path"; |
- |
- std::string scheme; |
- std::string host_port; |
- std::string path; |
- SpdyHeaderBlock::const_iterator it; |
- it = headers->find(scheme_header); |
- if (it != (*headers).end()) |
- scheme = it->second; |
- it = headers->find(host_header); |
- if (it != (*headers).end()) |
- host_port = it->second; |
- it = headers->find(path_header); |
- if (it != (*headers).end()) |
- path = it->second; |
- std::string url = scheme + "://" + host_port + path; |
- return GURL(url); |
+ const SpdyHeaderBlock& headers = (pushed_) ? *response_ : *request_; |
+ return GetUrlFromHeaderBlock(headers, GetProtocolVersion(), pushed_); |
} |
void SpdyStream::OnGetDomainBoundCertComplete(int result) { |