-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace HttpWebRequest with HttpClient #35
Comments
similar to #31 |
I'm researching and I hope I can find a solution soon. Because the structure cost of the program for conversion and full use of |
I think |
There is a problem with http client. |
@GihanSoft You can buffer it by yourself while using var req = new HttpRequestMessage(...);
var res = (await httpClient.SendAsync(req, HttpCompletionOption.ResponseHeadersRead)).EnsureSuccessStatusCode();
using var stream = await res.Content.ReadAsStreamAsync();
const int bufferSize = 1048576;
var buffer = new byte[bufferSize];
while (true)
{
var length = await stream.ReadAsync(buffer);
if (length == 0) break;
// use buffer[0..length]
} |
@hez2010 |
HttpWebRequest and all related methods have been deprecated since .NET 6. We are already at .NET 9, and I wouldn't bet on this functionality being in .NET for much longer, so it would probably be wise to start to port this project over to HttpClient soon...-ish? 😄 |
@bezzad any news? still open from 2021! |
I came across this issue recently:
https://stackoverflow.com/questions/66156483/webrequest-behavour-different-between-net-framework-4-8-and-dotnet-5
and
https://twitter.com/mikaelsyska/status/1359968961765535744
It might be worth looking into replacing the HttpWebRequest in ChunkDownloader with something like a HttpClient, which has been completely rewritten in .NET Core and should yield better performance.
The text was updated successfully, but these errors were encountered: