Index: net/http/http_request_headers.cc |
diff --git a/net/http/http_request_headers.cc b/net/http/http_request_headers.cc |
index 9348e3e27788ad7e1d82ec478ecc54482b147950..c76c326019611ee76d13eb83a545b4d583ed5180 100644 |
--- a/net/http/http_request_headers.cc |
+++ b/net/http/http_request_headers.cc |
@@ -41,17 +41,19 @@ HttpRequestHeaders::HeaderKeyValuePair::HeaderKeyValuePair() { |
} |
HttpRequestHeaders::HeaderKeyValuePair::HeaderKeyValuePair( |
- const base::StringPiece& key, const base::StringPiece& value) |
+ const base::StringPiece& key, |
+ const base::StringPiece& value) |
: key(key.data(), key.size()), value(value.data(), value.size()) { |
} |
- |
HttpRequestHeaders::Iterator::Iterator(const HttpRequestHeaders& headers) |
: started_(false), |
curr_(headers.headers_.begin()), |
- end_(headers.headers_.end()) {} |
+ end_(headers.headers_.end()) { |
+} |
-HttpRequestHeaders::Iterator::~Iterator() {} |
+HttpRequestHeaders::Iterator::~Iterator() { |
+} |
bool HttpRequestHeaders::Iterator::GetNext() { |
if (!started_) { |
@@ -66,8 +68,10 @@ bool HttpRequestHeaders::Iterator::GetNext() { |
return curr_ != end_; |
} |
-HttpRequestHeaders::HttpRequestHeaders() {} |
-HttpRequestHeaders::~HttpRequestHeaders() {} |
+HttpRequestHeaders::HttpRequestHeaders() { |
+} |
+HttpRequestHeaders::~HttpRequestHeaders() { |
+} |
bool HttpRequestHeaders::GetHeader(const base::StringPiece& key, |
std::string* out) const { |
@@ -106,8 +110,8 @@ void HttpRequestHeaders::RemoveHeader(const base::StringPiece& key) { |
void HttpRequestHeaders::AddHeaderFromString( |
const base::StringPiece& header_line) { |
- DCHECK_EQ(std::string::npos, header_line.find("\r\n")) |
- << "\"" << header_line << "\" contains CRLF."; |
+ DCHECK_EQ(std::string::npos, header_line.find("\r\n")) << "\"" << header_line |
+ << "\" contains CRLF."; |
const std::string::size_type key_end_index = header_line.find(":"); |
if (key_end_index == std::string::npos) { |
@@ -127,10 +131,8 @@ void HttpRequestHeaders::AddHeaderFromString( |
if (value_index < header_line.size()) { |
std::string header_value(header_line.data() + value_index, |
header_line.size() - value_index); |
- std::string::const_iterator header_value_begin = |
- header_value.begin(); |
- std::string::const_iterator header_value_end = |
- header_value.end(); |
+ std::string::const_iterator header_value_begin = header_value.begin(); |
+ std::string::const_iterator header_value_end = header_value.end(); |
HttpUtil::TrimLWS(&header_value_begin, &header_value_end); |
if (header_value_begin == header_value_end) { |
@@ -153,10 +155,11 @@ void HttpRequestHeaders::AddHeadersFromString( |
// TODO(willchan): Consider adding more StringPiece support in string_util.h |
// to eliminate copies. |
std::vector<std::string> header_line_vector; |
- base::SplitStringUsingSubstr(headers.as_string(), "\r\n", |
- &header_line_vector); |
+ base::SplitStringUsingSubstr( |
+ headers.as_string(), "\r\n", &header_line_vector); |
for (std::vector<std::string>::const_iterator it = header_line_vector.begin(); |
- it != header_line_vector.end(); ++it) { |
+ it != header_line_vector.end(); |
+ ++it) { |
if (!it->empty()) |
AddHeaderFromString(*it); |
} |
@@ -164,18 +167,19 @@ void HttpRequestHeaders::AddHeadersFromString( |
void HttpRequestHeaders::MergeFrom(const HttpRequestHeaders& other) { |
for (HeaderVector::const_iterator it = other.headers_.begin(); |
- it != other.headers_.end(); ++it ) { |
+ it != other.headers_.end(); |
+ ++it) { |
SetHeader(it->key, it->value); |
} |
} |
std::string HttpRequestHeaders::ToString() const { |
std::string output; |
- for (HeaderVector::const_iterator it = headers_.begin(); |
- it != headers_.end(); ++it) { |
+ for (HeaderVector::const_iterator it = headers_.begin(); it != headers_.end(); |
+ ++it) { |
if (!it->value.empty()) { |
- base::StringAppendF(&output, "%s: %s\r\n", |
- it->key.c_str(), it->value.c_str()); |
+ base::StringAppendF( |
+ &output, "%s: %s\r\n", it->key.c_str(), it->value.c_str()); |
} else { |
base::StringAppendF(&output, "%s:\r\n", it->key.c_str()); |
} |
@@ -190,13 +194,12 @@ base::Value* HttpRequestHeaders::NetLogCallback( |
base::DictionaryValue* dict = new base::DictionaryValue(); |
dict->SetString("line", *request_line); |
base::ListValue* headers = new base::ListValue(); |
- for (HeaderVector::const_iterator it = headers_.begin(); |
- it != headers_.end(); ++it) { |
- std::string log_value = ElideHeaderValueForNetLog( |
- log_level, it->key, it->value); |
+ for (HeaderVector::const_iterator it = headers_.begin(); it != headers_.end(); |
+ ++it) { |
+ std::string log_value = |
+ ElideHeaderValueForNetLog(log_level, it->key, it->value); |
headers->Append(new base::StringValue( |
- base::StringPrintf("%s: %s", |
- it->key.c_str(), log_value.c_str()))); |
+ base::StringPrintf("%s: %s", it->key.c_str(), log_value.c_str()))); |
} |
dict->Set("headers", headers); |
return dict; |
@@ -212,8 +215,7 @@ bool HttpRequestHeaders::FromNetLogParam(const base::Value* event_param, |
const base::DictionaryValue* dict = NULL; |
const base::ListValue* header_list = NULL; |
- if (!event_param || |
- !event_param->GetAsDictionary(&dict) || |
+ if (!event_param || !event_param->GetAsDictionary(&dict) || |
!dict->GetList("headers", &header_list) || |
!dict->GetString("line", request_line)) { |
return false; |
@@ -233,10 +235,10 @@ bool HttpRequestHeaders::FromNetLogParam(const base::Value* event_param, |
return true; |
} |
-HttpRequestHeaders::HeaderVector::iterator |
-HttpRequestHeaders::FindHeader(const base::StringPiece& key) { |
- for (HeaderVector::iterator it = headers_.begin(); |
- it != headers_.end(); ++it) { |
+HttpRequestHeaders::HeaderVector::iterator HttpRequestHeaders::FindHeader( |
+ const base::StringPiece& key) { |
+ for (HeaderVector::iterator it = headers_.begin(); it != headers_.end(); |
+ ++it) { |
if (key.length() == it->key.length() && |
!base::strncasecmp(key.data(), it->key.data(), key.length())) |
return it; |
@@ -245,10 +247,10 @@ HttpRequestHeaders::FindHeader(const base::StringPiece& key) { |
return headers_.end(); |
} |
-HttpRequestHeaders::HeaderVector::const_iterator |
-HttpRequestHeaders::FindHeader(const base::StringPiece& key) const { |
- for (HeaderVector::const_iterator it = headers_.begin(); |
- it != headers_.end(); ++it) { |
+HttpRequestHeaders::HeaderVector::const_iterator HttpRequestHeaders::FindHeader( |
+ const base::StringPiece& key) const { |
+ for (HeaderVector::const_iterator it = headers_.begin(); it != headers_.end(); |
+ ++it) { |
if (key.length() == it->key.length() && |
!base::strncasecmp(key.data(), it->key.data(), key.length())) |
return it; |