Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #26 from sloonz/master

Some changes for better Nginx compatibility
  • Loading branch information...
commit 2c15fc5072bb9cf939cd16bdee3f201ace3b4313 2 parents cc33788 + 8a02a86
Fabrice Luraine authored
Showing with 9 additions and 3 deletions.
  1. +8 −2 lib/limonade.php
  2. +1 −1  lib/limonade/tests.php
View
10 lib/limonade.php
@@ -1044,7 +1044,7 @@ function request_uri($env = null)
$uri = $path_info;
}
// No PATH_INFO?... What about QUERY_STRING?
- elseif (trim($query_string, '/') != '')
+ elseif (trim($query_string, '/') != '' && $query_string[0] == '/')
{
$uri = $query_string;
$get = $env['GET'];
@@ -1058,11 +1058,17 @@ function request_uri($env = null)
}
elseif(array_key_exists('REQUEST_URI', $env['SERVER']) && !empty($env['SERVER']['REQUEST_URI']))
{
- $request_uri = rtrim(rawurldecode($env['SERVER']['REQUEST_URI']), '?/').'/';
+ $request_uri = rtrim($env['SERVER']['REQUEST_URI'], '?/').'/';
$base_path = $env['SERVER']['SCRIPT_NAME'];
if($request_uri."index.php" == $base_path) $request_uri .= "index.php";
$uri = str_replace($base_path, '', $request_uri);
+ if(option('base_uri') && strpos($uri, option('base_uri')) === 0) {
+ $uri = substr($uri, strlen(option('base_uri')));
+ }
+ if(strpos($uri, '?') !== false) {
+ $uri = substr($uri, 0, strpos($uri, '?')) . '/';
+ }
}
elseif($env['SERVER']['argc'] > 1 && trim($env['SERVER']['argv'][1], '/') != '')
{
View
2  lib/limonade/tests.php
@@ -334,7 +334,7 @@ function test_request($url, $method="GET", $include_header=false, $post_data=arr
curl_setopt($curl, CURLOPT_HTTPHEADER, $http_header);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
- if($method == 'POST')
+ if($method == 'POST' || $method == 'PUT')
{
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
Please sign in to comment.
Something went wrong with that request. Please try again.