http://bugs.winehq.org/show_bug.cgi?id=58737
Bug ID: 58737 Summary: Download of large file via WinHTTP fails with WSATIMEDOUT Product: Wine Version: 10.15 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winhttp Assignee: wine-bugs@winehq.org Reporter: felixhaedicke@web.de Distribution: ---
Created attachment 79362 --> http://bugs.winehq.org/attachment.cgi?id=79362 Source code: Download a file (without acutally storing it) via HTTPS via WinHTTP
See attached sample code: For particular (large) files, downloads using wine's WinHTTP implementations can fail reproducibly with a WSATIMEDOUT.
This happens when running the installer of Condor 3 (https://www.condorsoaring.com), which is obviously built with "Inno Setup". The installer downloads a 14 GB archive from https://downloads3.condorsoaring.com/V3/Landscapes1.zip during installation. Unfortunately, when the actual download is finished, the installer fails with a code 10060 (WSATIMEDOUT) error message.
Using the attached sample code, I could reproduce this problem. The file is downloaded, but the last WinHttpQueryDataAvailable() call fails with WSATIMEDOUT (instead of detecting EOF):
winhttpdownload.exe "downloads3.condorsoaring.com" "/V3/Landscapes1.zip"
It seems to work fine for most other downloads, even for files which are larger than 4GB (4294967295 bytes, DWORD max value).
The sample code works fine on Windows 11.
http://bugs.winehq.org/show_bug.cgi?id=58737
--- Comment #1 from Felix Hädicke felixhaedicke@web.de --- Created attachment 79363 --> http://bugs.winehq.org/attachment.cgi?id=79363 WINEDEBUG=winhttp log
Debug output of WINEDEBUG=winhttp wine winhttpdownload.exe "downloads3.condorsoaring.com" "/V3/Landscapes1.zip
http://bugs.winehq.org/show_bug.cgi?id=58737
--- Comment #2 from Felix Hädicke felixhaedicke@web.de --- Looks like the end of stream detection does not work reliably.
See function end_of_read_data() in request.c, which compares the DWORD values request->content_length and request->content_read. Both variable values are incorrect: content_length is 4294967295 (DWORD max value) in this case. content_read is a lower value because the variable has overflowed several times.
http://bugs.winehq.org/show_bug.cgi?id=58737
--- Comment #3 from Felix Hädicke felixhaedicke@web.de --- Created attachment 79364 --> http://bugs.winehq.org/attachment.cgi?id=79364 unsigned long long type for variables content_length / content_read
It works fine after changing variable type to unsigned long long for variables content_length and content_read. See attached patch.
http://bugs.winehq.org/show_bug.cgi?id=58737
--- Comment #4 from Hans Leidekker hans@meelstraat.net --- (In reply to Felix Hädicke from comment #3)
Created attachment 79364 [details] unsigned long long type for variables content_length / content_read
It works fine after changing variable type to unsigned long long for variables content_length and content_read. See attached patch.
Thanks for the bug report. UINT64 is more idiomatic than 'unsigned long long' here but otherwise the patch looks good. Would you mind opening an MR on gitlab.winehq.org?