| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 430 |
| 431 // TODO(ananta) | 431 // TODO(ananta) |
| 432 // Look into whether the other load flags need to be supported in chrome | 432 // Look into whether the other load flags need to be supported in chrome |
| 433 // frame. | 433 // frame. |
| 434 if (load_flags_ & net::LOAD_VALIDATE_CACHE) | 434 if (load_flags_ & net::LOAD_VALIDATE_CACHE) |
| 435 *bind_flags |= BINDF_RESYNCHRONIZE; | 435 *bind_flags |= BINDF_RESYNCHRONIZE; |
| 436 | 436 |
| 437 if (load_flags_ & net::LOAD_BYPASS_CACHE) | 437 if (load_flags_ & net::LOAD_BYPASS_CACHE) |
| 438 *bind_flags |= BINDF_GETNEWESTVERSION; | 438 *bind_flags |= BINDF_GETNEWESTVERSION; |
| 439 | 439 |
| 440 bool upload_data = false; | |
| 441 | 440 |
| 442 if (LowerCaseEqualsASCII(method(), "get")) { | 441 if (LowerCaseEqualsASCII(method(), "get")) { |
| 443 bind_info->dwBindVerb = BINDVERB_GET; | 442 bind_info->dwBindVerb = BINDVERB_GET; |
| 444 } else if (LowerCaseEqualsASCII(method(), "post")) { | 443 } else if (LowerCaseEqualsASCII(method(), "post")) { |
| 445 bind_info->dwBindVerb = BINDVERB_POST; | 444 bind_info->dwBindVerb = BINDVERB_POST; |
| 446 upload_data = true; | |
| 447 } else if (LowerCaseEqualsASCII(method(), "put")) { | 445 } else if (LowerCaseEqualsASCII(method(), "put")) { |
| 448 bind_info->dwBindVerb = BINDVERB_PUT; | 446 bind_info->dwBindVerb = BINDVERB_PUT; |
| 449 upload_data = true; | |
| 450 } else { | 447 } else { |
| 451 std::wstring verb(ASCIIToWide(StringToUpperASCII(method()))); | 448 std::wstring verb(ASCIIToWide(StringToUpperASCII(method()))); |
| 452 bind_info->dwBindVerb = BINDVERB_CUSTOM; | 449 bind_info->dwBindVerb = BINDVERB_CUSTOM; |
| 453 bind_info->szCustomVerb = reinterpret_cast<wchar_t*>( | 450 bind_info->szCustomVerb = reinterpret_cast<wchar_t*>( |
| 454 ::CoTaskMemAlloc((verb.length() + 1) * sizeof(wchar_t))); | 451 ::CoTaskMemAlloc((verb.length() + 1) * sizeof(wchar_t))); |
| 455 lstrcpyW(bind_info->szCustomVerb, verb.c_str()); | 452 lstrcpyW(bind_info->szCustomVerb, verb.c_str()); |
| 456 } | 453 } |
| 457 | 454 |
| 458 if (upload_data) { | 455 if (post_data_len()) { |
| 459 // Bypass caching proxies on POSTs and PUTs and avoid writing responses to | 456 // Bypass caching proxies on upload requests and avoid writing responses to |
| 460 // these requests to the browser's cache | 457 // the browser's cache. |
| 461 *bind_flags |= BINDF_GETNEWESTVERSION | BINDF_PRAGMA_NO_CACHE; | 458 *bind_flags |= BINDF_GETNEWESTVERSION | BINDF_PRAGMA_NO_CACHE; |
| 462 | 459 |
| 463 // Attempt to avoid storing the response for XHR request. | 460 // Attempt to avoid storing the response for upload requests. |
| 464 // See http://crbug.com/55918 | 461 // See http://crbug.com/55918 |
| 465 if (resource_type_ != ResourceType::MAIN_FRAME) | 462 if (resource_type_ != ResourceType::MAIN_FRAME) |
| 466 *bind_flags |= BINDF_NOWRITECACHE; | 463 *bind_flags |= BINDF_NOWRITECACHE; |
| 467 | 464 |
| 468 // Initialize the STGMEDIUM. | 465 // Initialize the STGMEDIUM. |
| 469 memset(&bind_info->stgmedData, 0, sizeof(STGMEDIUM)); | 466 memset(&bind_info->stgmedData, 0, sizeof(STGMEDIUM)); |
| 470 bind_info->grfBindInfoF = 0; | 467 bind_info->grfBindInfoF = 0; |
| 471 bind_info->szCustomVerb = NULL; | 468 |
| 469 if (bind_info->dwBindVerb != BINDVERB_CUSTOM) |
| 470 bind_info->szCustomVerb = NULL; |
| 472 | 471 |
| 473 if (get_upload_data(&bind_info->stgmedData.pstm) == S_OK) { | 472 if (get_upload_data(&bind_info->stgmedData.pstm) == S_OK) { |
| 474 bind_info->stgmedData.tymed = TYMED_ISTREAM; | 473 bind_info->stgmedData.tymed = TYMED_ISTREAM; |
| 475 DVLOG(1) << __FUNCTION__ << me() << method() | 474 DVLOG(1) << __FUNCTION__ << me() << method() |
| 476 << " request with " << base::Int64ToString(post_data_len()) | 475 << " request with " << base::Int64ToString(post_data_len()) |
| 477 << " bytes. url=" << url(); | 476 << " bytes. url=" << url(); |
| 478 } else { | 477 } else { |
| 479 DVLOG(1) << __FUNCTION__ << me() << "POST request with no data!"; | 478 DVLOG(1) << __FUNCTION__ << me() << "POST request with no data!"; |
| 480 } | 479 } |
| 481 } | 480 } |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 privacy_info_.privacy_records[UTF8ToWide(url)]; | 1238 privacy_info_.privacy_records[UTF8ToWide(url)]; |
| 1240 | 1239 |
| 1241 privacy_entry.flags |= flags; | 1240 privacy_entry.flags |= flags; |
| 1242 privacy_entry.policy_ref = UTF8ToWide(policy_ref); | 1241 privacy_entry.policy_ref = UTF8ToWide(policy_ref); |
| 1243 | 1242 |
| 1244 if (fire_privacy_event && IsWindow(notification_window_)) { | 1243 if (fire_privacy_event && IsWindow(notification_window_)) { |
| 1245 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, | 1244 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, |
| 1246 0); | 1245 0); |
| 1247 } | 1246 } |
| 1248 } | 1247 } |
| OLD | NEW |