Skip to content

Add fallback support for when cURL multi is not available#17

Closed
westonruter wants to merge 5 commits intowillwashburn:masterfrom
westonruter:add/curl-multi-fallback-support
Closed

Add fallback support for when cURL multi is not available#17
westonruter wants to merge 5 commits intowillwashburn:masterfrom
westonruter:add/curl-multi-fallback-support

Conversation

@westonruter
Copy link
Copy Markdown
Collaborator

Fixes #16.

It turns out that even when cURL is installed, the curl_multi_init() function may be disabled on some hosts who are seeking to guard against DDoS attacks. See ampproject/amp-wp#2183 (comment).

This PR modifies FasterImage::batch() to check if cURL multi is available, and if not, it falls back to doing plain curl_init() calls to obtain the images sequentially.

@westonruter westonruter marked this pull request as ready for review May 19, 2019 04:52
@westonruter
Copy link
Copy Markdown
Collaborator Author

westonruter commented May 19, 2019

@willwashburn Are unit tests on CI not working?

@westonruter
Copy link
Copy Markdown
Collaborator Author

I ran the unit tests locally and they are working when $has_curl_multi is manually set to false per above.

Copy link
Copy Markdown
Owner

@willwashburn willwashburn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome quick work @westonruter ! Always impressed at how quickly you move on this stuff. Only a few suggestions so we can get it all tested and documented.

I'm not sure why Circle isn't running your branch, as it seems to be running when I tired last:
https://circleci.com/gh/willwashburn/fasterimage/33

Perhaps it only runs on my branches?

Also, it seems like this repo might be important to things you work on frequently. Would you like some higher level of commit access here so I am not a risk of blocking you in the future?

Co-Authored-By: Will Washburn <will.washburn@gmail.com>
@westonruter
Copy link
Copy Markdown
Collaborator Author

If you'd like to add me as a pusher to the repo that would be great. Hopefully that would also cause Circle to get triggered.

@westonruter
Copy link
Copy Markdown
Collaborator Author

Ah, Circle is now running the tests from my PR. It may be that I had to be added as a contributor first.

@westonruter
Copy link
Copy Markdown
Collaborator Author

@willwashburn Circle is failing with apparently due to the update of PHPUnit from v4 to v6. Perhaps a Composer cache problem?

@westonruter westonruter requested a review from willwashburn May 21, 2019 21:27
@westonruter
Copy link
Copy Markdown
Collaborator Author

@willwashburn could you please try the “Rebuild without cache”?

image

(I would but there are auth issues for me with GitHub and Circle.)

@willwashburn
Copy link
Copy Markdown
Owner

@westonruter I tried rerunning without the cache but doesn't even seem to be getting there. I think if you make another commit it might actually run (circle is weird)

@westonruter
Copy link
Copy Markdown
Collaborator Author

(I had to also push the commit to a branch on the target repo in order to trigger the build.)

@westonruter
Copy link
Copy Markdown
Collaborator Author

Closing in favor of #18.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fallback support when curl_multi_init() is not available

2 participants