File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,10 @@ function luasocket_mt.getreusedtimes()
4949end
5050
5151function luasocket_mt :settimeout (t )
52- self .sock :settimeout (t / 1000 )
52+ if t then
53+ t = t / 1000
54+ end
55+ self .sock :settimeout (t )
5356end
5457
5558function luasocket_mt :setkeepalive ()
Original file line number Diff line number Diff line change @@ -85,7 +85,33 @@ could not receive: timeout
8585
8686
8787
88- === TEST 3: luasocket setkeepalive() compat (close)
88+ === TEST 3: luasocket settimeout() nil
89+ --- wait: 1
90+ --- http_config eval
91+ "$t::Utils::HttpConfig"
92+ --- config
93+ location /t {
94+ return 200;
95+
96+ log_by_lua_block {
97+ local socket = require "resty.socket"
98+ local sock = socket.tcp()
99+ sock:settimeout() -- no errors
100+ ngx.log(ngx.INFO, "ok")
101+ }
102+ }
103+ --- request
104+ GET /t
105+ --- response_body
106+
107+ --- no_error_log
108+ [error]
109+ --- error_log
110+ ok
111+
112+
113+
114+ === TEST 4: luasocket setkeepalive() compat (close)
89115--- wait: 1
90116--- http_config eval
91117"$t::Utils::HttpConfig"
@@ -137,7 +163,7 @@ could not send after keepalive: closed
137163
138164
139165
140- === TEST 4 : luasocket sslhandshake() compat
166+ === TEST 5 : luasocket sslhandshake() compat
141167--- http_config eval
142168"$t::Utils::HttpConfig"
143169--- config
You can’t perform that action at this time.
0 commit comments