MIME filter
-
Hello, has anyone ever created a MIME filter before (c# or otherwise)? I tried to make a mime filter for a content-type that I invented: "text/myml", and when I test it, my filter's Start() method get's called, but then nothing else happens. The behavior in the browser is that it just hangs until I click the stop button. Although, when I click the stop button, IE calls my mime filter's Abort and Terminate methods. Is there something special my MIME filter has to do in the Start method? All I have it doing right now is store m_Sink and m_pIncomingProt. Also when Start() is called, dwReserved.pProtocol comes in null. I don't know why but that seems like a bad thing? "Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read." -Groucho Marx
-
Hello, has anyone ever created a MIME filter before (c# or otherwise)? I tried to make a mime filter for a content-type that I invented: "text/myml", and when I test it, my filter's Start() method get's called, but then nothing else happens. The behavior in the browser is that it just hangs until I click the stop button. Although, when I click the stop button, IE calls my mime filter's Abort and Terminate methods. Is there something special my MIME filter has to do in the Start method? All I have it doing right now is store m_Sink and m_pIncomingProt. Also when Start() is called, dwReserved.pProtocol comes in null. I don't know why but that seems like a bad thing? "Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read." -Groucho Marx
Do you have documentation source for this? I need to do something similar, and I assumed that it would require writing a COM server... Arun
-
Do you have documentation source for this? I need to do something similar, and I assumed that it would require writing a COM server... Arun
It does, and I haven't had much success doing so. You need to look into the
IInternetProtocol
interface and its related interface. You basically have to recreate a lot of that functionality in .NET. By the time you're done, you may as well have done it in C++ because of the amount of work. I was working on a library for it (abstract class and stuff like that), but there's a lot of hang-ups because interface methods don't always interop using 1-to-1 parameter mapping. For instance, theIClassFactory.CreateInstance
method is only supposed to take 2 methods (while the return type is still void) instead of 3. Just weird stuff like that. If you want, you could create forward declarations of these in an IDL file, compile the IDL file using the MIDL compiler, then generate an interop assembly using tlbimp.exe. It works to generate the interfaces, structs, and enums, but it's very messy and doesn't always provide what you need. For instance, it always creates methods that returnvoid
, when some of those protocol methods must return anHRESULT
(int
oruint
is good in .NET) in order to work correctly, since different return values tell the client to do different things. This becomes a big problem when generating the interop assembly automatically.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----