Reputation: 11
we have a problem with a multi-step availability test both on Visual Studio 2019 Enterprise and Azure Application Insights.
The first HTTP request works as expected, but the second HTTP request ends with the following exception:
Request failed: The server committed a protocol violation. Section=ResponseStatusLine
I have done the following tests trying to find a solution to this issue:
Have you any suggestion on how I can better investigate the reason behind this exception?
Just to add another information, we are currently using Dynatrace Synthetic with the same HTTP flow and it works fine, and we are trying to configure Azure Application Insights with the same services in order to evaluate if we can switch from Dynatrace to Azure Application Insights.
Thanks in advance for all your replies!
Upvotes: 1
Views: 2742
Reputation: 4248
This seems to be a .NET "security feature". With default configuration the HttpWebRequest
does not accept response status lines without an explicit status description. I haven't tested it but this is most likely the reason for your error message. The default behaviour can be changed through the useUnsafeHeaderParsing
property. The name of the property is misleading. It's not just about parsing of headers it covers also the behaviour for parsing the resonse status line. You can try to temporarily disable the property as described in the answer of this question.
Since this disables also some other checks (see the first link from above for a list of all checks) that help to avoid HTTP response split attacks, I would change the default behaviour only to verify that this is definitely the root cause of your error message. For a production setup it is definitely better to add a status description to your status codes. Why Microsoft treats a missing status messages as a potential security issue is unfortunately undocumented and out of my knowledge.
Upvotes: 1