luvit / luvit

Lua + libUV + jIT = pure awesomesauce

Home Page:https://luvit.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't connect to TLSv1_2 server

d4rkmen opened this issue · comments

The protocol is set to https, the secure protocol is TLS
It always sending TLSv1 client hello, and need TLSv1_2

Server response:

TLSv1 Record Layer: Alert (Level: Fatal, Description: Handshake Failure)
    Content Type: Alert (21)
    Version: TLS 1.0 (0x0301)
    Length: 2
    Alert Message
        Level: Fatal (2)
        Description: Handshake Failure (40)
local http = require('https')

local API_TOKEN = "----"

    local options = {
        host = "api.ukrainealarm.com",
        protocol = "https",
        port = 443,
        path = "/api/v3/regions",
        headers = {{"Authorization", API_TOKEN}}
    }

local req = http.request(options, function (res, err)
  p(">>>>>>>>>>>>>>>>", res, err)
  res:on('data', function (chunk)
    p("ondata", #chunk)
  end)
end)
req:done()
p("sent")

please try set to options.ciphers = 'ALL'

Solved somehow using options = http.parseUrl() and then https.request()
thanks