On Fri Sep 12 17:23:12 2025 +0000, Gabriel Ivăncescu wrote:
I'm not sure. XDR only accepts text/plain responses, but this method seems to detect it from the content (not from headers, else it would be pointless). urlmon reports its sniffing via `BINDSTATUS_MIMETYPEAVAILABLE`, but that's on the channel, how do I obtain the channel from the XHR or associate it with it? (so I can access its `content_type` field) From what I see, Gecko creates the channel internally during open() and there's no way to directly obtain it from the XHR. An ugly solution would be some sort of thread-local hack wrapping open() (and read it in `nsIOServiceHook_NewChannel` to give it a pointer to it), but that's not very pretty either. Any better ideas?
There is `nsIXMLHttpRequest::GetChannel` and `nsIChannel::GetContentType` that could potentially be useful. And if we really need to do parsing here, there is `nsIXMLHttpRequest::GetResponseBuffer` that would give us raw data instead of converting it back and forth with potentially different code pages.
What's the exact Windows behavior? For example "Accept" header from the other patch could probably be tested with our emulated http protocol handler, I'm not sure how practical that is. It should be easy to capture http traffic on Windows to see, does it behave the same?