Lua https timeout is not working

前端 未结 1 365
傲寒
傲寒 2021-01-24 09:32

I am using following versions of Lua and it\'s packets on openWRT environment:

  • luasocket-2.0.2

  • luasec-0.4

  • lua-5.1.4

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-24 10:22

    Setting the timeout on ssl.https does not work. You have to set it on socket.http.

    For instance, if your code looks like this:

    local https = require "ssl.https"
    https.TIMEOUT = 0.01
    b, c, h = https.request("https://www.google.fr/")
    

    change it to this:

    local http = require "socket.http"
    local https = require "ssl.https"
    http.TIMEOUT = 0.01
    b, c, h = https.request("https://www.google.fr/")
    

    0 讨论(0)
提交回复
热议问题