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

Unified Diff: net/spdy/spdy_http_utils.cc

Issue 2801603003: Add SpdyString alias for std::string in net/spdy. (Closed)
Patch Set: Created 3 years, 8 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_http_stream_unittest.cc ('k') | net/spdy/spdy_log_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_http_utils.cc
diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
index 005b1987a2f5c54ef3c2f73067cced3fc8d18cba..24cd83c9faa157350678714b31e63eebdd19fb2e 100644
--- a/net/spdy/spdy_http_utils.cc
+++ b/net/spdy/spdy_http_utils.cc
@@ -4,8 +4,6 @@
#include "net/spdy/spdy_http_utils.h"
-#include <string>
-
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
@@ -18,19 +16,20 @@
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
#include "net/http/http_util.h"
+#include "net/spdy/platform/api/spdy_string.h"
#include "net/spdy/platform/api/spdy_string_piece.h"
namespace net {
namespace {
-void AddSpdyHeader(const std::string& name,
- const std::string& value,
+void AddSpdyHeader(const SpdyString& name,
+ const SpdyString& value,
SpdyHeaderBlock* headers) {
if (headers->find(name) == headers->end()) {
(*headers)[name] = value;
} else {
- std::string joint_value = (*headers)[name].as_string();
+ SpdyString joint_value = (*headers)[name].as_string();
joint_value.append(1, '\0');
joint_value.append(value);
(*headers)[name] = joint_value;
@@ -45,8 +44,8 @@ bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers,
SpdyHeaderBlock::const_iterator it = headers.find(":status");
if (it == headers.end())
return false;
- std::string status = it->second.as_string();
- std::string raw_headers("HTTP/1.1 ");
+ SpdyString status = it->second.as_string();
+ SpdyString raw_headers("HTTP/1.1 ");
raw_headers.append(status);
raw_headers.push_back('\0');
for (it = headers.begin(); it != headers.end(); ++it) {
@@ -58,12 +57,12 @@ bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers,
// becomes
// Set-Cookie: foo\0
// Set-Cookie: bar\0
- std::string value = it->second.as_string();
+ SpdyString value = it->second.as_string();
size_t start = 0;
size_t end = 0;
do {
end = value.find('\0', start);
- std::string tval;
+ SpdyString tval;
if (end != value.npos)
tval = value.substr(start, (end - start));
else
@@ -99,7 +98,7 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
HttpRequestHeaders::Iterator it(request_headers);
while (it.GetNext()) {
- std::string name = base::ToLowerASCII(it.name());
+ SpdyString name = base::ToLowerASCII(it.name());
if (name.empty() || name[0] == ':' || name == "connection" ||
name == "proxy-connection" || name == "transfer-encoding" ||
name == "host") {
@@ -150,7 +149,7 @@ GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers) {
SpdyHeaderBlock::const_iterator it = headers.find(":scheme");
if (it == headers.end())
return GURL();
- std::string url = it->second.as_string();
+ SpdyString url = it->second.as_string();
url.append("://");
it = headers.find(":authority");
« no previous file with comments | « net/spdy/spdy_http_stream_unittest.cc ('k') | net/spdy/spdy_log_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698