OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/url_request/url_request.h" | 5 #include "net/url_request/url_request.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
11 #include "net/base/load_flags.h" | 11 #include "net/base/load_flags.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 #include "net/base/net_log.h" | 13 #include "net/base/net_log.h" |
14 #include "net/base/ssl_cert_request_info.h" | 14 #include "net/base/ssl_cert_request_info.h" |
15 #include "net/base/upload_data.h" | 15 #include "net/base/upload_data.h" |
16 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
17 #include "net/http/http_util.h" | 17 #include "net/http/http_util.h" |
18 #include "net/url_request/url_request_context.h" | 18 #include "net/url_request/url_request_context.h" |
19 #include "net/url_request/url_request_job.h" | 19 #include "net/url_request/url_request_job.h" |
20 #include "net/url_request/url_request_job_manager.h" | 20 #include "net/url_request/url_request_job_manager.h" |
| 21 #include "net/url_request/url_request_netlog_params.h" |
21 | 22 |
22 using base::Time; | 23 using base::Time; |
23 using net::UploadData; | 24 using net::UploadData; |
24 using std::string; | 25 using std::string; |
25 using std::wstring; | 26 using std::wstring; |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
29 // Max number of http redirects to follow. Same number as gecko. | 30 // Max number of http redirects to follow. Same number as gecko. |
30 const int kMaxRedirects = 20; | 31 const int kMaxRedirects = 20; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 261 } |
261 | 262 |
262 /////////////////////////////////////////////////////////////////////////////// | 263 /////////////////////////////////////////////////////////////////////////////// |
263 | 264 |
264 void URLRequest::StartJob(URLRequestJob* job) { | 265 void URLRequest::StartJob(URLRequestJob* job) { |
265 DCHECK(!is_pending_); | 266 DCHECK(!is_pending_); |
266 DCHECK(!job_); | 267 DCHECK(!job_); |
267 | 268 |
268 net_log_.BeginEvent( | 269 net_log_.BeginEvent( |
269 net::NetLog::TYPE_URL_REQUEST_START, | 270 net::NetLog::TYPE_URL_REQUEST_START, |
270 new net::NetLogStringParameter( | 271 new URLRequestStartEventParameters(url_, method_, load_flags_)); |
271 "url", original_url().possibly_invalid_spec())); | |
272 | 272 |
273 job_ = job; | 273 job_ = job; |
274 job_->SetExtraRequestHeaders(extra_request_headers_); | 274 job_->SetExtraRequestHeaders(extra_request_headers_); |
275 | 275 |
276 if (upload_.get()) | 276 if (upload_.get()) |
277 job_->SetUpload(upload_.get()); | 277 job_->SetUpload(upload_.get()); |
278 | 278 |
279 is_pending_ = true; | 279 is_pending_ = true; |
280 | 280 |
281 response_info_.request_time = Time::Now(); | 281 response_info_.request_time = Time::Now(); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { | 530 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { |
531 UserDataMap::const_iterator found = user_data_.find(key); | 531 UserDataMap::const_iterator found = user_data_.find(key); |
532 if (found != user_data_.end()) | 532 if (found != user_data_.end()) |
533 return found->second.get(); | 533 return found->second.get(); |
534 return NULL; | 534 return NULL; |
535 } | 535 } |
536 | 536 |
537 void URLRequest::SetUserData(const void* key, UserData* data) { | 537 void URLRequest::SetUserData(const void* key, UserData* data) { |
538 user_data_[key] = linked_ptr<UserData>(data); | 538 user_data_[key] = linked_ptr<UserData>(data); |
539 } | 539 } |
OLD | NEW |