We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It would be nice to check the progress of larger downloads.
Something like this:
if (!naettComplete(res_)) { // Update progress int downloadedBytes = 0, totalBytes= 0; naettGetProgress(res_, &downloadedBytes , &totalBytes); // ... }
If the size is unknown, *totalSize would be set to -1.
I guess cleanest would be if naettComplete also had two output parameters, downloadedBytes and totalBytes.
downloadedBytes
totalBytes
Actually I guess this can be hacked by manually reading the Content-Length header, and then checking res->body.size.
Though it occurs to me that there's a data race - if I read headers while !completed, it may be that the headers are currently being filled in.
Here's my current hack that 'works' (doing the below if naettComplete() didn't return true) but has at least two races:
naettComplete()
const char *header = naettGetHeader(res_, "Content-Length"); if (header) { strlcpy(buf, sizeof(buf), header); sscanf(buf, "%d", &total); int size; naettGetBody(res_, &size); progress_.Update(size, total); }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
It would be nice to check the progress of larger downloads.
Something like this:
If the size is unknown, *totalSize would be set to -1.
I guess cleanest would be if naettComplete also had two output parameters,
downloadedBytes
andtotalBytes
.Actually I guess this can be hacked by manually reading the Content-Length header, and then checking res->body.size.
Though it occurs to me that there's a data race - if I read headers while !completed, it may be that the headers are currently being filled in.
Here's my current hack that 'works' (doing the below if
naettComplete()
didn't return true) but has at least two races:The text was updated successfully, but these errors were encountered: