Drupal has a nice function: drupal_http_request that allows you to request remote URLs and get their contents. If this module used this instead of cURL it would reduce the complexity of the code, and wouldn't depend on cURL being around.

Comments

greggles’s picture

Title: Don't use cURL » Use drupal_http_request instead of cURL
Version: 6.x-1.x-dev » 7.x-1.x-dev
BarisW’s picture

Status: Active » Needs review
StatusFileSize
new1018 bytes

See patch

steven jones’s picture

Status: Needs review » Needs work

Thanks for the patch, but...

+++ b/stage_file_proxy.moduleundefined
@@ -66,15 +66,8 @@ function _stage_file_proxy_fetch($server, $remote_file_dir, $relative_path) {
   $response = drupal_http_request($url);
 

I don't think patch is valid, since this line isn't in the codebase, but isn't added by the patch either?

Maybe you've missed some commits in the patch there? Or something else has gone awry.

BarisW’s picture

Status: Needs work » Needs review
StatusFileSize
new1 KB

Ah you are right. Re-rolled.

ericmulder1980’s picture

drupal_http_request is much slower than curl. To make this module more platform independant the switch to drupal_http_request is the correct approach.

Should performance become an issue in the future than the chr module (http://drupal.org/project/chr) could be a nice one to use. You could make this configurable on the settings page and let users choose between drupal_http_request and curl_http_request.

BarisW’s picture

Hi Greg; any updates here? Would love to get this issue and #1895516: Images don't show when they have spaces in folder name in.

greggles’s picture

Status: Needs review » Fixed

Thanks BarisW and Steven Jones - committed http://drupalcode.org/project/stage_file_proxy.git/commit/1cf54fb

I didn't test either patch, but other people have had a reasonable amount of time to test/weigh in and I figure testing is what the -dev branch is for :) Besides, they both sure look sane.

BarisW’s picture

Awesome, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.