| 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/url_request/url_request.h" | 5 #include "net/url_request/url_request.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 220 } |
| 221 | 221 |
| 222 const UploadDataStream* URLRequest::get_upload() const { | 222 const UploadDataStream* URLRequest::get_upload() const { |
| 223 return upload_data_stream_.get(); | 223 return upload_data_stream_.get(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool URLRequest::has_upload() const { | 226 bool URLRequest::has_upload() const { |
| 227 return upload_data_stream_.get() != NULL; | 227 return upload_data_stream_.get() != NULL; |
| 228 } | 228 } |
| 229 | 229 |
| 230 void URLRequest::SetExtraRequestHeaderById(int id, const string& value, | |
| 231 bool overwrite) { | |
| 232 DCHECK(!is_pending_ || is_redirecting_); | |
| 233 NOTREACHED() << "implement me!"; | |
| 234 } | |
| 235 | |
| 236 void URLRequest::SetExtraRequestHeaderByName(const string& name, | 230 void URLRequest::SetExtraRequestHeaderByName(const string& name, |
| 237 const string& value, | 231 const string& value, |
| 238 bool overwrite) { | 232 bool overwrite) { |
| 239 DCHECK(!is_pending_ || is_redirecting_); | 233 DCHECK(!is_pending_ || is_redirecting_); |
| 240 if (overwrite) { | 234 if (overwrite) { |
| 241 extra_request_headers_.SetHeader(name, value); | 235 extra_request_headers_.SetHeader(name, value); |
| 242 } else { | 236 } else { |
| 243 extra_request_headers_.SetHeaderIfMissing(name, value); | 237 extra_request_headers_.SetHeaderIfMissing(name, value); |
| 244 } | 238 } |
| 245 } | 239 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 } | 365 } |
| 372 if (final_upload_progress_.position()) { | 366 if (final_upload_progress_.position()) { |
| 373 // The first job completed and none of the subsequent series of | 367 // The first job completed and none of the subsequent series of |
| 374 // GETs when following redirects will upload anything, so we return the | 368 // GETs when following redirects will upload anything, so we return the |
| 375 // cached results from the initial job, the POST. | 369 // cached results from the initial job, the POST. |
| 376 return final_upload_progress_; | 370 return final_upload_progress_; |
| 377 } | 371 } |
| 378 return job_->GetUploadProgress(); | 372 return job_->GetUploadProgress(); |
| 379 } | 373 } |
| 380 | 374 |
| 381 void URLRequest::GetResponseHeaderById(int id, string* value) { | |
| 382 DCHECK(job_.get()); | |
| 383 NOTREACHED() << "implement me!"; | |
| 384 } | |
| 385 | |
| 386 void URLRequest::GetResponseHeaderByName(const string& name, string* value) { | 375 void URLRequest::GetResponseHeaderByName(const string& name, string* value) { |
| 387 DCHECK(value); | 376 DCHECK(value); |
| 388 if (response_info_.headers.get()) { | 377 if (response_info_.headers.get()) { |
| 389 response_info_.headers->GetNormalizedHeader(name, value); | 378 response_info_.headers->GetNormalizedHeader(name, value); |
| 390 } else { | 379 } else { |
| 391 value->clear(); | 380 value->clear(); |
| 392 } | 381 } |
| 393 } | 382 } |
| 394 | 383 |
| 395 void URLRequest::GetAllResponseHeaders(string* headers) { | |
| 396 DCHECK(headers); | |
| 397 if (response_info_.headers.get()) { | |
| 398 response_info_.headers->GetNormalizedHeaders(headers); | |
| 399 } else { | |
| 400 headers->clear(); | |
| 401 } | |
| 402 } | |
| 403 | |
| 404 HostPortPair URLRequest::GetSocketAddress() const { | 384 HostPortPair URLRequest::GetSocketAddress() const { |
| 405 DCHECK(job_.get()); | 385 DCHECK(job_.get()); |
| 406 return job_->GetSocketAddress(); | 386 return job_->GetSocketAddress(); |
| 407 } | 387 } |
| 408 | 388 |
| 409 HttpResponseHeaders* URLRequest::response_headers() const { | 389 HttpResponseHeaders* URLRequest::response_headers() const { |
| 410 return response_info_.headers.get(); | 390 return response_info_.headers.get(); |
| 411 } | 391 } |
| 412 | 392 |
| 413 void URLRequest::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { | 393 void URLRequest::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 new base::debug::StackTrace(NULL, 0); | 1214 new base::debug::StackTrace(NULL, 0); |
| 1235 *stack_trace_copy = stack_trace; | 1215 *stack_trace_copy = stack_trace; |
| 1236 stack_trace_.reset(stack_trace_copy); | 1216 stack_trace_.reset(stack_trace_copy); |
| 1237 } | 1217 } |
| 1238 | 1218 |
| 1239 const base::debug::StackTrace* URLRequest::stack_trace() const { | 1219 const base::debug::StackTrace* URLRequest::stack_trace() const { |
| 1240 return stack_trace_.get(); | 1220 return stack_trace_.get(); |
| 1241 } | 1221 } |
| 1242 | 1222 |
| 1243 } // namespace net | 1223 } // namespace net |
| OLD | NEW |