Hi Aaron, On Tue, 2022-01-11 at 22:07 -0500, Aaron Merey via Elfutils-devel wrote: > In some cases the content-length header may not be available in order > to pass to a progressfn. If content-length isn't available then attempt > to get the size of the download from the debuginfod-size header instead. > > It should be mentioned that if a compressed file (ex. gzip) is being > transferred, the actual transfer length will be less than debuginfod-size. > In this case debuginfod-size is a best-guess upper bound on the size of > the transfer.
Sorry this patch wasn't reviewed for such a long time. It looks correct and is also a nice cleanup. Consolidating getting the download size in one place instead of two (for the progress function and the maxsize check). Just a question about this part: > + /* If Content-Length is -1, try to get the size from > + X-Debuginfod-Size */ > + if (dl_size == -1 && c->winning_headers != NULL) > + { > + double xdl; > + char *hdr = strstr(c->winning_headers, "x-debuginfod-size"); > + > + if (hdr != NULL > + && sscanf(hdr, "x-debuginfod-size: %lf", &xdl) == 1) > + dl_size = (xdl >= (double)(LONG_MAX+1UL) ? LONG_MAX : > (long)xdl); > + } > + } In debuginfod.cxx the header is spelled all uppercase as "X-DEBUGINFOD- SIZE" which is also what is checked for in the run-debuginfod-response- headers.sh test. So shouldn't the above also be all uppercase or should you use strcasestr? When using sscanf why are you using a double and %lf? Isn't it simpler to use a long and %ld? Is there a way to test this easily? When would Content-Length not be available? Cheers, Mark