-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow size limit of data read #147
Conversation
For the record and posterity : curl has |
Yeah unit test time out. |
This makes more sense and will help understand the code in the future
Conflicts: library/Requests/Transport/cURL.php
* | ||
* @var integer | ||
*/ | ||
const CHUNK = 1160; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably call this BUFFER_SIZE
or similar; chunk might get confusing when dealing with HTTP/1.1 chunked responses.
👍
I wonder if this is the right way to do it. Would we be better off supporting range requests instead? What's the original motivation for your change here? :) (In addition, if we properly support range requests, we'd allow resuming requests properly.) |
It seems that range requests aren't 100% supported by servers and you cannot test beforehand if they are -- see for instance http://stackoverflow.com/questions/985455/curl-how-to-limit-size-of-get/985471#985471 and comments below |
@rmccue Can you trigger the unit tests to restart on Travis for this PR? They timed out after indicating one failure but I'm not sure it's related to that test Also: thoughts on using range requests vs my more compatible approach? |
We need this for rmccue/Requests-WPHTTP#1 - thanks so much for making a start here 💃 I'm going to fork this so I can merge master into it. |
This PR allows to fetch the XXX first bytes of a remote URL
Changes:
response_byte_limit
to limit response body (integer | false)CHUNK
, used to define the buffer chunk size, that was hardcoded in the socket transport class as 1160 and is now used also in the cURL classKey concept with cURL:
Key concept with sockets is obvious, instead of reading till
feof($fp)
you check the size of downloaded stuff so far.