]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Replace deprecated pycurl IOCTLFUNCTION callback with SEEKFUNCTION
authorThomas Kluyver <thomas@kluyver.me.uk>
Wed, 6 May 2026 10:16:36 +0000 (11:16 +0100)
committerThomas Kluyver <thomas@kluyver.me.uk>
Wed, 6 May 2026 10:16:36 +0000 (11:16 +0100)
tornado/curl_httpclient.py

index ecaf1379401db37feedf666fc141ba0da8b14cd4..82f739b5a2052715cbd63d720d2c7d5e7147566f 100644 (file)
@@ -487,12 +487,12 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
                 raise ValueError("Body must be None for GET request")
             request_buffer = BytesIO(utf8(request.body or ""))
 
-            def ioctl(cmd: int) -> None:
-                if cmd == curl.IOCMD_RESTARTREAD:  # type: ignore
-                    request_buffer.seek(0)
+            def seek(offset: int, origin: int) -> int:
+                request_buffer.seek(offset, origin)
+                return pycurl.SEEKFUNC_OK
 
             curl.setopt(pycurl.READFUNCTION, request_buffer.read)
-            curl.setopt(pycurl.IOCTLFUNCTION, ioctl)
+            curl.setopt(pycurl.SEEKFUNCTION, seek)
             if request.method == "POST":
                 curl.setopt(pycurl.POSTFIELDSIZE, len(request.body or ""))
             else: