diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 05:18:43 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 05:18:43 +0000 |
commit | 04ac6e874adc7e00269b7f3bab879d3d93530184 (patch) | |
tree | 47b31b00716c3d0b9b7ce838568537b8fbaefc4a /chrome_frame/utils.cc | |
parent | 3358a3dc6df4a18cf36288b40c6777ed9fba4204 (diff) | |
download | chromium_src-04ac6e874adc7e00269b7f3bab879d3d93530184.zip chromium_src-04ac6e874adc7e00269b7f3bab879d3d93530184.tar.gz chromium_src-04ac6e874adc7e00269b7f3bab879d3d93530184.tar.bz2 |
ChromeFrame would fail to upload POST data to the server if the webserver requested NTLM
authentication. This is due to a bug in urlmon on IE6 and IE7 which manifests itself when
the post data is passed to urlmon as an IStream.
Fix is to pass in the uploaded data as a HGLOBAL. We always pass in a copy of the HGLOBAL
which points to the posted data to urlmon. This is to have it accessible for reissuing
navigation requests which target downloads.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=62687
BUG=62687
TEST=manually at this point. As we need a server which supports NTLM authentication like IIS.
Review URL: http://codereview.chromium.org/6603006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76880 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/utils.cc')
-rw-r--r-- | chrome_frame/utils.cc | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc index 1db94dc..f622c7d 100644 --- a/chrome_frame/utils.cc +++ b/chrome_frame/utils.cc @@ -791,9 +791,13 @@ RendererType RendererTypeForUrl(const std::wstring& url) { return renderer_type; } -HRESULT NavigateBrowserToMoniker(IUnknown* browser, IMoniker* moniker, - const wchar_t* headers, IBindCtx* bind_ctx, - const wchar_t* fragment, IStream* post_data) { +HRESULT NavigateBrowserToMoniker(IUnknown* browser, + IMoniker* moniker, + const wchar_t* headers, + IBindCtx* bind_ctx, + const wchar_t* fragment, + const uint8* post_data, + int post_data_len) { DCHECK(browser); DCHECK(moniker); DCHECK(bind_ctx); @@ -817,34 +821,9 @@ HRESULT NavigateBrowserToMoniker(IUnknown* browser, IMoniker* moniker, // If the data to be downloaded was received in response to a post request // then we need to reissue the post request. base::win::ScopedVariant post_data_variant; - if (post_data) { - RewindStream(post_data); - + if (post_data && post_data_len > 0) { CComSafeArray<uint8> safe_array_post; - - STATSTG stat; - post_data->Stat(&stat, STATFLAG_NONAME); - - if (stat.cbSize.LowPart > 0) { - std::string data; - - HRESULT hr = E_FAIL; - while ((hr = ReadStream(post_data, 0xffff, &data)) == S_OK) { - safe_array_post.Add( - data.size(), - reinterpret_cast<unsigned char*>(const_cast<char*>(data.data()))); - data.clear(); - } - } else { - // If we get here it means that the navigation is being reissued for a - // POST request with no data. To ensure that the new window used as a - // target to handle the new navigation issues a POST request - // we need valid POST data. In this case we create a dummy 1 byte array. - // May not work as expected with some web sites. - DLOG(WARNING) << "Reissuing navigation with empty POST data. May not" - << " work as expected"; - safe_array_post.Create(1); - } + safe_array_post.Add(post_data_len, post_data); post_data_variant.Set(safe_array_post.Detach()); } // Create a new bind context that's not associated with our callback. |