| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_request_headers.h" | 5 #include "net/http/http_request_headers.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 std::unique_ptr<base::Value> HttpRequestHeaders::NetLogCallback( | 190 std::unique_ptr<base::Value> HttpRequestHeaders::NetLogCallback( |
| 191 const std::string* request_line, | 191 const std::string* request_line, |
| 192 NetLogCaptureMode capture_mode) const { | 192 NetLogCaptureMode capture_mode) const { |
| 193 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 193 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 194 dict->SetString("line", *request_line); | 194 dict->SetString("line", *request_line); |
| 195 base::ListValue* headers = new base::ListValue(); | 195 base::ListValue* headers = new base::ListValue(); |
| 196 for (HeaderVector::const_iterator it = headers_.begin(); | 196 for (HeaderVector::const_iterator it = headers_.begin(); |
| 197 it != headers_.end(); ++it) { | 197 it != headers_.end(); ++it) { |
| 198 std::string log_value = | 198 std::string log_value = |
| 199 ElideHeaderValueForNetLog(capture_mode, it->key, it->value); | 199 ElideHeaderValueForNetLog(capture_mode, it->key, it->value); |
| 200 headers->Append(new base::StringValue( | 200 headers->AppendString( |
| 201 base::StringPrintf("%s: %s", | 201 base::StringPrintf("%s: %s", it->key.c_str(), log_value.c_str())); |
| 202 it->key.c_str(), log_value.c_str()))); | |
| 203 } | 202 } |
| 204 dict->Set("headers", headers); | 203 dict->Set("headers", headers); |
| 205 return std::move(dict); | 204 return std::move(dict); |
| 206 } | 205 } |
| 207 | 206 |
| 208 // static | 207 // static |
| 209 bool HttpRequestHeaders::FromNetLogParam(const base::Value* event_param, | 208 bool HttpRequestHeaders::FromNetLogParam(const base::Value* event_param, |
| 210 HttpRequestHeaders* headers, | 209 HttpRequestHeaders* headers, |
| 211 std::string* request_line) { | 210 std::string* request_line) { |
| 212 headers->Clear(); | 211 headers->Clear(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 for (HeaderVector::const_iterator it = headers_.begin(); | 251 for (HeaderVector::const_iterator it = headers_.begin(); |
| 253 it != headers_.end(); ++it) { | 252 it != headers_.end(); ++it) { |
| 254 if (base::EqualsCaseInsensitiveASCII(key, it->key)) | 253 if (base::EqualsCaseInsensitiveASCII(key, it->key)) |
| 255 return it; | 254 return it; |
| 256 } | 255 } |
| 257 | 256 |
| 258 return headers_.end(); | 257 return headers_.end(); |
| 259 } | 258 } |
| 260 | 259 |
| 261 } // namespace net | 260 } // namespace net |
| OLD | NEW |