-
Notifications
You must be signed in to change notification settings - Fork 298
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
Added (and set as default) a cURL-based method for fetching HTTP content #624
Conversation
Thanks! A few remarks:
|
I think it is fixed now, for the first remark. For the latter one, I can return an empty body on 40x HTTP codes, even though the body would be still downloaded. |
Nah, I like what you did, removing the |
. ',en-US;q=0.7,en;q=0.3'; | ||
|
||
if (!function_exists('curl_init')) { | ||
return get_http_response_fallback($cleanUrl, $timeout, $maxBytes, |
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.
If the arguments list is too long, we usually use one line per argument, as stated in PSR-2.
OK to do that, but I would remove the condition on line 159 too. |
No. We make an extra request changing one parameter if we don't get a HTTP 200. However, if we already have a valid response, the extra request is not necessary. |
OK, I made all the changes you stated. And also:
I also noticed that |
You're right, I don't know how I didn't see that. A bit of clean up could be done later. I'll run a few tests but I'm OK with the current PR. Could you squash your commits and update the wiki? |
Yes, I can. Which commit structure do you want? |
You changed one file for one feature, I'd say one commit is fine. |
7d3a284
to
39819a4
Compare
Tested, it works fine. |
* @param int $maxBytes maximum downloaded bytes | ||
* @param string $userAgent "User-Agent" header | ||
* @param string $acceptLanguage "Accept-Language" header | ||
* @param int $maxRedr maximum amonut of redirections followed |
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.
*amount
+1 for merging, PR tested with a few known-to-be-problematic web sites listed in #531 Btw, this list of problematic websites could be used to add functional (vs. unitary) test suites, to check Shaarli code against real-world conditions. Let me know if there's interest, this would be quite easy to add through PHPUnit's configuration. |
…cy fixup between both methods
39819a4
to
634783f
Compare
@virtualtam It would be interesting indeed. However, aren't functional tests supposed to test the application a whole, meaning fire up a web server, login, etc., instead of components? @julienCXX Thanks again! |
Well, you can test both; usually functional tests cover a whole feature in real-world conditions, but can also be used to check features that cannot be covered through unitary tests, e.g. accessing external services. We actually do have such tests, I think most of them are related to |
Relates to shaarli#607 Relates to shaarli#612 Relates to shaarli#624 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Additions: - [all][env] set $TERM=dumb to avoid debconf-related issues - [all][pkg] install ca-certificates - [all][pkg] cleanup APT cache after installing packages - [dev] refactor Dockerfile TODO: - [prod][php] use Composer to resolve PHP dependencies - [prod] refactor Dockerfile Signed-off-by: VirtualTam <[email protected]>
Relates to shaarli#607 Relates to shaarli#612 Relates to shaarli#624 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [all][env] set $TERM=dumb to avoid debconf-related issues - [all][pkg] install ca-certificates - [all][pkg] cleanup APT cache after installing packages - [dev] refactor Dockerfile - [prod][master][php] use Composer to resolve PHP dependencies - [prod][master] refactor Dockerfile TODO: - [prod][stable][php] use Composer to resolve PHP dependencies - [prod][stable] refactor Dockerfile Signed-off-by: VirtualTam <[email protected]>
Relates to shaarli#607 Relates to shaarli#612 Relates to shaarli#624 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [all][env] set $TERM=dumb to avoid debconf-related issues - [all][pkg] install ca-certificates - [all][pkg] cleanup APT cache after installing packages - [dev] refactor Dockerfile - [prod][master][php] use Composer to resolve PHP dependencies - [prod][master] refactor Dockerfile Commented modifications: - [prod][stable][php] use Composer to resolve PHP dependencies - [prod][stable] refactor Dockerfile Signed-off-by: VirtualTam <[email protected]>
Relates to shaarli#607 Relates to shaarli#612 Relates to shaarli#624 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [all][env] set $TERM=dumb to avoid debconf-related issues - [all][pkg] install ca-certificates - [all][pkg] cleanup APT cache after installing packages - [dev] refactor Dockerfile - [prod][master][php] use Composer to resolve PHP dependencies - [prod][master] refactor Dockerfile - [prod][stable] refactor Dockerfile Commented modifications: - [prod][stable][php] use Composer to resolve PHP dependencies Signed-off-by: VirtualTam <[email protected]>
Relates to shaarli#607 Relates to shaarli#612 Relates to shaarli#624 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [all][env] set $TERM=dumb to avoid debconf-related issues - [all][pkg] install ca-certificates - [all][pkg] cleanup APT cache after installing packages - [dev] refactor Dockerfile - [prod][master] refactor Dockerfile - [prod][master][php] use Composer to resolve PHP dependencies Signed-off-by: VirtualTam <[email protected]>
Relates to shaarli#607 Relates to shaarli#612 Relates to shaarli#624 Relates to shaarli#633 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [prod][stable] refactor Dockerfile - [prod][stable] set $TERM=dumb to avoid debconf-related issues - [prod][stable] install ca-certificates - [prod][stable] cleanup APT cache after installing packages - [prod][stable] use Composer to resolve PHP dependencies Signed-off-by: VirtualTam <[email protected]>
Relates to #607 Relates to #612 Relates to #624 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [all][env] set $TERM=dumb to avoid debconf-related issues - [all][pkg] install ca-certificates - [all][pkg] cleanup APT cache after installing packages - [dev] refactor Dockerfile - [prod][master] refactor Dockerfile - [prod][master][php] use Composer to resolve PHP dependencies Signed-off-by: VirtualTam <[email protected]>
Relates to #607 Relates to #612 Relates to #624 Relates to #633 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [prod][stable] refactor Dockerfile - [prod][stable] set $TERM=dumb to avoid debconf-related issues - [prod][stable] install ca-certificates - [prod][stable] cleanup APT cache after installing packages - [prod][stable] use Composer to resolve PHP dependencies Signed-off-by: VirtualTam <[email protected]>
Relates to shaarli#607 Relates to shaarli#612 Relates to shaarli#624 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [all][env] set $TERM=dumb to avoid debconf-related issues - [all][pkg] install ca-certificates - [all][pkg] cleanup APT cache after installing packages - [dev] refactor Dockerfile - [prod][master] refactor Dockerfile - [prod][master][php] use Composer to resolve PHP dependencies Signed-off-by: VirtualTam <[email protected]>
Relates to shaarli#607 Relates to shaarli#612 Relates to shaarli#624 Relates to shaarli#633 See https://github.com/shaarli/Shaarli/wiki/Server-requirements Modifications: - [prod][stable] refactor Dockerfile - [prod][stable] set $TERM=dumb to avoid debconf-related issues - [prod][stable] install ca-certificates - [prod][stable] cleanup APT cache after installing packages - [prod][stable] use Composer to resolve PHP dependencies Signed-off-by: VirtualTam <[email protected]>
Implements proposal in #531.
[EDIT 2016-08-10] Relates to sebsauvage#114 (virtualtam)