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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 base::StringAppendF(&output, "%s: %s\r\n", | 176 base::StringAppendF(&output, "%s: %s\r\n", |
177 it->key.c_str(), it->value.c_str()); | 177 it->key.c_str(), it->value.c_str()); |
178 } else { | 178 } else { |
179 base::StringAppendF(&output, "%s:\r\n", it->key.c_str()); | 179 base::StringAppendF(&output, "%s:\r\n", it->key.c_str()); |
180 } | 180 } |
181 } | 181 } |
182 output.append("\r\n"); | 182 output.append("\r\n"); |
183 return output; | 183 return output; |
184 } | 184 } |
185 | 185 |
186 Value* HttpRequestHeaders::NetLogCallback( | 186 base::Value* HttpRequestHeaders::NetLogCallback( |
187 const std::string* request_line, | 187 const std::string* request_line, |
188 NetLog::LogLevel /* log_level */) const { | 188 NetLog::LogLevel /* log_level */) const { |
189 DictionaryValue* dict = new DictionaryValue(); | 189 base::DictionaryValue* dict = new base::DictionaryValue(); |
190 dict->SetString("line", *request_line); | 190 dict->SetString("line", *request_line); |
191 ListValue* headers = new ListValue(); | 191 base::ListValue* headers = new base::ListValue(); |
192 for (HeaderVector::const_iterator it = headers_.begin(); | 192 for (HeaderVector::const_iterator it = headers_.begin(); |
193 it != headers_.end(); ++it) { | 193 it != headers_.end(); ++it) { |
194 headers->Append( | 194 headers->Append( |
195 new StringValue(base::StringPrintf("%s: %s", | 195 new base::StringValue(base::StringPrintf("%s: %s", |
196 it->key.c_str(), | 196 it->key.c_str(), |
197 it->value.c_str()))); | 197 it->value.c_str()))); |
198 } | 198 } |
199 dict->Set("headers", headers); | 199 dict->Set("headers", headers); |
200 return dict; | 200 return dict; |
201 } | 201 } |
202 | 202 |
203 // static | 203 // static |
204 bool HttpRequestHeaders::FromNetLogParam(const base::Value* event_param, | 204 bool HttpRequestHeaders::FromNetLogParam(const base::Value* event_param, |
205 HttpRequestHeaders* headers, | 205 HttpRequestHeaders* headers, |
206 std::string* request_line) { | 206 std::string* request_line) { |
207 headers->Clear(); | 207 headers->Clear(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 it != headers_.end(); ++it) { | 249 it != headers_.end(); ++it) { |
250 if (key.length() == it->key.length() && | 250 if (key.length() == it->key.length() && |
251 !base::strncasecmp(key.data(), it->key.data(), key.length())) | 251 !base::strncasecmp(key.data(), it->key.data(), key.length())) |
252 return it; | 252 return it; |
253 } | 253 } |
254 | 254 |
255 return headers_.end(); | 255 return headers_.end(); |
256 } | 256 } |
257 | 257 |
258 } // namespace net | 258 } // namespace net |
OLD | NEW |