| 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_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 557 |
| 558 void URLRequestHttpJob::StartTransaction() { | 558 void URLRequestHttpJob::StartTransaction() { |
| 559 // NOTE: This method assumes that request_info_ is already setup properly. | 559 // NOTE: This method assumes that request_info_ is already setup properly. |
| 560 | 560 |
| 561 // Create a transaction. | 561 // Create a transaction. |
| 562 DCHECK(!transaction_.get()); | 562 DCHECK(!transaction_.get()); |
| 563 | 563 |
| 564 DCHECK(request_->context()); | 564 DCHECK(request_->context()); |
| 565 DCHECK(request_->context()->http_transaction_factory()); | 565 DCHECK(request_->context()->http_transaction_factory()); |
| 566 | 566 |
| 567 transaction_.reset( | |
| 568 request_->context()->http_transaction_factory()->CreateTransaction()); | |
| 569 | |
| 570 // No matter what, we want to report our status as IO pending since we will | 567 // No matter what, we want to report our status as IO pending since we will |
| 571 // be notifying our consumer asynchronously via OnStartCompleted. | 568 // be notifying our consumer asynchronously via OnStartCompleted. |
| 572 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); | 569 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
| 573 | 570 |
| 574 int rv; | 571 int rv = request_->context()->http_transaction_factory()->CreateTransaction( |
| 575 if (transaction_.get()) { | 572 &transaction_); |
| 573 |
| 574 if (rv == net::OK) { |
| 576 rv = transaction_->Start( | 575 rv = transaction_->Start( |
| 577 &request_info_, &start_callback_, request_->load_log()); | 576 &request_info_, &start_callback_, request_->load_log()); |
| 578 if (rv == net::ERR_IO_PENDING) | 577 if (rv == net::ERR_IO_PENDING) |
| 579 return; | 578 return; |
| 580 } else { | |
| 581 rv = net::ERR_FAILED; | |
| 582 } | 579 } |
| 583 | 580 |
| 584 // The transaction started synchronously, but we need to notify the | 581 // The transaction started synchronously, but we need to notify the |
| 585 // URLRequest delegate via the message loop. | 582 // URLRequest delegate via the message loop. |
| 586 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 583 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
| 587 this, &URLRequestHttpJob::OnStartCompleted, rv)); | 584 this, &URLRequestHttpJob::OnStartCompleted, rv)); |
| 588 } | 585 } |
| 589 | 586 |
| 590 void URLRequestHttpJob::AddExtraHeaders() { | 587 void URLRequestHttpJob::AddExtraHeaders() { |
| 591 // TODO(jar): Consider optimizing away SDCH advertising bytes when the URL is | 588 // TODO(jar): Consider optimizing away SDCH advertising bytes when the URL is |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 | 701 |
| 705 std::string name = "Strict-Transport-Security"; | 702 std::string name = "Strict-Transport-Security"; |
| 706 std::string value; | 703 std::string value; |
| 707 | 704 |
| 708 void* iter = NULL; | 705 void* iter = NULL; |
| 709 while (response_info_->headers->EnumerateHeader(&iter, name, &value)) { | 706 while (response_info_->headers->EnumerateHeader(&iter, name, &value)) { |
| 710 ctx->strict_transport_security_state()->DidReceiveHeader( | 707 ctx->strict_transport_security_state()->DidReceiveHeader( |
| 711 request_info_.url, value); | 708 request_info_.url, value); |
| 712 } | 709 } |
| 713 } | 710 } |
| OLD | NEW |