diff options
Diffstat (limited to 'net/spdy')
-rw-r--r-- | net/spdy/spdy_network_transaction_unittest.cc | 22 | ||||
-rw-r--r-- | net/spdy/spdy_session.cc | 14 | ||||
-rw-r--r-- | net/spdy/spdy_session.h | 2 |
3 files changed, 15 insertions, 23 deletions
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index cc08a9e..12625b2 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -1193,9 +1193,8 @@ TEST_F(SpdyNetworkTransactionTest, SynReplyHeadersVary) { { &syn_reply_info, true, - { 2, 4 }, - { { "cookie", "val1", - "cookie", "val2", + { 1, 4 }, + { { "cookie", "val1,val2", NULL }, { "vary", "cookie", @@ -1254,8 +1253,6 @@ TEST_F(SpdyNetworkTransactionTest, SynReplyHeadersVary) { }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { - char modified_syn_header[64]; - // Construct the request. scoped_ptr<spdy::SpdyFrame> frame_req( ConstructSpdyGet(test_cases[i].extra_headers[0], @@ -1292,17 +1289,12 @@ TEST_F(SpdyNetworkTransactionTest, SynReplyHeadersVary) { request.load_flags = 0; // Attach the headers to the request. - int hdrCount = test_cases[i].num_headers[0]; - int len = 0; - - for (int ct = 0; ct < hdrCount; ct++) { - len = ConstructSpdyHeader(test_cases[i].extra_headers[0], - test_cases[i].num_headers[0], - modified_syn_header, - 64, - ct); + int header_count = test_cases[i].num_headers[0]; - request.extra_headers.append(modified_syn_header); + for (int ct = 0; ct < header_count; ct++) { + const char* header_key = test_cases[i].extra_headers[0][ct * 2]; + const char* header_value = test_cases[i].extra_headers[0][ct * 2 + 1]; + request.extra_headers.SetHeader(header_key, header_value); } scoped_refptr<DelayedSocketData> data( diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 54e80c9..90b040c 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -133,19 +133,21 @@ bool SpdyHeadersToHttpResponse(const spdy::SpdyHeaderBlock& headers, // a HttpRequestInfo block. void CreateSpdyHeadersFromHttpRequest( const HttpRequestInfo& info, spdy::SpdyHeaderBlock* headers) { + // TODO(willchan): It's not really necessary to convert from + // HttpRequestHeaders to spdy::SpdyHeaderBlock. + static const char kHttpProtocolVersion[] = "HTTP/1.1"; - HttpUtil::HeadersIterator it(info.extra_headers.begin(), - info.extra_headers.end(), - "\r\n"); + HttpRequestHeaders::Iterator it(info.extra_headers); + while (it.GetNext()) { std::string name = StringToLowerASCII(it.name()); if (headers->find(name) == headers->end()) { - (*headers)[name] = it.values(); + (*headers)[name] = it.value(); } else { std::string new_value = (*headers)[name]; new_value.append(1, '\0'); // +=() doesn't append 0's - new_value += it.values(); + new_value += it.value(); (*headers)[name] = new_value; } } @@ -156,8 +158,6 @@ void CreateSpdyHeadersFromHttpRequest( (*headers)["method"] = info.method; (*headers)["url"] = info.url.spec(); (*headers)["version"] = kHttpProtocolVersion; - if (info.user_agent.length()) - (*headers)["user-agent"] = info.user_agent; if (!info.referrer.is_empty()) (*headers)["referer"] = info.referrer.spec(); diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h index d7f60c0..0564354 100644 --- a/net/spdy/spdy_session.h +++ b/net/spdy/spdy_session.h @@ -30,7 +30,7 @@ namespace net { class SpdyStream; class HttpNetworkSession; -class HttpRequestInfo; +struct HttpRequestInfo; class HttpResponseInfo; class BoundNetLog; class SSLInfo; |