@@ -0,0 +1,2244 @@
+#!/usr/bin/python%0A%0Aimport sys%0Aimport pycurl%0A%0Asaw_error = 1%0A%0Adef main():%0A        global saw_error%0A%0A        pycurl.global_init(pycurl.GLOBAL_DEFAULT)%0A%0A        outf = file(%22/dev/null%22, %22rb+%22)%0A        cm = pycurl.CurlMulti()%0A%0A        # Set multi handle's options%0A        cm.setopt(pycurl.M_PIPELINING, 1)%0A%0A        eh = pycurl.Curl()%0A%0A        for x in range(1, 20):%0A%0A                eh.setopt(pycurl.WRITEDATA, outf)%0A                eh.setopt(pycurl.URL, sys.argv%5B1%5D)%0A                cm.add_handle(eh)%0A%0A                while 1:%0A                        ret, active_handles = cm.perform()%0A                        if ret != pycurl.E_CALL_MULTI_PERFORM:%0A                                break%0A%0A                while active_handles:%0A                        ret = cm.select(1.0)%0A                        if ret == -1:%0A                                continue%0A                        while 1:%0A                                ret, active_handles = cm.perform()%0A                                if ret != pycurl.E_CALL_MULTI_PERFORM:%0A                                        break%0A%0A                count, good, bad = cm.info_read()%0A%0A                for h, en, em in bad:%0A                        print %22Transfer to %25s failed with %25d, %25s%5Cn%22 %25 %5C%0A                            (h.getinfo(pycurl.EFFECTIVE_URL), en, em)%0A                        raise RuntimeError%0A%0A                for h in good:%0A                        httpcode = h.getinfo(pycurl.RESPONSE_CODE)%0A                        if httpcode != 200:%0A                                print %22Transfer to %25s failed with code %25d%5Cn%22 %25%5C%0A                                    (h.getinfo(pycurl.EFFECTIVE_URL), httpcode)%0A                                raise RuntimeError%0A%0A                        else:%0A                                print %22Recd %25d bytes from %25s%22 %25 %5C%0A                                    (h.getinfo(pycurl.SIZE_DOWNLOAD),%0A                                    h.getinfo(pycurl.EFFECTIVE_URL))%0A%0A                cm.remove_handle(eh)%0A                eh.reset()%0A%0A        eh.close()%0A        cm.close()%0A        outf.close()%0A%0A        pycurl.global_cleanup()%0A%0A%0Aif __name__ == '__main__':%0A        if len(sys.argv) != 2:%0A                print %22Usage: %25s %3Curl%3E%22 %25 sys.argv%5B0%5D%0A                sys.exit(2)%0A        main()%0A%0A

Test for reset fixes refcount bug