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

Unified Diff: net/spdy/spdy_stream.cc

Issue 9958023: Properly handle spdy3 responses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 9 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/spdy/spdy_stream.h ('k') | net/spdy/spdy_stream_spdy2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « net/spdy/spdy_stream.h ('k') | net/spdy/spdy_stream_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698