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

Support POST requests for UploadFile method #54

Open CrazyHackGUT opened 3 years ago

CrazyHackGUT commented 3 years ago

Some web hosting providers are using nginx as primary web server. By default it rejects PUT requests. We can solve this problem by editing the configuration, but usually web hosting providers do not allow doing such things.

ErikMinekus commented 3 years ago

The UploadFile function signature is pretty stuck on only using one HTTP method, and PUT seems to be the most appropriate for sending binary data. I also can't handle every webserver's quirks.

Wouldn't a web hosting provider allow at least some custom Nginx configuration, so you can create pretty URLs for example? Supposedly a try_files directive is enough to support PUT and DELETE on Nginx.

CrazyHackGUT commented 3 years ago

Currently, we're just require end-user use full URL in configuration file (include index.php). So, for us, this is not a big issue now. But I don't see anything wrong with implementing an extra parameter for the UploadFile method, which allows POST method to be used instead of PUT.

Maybe just adding CURLOPT_POST force cURL upload file with POST method instead of PUT, i don't tested.