Okay, so I got to talk with a CGI api of a proprietary hardware device using .NETs HttpClient. While issuing requests and playing around with the API a little bit, I noticed that the server sometimes returns responses where the header part of the HTTP response is separated by two line feeds (LF) from the body instead of two carriage return/line feeds (CRLF), which obviously violates the HTTP protocol spec.
Because of that, the HttpClient returns the following error:
The server committed a protocol violation.
After googling a bit, I found several answers on SO that suggested inserting the following into my web/app config:
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing = "true"/>
</settings>
</system.net>
Now the problem is, the library I'm implementing the API client will be used in two kinds of apps: Windows 8 Phone apps and a vNEXT ASP.NET project: Both of them not having a web/app config.
So, is there a way to solve this? Implementing a custom message handler?
Aucun commentaire:
Enregistrer un commentaire