Lua https 超时不起作用

编程入门 行业动态 更新时间:2024-10-27 16:39:01
本文介绍了Lua https 超时不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用以下版本的 Lua 及其在 openWRT 环境中的数据包:

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

  • luasocket-2.0.2

  • luasocket-2.0.2

luasec-0.4

lua-5.1.4

尝试对 https.request 调用使用超时.尝试使用 https.TIMEOUT 其中 local https = require("ssl.https") 并且它永远不会超时.我尝试给出一个非常小的 timeout(我知道在那个时间我不会得到答案并且互联网连接正常)我也尝试过当网络连接断开一次 https.request被调用.这是一个已知问题吗?或者我应该为此尝试其他方法.我可以猜测 send/recieve 会无限期地阻止它.

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

推荐答案

在 ssl.https 上设置超时不起作用.你必须在 socket.http 上设置它.

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("www.google.fr/")

改成这样:

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

更多推荐

Lua https 超时不起作用

本文发布于:2023-05-31 12:01:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/391369.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   Lua   https

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!