shane Sun Oct 19 16:59:12 2003 EDT
Modified files:
/php-src/main/streams plain_wrapper.c streams.c
Log:
A simpler patch to add file uri support
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.25
php-src/main/streams/plain_wrapper.c:1.26
--- php-src/main/streams/plain_wrapper.c:1.25 Sun Oct 19 16:57:20 2003
+++ php-src/main/streams/plain_wrapper.c Sun Oct 19 16:59:12 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: plain_wrapper.c,v 1.25 2003/10/19 20:57:20 shane Exp $ */
+/* $Id: plain_wrapper.c,v 1.26 2003/10/19 20:59:12 shane Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -882,6 +882,16 @@
static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, char
*path, char *mode,
int options, char **opened_path, php_stream_context *context
STREAMS_DC TSRMLS_DC)
{
+ char *filename = path;
+ if (!strncasecmp(filename, "file:", sizeof("file:")-1)) {
+ filename += 6;
+ while (*(++filename)=='/');
+#ifdef PHP_WIN32
+ if (*(filename + 1) != ':')
+#endif
+ filename--;
+ }
+
if ((options & USE_PATH) && PG(include_path) != NULL) {
return php_stream_fopen_with_path_rel(path, mode, PG(include_path),
opened_path, options);
}
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.37 php-src/main/streams/streams.c:1.38
--- php-src/main/streams/streams.c:1.37 Sat Sep 13 15:56:38 2003
+++ php-src/main/streams/streams.c Sun Oct 19 16:59:12 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.37 2003/09/13 19:56:38 helly Exp $ */
+/* $Id: streams.c,v 1.38 2003/10/19 20:59:12 shane Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -1415,14 +1415,20 @@
}
/* TODO: curl based streams probably support file:// properly */
if (!protocol || !strncasecmp(protocol, "file", n)) {
- if (protocol && path[n+1] == '/' && path[n+2] == '/') {
+ if (protocol && path[n+1] == '/' && path[n+2] == '/' && path[n+3] !=
'/') {
if (options & REPORT_ERRORS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "remote
host file access not supported, %s", path);
}
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)=='/');
+#ifdef PHP_WIN32
+ if (*(*path_for_open + 1) != ':')
+#endif
+ *path_for_open--;
}
/* fall back on regular file access */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php