Commit Graph

230 Commits

Author SHA1 Message Date
Antony Dovgal
2a83dbdf1c revert the patch, the problem seems to be somewhere else 2005-04-11 15:19:27 +00:00
Sara Golemon
dc8823b565 Fold validation into an inlined function per Andi's suggestion 2005-04-09 19:36:49 +00:00
Uwe Schindler
cd47b3c542 Bug #32614 - prevent from crahsing with segfault on solaris if fdopen() fails - this fixes NOT the stdio-problem on solaris! 2005-04-07 07:29:14 +00:00
Ilia Alshanetsky
a7ae41bf89 Fixed bug #31363 (broken non-blocking flock()).
# Patch by ian at snork dot net
2005-04-06 13:57:30 +00:00
Antony Dovgal
e7a2efe053 do not try to read after EOF 2005-04-06 08:26:06 +00:00
Ilia Alshanetsky
d9aea604b3 Fixed bug #30362 (stream_get_line() not reading data correctly). 2005-04-05 03:00:04 +00:00
Sara Golemon
51852db0df BugFix #32563
This could have been done in stream_wrapper_register()
without introducing the slight performance hit on
wrapper registration since anyone registering a wrapper
in an extension should know better.

The important thing is that since locate_wrapper makes
the assumption that all schemes will be /^[a-z0-9+.-]+$/i
Anything which registers them should make the same assumption as well.
2005-04-04 19:34:32 +00:00
Sara Golemon
29ede46872 BugFix #31137 stream_filter_remove() segfaults when stream already closed 2005-03-29 04:02:03 +00:00
Rasmus Lerdorf
00832b763f Silence a warning here on systems where off_t is a long long. 2005-03-17 16:26:24 +00:00
Andi Gutmans
f4cdd366e1 - Fix comment 2005-02-24 03:04:57 +00:00
Ilia Alshanetsky
8aaafb1ae9 Increase maximum mmapable file size to 2mb from 1mb. 2005-02-23 22:41:05 +00:00
Ilia Alshanetsky
c7b931d80d Fixed bug #31515 (Improve performance of scandir() by factor of 10 or so). 2005-02-22 00:24:13 +00:00
Wez Furlong
f400f0e665 add an open mode for the memory streams that allows the stream to take
ownership of the passed-in buffer
2005-02-06 21:41:36 +00:00
Ilia Alshanetsky
d98a44d483 Fixed bug #29801 (Set limit on the size of mmapable data). 2004-11-15 23:43:12 +00:00
Rob Richards
d563495a24 add support for file://localhost/
support file:/// under windows again
2004-11-11 13:08:32 +00:00
Antony Dovgal
aa35b11afe fix Win32 & Netware build 2004-10-28 05:05:20 +00:00
Antony Dovgal
ceacc834fb fix bug #30388 (rename across filesystems loses ownership and permission info) 2004-10-27 11:58:49 +00:00
Ilia Alshanetsky
5c04e39383 Fixed bug #30362 (stream_get_line() not handling end string correctly). 2004-10-11 18:31:49 +00:00
Wez Furlong
b7182e85c7 Fix the return value check too 2004-10-11 01:40:41 +00:00
Wez Furlong
7cb4e769ff check the correct flag for async connect 2004-10-11 01:30:19 +00:00
Christian Stocker
bd99d77bf6 - Fixed bug #27183 (Userland stream wrapper segfaults on stream_write)
Was applied to PHP 4 ages ago, but not to PHP 5 branch
2004-10-08 14:40:11 +00:00
Anantha Kesari H Y
b855337d39 CLIB_STAT_PATCH check is redundant. So removing it 2004-09-23 13:07:43 +00:00
Wez Furlong
ff4e970fb1 Make new poll stuff work on win32 (and still be safe on unix) 2004-09-17 14:36:55 +00:00
Wez Furlong
99e290f882 Fix for Bug #24189: possibly unsafe select(2) usage.
We avoid the problem by using poll(2).

On systems without poll(2) (older bsd-ish systems, and win32), we emulate
poll(2) using select(2) and check for valid descriptors before attempting
to access them via the descriptor sets.

If an out-of-range descriptor is detected, an E_WARNING is raised suggesting
that PHP should be recompiled with a larger FD_SETSIZE (and also with a
suggested value).

Most uses of select(2) in the source are to poll a single descriptor, so
a couple of handy wrapper functions have been added to make this easier.

