Lua https timeout is not working

user2830387

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

Trying to use timeout for a https.request call. Tried using https.TIMEOUT where local https = require("ssl.https") and it never time outs. I tried giving a very small timeout (I know that I won't get answer in that time and internet connection is OK) also I tried when net connection is disconnected once https.request is called. Is it a known issue? or shall I try something else for this. I can guess either send/recieve is blocking it for infinite time.

-Swapnel

catwell

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/")

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related