alliedmodders / sourcemod

SourceMod - Source Engine Scripting and Administration
http://www.sourcemod.net/
986 stars 423 forks source link

WebTransfer::Download does a POST instead of a GET #1420

Open BradleyMarie opened 3 years ago

BradleyMarie commented 3 years ago

https://github.com/alliedmodders/sourcemod/blob/b14c18ee64fc822dd6b0f5baea87226d59707d5a/extensions/curl/curlapi.cpp#L128

Not sure if this is strictly a bug or intended for some use case I'm not seeing, but WebTransfer::Download does a POST instead of a GET which seems a bit unnatural since no data is being posted. This also causes a 405 to be returned from the server for my use case which requires a GET.

I'd like to remove the line referenced above to resolve this.

asherkin commented 3 years ago

The webternet API exists only to back the gamedata updater, which relies on the behaviour here.

BradleyMarie commented 3 years ago

Got it. Is there openness to adding a mechanism for enabling IWebternet to issue a GET? I'd prefer to avoid linking to a separate HTTP client in my extension if there is one already included with base sourcemod.

Also, out of curiosity, why does the gamedata updater require this to be a POST? At least in my testing, the actual downloading of the gamedata itself worked fine with a GET request.

I used this URL in my testing: https://update.sourcemod.net/update/master/gamedata/sdktools.games/game.empires.txt

I also don't mean to imply that the initial updater request to determine which files can be downloaded (the request to https://update.sourcemod.net/update/) can be turned into a GET request since that request does include posted form data. That request, however, goes down WebTransfer::PostAndDownload and so it wouldn't be impacted by turning WebTransfer::Download requests into GET requests. Assuming I've read the code correctly the only requests that use WebTransfer::Download are the downloads of the actual game updates themselves and in my testing these requests would work fine as with GET command.

Totally possible I missed something and what I'm suggesting is unworkable. Just wanted to make sure I fully explained myself.