Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome_frame/urlmon_url_request.cc

Issue 491057: ChromeFrame's host network stack implementation for IE should ensure that HTT... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome_frame/urlmon_url_request.h" 5 #include "chrome_frame/urlmon_url_request.h"
6 6
7 #include <wininet.h> 7 #include <wininet.h>
8 8
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 << status_text; 207 << status_text;
208 redirect_url_ = status_text; 208 redirect_url_ = status_text;
209 redirect_status_ = 209 redirect_status_ =
210 redirect_status > 0 ? redirect_status : kDefaultHttpRedirectCode; 210 redirect_status > 0 ? redirect_status : kDefaultHttpRedirectCode;
211 // Chrome should decide whether a redirect has to be followed. To achieve 211 // Chrome should decide whether a redirect has to be followed. To achieve
212 // this we send over a fake response to Chrome and abort the redirect. 212 // this we send over a fake response to Chrome and abort the redirect.
213 std::string headers = GetHttpHeaders(); 213 std::string headers = GetHttpHeaders();
214 OnResponse(0, UTF8ToWide(headers).c_str(), NULL, NULL); 214 OnResponse(0, UTF8ToWide(headers).c_str(), NULL, NULL);
215 ignore_redirect_stop_binding_error_ = true; 215 ignore_redirect_stop_binding_error_ = true;
216 DCHECK(binding_ != NULL); 216 DCHECK(binding_ != NULL);
217 binding_->Abort(); 217 if (binding_) {
218 binding_ = NULL; 218 binding_->Abort();
219 binding_ = NULL;
220 }
219 return E_ABORT; 221 return E_ABORT;
220 } 222 }
221 223
222 default: 224 default:
223 DLOG(INFO) << " Obj: " << std::hex << this << " OnProgress(" << url() 225 DLOG(INFO) << " Obj: " << std::hex << this << " OnProgress(" << url()
224 << StringPrintf(L") code: %i status: %ls", status_code, status_text); 226 << StringPrintf(L") code: %i status: %ls", status_code, status_text);
225 break; 227 break;
226 } 228 }
227 229
228 return S_OK; 230 return S_OK;
229 } 231 }
230 232
231 STDMETHODIMP UrlmonUrlRequest::OnStopBinding(HRESULT result, LPCWSTR error) { 233 STDMETHODIMP UrlmonUrlRequest::OnStopBinding(HRESULT result, LPCWSTR error) {
232 DCHECK(worker_thread_ != NULL); 234 DCHECK(worker_thread_ != NULL);
233 DCHECK_EQ(PlatformThread::CurrentId(), worker_thread_->thread_id()); 235 DCHECK_EQ(PlatformThread::CurrentId(), worker_thread_->thread_id());
234 236
235 DLOG(INFO) << StringPrintf("URL: %s Obj: %X", url().c_str(), this) << 237 DLOG(INFO) << StringPrintf("URL: %s Obj: %X", url().c_str(), this) <<
236 " - Request stopped, Result: " << std::hex << result << 238 " - Request stopped, Result: " << std::hex << result <<
237 " Status: " << status_.status(); 239 " Status: " << status_.status();
238 240
239 if (FAILED(result)) { 241 if (FAILED(result)) {
240 status_.set_status(URLRequestStatus::FAILED); 242 status_.set_status(URLRequestStatus::FAILED);
241 status_.set_os_error(HresultToNetError(result)); 243 status_.set_os_error(HresultToNetError(result));
242 EndRequest(); 244 EndRequest();
243 } else { 245 } else {
244 status_.set_status(URLRequestStatus::SUCCESS); 246 status_.set_status(URLRequestStatus::SUCCESS);
245 status_.set_os_error(0); 247 status_.set_os_error(0);
246 ReleaseBindings(); 248 ReleaseBindings();
249 // In most cases we receive the end request notification from Chrome.
250 // However at times requests can complete without us receiving any
251 // data. In this case we need to inform Chrome that this request has been
252 // completed to prevent Chrome from waiting forever for data for this
253 // request.
254 if (!cached_data_.is_valid()) {
255 pending_read_size_ = 0;
256 OnResponseEnd(status_);
257 }
247 } 258 }
248 259
249 return S_OK; 260 return S_OK;
250 } 261 }
251 262
252 STDMETHODIMP UrlmonUrlRequest::GetBindInfo(DWORD* bind_flags, 263 STDMETHODIMP UrlmonUrlRequest::GetBindInfo(DWORD* bind_flags,
253 BINDINFO *bind_info) { 264 BINDINFO *bind_info) {
254 DCHECK(worker_thread_ != NULL); 265 DCHECK(worker_thread_ != NULL);
255 DCHECK_EQ(PlatformThread::CurrentId(), worker_thread_->thread_id()); 266 DCHECK_EQ(PlatformThread::CurrentId(), worker_thread_->thread_id());
256 267
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 cached_data_.Append(read_stream, &bytes_available); 336 cached_data_.Append(read_stream, &bytes_available);
326 DLOG(INFO) << StringPrintf("URL: %s Obj: %X", url().c_str(), this) << 337 DLOG(INFO) << StringPrintf("URL: %s Obj: %X", url().c_str(), this) <<
327 " - Bytes read into cache: " << bytes_available; 338 " - Bytes read into cache: " << bytes_available;
328 339
329 if (pending_read_size_ && cached_data_.is_valid()) { 340 if (pending_read_size_ && cached_data_.is_valid()) {
330 CComObjectStackEx<SendStream> send_stream; 341 CComObjectStackEx<SendStream> send_stream;
331 send_stream.Initialize(this); 342 send_stream.Initialize(this);
332 cached_data_.Read(&send_stream, pending_read_size_, &pending_read_size_); 343 cached_data_.Read(&send_stream, pending_read_size_, &pending_read_size_);
333 DLOG(INFO) << StringPrintf("URL: %s Obj: %X", url().c_str(), this) << 344 DLOG(INFO) << StringPrintf("URL: %s Obj: %X", url().c_str(), this) <<
334 " - size read: " << pending_read_size_; 345 " - size read: " << pending_read_size_;
346 pending_read_size_ = 0;
335 } else { 347 } else {
336 DLOG(INFO) << StringPrintf("URL: %s Obj: %X", url().c_str(), this) << 348 DLOG(INFO) << StringPrintf("URL: %s Obj: %X", url().c_str(), this) <<
337 " - waiting for remote read"; 349 " - waiting for remote read";
338 } 350 }
339 351
340 if (BSCF_LASTDATANOTIFICATION & flags) { 352 if (BSCF_LASTDATANOTIFICATION & flags) {
341 status_.set_status(URLRequestStatus::SUCCESS); 353 status_.set_status(URLRequestStatus::SUCCESS);
342 DLOG(INFO) << StringPrintf("URL: %s Obj: %X", url().c_str(), this) << 354 DLOG(INFO) << StringPrintf("URL: %s Obj: %X", url().c_str(), this) <<
343 " - end of data."; 355 " - end of data.";
344 } 356 }
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 ret = net::ERR_ACCESS_DENIED; 835 ret = net::ERR_ACCESS_DENIED;
824 break; 836 break;
825 837
826 default: 838 default:
827 DLOG(WARNING) 839 DLOG(WARNING)
828 << StringPrintf("TODO: translate HRESULT 0x%08X to net::Error", hr); 840 << StringPrintf("TODO: translate HRESULT 0x%08X to net::Error", hr);
829 break; 841 break;
830 } 842 }
831 return ret; 843 return ret;
832 } 844 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698