From b55aaa67d96309c6dd983d8cf8cfaad723174567 Mon Sep 17 00:00:00 2001 From: "robertshield@chromium.org" Date: Thu, 3 Dec 2009 00:21:50 +0000 Subject: Adding support for Chrome Frame to be loaded via the presence of an X-UA-Compatible HTTP header (in addition to the meta tag support). Also pins the CF module into the process such that it won't get unloaded. Doing this to work around how we can get unloaded without unpatching properly. BUG=22802 TEST=Navigate to a web site whose server sends the X-UA-Compatible: chrome=1 HTTP header and ensure that the page is loaded in CF. Review URL: http://codereview.chromium.org/465009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33629 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome_frame/utils.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'chrome_frame/utils.cc') diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc index 61bf7df..10bf92a 100644 --- a/chrome_frame/utils.cc +++ b/chrome_frame/utils.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include #include "chrome_frame/html_utils.h" #include "chrome_frame/utils.h" @@ -610,3 +611,27 @@ bool IsValidUrlScheme(const std::wstring& url, bool is_privileged) { return false; } + +std::string GetRawHttpHeaders(IWinInetHttpInfo* info) { + DCHECK(info); + + std::string buffer; + + DWORD size = 0; + DWORD flags = 0; + DWORD reserved = 0; + HRESULT hr = info->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF, NULL, &size, + &flags, &reserved); + if (!size) { + DLOG(WARNING) << "Failed to query HTTP headers size. Error: " << hr; + } else { + buffer.resize(size + 1); + hr = info->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF, &buffer[0], + &size, &flags, &reserved); + if (FAILED(hr)) { + DLOG(WARNING) << "Failed to query HTTP headers. Error: " << hr; + } + } + + return buffer; +} -- cgit v1.1