diff options
author | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 22:22:12 +0000 |
---|---|---|
committer | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 22:22:12 +0000 |
commit | a43cd619a3919b6e868dbd63ca29e5af9072c2f5 (patch) | |
tree | c95c405e2a46fb5624c9d156187126d05ca5287f | |
parent | 0b2a2f4907087f36cd185bacbd685930eb7cbb31 (diff) | |
download | chromium_src-a43cd619a3919b6e868dbd63ca29e5af9072c2f5.zip chromium_src-a43cd619a3919b6e868dbd63ca29e5af9072c2f5.tar.gz chromium_src-a43cd619a3919b6e868dbd63ca29e5af9072c2f5.tar.bz2 |
Protect against receiving different BINDSTATUS_MIMETYPEAVAILABLE multiple times.
Review URL: http://codereview.chromium.org/3038049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54979 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome_frame/protocol_sink_wrap.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/chrome_frame/protocol_sink_wrap.cc b/chrome_frame/protocol_sink_wrap.cc index 05b092d..5752776 100644 --- a/chrome_frame/protocol_sink_wrap.cc +++ b/chrome_frame/protocol_sink_wrap.cc @@ -361,6 +361,20 @@ HRESULT ProtData::Read(void* buffer, ULONG size, ULONG* size_read) { return read_fun_(protocol_, buffer, size, size_read); } +// Attempt to detect ChromeFrame from HTTP headers when +// BINDSTATUS_MIMETYPEAVAILABLE is received. +// There are three possible outcomes: CHROME/OTHER/UNDETERMINED. +// If UNDETERMINED we are going to sniff the content later in ReportData(). +// +// With not-so-well-written software (mime filters/protocols/protocol patchers) +// BINDSTATUS_MIMETYPEAVAILABLE might be fired multiple times with different +// values for the same client. +// If the renderer_type_ member is: +// CHROME - 2nd (and any subsequent) BINDSTATUS_MIMETYPEAVAILABLE is ignored. +// OTHER - 2nd (and any subsequent) BINDSTATUS_MIMETYPEAVAILABLE is +// passed through. +// UNDETERMINED - Try to detect ChromeFrame from HTTP headers (acts as if this +// is the first time BINDSTATUS_MIMETYPEAVAILABLE is received). HRESULT ProtData::ReportProgress(IInternetProtocolSink* delegate, ULONG status_code, LPCWSTR status_text) { switch (status_code) { @@ -382,12 +396,12 @@ HRESULT ProtData::ReportProgress(IInternetProtocolSink* delegate, // TODO(stoyan): BINDSTATUS_RAWMIMETYPE case BINDSTATUS_MIMETYPEAVAILABLE: case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE: + SaveSuggestedMimeType(status_text); // When Transaction is attached i.e. when existing BTS it terminated // and "converted" to BTO, events will be re-fired for the new sink, // but we may skip the renderer_type_ determination since it's already // done. if (renderer_type_ == UNDETERMINED) { - SaveSuggestedMimeType(status_text); // This may seem awkward. CBinding's implementation of IWinInetHttpInfo // will forward to CTransaction that will forward to the real protocol. // We may ask CTransaction (our protocol_ member) for IWinInetHttpInfo. |