OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" | |
11 #include "base/string_util.h" | |
12 #include "base/logging.h" | 10 #include "base/logging.h" |
13 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/scoped_ptr.h" |
| 13 #include "base/string_number_conversions.h" |
14 #include "chrome_frame/bind_context_info.h" | 14 #include "chrome_frame/bind_context_info.h" |
15 #include "chrome_frame/chrome_frame_activex_base.h" | 15 #include "chrome_frame/chrome_frame_activex_base.h" |
16 #include "chrome_frame/extra_system_apis.h" | 16 #include "chrome_frame/extra_system_apis.h" |
17 #include "chrome_frame/html_utils.h" | 17 #include "chrome_frame/html_utils.h" |
18 #include "chrome_frame/urlmon_url_request_private.h" | 18 #include "chrome_frame/urlmon_url_request_private.h" |
19 #include "chrome_frame/urlmon_upload_data_stream.h" | 19 #include "chrome_frame/urlmon_upload_data_stream.h" |
20 #include "chrome_frame/utils.h" | 20 #include "chrome_frame/utils.h" |
21 #include "net/http/http_util.h" | 21 #include "net/http/http_util.h" |
22 #include "net/http/http_response_headers.h" | 22 #include "net/http/http_response_headers.h" |
23 | 23 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 *bind_flags |= BINDF_GETNEWESTVERSION | BINDF_PRAGMA_NO_CACHE; | 443 *bind_flags |= BINDF_GETNEWESTVERSION | BINDF_PRAGMA_NO_CACHE; |
444 | 444 |
445 // Initialize the STGMEDIUM. | 445 // Initialize the STGMEDIUM. |
446 memset(&bind_info->stgmedData, 0, sizeof(STGMEDIUM)); | 446 memset(&bind_info->stgmedData, 0, sizeof(STGMEDIUM)); |
447 bind_info->grfBindInfoF = 0; | 447 bind_info->grfBindInfoF = 0; |
448 bind_info->szCustomVerb = NULL; | 448 bind_info->szCustomVerb = NULL; |
449 | 449 |
450 if (get_upload_data(&bind_info->stgmedData.pstm) == S_OK) { | 450 if (get_upload_data(&bind_info->stgmedData.pstm) == S_OK) { |
451 bind_info->stgmedData.tymed = TYMED_ISTREAM; | 451 bind_info->stgmedData.tymed = TYMED_ISTREAM; |
452 DLOG(INFO) << __FUNCTION__ << me() << method() | 452 DLOG(INFO) << __FUNCTION__ << me() << method() |
453 << " request with " << Int64ToString(post_data_len()) | 453 << " request with " << base::Int64ToString(post_data_len()) |
454 << " bytes. url=" << url(); | 454 << " bytes. url=" << url(); |
455 } else { | 455 } else { |
456 DLOG(INFO) << __FUNCTION__ << me() << "POST request with no data!"; | 456 DLOG(INFO) << __FUNCTION__ << me() << "POST request with no data!"; |
457 } | 457 } |
458 } | 458 } |
459 | 459 |
460 return S_OK; | 460 return S_OK; |
461 } | 461 } |
462 | 462 |
463 STDMETHODIMP UrlmonUrlRequest::OnDataAvailable(DWORD flags, DWORD size, | 463 STDMETHODIMP UrlmonUrlRequest::OnDataAvailable(DWORD flags, DWORD size, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 return E_ABORT; | 536 return E_ABORT; |
537 } | 537 } |
538 | 538 |
539 HRESULT hr = S_OK; | 539 HRESULT hr = S_OK; |
540 | 540 |
541 std::string new_headers; | 541 std::string new_headers; |
542 if (post_data_len() > 0) { | 542 if (post_data_len() > 0) { |
543 // Tack on the Content-Length header since when using an IStream type | 543 // Tack on the Content-Length header since when using an IStream type |
544 // STGMEDIUM, it looks like it doesn't get set for us :( | 544 // STGMEDIUM, it looks like it doesn't get set for us :( |
545 new_headers = StringPrintf("Content-Length: %s\r\n", | 545 new_headers = StringPrintf("Content-Length: %s\r\n", |
546 Int64ToString(post_data_len()).c_str()); | 546 base::Int64ToString(post_data_len()).c_str()); |
547 } | 547 } |
548 | 548 |
549 if (!extra_headers().empty()) { | 549 if (!extra_headers().empty()) { |
550 // TODO(robertshield): We may need to sanitize headers on POST here. | 550 // TODO(robertshield): We may need to sanitize headers on POST here. |
551 new_headers += extra_headers(); | 551 new_headers += extra_headers(); |
552 } | 552 } |
553 | 553 |
554 if (!referrer().empty()) { | 554 if (!referrer().empty()) { |
555 // Referrer is famously misspelled in HTTP: | 555 // Referrer is famously misspelled in HTTP: |
556 new_headers += StringPrintf("Referer: %s\r\n", referrer().c_str()); | 556 new_headers += StringPrintf("Referer: %s\r\n", referrer().c_str()); |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 privacy_info_.privacy_records[UTF8ToWide(url)]; | 1158 privacy_info_.privacy_records[UTF8ToWide(url)]; |
1159 | 1159 |
1160 privacy_entry.flags |= flags; | 1160 privacy_entry.flags |= flags; |
1161 privacy_entry.policy_ref = UTF8ToWide(policy_ref); | 1161 privacy_entry.policy_ref = UTF8ToWide(policy_ref); |
1162 | 1162 |
1163 if (fire_privacy_event && IsWindow(notification_window_)) { | 1163 if (fire_privacy_event && IsWindow(notification_window_)) { |
1164 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, | 1164 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, |
1165 0); | 1165 0); |
1166 } | 1166 } |
1167 } | 1167 } |
OLD | NEW |