I am currently migrating .NetFramework4.8 project to .Net6. Here we have use case get some data from a old server. Below is the CURL response of the url from command prompt,
DATAFOUND 200 OK
Server: IMRIP DATA Provider 4.7
Content-Type: text/plain
Content-Length: 17798
Date: Thu, 20 Oct 2022 10:29:25 UTC
DTR;AB-LM-SSS;SS-VMR-Nx;CMRx;1(1)................etc..
But while calling the URL using HttpClient, we are getting below error due to the not well formed status code.
Received an invalid status line: 'DATAFOUND 200 OK'.
Same code is successfully getting executed in .NetFramework 4.8. In Net4.8, we have below config which can read unsafe headers from the response.
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
The code I am trying to execute is below,
var client = new HttpClient();
client.DefaultRequestHeaders.ExpectContinue = false;
client.DefaultRequestHeaders.Add("User-Agent", "Data provider");
client.DefaultRequestHeaders
.Accept
.Add(new MediaTypeWithQualityHeaderValue("text/plain"));
var response = await client.GetAsync("http://www.someurl.com:1102"); //Getting error here
Can you please help me to get equivalent config or method in .NET6 to solve this.