OLD | NEW |
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 #include <urlmon.h> | 8 #include <urlmon.h> |
9 | 9 |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 } | 643 } |
644 } | 644 } |
645 | 645 |
646 return hr; | 646 return hr; |
647 } | 647 } |
648 | 648 |
649 STDMETHODIMP UrlmonUrlRequest::OnResponse(DWORD dwResponseCode, | 649 STDMETHODIMP UrlmonUrlRequest::OnResponse(DWORD dwResponseCode, |
650 const wchar_t* response_headers, const wchar_t* request_headers, | 650 const wchar_t* response_headers, const wchar_t* request_headers, |
651 wchar_t** additional_headers) { | 651 wchar_t** additional_headers) { |
652 DCHECK(worker_thread_ != NULL); | 652 DCHECK(worker_thread_ != NULL); |
| 653 DLOG(INFO) << __FUNCTION__ << " " << url() << std::endl << " headers: " << |
| 654 std::endl << response_headers; |
653 DCHECK_EQ(PlatformThread::CurrentId(), worker_thread_->thread_id()); | 655 DCHECK_EQ(PlatformThread::CurrentId(), worker_thread_->thread_id()); |
654 | 656 |
655 if (!binding_) { | 657 if (!binding_) { |
656 DCHECK(redirect_url_.empty() == false); | 658 DCHECK(redirect_url_.empty() == false); |
657 DLOG(WARNING) << __FUNCTION__ | 659 DLOG(WARNING) << __FUNCTION__ |
658 << ": Ignoring as the binding was aborted due to a redirect"; | 660 << ": Ignoring as the binding was aborted due to a redirect"; |
659 return S_OK; | 661 return S_OK; |
660 } | 662 } |
661 | 663 |
662 std::string raw_headers = WideToUTF8(response_headers); | 664 std::string raw_headers = WideToUTF8(response_headers); |
(...skipping 23 matching lines...) Expand all Loading... |
686 return E_FAIL; | 688 return E_FAIL; |
687 } | 689 } |
688 } | 690 } |
689 | 691 |
690 std::wstring url_for_persistent_cookies = | 692 std::wstring url_for_persistent_cookies = |
691 redirect_url_.empty() ? UTF8ToWide(url()) : redirect_url_; | 693 redirect_url_.empty() ? UTF8ToWide(url()) : redirect_url_; |
692 | 694 |
693 std::string persistent_cookies; | 695 std::string persistent_cookies; |
694 | 696 |
695 DWORD cookie_size = 0; // NOLINT | 697 DWORD cookie_size = 0; // NOLINT |
| 698 // Note that there's really no way for us here to distinguish session cookies |
| 699 // from persistent cookies here. Session cookies should get filtered |
| 700 // out on the chrome side as to not be added again. |
696 InternetGetCookie(url_for_persistent_cookies.c_str(), NULL, NULL, | 701 InternetGetCookie(url_for_persistent_cookies.c_str(), NULL, NULL, |
697 &cookie_size); | 702 &cookie_size); |
698 if (cookie_size) { | 703 if (cookie_size) { |
699 scoped_array<wchar_t> cookies(new wchar_t[cookie_size + 1]); | 704 scoped_array<wchar_t> cookies(new wchar_t[cookie_size + 1]); |
700 if (!InternetGetCookie(url_for_persistent_cookies.c_str(), NULL, | 705 if (!InternetGetCookie(url_for_persistent_cookies.c_str(), NULL, |
701 cookies.get(), &cookie_size)) { | 706 cookies.get(), &cookie_size)) { |
702 NOTREACHED() << "InternetGetCookie failed. Error: " << GetLastError(); | 707 NOTREACHED() << "InternetGetCookie failed. Error: " << GetLastError(); |
703 } else { | 708 } else { |
704 persistent_cookies = WideToUTF8(cookies.get()); | 709 persistent_cookies = WideToUTF8(cookies.get()); |
705 } | 710 } |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 ret = net::ERR_ACCESS_DENIED; | 1089 ret = net::ERR_ACCESS_DENIED; |
1085 break; | 1090 break; |
1086 | 1091 |
1087 default: | 1092 default: |
1088 DLOG(WARNING) | 1093 DLOG(WARNING) |
1089 << StringPrintf("TODO: translate HRESULT 0x%08X to net::Error", hr); | 1094 << StringPrintf("TODO: translate HRESULT 0x%08X to net::Error", hr); |
1090 break; | 1095 break; |
1091 } | 1096 } |
1092 return ret; | 1097 return ret; |
1093 } | 1098 } |
OLD | NEW |