Progress monitoring using HTTP client

I’m using the http client in an application, and I was wondering the best way to add a progress monitor. It seems like the underlying stream processing for chunked streams uses cgi_statistics, at least internally. Is this the appropriate way to attempt a progress monitor?

1 Like

A quick scan of http_chunked.c doesn’t point me at and stats. The CGI stream is only used for the server side HTTP AFAIK. There also doesn’t seem to be a callback that allows running stats. In theory you could do so by having a second thread polling the current stream position or the size of the object/file you use to dump the result. That can get a little tricky when dealing with cleanup in various possible error scenarios.

Alternatively you could propose a PR that adds a progress callback to the chunked open or add yet another filter stream to the set that merely provides a progress callback. The latter solution would allow tracking progress on any stream.

2 Likes