Webrequest https

Discussion in 'Rust Development' started by Rizzok, Oct 17, 2016.

  1. Hi, tried to post data to https page and it not working... Is this functionality missing or I'm missing something?
     
  2. Hello, you can take a look at Babel | Oxide from @Wulf, i think it will help you a lot for webrequest
     
  3. Wulf

    Wulf Community Admin

    HTTPS works fine with web requests, but keep in mind that some certificates have issues with Mono.
     
  4. Hmm, may be Lets Encrypt ECDSA P-384 cert is the issue?
     
  5. Wulf

    Wulf Community Admin

    Generally you'd get an error in the console if there is an HTTPS certificate issue.
     
  6. 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);
            }
    trivial code above: with https I get "[Oxide] 08:24 [Info] [TelegramAlarms] Error: 0 - Couldn't get an answer from Telegram for 76561198054016887"
     
  7. Wulf

    Wulf Community Admin

    Looks like that may be the issue then, but not certain.