| OLD | NEW |
| (Empty) |
| 1 // Copyright 2007-2010 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 | |
| 16 #include "omaha/net/network_request.h" | |
| 17 #include "omaha/net/network_request_impl.h" | |
| 18 | |
| 19 namespace omaha { | |
| 20 | |
| 21 NetworkRequest::NetworkRequest(const NetworkConfig::Session& network_session) { | |
| 22 impl_.reset(new detail::NetworkRequestImpl(network_session)); | |
| 23 } | |
| 24 | |
| 25 NetworkRequest::~NetworkRequest() { | |
| 26 } | |
| 27 | |
| 28 HRESULT NetworkRequest::Close() { | |
| 29 return impl_->Close(); | |
| 30 } | |
| 31 | |
| 32 void NetworkRequest::AddHttpRequest(HttpRequestInterface* http_request) { | |
| 33 return impl_->AddHttpRequest(http_request); | |
| 34 } | |
| 35 | |
| 36 HRESULT NetworkRequest::Post(const CString& url, | |
| 37 const void* buffer, | |
| 38 size_t length, | |
| 39 std::vector<uint8>* response) { | |
| 40 return impl_->Post(url, buffer, length, response); | |
| 41 } | |
| 42 | |
| 43 HRESULT NetworkRequest::Get(const CString& url, std::vector<uint8>* response) { | |
| 44 return impl_->Get(url, response); | |
| 45 } | |
| 46 | |
| 47 HRESULT NetworkRequest::DownloadFile(const CString& url, | |
| 48 const CString& filename) { | |
| 49 return impl_->DownloadFile(url, filename); | |
| 50 } | |
| 51 | |
| 52 HRESULT NetworkRequest::Pause() { | |
| 53 return impl_->Pause(); | |
| 54 } | |
| 55 | |
| 56 HRESULT NetworkRequest::Resume() { | |
| 57 return impl_->Resume(); | |
| 58 } | |
| 59 | |
| 60 HRESULT NetworkRequest::Cancel() { | |
| 61 return impl_->Cancel(); | |
| 62 } | |
| 63 | |
| 64 void NetworkRequest::AddHeader(const TCHAR* name, const TCHAR* value) { | |
| 65 return impl_->AddHeader(name, value); | |
| 66 } | |
| 67 | |
| 68 int NetworkRequest::http_status_code() const { | |
| 69 return impl_->http_status_code(); | |
| 70 } | |
| 71 | |
| 72 void NetworkRequest::set_proxy_auth_config(const ProxyAuthConfig& config) { | |
| 73 return impl_->set_proxy_auth_config(config); | |
| 74 } | |
| 75 | |
| 76 void NetworkRequest::set_num_retries(int num_retries) { | |
| 77 return impl_->set_num_retries(num_retries); | |
| 78 } | |
| 79 | |
| 80 void NetworkRequest::set_time_between_retries(int time_between_retries_ms) { | |
| 81 return impl_->set_time_between_retries(time_between_retries_ms); | |
| 82 } | |
| 83 | |
| 84 void NetworkRequest::set_callback(NetworkRequestCallback* callback) { | |
| 85 return impl_->set_callback(callback); | |
| 86 } | |
| 87 | |
| 88 void NetworkRequest::set_preserve_protocol(bool preserve_protocol) { | |
| 89 return impl_->set_preserve_protocol(preserve_protocol); | |
| 90 } | |
| 91 | |
| 92 CString NetworkRequest::response_headers() const { | |
| 93 return impl_->response_headers(); | |
| 94 } | |
| 95 | |
| 96 CString NetworkRequest::trace() const { | |
| 97 return impl_->trace(); | |
| 98 } | |
| 99 | |
| 100 HRESULT NetworkRequest::QueryHeadersString(uint32 info_level, | |
| 101 const TCHAR* name, | |
| 102 CString* value) { | |
| 103 return impl_->QueryHeadersString(info_level, name, value); | |
| 104 } | |
| 105 | |
| 106 void NetworkRequest::set_low_priority(bool low_priority) { | |
| 107 return impl_->set_low_priority(low_priority); | |
| 108 } | |
| 109 | |
| 110 void NetworkRequest::set_proxy_configuration( | |
| 111 const ProxyConfig* proxy_configuration) { | |
| 112 return impl_->set_proxy_configuration(proxy_configuration); | |
| 113 } | |
| 114 | |
| 115 HRESULT PostRequest(NetworkRequest* network_request, | |
| 116 bool fallback_to_https, | |
| 117 const CString& url, | |
| 118 const CString& request_string, | |
| 119 std::vector<uint8>* response) { | |
| 120 return detail::PostRequest(network_request, | |
| 121 fallback_to_https, | |
| 122 url, | |
| 123 request_string, | |
| 124 response); | |
| 125 } | |
| 126 | |
| 127 HRESULT GetRequest(NetworkRequest* network_request, | |
| 128 const CString& url, | |
| 129 std::vector<uint8>* response) { | |
| 130 return detail::GetRequest(network_request, url, response); | |
| 131 } | |
| 132 | |
| 133 } // namespace omaha | |
| 134 | |
| OLD | NEW |