rrichards Thu Nov 11 08:08:34 2004 EDT
Modified files:
/php-src/main/streams streams.c
Log:
add support for file://localhost/
support file:/// under windows again
http://cvs.php.net/diff.php/php-src/main/streams/streams.c?r1=1.68&r2=1.69&ty=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.68 php-src/main/streams/streams.c:1.69
--- php-src/main/streams/streams.c:1.68 Mon Oct 11 14:31:47 2004
+++ php-src/main/streams/streams.c Thu Nov 11 08:08:32 2004
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.68 2004/10/11 18:31:47 iliaa Exp $ */
+/* $Id: streams.c,v 1.69 2004/11/11 13:08:32 rrichards Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -1492,24 +1492,36 @@
}
/* TODO: curl based streams probably support file:// properly */
if (!protocol || !strncasecmp(protocol, "file", n)) {
-#ifdef PHP_WIN32
- if (protocol && path[n+1] == '/' && path[n+2] == '/' &&
path[n+4] != ':') {
+ if (protocol) {
+ int localhost = 0;
+
+ if (!strncasecmp(path, "file://localhost/", 17)) {
+ localhost = 1;
+ }
+
+#ifdef PHP_WIN32
+ if (localhost == 0 && path[n+3] != '\0' && path[n+3] !=
'/' && path[n+4] != ':') {
#else
- if (protocol && path[n+1] == '/' && path[n+2] == '/' &&
path[n+3] != '/') {
+ if (localhost == 0 && path[n+3] != '/') {
#endif
- if (options & REPORT_ERRORS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
"remote host file access not supported, %s", path);
+ if (options & REPORT_ERRORS) {
+ php_error_docref(NULL TSRMLS_CC,
E_WARNING, "remote host file access not supported, %s", path);
+ }
+ return NULL;
}
- return NULL;
- }
- if (protocol && path_for_open) {
- /* skip past protocol and :/, but handle windows
correctly */
- *path_for_open = (char*)path + n + 1;
- while (*(++*path_for_open)=='/');
+
+ if (path_for_open) {
+ /* skip past protocol and :/, but handle
windows correctly */
+ *path_for_open = (char*)path + n + 1;
+ if (localhost == 1) {
+ (*path_for_open) += 11;
+ }
+ while (*(++*path_for_open)=='/');
#ifdef PHP_WIN32
- if (*(*path_for_open + 1) != ':')
+ if (*(*path_for_open + 1) != ':')
#endif
- (*path_for_open)--;
+ (*path_for_open)--;
+ }
}
if (options & STREAM_LOCATE_WRAPPERS_ONLY) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php