mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-25 10:58:20 -10:00
CurlHandler was explicitly setting the Content-Length header, which overrides libcurl's default handling of Content-Length. This means that Content-Length was being sent even when it shouldn't have been, such as when redirecting a POST to a GET. This commit changes how we handle Content-Length. Rather than explicitly setting the header ourselves, we let libcurl do it, and we tell it the length of the input via the INFILESIZE and POSTFIELDSIZE options. A few other issues addressed as well in the act of fixing this: - A SafeHandle wasn't being disposed of in the case of a redirect. - 301 wasn't being considered a redirect status code for the purposes of credential handling. - Some code could have been a bit cleaner. Commit migrated from https://github.com/dotnet/corefx/commit/864f0926754fbb781b81b543f972e069f6295a0c