A configure option --enable-fd-setsize has been added to both the unix and
win32 builds; on unix we default to 16384 and on windows we default to 256.
Windows FD_SETSIZE imposes a limit on the maximum number of descriptors that
can be select()ed at once, whereas the unix FD_SETSIZE limit is based on the
highest numbered descriptor; 256 should be plenty for PHP scripts under windows
(the default OS setting is 64).

The win32 specific parts are untested; will do that now.
2004-09-17 12:44:56 +00:00
Sara Golemon
34550382d8 Added stream_filter_remove() to cancel a stream filter.
Register filters as resources when
instantiated by stream_filter_(ap|pre)pend().

Export php_stream_filter_flush() internal function to wind buffered data
out of a particular filter until consumed by a later filter or sent to
stream->readbuffer or stream->ops->write()
2004-09-14 03:48:17 +00:00
Sara Golemon
9cd4320b65 Allocating hash tables should be done via macro, not directly 2004-09-13 21:07:22 +00:00
Sara Golemon
ed5dcbff9b A little extra code to allow overriding plainfiles wrapper as well 2004-09-10 21:50:29 +00:00
Sara Golemon
955b43ba12 Add stream_wrapper_unregister()
Disables a wrapper (user-defined or built-in) for the life of the request.

Add stream_wrapper_restore()
Restores the wrapper originally defined at the time the request started
to the protocol name mentioned.
2004-09-10 20:45:35 +00:00
Sara Golemon
d179ac771c Handle maxlen when stream can't be mmaped 2004-09-08 18:42:15 +00:00
Antony Dovgal
fd6d9cbeac fix bug #29723 (file_get_contents() fails with the file:// wrapper under Win32) 2004-08-31 11:37:02 +00:00
Ilia Alshanetsky
c84bd49fb5 Using int when long should be used. 2004-08-22 18:05:24 +00:00
Wez Furlong
b21a7357fc Fix for #29256 from Dmitry, very slightly modified 2004-08-10 13:44:43 +00:00
Wez Furlong
d0be029908 zts fix... 2004-07-31 16:34:44 +00:00
Wez Furlong
ae7285d658 Misc sendto/recvfrom tweaks that have been pending here for a while... 2004-07-31 10:56:55 +00:00
Wez Furlong
05a3fabacb Make sure this is initialized... 2004-07-31 10:49:09 +00:00
Wez Furlong
71078de71a Implement an fstat cache for plain files. 2004-07-31 10:09:25 +00:00
Wez Furlong
971fcd4254 Looks like Sara forgot to change this too. 2004-07-13 16:34:56 +00:00
Wez Furlong
ae40d0ef2a Fix file_get_contents() bug... 2004-07-12 20:59:24 +00:00
Wez Furlong
cd732f1a3f RIP: greedy ready problems
This allows people to use fread($fp, filesize($filename)) for regular files,
but packet-based non-greedy reads for everything else.
2004-07-10 10:54:09 +00:00
Wez Furlong
8f435013ff Fix for Bug #28964 fread "greedy" behaviour 2004-06-29 21:51:53 +00:00
Sara Golemon
a2c24ae90e BugFix#28868 (Part Two): This fixes thread unsafety in the userspace
filters which relates to the fix just applied for userspace wrappers.
2004-06-21 21:08:05 +00:00
Sara Golemon
7fcfa8865e BugFix#28868: Wrapper hash not thread-safe.
Userdefined wrappers were being registered into a global wrapper hash
which can cross threads.  Termination of once instance then has the
potential to leave an active stream in another instance with no wrapper
leading to segfault.
2004-06-21 18:58:55 +00:00
Wez Furlong
b369925372 Fix #25939 for good this time.
# How could I miss this??
2004-05-27 13:04:14 +00:00
Wez Furlong
dd9ac710f1 Fix silly mistake.
Thanks Antony :)
2004-05-26 21:19:21 +00:00
Wez Furlong
6873d6839d *sigh*, obviously, we need this to be able to use sapi_module.name 2004-05-25 13:23:20 +00:00
Wez Furlong
ff0ee48537 DEBUG -> PHP_DEBUG 2004-05-25 13:17:01 +00:00
Wez Furlong
146255f35c check if it matches... not if it doesn't... 2004-05-25 13:00:25 +00:00
Wez Furlong
c6dff79138 In debug mode, under CLI don't close stderr.
This is so that we can see any error reports.

