summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-27 16:45:20 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-27 16:45:20 +0000
commitb94f92d469791662549f4e8b41851c31402381f9 (patch)
treef00e383a87ee15d9dcfbadb11b51aed6ce0ba580 /net/spdy
parent8c3e6878dc50e7ab2ee9ba53757d54b73897fd12 (diff)
downloadchromium_src-b94f92d469791662549f4e8b41851c31402381f9.zip
chromium_src-b94f92d469791662549f4e8b41851c31402381f9.tar.gz
chromium_src-b94f92d469791662549f4e8b41851c31402381f9.tar.bz2
HttpStream::SendRequest
Modify HttpStream::SendRequest to take the HttpRequestHeaders instead of a string so that HttpNetworkTransaction can handle both HTTP and SPDY requests the same way. BUG= TEST= Review URL: http://codereview.chromium.org/4061005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64082 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/spdy_http_stream.cc6
-rw-r--r--net/spdy/spdy_http_stream.h2
-rw-r--r--net/spdy/spdy_http_stream_unittest.cc6
3 files changed, 7 insertions, 7 deletions
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index 6fede6c..737eba5 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -12,6 +12,7 @@
#include "base/message_loop.h"
#include "net/base/load_flags.h"
#include "net/base/net_util.h"
+#include "net/http/http_request_headers.h"
#include "net/http/http_request_info.h"
#include "net/http/http_response_info.h"
#include "net/http/http_util.h"
@@ -139,7 +140,7 @@ void SpdyHttpStream::Close(bool not_reusable) {
Cancel();
}
-int SpdyHttpStream::SendRequest(const std::string& /*headers_string*/,
+int SpdyHttpStream::SendRequest(const HttpRequestHeaders& request_headers,
UploadDataStream* request_body,
HttpResponseInfo* response,
CompletionCallback* callback) {
@@ -148,9 +149,6 @@ int SpdyHttpStream::SendRequest(const std::string& /*headers_string*/,
stream_->SetDelegate(this);
- HttpRequestHeaders request_headers;
- HttpUtil::BuildRequestHeaders(request_info_, request_body, NULL, false, false,
- !direct_, &request_headers);
linked_ptr<spdy::SpdyHeaderBlock> headers(new spdy::SpdyHeaderBlock);
CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers,
headers.get(), direct_);
diff --git a/net/spdy/spdy_http_stream.h b/net/spdy/spdy_http_stream.h
index 372db57..a878ff9 100644
--- a/net/spdy/spdy_http_stream.h
+++ b/net/spdy/spdy_http_stream.h
@@ -49,7 +49,7 @@ class SpdyHttpStream : public SpdyStream::Delegate, public HttpStream {
// |callback| is used when this completes asynchronously.
// SpdyHttpStream takes ownership of |upload_data|. |upload_data| may be NULL.
// The actual SYN_STREAM packet will be sent if the stream is non-pushed.
- virtual int SendRequest(const std::string& headers,
+ virtual int SendRequest(const HttpRequestHeaders& headers,
UploadDataStream* request_body,
HttpResponseInfo* response,
CompletionCallback* callback);
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc
index ee1a34e..df979ec 100644
--- a/net/spdy/spdy_http_stream_unittest.cc
+++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -74,6 +74,7 @@ TEST_F(SpdyHttpStreamTest, SendRequest) {
request.url = GURL("http://www.google.com/");
TestCompletionCallback callback;
HttpResponseInfo response;
+ HttpRequestHeaders headers;
BoundNetLog net_log;
scoped_ptr<SpdyHttpStream> http_stream(
new SpdyHttpStream(session_.get(), true));
@@ -82,7 +83,7 @@ TEST_F(SpdyHttpStreamTest, SendRequest) {
http_stream->InitializeStream(&request, net_log, NULL));
EXPECT_EQ(ERR_IO_PENDING,
- http_stream->SendRequest("", NULL, &response, &callback));
+ http_stream->SendRequest(headers, NULL, &response, &callback));
EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair));
// This triggers the MockWrite and read 2
@@ -125,6 +126,7 @@ TEST_F(SpdyHttpStreamTest, SpdyURLTest) {
request.url = GURL(full_url);
TestCompletionCallback callback;
HttpResponseInfo response;
+ HttpRequestHeaders headers;
BoundNetLog net_log;
scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true));
ASSERT_EQ(
@@ -132,7 +134,7 @@ TEST_F(SpdyHttpStreamTest, SpdyURLTest) {
http_stream->InitializeStream(&request, net_log, NULL));
EXPECT_EQ(ERR_IO_PENDING,
- http_stream->SendRequest("", NULL, &response, &callback));
+ http_stream->SendRequest(headers, NULL, &response, &callback));
spdy::SpdyHeaderBlock* spdy_header =
http_stream->stream()->spdy_headers().get();