com php-src: Fix #68291: 404 on urls with '+': sapi/cli/php_c li_server.c sapi/cli/tests/bug68291.phpt
| From: | Christoph Michael Becker | Date: | Sat, 05 Sep 2015 12:34:08 +0000 |
| Subject: | com php-src: Fix #68291: 404 on urls with '+': sapi/cli/php_c li_server.c sapi/cli/tests/bug68291.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88927@lists.php.net to get a copy of this message | ||
Commit: fd94c92171eb4f25a792b38c7754bdd76933ec04
Author: Christoph M. Becker <cmbecker69@gmx.de> Sat, 5 Sep 2015 13:52:41 +0200
Committer: Christoph M. Becker <cmb@php.net> Sat, 5 Sep 2015 14:34:08 +0200
Parents: f9ece839943cccd7095a38a9962e4d9e15ddc404
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fd94c92171eb4f25a792b38c7754bdd76933ec04
Log:
Fix #68291: 404 on urls with '+'
URI paths have to be treated according to RFC 3986 by the CLI web server, not
as application/x-www-form-urlencoded.
Bugs:
https://bugs.php.net/68291
Changed paths:
M sapi/cli/php_cli_server.c
A sapi/cli/tests/bug68291.phpt
Diff:
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index e4ea00a..4ed0efb 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -98,7 +98,7 @@
#include "ext/standard/file.h" /* for php_set_sock_blocking() :-( */
#include "ext/standard/php_smart_str.h"
#include "ext/standard/html.h"
-#include "ext/standard/url.h" /* for php_url_decode() */
+#include "ext/standard/url.h" /* for php_raw_url_decode() */
#include "ext/standard/php_string.h" /* for php_dirname() */
#include "php_network.h"
@@ -1577,7 +1577,7 @@ static void normalize_vpath(char **retval, size_t *retval_len, const char
*vpath
return;
}
- decoded_vpath_end = decoded_vpath + php_url_decode(decoded_vpath, vpath_len);
+ decoded_vpath_end = decoded_vpath + php_raw_url_decode(decoded_vpath, vpath_len);
#ifdef PHP_WIN32
{
diff --git a/sapi/cli/tests/bug68291.phpt b/sapi/cli/tests/bug68291.phpt
new file mode 100644
index 0000000..6204230
--- /dev/null
+++ b/sapi/cli/tests/bug68291.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #68291 (404 on urls with '+')
+--INI--
+allow_url_fopen=1
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+include "php_cli_server.inc";
+file_put_contents(__DIR__ . '/bug68291+test.html', 'Found');
+php_cli_server_start(NULL, NULL);
+echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS .
'/bug68291+test.html');
+?>
+--CLEAN--
+<?php
+@unlink(__DIR__ . '/bug68291+test.html');
+?>
+--EXPECT--
+Found