# for extra paranoia, could limit this check to happen only after the script is
# finished running.
2004-05-25 12:59:15 +00:00
Sara Golemon
0dae58bb2a Bugfix #28300 Userspace stream/filter names don't need to be lowercased. 2004-05-06 14:29:33 +00:00
Sara Golemon
0180c36951 BugFix#28287 stream_*_register() not calling __autoload(). 2004-05-05 18:18:57 +00:00
Wez Furlong
0fb4bf9771 Fixed bug #19749 (shouldn't mmap() files larger than memory_limit) 2004-04-21 12:02:47 +00:00
Sara Golemon
fac9416797 Only wind filters when appending to the read chain. 2004-04-01 03:52:34 +00:00
Sara Golemon
002f7ef393 This leaks when a stream opener proxy opens another stream. 2004-04-01 01:07:54 +00:00
Sara Golemon
72616e6eae BugFix#27619
Filters not applied to pre-buffered stream data.
(esp. http:// streams)
2004-03-31 23:48:59 +00:00
Sara Golemon
581948ab00 Provide a meaningful error message when registration fails 2004-03-17 00:08:22 +00:00
Ilia Alshanetsky
88058e5715 Fixed bug #27498 (bogus safe_mode error on nonexistent directories for
chdir() and opendir() functions).
2004-03-16 23:23:17 +00:00
Ard Biesheuvel
b303ba089c More wordsize fixes 2004-03-08 23:11:45 +00:00
Wez Furlong
70757063a7 add cast for qsort compare function.
Kinda ugly, but helps assert that we are doing the right thing as well as
kill the warning there.
2004-03-07 22:06:36 +00:00
Wez Furlong
1e35cf4f32 Connect feof() call to user-space stream feof() method.
Fixes Bug #27417 and #27508
2004-03-07 22:05:21 +00:00
Wez Furlong
0dd2280102 Less magic please 2004-03-07 21:36:55 +00:00
Jon Parise
4db900732d Cast the php_stream_dirent to a 'const char *' for estrndup() to avoid a
compiler warning.
2004-03-01 07:02:23 +00:00
Sara Golemon
860daac5d8 Must addref the resource when we make a new zval reference to it that will be exported to userspace. 2004-03-01 05:33:19 +00:00
Hartmut Holzgraefe
8c32fa79d7 EXTERN_C wrapping for PHPAPI prototypes
(Zend and main should now be ok)
2004-02-20 08:22:12 +00:00
Wez Furlong
a44838e8a3 Fix a bug in the persistent socket liveness checks and feof(); they were
using the default socket timeout of 60 seconds before returning the socket
to the calling script.  The reason they were using that value is that the
same code is used for feof(), so the fix is allowing the caller to
indicate the timeout value for liveness checks.

A possible remaining issue now is that 0 second timeout[1] for pfsockopen
is possibly too short; it's impossible to specify a sane value for all
possible uses, so maybe we need a stream context or an .ini option to
control this, or maybe use the timeout value that was passed to
pfsockopen().

