File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -556,14 +556,19 @@ function Multi:remove_handle(e)
556556end
557557
558558function Multi :info_read (...)
559- local h , ok , err = self :handle ():info_read (... )
560- if not h then return nil , ok end
561- if h == 0 then return h end
562-
563- if ... and self ._easy [h ] then
564- self ._easy [h ], self ._easy .n = nil , self ._easy .n - 1
559+ while true do
560+ local h , ok , err = self :handle ():info_read (... )
561+ if not h then return nil , ok end
562+ if h == 0 then return h end
563+
564+ local e = self ._easy [h ]
565+ if e then
566+ if ... then
567+ self ._easy [h ], self ._easy .n = nil , self ._easy .n - 1
568+ end
569+ return e , ok , err
570+ end
565571 end
566- return h , ok , err
567572end
568573
569574end
Original file line number Diff line number Diff line change @@ -93,6 +93,20 @@ function test_add_handle()
9393 assert_nil (c )
9494end
9595
96+ function test_info_read ()
97+ local url = ' http://httpbin.org/get?key=1'
98+ c = assert (curl .easy {url = url , writefunction = function () end })
99+ assert_equal (m , m :add_handle (c ))
100+
101+ while m :perform () > 0 do m :wait () end
102+
103+ local h , ok , err = m :info_read ()
104+ assert_equal (c , h )
105+
106+ local h , ok , err = m :info_read ()
107+ assert_equal (0 , h )
108+ end
109+
96110end
97111
98112local _ENV = TEST_CASE ' form' if ENABLE then
You can’t perform that action at this time.
0 commit comments