Skip to content

Commit 1738369

Browse files
committed
Fix. multi iterator in v2 and v3 API.
1 parent 010a54e commit 1738369

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/lua/cURL/impl/cURL.lua

+18-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ local function make_iterator(self, perform)
9999

100100
if n <= remain then
101101
while true do
102-
local h, ok, err = assert(self:info_read())
103-
if h == 0 then break end
104-
local e = assert(self._easy[h])
102+
local e, ok, err = assert(self:info_read())
103+
if e == 0 then break end
105104
if ok then
106105
ok = e:getinfo_response_code() or ok
107106
buffers:append(e, "done", ok)
@@ -423,6 +422,22 @@ function Multi:remove_handle(e)
423422
return remove_handle(self, h)
424423
end
425424

425+
function Multi:info_read(...)
426+
while true do
427+
local h, ok, err = self:handle():info_read(...)
428+
if not h then return nil, ok end
429+
if h == 0 then return h end
430+
431+
local e = self._easy[h]
432+
if e then
433+
if ... then
434+
self._easy[h], self._easy.n = nil, self._easy.n - 1
435+
end
436+
return e, ok, err
437+
end
438+
end
439+
end
440+
426441
end
427442
-------------------------------------------
428443

0 commit comments

Comments
 (0)