| 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_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/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 337 |
| 338 // The ordering of these calls is not important. | 338 // The ordering of these calls is not important. |
| 339 ProcessStrictTransportSecurityHeader(); | 339 ProcessStrictTransportSecurityHeader(); |
| 340 ProcessPublicKeyPinsHeader(); | 340 ProcessPublicKeyPinsHeader(); |
| 341 | 341 |
| 342 // Handle the server notification of a new SDCH dictionary. | 342 // Handle the server notification of a new SDCH dictionary. |
| 343 SdchManager* sdch_manager(request()->context()->sdch_manager()); | 343 SdchManager* sdch_manager(request()->context()->sdch_manager()); |
| 344 if (sdch_manager) { | 344 if (sdch_manager) { |
| 345 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url()); | 345 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url()); |
| 346 if (rv != SDCH_OK) { | 346 if (rv != SDCH_OK) { |
| 347 // If SDCH is just disabled, it is not a real error. | 347 SdchManager::SdchErrorRecovery(rv); |
| 348 if (rv != SDCH_DISABLED) { | 348 request()->net_log().AddEvent( |
| 349 SdchManager::SdchErrorRecovery(rv); | 349 NetLog::TYPE_SDCH_DECODING_ERROR, |
| 350 request()->net_log().AddEvent( | 350 base::Bind(&NetLogSdchResourceProblemCallback, rv)); |
| 351 NetLog::TYPE_SDCH_DECODING_ERROR, | |
| 352 base::Bind(&NetLogSdchResourceProblemCallback, rv)); | |
| 353 } | |
| 354 } else { | 351 } else { |
| 355 const std::string name = "Get-Dictionary"; | 352 const std::string name = "Get-Dictionary"; |
| 356 std::string url_text; | 353 std::string url_text; |
| 357 void* iter = NULL; | 354 void* iter = NULL; |
| 358 // TODO(jar): We need to not fetch dictionaries the first time they are | 355 // TODO(jar): We need to not fetch dictionaries the first time they are |
| 359 // seen, but rather wait until we can justify their usefulness. | 356 // seen, but rather wait until we can justify their usefulness. |
| 360 // For now, we will only fetch the first dictionary, which will at least | 357 // For now, we will only fetch the first dictionary, which will at least |
| 361 // require multiple suggestions before we get additional ones for this | 358 // require multiple suggestions before we get additional ones for this |
| 362 // site. Eventually we should wait until a dictionary is requested | 359 // site. Eventually we should wait until a dictionary is requested |
| 363 // several times | 360 // several times |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 HttpRequestHeaders::kAcceptEncoding)) { | 549 HttpRequestHeaders::kAcceptEncoding)) { |
| 553 // We don't support SDCH responses to POST as there is a possibility | 550 // We don't support SDCH responses to POST as there is a possibility |
| 554 // of having SDCH encoded responses returned (e.g. by the cache) | 551 // of having SDCH encoded responses returned (e.g. by the cache) |
| 555 // which we cannot decode, and in those situations, we will need | 552 // which we cannot decode, and in those situations, we will need |
| 556 // to retransmit the request without SDCH, which is illegal for a POST. | 553 // to retransmit the request without SDCH, which is illegal for a POST. |
| 557 bool advertise_sdch = sdch_manager != NULL && request()->method() != "POST"; | 554 bool advertise_sdch = sdch_manager != NULL && request()->method() != "POST"; |
| 558 if (advertise_sdch) { | 555 if (advertise_sdch) { |
| 559 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url()); | 556 SdchProblemCode rv = sdch_manager->IsInSupportedDomain(request()->url()); |
| 560 if (rv != SDCH_OK) { | 557 if (rv != SDCH_OK) { |
| 561 advertise_sdch = false; | 558 advertise_sdch = false; |
| 562 // If SDCH is just disabled, it is not a real error. | 559 SdchManager::SdchErrorRecovery(rv); |
| 563 if (rv != SDCH_DISABLED) { | 560 request()->net_log().AddEvent( |
| 564 SdchManager::SdchErrorRecovery(rv); | 561 NetLog::TYPE_SDCH_DECODING_ERROR, |
| 565 request()->net_log().AddEvent( | 562 base::Bind(&NetLogSdchResourceProblemCallback, rv)); |
| 566 NetLog::TYPE_SDCH_DECODING_ERROR, | |
| 567 base::Bind(&NetLogSdchResourceProblemCallback, rv)); | |
| 568 } | |
| 569 } | 563 } |
| 570 } | 564 } |
| 571 if (advertise_sdch) { | 565 if (advertise_sdch) { |
| 572 dictionaries_advertised_ = | 566 dictionaries_advertised_ = |
| 573 sdch_manager->GetDictionarySet(request_->url()); | 567 sdch_manager->GetDictionarySet(request_->url()); |
| 574 } | 568 } |
| 575 | 569 |
| 576 // The AllowLatencyExperiment() is only true if we've successfully done a | 570 // The AllowLatencyExperiment() is only true if we've successfully done a |
| 577 // full SDCH compression recently in this browser session for this host. | 571 // full SDCH compression recently in this browser session for this host. |
| 578 // Note that for this path, there might be no applicable dictionaries, | 572 // Note that for this path, there might be no applicable dictionaries, |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1558 return override_response_headers_.get() ? | 1552 return override_response_headers_.get() ? |
| 1559 override_response_headers_.get() : | 1553 override_response_headers_.get() : |
| 1560 transaction_->GetResponseInfo()->headers.get(); | 1554 transaction_->GetResponseInfo()->headers.get(); |
| 1561 } | 1555 } |
| 1562 | 1556 |
| 1563 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1557 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1564 awaiting_callback_ = false; | 1558 awaiting_callback_ = false; |
| 1565 } | 1559 } |
| 1566 | 1560 |
| 1567 } // namespace net | 1561 } // namespace net |
| OLD | NEW |