Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Handling some MIME type

65 views
Skip to first unread message

Rado

unread,
Jun 8, 2010, 5:32:46 PM6/8/10
to
I'm using webbrowser control in my application and I need to handle
one mime type and convert it to another (csv->html). I've implemented
and registered MIME Filter for my process, but it is called only when
I use "Navigate" method on web browser control, not when control wants
to download document by user action (maybe because download is
initiated by javascript). In this case browser control just show
save / open dialog.

So I've tried to use PassthruAPP. I've put mime type check into
CTestSink::OnResponse() like this:

....
CComPtr<IHttpNegotiate> spHttpNegotiate;
QueryServiceFromClient(&spHttpNegotiate);

if (dwResponseCode == 200 && szResponseHeaders &&
wcsstr(szResponseHeaders,L"\r\nContent-Type: application/x-csv\r\n"))
{
CStringW hdr = szResponseHeaders;
hdr.Replace(L"\r\nContent-Type: application/x-csv\r\n",L"\r\nContent-
Type: text/html\r\n");
HRESULT hr = spHttpNegotiate ?
spHttpNegotiate->OnResponse(dwResponseCode, hdr,
szRequestHeaders, pszAdditionalRequestHeaders) :
S_OK;
return hr;
}
....
It is called, but it does not help. ReportProgress() is still called
with BINDSTATUS_MIMETYPEAVAILABLE set to original mime type. So I've
tried also to handle ReportProgress():

if (ulStatusCode == BINDSTATUS_MIMETYPEAVAILABLE
{
if (szStatusText && !_wcsicmp(szStatusText,L"application/x-csv"))
{
HRESULT hr = m_spInternetProtocolSink ?
m_spInternetProtocolSink->ReportProgress(ulStatusCode, L"text/
html") :
S_OK;
return hr;
}
}

but it still does not help. Do you have idea how IE knows the original
mime type and why this does not work? How can I solve this?
Thank you.

0 new messages