skazantsev / WebDavClient

Asynchronous cross-platform WebDAV client for .NET Core
MIT License
155 stars 30 forks source link

Broken pipe error and Header lost in .net6 #89

Open jkpete opened 2 months ago

jkpete commented 2 months ago

The http header options “Connection: keep-alive” and “Authorization: xxx... lost ” in .net6. It caused by the exception: Unhandled exception. System.Net.Http.HttpRequestException: Error while copying content to a stream. ---> System.IO.IOException: Unable to write data to the transport connection: Broken pipe. ---> System.Net.Sockets.SocketException (32): Broken pipe

I compared two C# version , the 4.7.2 is worked and include two headers ,but in .net6 that two header options don't include in http headers. Should I need to construct the httpClient with two header options in .net6? Or other method to add the lost two http header options?

the header in .netframework 4.7.2

PUT /dav/Picture/PPT_Test.jpg HTTP/1.1
Content-Type: application/octet-stream
Content-Length: 36081
Connection: keep-alive
Host: xx.xx.xx.xx:xxxx
Accept-Encoding: gzip, deflate
Authorization: Basic Wkt...

the header in .net6

PUT /dav/Picture/PPT_Test.jpg HTTP/1.1
Host: xx.xx.xx.xx:xxxx
Accept-Encoding: gzip, deflate
Content-Type: application/octet-stream
Content-Length: 36081