OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "headless/public/util/http_url_fetcher.h" | 5 #include "headless/public/util/http_url_fetcher.h" |
6 | 6 |
7 #include "net/base/elements_upload_data_stream.h" | 7 #include "net/base/elements_upload_data_stream.h" |
8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
9 #include "net/base/upload_bytes_element_reader.h" | 9 #include "net/base/upload_bytes_element_reader.h" |
10 #include "net/cert/cert_status_flags.h" | 10 #include "net/cert/cert_status_flags.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 if (net_error != net::OK) { | 176 if (net_error != net::OK) { |
177 result_listener_->OnFetchStartError(static_cast<net::Error>(net_error)); | 177 result_listener_->OnFetchStartError(static_cast<net::Error>(net_error)); |
178 return; | 178 return; |
179 } | 179 } |
180 | 180 |
181 // TODO(alexclarke) apart from the headers there's a lot of stuff in | 181 // TODO(alexclarke) apart from the headers there's a lot of stuff in |
182 // |request->response_info()| that we drop here. Find a way to pipe it | 182 // |request->response_info()| that we drop here. Find a way to pipe it |
183 // through. | 183 // through. |
184 result_listener_->OnFetchComplete( | 184 result_listener_->OnFetchComplete( |
185 request->url(), request->GetResponseCode(), | 185 request->url(), request->response_info().headers, |
186 request->response_info().headers, | |
187 bytes_read_so_far_.c_str(), bytes_read_so_far_.size()); | 186 bytes_read_so_far_.c_str(), bytes_read_so_far_.size()); |
188 } | 187 } |
189 | 188 |
190 HttpURLFetcher::HttpURLFetcher( | 189 HttpURLFetcher::HttpURLFetcher( |
191 const net::URLRequestContext* url_request_context) | 190 const net::URLRequestContext* url_request_context) |
192 : url_request_context_(url_request_context) {} | 191 : url_request_context_(url_request_context) {} |
193 | 192 |
194 HttpURLFetcher::~HttpURLFetcher() {} | 193 HttpURLFetcher::~HttpURLFetcher() {} |
195 | 194 |
196 void HttpURLFetcher::StartFetch(const GURL& rewritten_url, | 195 void HttpURLFetcher::StartFetch(const GURL& rewritten_url, |
197 const std::string& method, | 196 const std::string& method, |
198 const std::string& post_data, | 197 const std::string& post_data, |
199 const net::HttpRequestHeaders& request_headers, | 198 const net::HttpRequestHeaders& request_headers, |
200 ResultListener* result_listener) { | 199 ResultListener* result_listener) { |
201 delegate_.reset(new Delegate(rewritten_url, method, post_data, | 200 delegate_.reset(new Delegate(rewritten_url, method, post_data, |
202 request_headers, url_request_context_, | 201 request_headers, url_request_context_, |
203 result_listener)); | 202 result_listener)); |
204 } | 203 } |
205 | 204 |
206 } // namespace headless | 205 } // namespace headless |
OLD | NEW |