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/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); |
208 *request_line = ""; | 208 *request_line = ""; |
209 | 209 |
210 const base::DictionaryValue* dict; | 210 const base::DictionaryValue* dict = NULL; |
211 const base::ListValue* header_list; | 211 const base::ListValue* header_list = NULL; |
212 | 212 |
213 if (!event_param || | 213 if (!event_param || |
214 !event_param->GetAsDictionary(&dict) || | 214 !event_param->GetAsDictionary(&dict) || |
215 !dict->GetList("headers", &header_list) || | 215 !dict->GetList("headers", &header_list) || |
216 !dict->GetString("line", request_line)) { | 216 !dict->GetString("line", request_line)) { |
217 return false; | 217 return false; |
218 } | 218 } |
219 | 219 |
220 for (base::ListValue::const_iterator it = header_list->begin(); | 220 for (base::ListValue::const_iterator it = header_list->begin(); |
221 it != header_list->end(); | 221 it != header_list->end(); |
(...skipping 27 matching lines...) Expand all 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 |