| 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <curl/curl.h> | 10 #include <curl/curl.h> |
| 11 #include <glib.h> | 11 #include <glib.h> |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "update_engine/http_fetcher.h" | 14 #include "update_engine/http_fetcher.h" |
| 15 | 15 |
| 16 // This is a concrete implementation of HttpFetcher that uses libcurl to do the | 16 // This is a concrete implementation of HttpFetcher that uses libcurl to do the |
| 17 // http work. | 17 // http work. |
| 18 | 18 |
| 19 namespace chromeos_update_engine { | 19 namespace chromeos_update_engine { |
| 20 | 20 |
| 21 class LibcurlHttpFetcher : public HttpFetcher { | 21 class LibcurlHttpFetcher : public HttpFetcher { |
| 22 public: | 22 public: |
| 23 static const int kMaxRedirects = 10; |
| 24 |
| 23 LibcurlHttpFetcher() | 25 LibcurlHttpFetcher() |
| 24 : curl_multi_handle_(NULL), | 26 : curl_multi_handle_(NULL), |
| 25 curl_handle_(NULL), | 27 curl_handle_(NULL), |
| 26 timeout_source_(NULL), | 28 timeout_source_(NULL), |
| 27 transfer_in_progress_(false), | 29 transfer_in_progress_(false), |
| 28 retry_count_(0), | 30 retry_count_(0), |
| 29 retry_seconds_(60), | 31 retry_seconds_(60), |
| 30 idle_seconds_(1) {} | 32 idle_seconds_(1) {} |
| 31 | 33 |
| 32 // Cleans up all internal state. Does not notify delegate | 34 // Cleans up all internal state. Does not notify delegate |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 145 |
| 144 // Seconds to wait before asking libcurl to "perform". | 146 // Seconds to wait before asking libcurl to "perform". |
| 145 int idle_seconds_; | 147 int idle_seconds_; |
| 146 | 148 |
| 147 DISALLOW_COPY_AND_ASSIGN(LibcurlHttpFetcher); | 149 DISALLOW_COPY_AND_ASSIGN(LibcurlHttpFetcher); |
| 148 }; | 150 }; |
| 149 | 151 |
| 150 } // namespace chromeos_update_engine | 152 } // namespace chromeos_update_engine |
| 151 | 153 |
| 152 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ | 154 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ |
| OLD | NEW |