| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 "update_engine/libcurl_http_fetcher.h" | 5 #include "update_engine/libcurl_http_fetcher.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include <base/logging.h> | 10 #include <base/logging.h> | 
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 115 | 115 | 
| 116   // If the connection drops under 10 bytes/sec for 3 minutes, reconnect. | 116   // If the connection drops under 10 bytes/sec for 3 minutes, reconnect. | 
| 117   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_LOW_SPEED_LIMIT, 10), | 117   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_LOW_SPEED_LIMIT, 10), | 
| 118            CURLE_OK); | 118            CURLE_OK); | 
| 119   // Use a smaller timeout on official builds, larger for dev. Dev users | 119   // Use a smaller timeout on official builds, larger for dev. Dev users | 
| 120   // want a longer timeout b/c they may be waiting on the dev server to | 120   // want a longer timeout b/c they may be waiting on the dev server to | 
| 121   // build an image. | 121   // build an image. | 
| 122   const int kTimeout = IsOfficialBuild() ? 90 : 3 * 60; | 122   const int kTimeout = IsOfficialBuild() ? 90 : 3 * 60; | 
| 123   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_LOW_SPEED_TIME, kTimeout), | 123   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_LOW_SPEED_TIME, kTimeout), | 
| 124            CURLE_OK); | 124            CURLE_OK); | 
|  | 125   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_CONNECTTIMEOUT, 30), | 
|  | 126            CURLE_OK); | 
| 125 | 127 | 
| 126   // By default, libcurl doesn't follow redirections. Allow up to | 128   // By default, libcurl doesn't follow redirections. Allow up to | 
| 127   // |kMaxRedirects| redirections. | 129   // |kMaxRedirects| redirections. | 
| 128   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_FOLLOWLOCATION, 1), CURLE_OK); | 130   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_FOLLOWLOCATION, 1), CURLE_OK); | 
| 129   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_MAXREDIRS, kMaxRedirects), | 131   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_MAXREDIRS, kMaxRedirects), | 
| 130            CURLE_OK); | 132            CURLE_OK); | 
| 131 | 133 | 
| 132   // Security lock-down in official builds: makes sure that peer certificate | 134   // Security lock-down in official builds: makes sure that peer certificate | 
| 133   // verification is enabled, restricts the set of trusted certificates, | 135   // verification is enabled, restricts the set of trusted certificates, | 
| 134   // restricts protocols to HTTPS, restricts ciphers to HIGH. | 136   // restricts protocols to HTTPS, restricts ciphers to HIGH. | 
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 457 void LibcurlHttpFetcher::GetHttpResponseCode() { | 459 void LibcurlHttpFetcher::GetHttpResponseCode() { | 
| 458   long http_response_code = 0; | 460   long http_response_code = 0; | 
| 459   if (curl_easy_getinfo(curl_handle_, | 461   if (curl_easy_getinfo(curl_handle_, | 
| 460                         CURLINFO_RESPONSE_CODE, | 462                         CURLINFO_RESPONSE_CODE, | 
| 461                         &http_response_code) == CURLE_OK) { | 463                         &http_response_code) == CURLE_OK) { | 
| 462     http_response_code_ = static_cast<int>(http_response_code); | 464     http_response_code_ = static_cast<int>(http_response_code); | 
| 463   } | 465   } | 
| 464 } | 466 } | 
| 465 | 467 | 
| 466 }  // namespace chromeos_update_engine | 468 }  // namespace chromeos_update_engine | 
| OLD | NEW | 
|---|