# [1] by timeout, I mean the time that PHP will wait for data on a
# persistent socket before deciding if a new connection should be made;
# NOT the timeout while waiting for a new connection to be established.
2004-02-04 22:46:44 +00:00
Sara Golemon
6d10371ec6 'Bug Fix': scandir, being a new function in PHP5 should have always been wrapper aware. 2004-01-28 22:21:54 +00:00
Wez Furlong
e1ae61802b Fix segfault for scripts like this:
<?php
pfsockopen("foo");
pfsockopen("foo");
?>
Where the transport fails to connect (since args are bogus);
the problem was that the persistent stream entry was not
correctly freed.
2004-01-27 22:40:44 +00:00
Ilia Alshanetsky
4cc62a06f6 Removed unused variable. 2004-01-27 03:20:35 +00:00
Hartmut Holzgraefe
234e8a76c4 stream_lock() method added to userspace streams wrapper 2004-01-21 10:17:12 +00:00
Ilia Alshanetsky
eb3ff409b0 Fixed bug #26974 (rename() doesn't check the destination file
against safe_mode/open_basedir).
2004-01-21 02:28:50 +00:00
foobar
ccfc46b0aa - Happy new year and PHP 5 for rest of the files too..
# Should the LICENSE and Zend/LICENSE dates be updated too?
2004-01-08 17:33:29 +00:00
Andi Gutmans
dbeb4158d2 - A belated happy holidays and PHP 5 2004-01-08 08:18:22 +00:00
Wez Furlong
ab11c8c5ba MFB fix for #25597 2003-12-20 20:25:55 +00:00
Ilia Alshanetsky
1128955aa4 Fixed compiler warnings. 2003-12-14 18:23:15 +00:00
Sara Golemon
822ea95785 Export STREAM_MKDIR_RECURSIVE constant 2003-12-13 23:13:51 +00:00
Sara Golemon
a67bf6ecc9 Fix Win32 Build. mkdir/rmdir are macros 2003-12-13 18:48:39 +00:00
Sara Golemon
c56647833b Route mkdir()/rmdir() via wrapper ops.
Move current rmdir()/rmdir() code to plain_wrappers.c
Implement mkdir()/rmdir() in ftp:// wrapper
2003-12-13 04:07:18 +00:00
Sara Golemon
b1f8236b63 Route rename() via wrapper ops.
Move current rename() code to main/streams/plain_wrapper.c
Implement ftp/rename()
Implement userstreams/rename()
2003-12-12 23:06:42 +00:00
Wez Furlong
ab0029cabf Be smarter about which systems should register unix transports.
Fix skip conditions in these network tests
2003-12-05 13:41:02 +00:00
Sara Golemon
dacb3a68fe Register url_stat flag constants in userspace 2003-12-02 20:06:40 +00:00
Sara Golemon
1aaf7da2ce Populate userstream objects with context property 2003-12-02 19:14:31 +00:00
Sara Golemon
88ccc6a630 Update userspace/url_stat proto 2003-12-02 18:52:58 +00:00
Wez Furlong
da9093be3a this can't be persistent 2003-12-02 16:35:19 +00:00
Sara Golemon
dbfe62117b CS 2003-12-02 01:04:14 +00:00
Sara Golemon
681d18effd Move safemode/basedir checks for url_stat to plain_wrapper. 2003-12-01 19:47:05 +00:00
Ilia Alshanetsky
c344754d48 Removed unused variables. 2003-11-30 19:43:30 +00:00
Wez Furlong
37f135ceef Add stream_socket_sendto and stream_socket_recvfrom which work very much
like sendto() and recvfrom() syscalls.
2003-11-29 21:46:50 +00:00
Sara Golemon
026d4c9e4c Route php_stat() via streams/url_stat API (php_stream_stat_path).
This enables fopen-wrappers support on stat() and related family calls.
2003-11-28 23:25:28 +00:00
Wez Furlong
6d86bb9e40 (sort of) MFB, feof fix for sockets. 2003-11-28 23:20:23 +00:00
Ilia Alshanetsky
baced1d63d Fixed a memory leak. 2003-11-28 00:00:28 +00:00
Wez Furlong
3ee72aa5be port "liveness" checks and a couple of other things from the 4.3 branch.
Liveness checks are used to validate persistent socket connects when they
are re-used.
2003-11-27 17:39:01 +00:00
Sara Golemon
0831f2b03a Fix for file:// wrapper parsing.
(Cristiano Duarte <cunha17@uol.com.br>)
2003-11-23 17:35:00 +00:00
Derick Rethans
3ab8d263b8 - Always store the URI path in the streams structure, and expose it with
stream_get_meta_data().
2003-11-03 14:12:46 +00:00
Sara Golemon
495fd01ca4 Stop looking once we've found a matching filter. 2003-10-28 23:29:16 +00:00
Sara Golemon
c9b49af990 Extend Filter matching to check wildcards at multiple levels.
Ex:  foo.bar.baz.bomb
Searches:
     foo.bar.baz.bomb itself,
     foo.bar.baz.*,
     foo.bar.*, and
     foo.*

Also changed tempvar "char wildcard[128];" to an estrdup() to
deal with potential filternames longer than 127 bytes.
2003-10-28 21:52:59 +00:00
Shane Caraveo
3a6ff32e2b finish file uri support, this stuff was unecessary. 2003-10-19 21:19:54 +00:00
Shane Caraveo
2a41429472 A simpler patch to add file uri support 2003-10-19 20:59:12 +00:00
Shane Caraveo
0029a45795 revert file: support in preparation for simpler patch 2003-10-19 20:57:20 +00:00
Shane Caraveo
e5103d764a make file uri's work with streams 2003-10-19 20:04:33 +00:00
Wez Furlong
590b3ccc79 Set the EOF indicator after each read attempt.
This prevents it getting stuck in the on position.
2003-10-08 10:55:51 +00:00
Marcus Boerger
3cf2d2f108 Show the whole message when in debug mode 2003-09-13 19:56:38 +00:00