-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
When connecting a server running this php sample
<?php
set_time_limit(0);
ob_start();
header('Content-type: text/plain');
header("Content-Encoding: none");
echo "OK";
header('Content-Length: '.ob_get_length());
header('Connection: close');
ob_end_flush();
@ob_flush();
flush();
if(session_id()) session_write_close();
sleep(10);
die("Client should never see this");
?>
if you view this page in a web browser or in curl you will only get OK
, however urequests.get
ignores the content length and waits for sleep to finish and get the die message before returning content, urequests.head has the same issue except you can't get the status_code
i managed to fix this, but my fix does nothing when i import
it even though it works if i copy/paste the library inside my script
this was how i fixed it
@property
def content(self):
if self._cached is None:
try:
if(self.headers["Content-Length"]):
self._cached = self.raw.read(int(self.headers["Content-Length"]))
else:
self._cached = self.raw.read()
finally:
self.raw.close()
self.raw = None
return self._cached
Metadata
Metadata
Assignees
Labels
No labels