Webrequest https
Discussion in 'Rust Development' started by Rizzok, Oct 17, 2016.
-
Hello, you can take a look at Babel | Oxide from @Wulf, i think it will help you a lot for webrequest
-
Wulf Community Admin
HTTPS works fine with web requests, but keep in mind that some certificates have issues with Mono.
-
Hmm, may be Lets Encrypt ECDSA P-384 cert is the issue?
-
Wulf Community Admin
Generally you'd get an error in the console if there is an HTTPS certificate issue. -
trivial code above: with https I get "[Oxide] 08:24 [Info] [TelegramAlarms] Error: 0 - Couldn't get an answer from Telegram for 76561198054016887"Code:
void PostRequest(IPlayer player, string action, string data) { // Set a timeout (in milliseconds) var timeout = 1000f; // Set some custom request headers (eg. for HTTP Basic Auth) //var headers = new Dictionary<string, string> { { "header", "value" } }; //webrequest.EnqueuePost("http://***/***.php", "action="+action+"&steamid="+player.Id+"&data="+data, (code, response) => PostCallback(code, response, player), this, null, timeout); webrequest.EnqueuePost("https://***/***.php", "action=" + action + "&steamid=" + player.Id + "&data=" + data, (code, response) => PostCallback(code, response, player), this, null, timeout); } void PostCallback(int code, string response, IPlayer player) { if (response == null || code != 200) { Puts($"Error: {code} - Couldn't get an answer from Telegram for {player.Id}"); return; } Puts("Telegram answered for " + player.Id + ": " + response); } -
Wulf Community Admin
Looks like that may be the issue then, but not certain.
