Skip to content

Commit c99d55b

Browse files
takluyverbdarnell
authored andcommitted
Replace deprecated pycurl IOCTLFUNCTION callback with SEEKFUNCTION
1 parent 2761431 commit c99d55b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎tornado/curl_httpclient.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,12 @@ def write_function(b: Union[bytes, bytearray]) -> int:
484484
raise ValueError("Body must be None for GET request")
485485
request_buffer = BytesIO(utf8(request.body or ""))
486486

487-
def ioctl(cmd: int) -> None:
488-
if cmd == curl.IOCMD_RESTARTREAD: # type: ignore
489-
request_buffer.seek(0)
487+
def seek(offset: int, origin: int) -> int:
488+
request_buffer.seek(offset, origin)
489+
return pycurl.SEEKFUNC_OK
490490

491491
curl.setopt(pycurl.READFUNCTION, request_buffer.read)
492-
curl.setopt(pycurl.IOCTLFUNCTION, ioctl)
492+
curl.setopt(pycurl.SEEKFUNCTION, seek)
493493
if request.method == "POST":
494494
curl.setopt(pycurl.POSTFIELDSIZE, len(request.body or ""))
495495
else:

0 commit comments

Comments
 (0)