Yesterday, I was helping a colleague debug a problem involving dynamically generated PDFs. For some reason, he was occaisionally getting double requests for the same file. Eventually, we cottoned on to the fact that the second request had a user-agent of “contype”. Not having heard of that before, I googled for it.
Tim Strehle is the first hit for user agent contype, and he has an explanation and a link to the MSDN article PRB: Three GET Requests Are Sent When You Retrieve Plug-in Served Content.
I have never been so astonished by what I saw.
Symptoms: When a server returns a document that is handled by a plug-in (such as an Adobe Acrobat PDF file), three requests are made for the document in Internet Explorer versions 4.x and 5, and two requests are made in Internet Explorer version 5.5.
Cause: The first behavior is by design. When an initial request is sent for the server file, this returns a data stream with a content-type that is handled by a plug-in (not an ActiveX control), and Internet Explorer closes the initial port and sends a new request with userAgent = contype. The only information that is needed in return from the contype request is the content-type.
That’s pretty broken design. You already have the information in the browser, yet you have to go across the network again to fetch it? What a crock. They didn’t even have the clue to use a HEAD request instead of a GET, which would have been a bit of a hint in the right direction.
But the bit that really infuriated me was this:
However, because most developers are unaware of this request style, they treat each GET the same and return the entire document.
Which I read as:
Because we fucked up and you didn’t know about it, you lose dumbass.
The whole thing has an infuriatingly arrogant tone to it. There’s no apology for their insane design. Just Nelson going “Har-Har”.
You have been warned.
2 replies on “contype is an MSIE bug”
Whaaaa? How about “However, because most developers are unaware that we don’t know the first thing about HTTP, they implement
GET
correctly, making us eat their bandwidth for no good reason.”Let me fix that. “However, because most developers are unaware that we don’t know the first thing about HTTP, they implement
GET
correctly, making us eat their bandwidth for no good reason.”