ErikMinekus / sm-ripext

SourceMod REST in Pawn Extension
https://forums.alliedmods.net/showthread.php?t=298024
GNU General Public License v3.0
136 stars 38 forks source link

Downloading some files hangs at the very beginning #48

Closed Mix-Anik closed 3 years ago

Mix-Anik commented 3 years ago

Issue description

Downloading files using HTTPClient.DownloadFile returns timeout error after reaching HTTPClient.Timeout amount of seconds being in that process, but with almost no data downloaded at all, whether it was 30 seconds or 5 minutes given as timeout value, downloaded amount of data was less than 1kb. Doesn't seem to be related to headers sent with the request, at least setting Accept/Accept-Encoding/Content-Type/Host didn't make any difference. Such behavior is true only for some files (wasn't able to identify what could be the reason), but trying to download same files directly with curl (7.68.0 and 7.75.0) succeeds without any errors whatsoever.

Steps to reproduce the issue

  1. Try to download any of given below files via HTTPClient.DownloadFile in \<sourcemod>/data location
  2. Observe returned in callback function error

Such case's different files' URLs: https://gamebanana.com/dl/509036 https://fastdlv2.gflclan.com/file/gflfastdlv2/csgo/maps/bhop_lego3.bsp.bz2 https://images.pexels.com/photos/325185/pexels-photo-325185.jpeg https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-large-zip-file.zip

What's the expected result?

Fully downloaded file located in \<sourcemod>/data directory

What's the actual result?

An error telling request was timed out returned Used url: https://images.pexels.com/photos/325185/pexels-photo-325185.jpeg with different timeouts. With 30s timeout set: Operation timed out after 29999 milliseconds with 555 out of 8635776 bytes received With 305s timeout set: Operation timed out after 304999 milliseconds with 553 out of 8635776 bytes received

Additional details

Bara commented 3 years ago

For future questions: Sounds like a issue in combination with windows servers, it (should) works with linux based servers.

ErikMinekus commented 3 years ago

Please try this build: sm-ripext-windows.zip

There seems to be an issue on Windows with file transfers over HTTP/2, so as a workaround, this build enforces HTTP/1.1 for file transfers.

Mix-Anik commented 3 years ago

@Bara yep, indeed I ended up testing it only on a few windows servers and assumed linux build having same trouble, which was a bit lame of me

@ErikMinekus that seems to resolve the issue, previously failing to download files are now successfully made it to the end, thanks!

ErikMinekus commented 3 years ago

Version 1.3 has been released with this workaround.