Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Remove follow redirects. #1461

Merged
merged 4 commits into from Aug 31, 2012
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions libraries/joomla/http/transport/curl.php
Expand Up @@ -135,9 +135,6 @@ public function request($method, JUri $uri, $data = null, array $headers = null,
// Link: http://the-stickman.com/web-development/php-and-curl-disabling-100-continue-header/
$options[CURLOPT_HTTPHEADER][] = 'Expect:';

// Follow redirects.
$options[CURLOPT_FOLLOWLOCATION] = true;

// Set the cURL options.
curl_setopt_array($ch, $options);
Copy link
Contributor

Choose a reason for hiding this comment

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

For now, would it be ok to just change this to:

$options[CURLOPT_FOLLOWLOCATION] = (bool) $this->options->get('curl.followLocation', true);

If we can support it in the other transports it won't be hard to support it with a generic option. It would be good to document the options that are available, probably in the this class constructor Docblock.

Does that get you out of trouble?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this will solve my problem, I just thought it would be better not to follow redirects automatically. In this case it would be a good idea to set the CURLOPT_MAXREDIRS in order to specify the maximum number of redirects to follow, avoiding infinite loops.

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using a curl specific option, why not use a generic name like the stream options (follow_location or max_redirects) and then at the transport level map them onto their respective options. This will automatically work for stream as it passes in the HTTP options straight through and cURL will require some level of custom handling either.

Safe mode is gone in PHP 5.4 as well.


Expand Down