Skip to content

Commit

Permalink
Fix Response object to handle 303 redirects when open_basedir i…
Browse files Browse the repository at this point in the history
…n effect [#1267]
  • Loading branch information
rhukster committed Jan 21, 2017
1 parent 300f65c commit 6968e2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Added a new `Collection::merge()` method to allow merging of multiple collections [#1258](https://github.com/getgrav/grav/pull/1258)
1. [](#bugfix)
* Fixed an issue when page collection with header-based `sort.by` returns an array [#1264](https://github.com/getgrav/grav/issues/1264)
* Fix `Response` object to handle `303` redirects when `open_basedir` in effect [#1267](https://github.com/getgrav/grav/issues/1267)

# v1.1.14
## 01/18/2017
Expand Down
4 changes: 2 additions & 2 deletions system/src/Grav/Common/GPM/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ private static function curlExecFollow($ch, $options, $callback)
return curl_exec($ch);
}

$max_redirects = isset($options['curl'][CURLOPT_MAXREDIRS]) ? $options['curl'][CURLOPT_MAXREDIRS] : 3;
$max_redirects = isset($options['curl'][CURLOPT_MAXREDIRS]) ? $options['curl'][CURLOPT_MAXREDIRS] : 5;
$options['curl'][CURLOPT_FOLLOWLOCATION] = false;

// open_basedir set but no redirects to follow, we can disable followlocation and proceed normally
Expand All @@ -386,7 +386,7 @@ private static function curlExecFollow($ch, $options, $callback)
$code = 0;
} else {
$code = curl_getinfo($rch, CURLINFO_HTTP_CODE);
if ($code == 301 || $code == 302) {
if ($code == 301 || $code == 302 || $code == 303) {
preg_match('/Location:(.*?)\n/', $header, $matches);
$uri = trim(array_pop($matches));
} else {
Expand Down

0 comments on commit 6968e2e

Please sign in to comment.