seraphx2 / ESI.NET

A C# wrapper for the Eve Online ESI API.
https://www.nuget.org/packages/ESI.NET/
MIT License
42 stars 25 forks source link

Error parsing headers limit request headers fields size #3

Closed Dusty-Meg closed 5 years ago

Dusty-Meg commented 5 years ago

Earlier this morning White 0rchid came into #esi on tweetfleet slack with the following error message. "Message": "<html>\n <head>\n <title>Bad Request<\/title>\n <\/head>\n <body>\n <h1><p>Bad Request<\/p><\/h1>\n Error parsing headers: &#x27;limit request headers fields size&#x27;\n <\/body>\n<\/html>\n" According to White 0rchid this error occurred after about 12 hours of use.

I had a quick look and I may be wrong but it seems like
https://github.com/seraphx2/ESI.NET/blob/b1b0ee59f64d128e7e51d4c3826fb12e554e1d82/ESI.NET/EsiRequest.cs#L38 Is causing the issue.

A quick test, shows that each this this line is called it appends the eTag to the header instead of overwriting. https://i.imgur.com/tL3sU9G.png

If client.DefaultRequestHeaders.Remove("If-None-Match"); was added before the add then this would prevent this happening. The remove can be called every time as this does not cause an issue if what it is trying to remove does not exist. https://i.imgur.com/b4SMUkD.png

This may not be the cause of this error and I have only been able to look at your code on Github, but I hope this helps.

seraphx2 commented 5 years ago

To be on the safe side, I just ended up deleting all headers whenever a new Request is started.