| Index: net/spdy/spdy_http_utils.cc
|
| diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
|
| index aab758aee599815d0b9d59177782ca41f7d33117..7162d96f3a18bd162829bcb63149beccdfb65172 100644
|
| --- a/net/spdy/spdy_http_utils.cc
|
| +++ b/net/spdy/spdy_http_utils.cc
|
| @@ -28,7 +28,10 @@ void AddSpdyHeader(const std::string& name,
|
| if (headers->find(name) == headers->end()) {
|
| (*headers)[name] = value;
|
| } else {
|
| - (*headers)[name] += '\0' + value;
|
| + std::string joint_value = (*headers)[name].as_string();
|
| + joint_value.append(1, '\0');
|
| + joint_value.append(value);
|
| + (*headers)[name] = joint_value;
|
| }
|
| }
|
|
|
| @@ -48,7 +51,7 @@ bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers,
|
| it = headers.find(status_key);
|
| if (it == headers.end())
|
| return false;
|
| - status = it->second;
|
| + status = it->second.as_string();
|
|
|
| if (protocol_version >= HTTP2) {
|
| version = "HTTP/1.1";
|
| @@ -56,7 +59,7 @@ bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers,
|
| it = headers.find(version_key);
|
| if (it == headers.end())
|
| return false;
|
| - version = it->second;
|
| + version = it->second.as_string();
|
| }
|
| std::string raw_headers(version);
|
| raw_headers.push_back(' ');
|
| @@ -71,7 +74,7 @@ bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers,
|
| // becomes
|
| // Set-Cookie: foo\0
|
| // Set-Cookie: bar\0
|
| - std::string value = it->second;
|
| + std::string value = it->second.as_string();
|
| size_t start = 0;
|
| size_t end = 0;
|
| do {
|
| @@ -82,9 +85,9 @@ bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers,
|
| else
|
| tval = value.substr(start);
|
| if (protocol_version >= 3 && it->first[0] == ':')
|
| - raw_headers.append(it->first.substr(1));
|
| + raw_headers.append(it->first.as_string().substr(1));
|
| else
|
| - raw_headers.append(it->first);
|
| + raw_headers.append(it->first.as_string());
|
| raw_headers.push_back(':');
|
| raw_headers.append(tval);
|
| raw_headers.push_back('\0');
|
| @@ -102,18 +105,7 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
|
| SpdyMajorVersion protocol_version,
|
| bool direct,
|
| SpdyHeaderBlock* headers) {
|
| -
|
| - HttpRequestHeaders::Iterator it(request_headers);
|
| - while (it.GetNext()) {
|
| - std::string name = base::ToLowerASCII(it.name());
|
| - if (name == "connection" || name == "proxy-connection" ||
|
| - name == "transfer-encoding" || name == "host") {
|
| - continue;
|
| - }
|
| - AddSpdyHeader(name, it.value(), headers);
|
| - }
|
| static const char kHttpProtocolVersion[] = "HTTP/1.1";
|
| -
|
| switch (protocol_version) {
|
| case SPDY2:
|
| // TODO(bnc): Remove this code now that SPDY/2 is deprecated.
|
| @@ -130,8 +122,8 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
|
| break;
|
| case SPDY3:
|
| (*headers)[":version"] = kHttpProtocolVersion;
|
| - (*headers)[":host"] = GetHostAndOptionalPort(info.url);
|
| (*headers)[":method"] = info.method;
|
| + (*headers)[":host"] = GetHostAndOptionalPort(info.url);
|
| if (info.method == "CONNECT") {
|
| (*headers)[":path"] = GetHostAndPort(info.url);
|
| } else {
|
| @@ -152,6 +144,17 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
|
| default:
|
| NOTREACHED();
|
| }
|
| +
|
| + HttpRequestHeaders::Iterator it(request_headers);
|
| + while (it.GetNext()) {
|
| + std::string name = base::ToLowerASCII(it.name());
|
| + if (name.empty() || name[0] == ':' || name == "connection" ||
|
| + name == "proxy-connection" || name == "transfer-encoding" ||
|
| + name == "host") {
|
| + continue;
|
| + }
|
| + AddSpdyHeader(name, it.value(), headers);
|
| + }
|
| }
|
|
|
| void CreateSpdyHeadersFromHttpResponse(
|
| @@ -205,18 +208,18 @@ GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers,
|
| SpdyHeaderBlock::const_iterator it = headers.find(":scheme");
|
| if (it == headers.end())
|
| return GURL();
|
| - std::string url = it->second;
|
| + std::string url = it->second.as_string();
|
| url.append("://");
|
|
|
| it = headers.find(protocol_version >= HTTP2 ? ":authority" : ":host");
|
| if (it == headers.end())
|
| return GURL();
|
| - url.append(it->second);
|
| + url.append(it->second.as_string());
|
|
|
| it = headers.find(":path");
|
| if (it == headers.end())
|
| return GURL();
|
| - url.append(it->second);
|
| + url.append(it->second.as_string());
|
| return GURL(url);
|
| }
|
|
|
|
|