1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 02:33:17 +02:00
Commit Graph

78 Commits

Author SHA1 Message Date
Sara Golemon 10a0500ad9 MFH: BugFix#28868 Wrapper hash not thread-safe 2004-06-21 19:33:48 +00:00
Ilia Alshanetsky 349a98d388 MFH: persistent streams patch 2003-07-29 18:26:59 +00:00
Sara Golemon 97b55a966d Plug the last (hopefully) of the PHP4 context leaks. This one regarding notifier->ptr 2003-06-27 16:16:46 +00:00
foobar 8506ee1bfe - Re-added the FD lexer patch.
# Marcus is going to add the long-opts patches back in after this.
2003-05-31 01:37:45 +00:00
Zeev Suraski b831413ba7 Remove php_stream_open_wrapper_as_file_handle, it was fd-patch specific 2003-05-21 10:19:03 +00:00
Sascha Schumann 7017cc588c Use and supply zend_open func 2003-05-13 23:09:27 +00:00
Wez Furlong 3b2f0b8ac4 Fix erroneous error status when attempting to use stream_select() on an SSL
stream.  As a by-product, this also fixes Bug #22238, stream_select() clobbers
read buffer for pipes.
2003-05-13 00:18:27 +00:00
Wez Furlong 4a8de5c704 Manual merge of the persistent plain file streams code.
See http://news.php.net/article.php?group=php.cvs&article=19680 for
more information.
2003-03-18 23:39:31 +00:00
Wez Furlong ca552c2618 Avoid using FILE* unless we have to. 2003-03-18 16:39:06 +00:00
Sascha Schumann 97301cbc36 MFH 2003-02-27 10:07:59 +00:00
Wez Furlong bd55197721 Miscellaneous streams fixes, including probable fixes for:
Bug #21131 (fopen with 'a+' and rewind() doesn't work)
Bug #21713 (include remote files leaks temporary files + descriptors on Solaris)
Bug #21185 (move_uploaded_file() does not ignore open_basedir as it should)
Bug #22362 (combinations of fwrite(), fread() and fseek() produce unexpected results)
2003-02-22 02:43:58 +00:00
Derick Rethans 4e4a4036cf - MFH: Fix warnings on UnixWare 2003-01-02 13:31:30 +00:00
Sebastian Bergmann 03d440e1c0 MFH: Bump year. 2002-12-31 16:27:40 +00:00
Wez Furlong 81bf1d581d Add missing Id tag. 2002-11-17 23:16:45 +00:00
Wez Furlong 463ccd8283 Revise stream shutdown procedure. 2002-11-17 23:08:40 +00:00
Wez Furlong 03851bac05 php_stream_fopen_tmpfile now uses php_open_temporary_file rather than
tmpfile().
tmpfile() under win32 will try to use the root directory; the default
IIS settings prohibit access to the root directory, which renders tmpfile()
useless.
PHP's tmpfile() streams are correctly cleaned up and unlinked when closed
(or at request shutdown).  However, if the stream is cast and passed to
a third party library, the temporary file may linger.
This is unfortunate, since streams uses this process internally for handling
the casting of user-streams.
--> some more work is needed on this, but this can be done more easily under
Linux.
2002-11-16 22:59:55 +00:00
Wez Furlong c52b6d3fc0 Make include/require of user-streams work on systems without fopencookie. 2002-11-16 11:39:36 +00:00
Marcus Boerger a73e74c2f8 Make the macro use the function and not the other macro as discussed
with Wez.
2002-11-06 00:17:44 +00:00
Marcus Boerger 1f0b200188 php_stream replacement for fprintf
#Agreed by Wez - I will use this mysel soon.
2002-11-06 00:15:24 +00:00
Marcus Boerger 8f6120fef4 correct define: silences compiler warning in http_fopen_wrapper.c 2002-11-05 11:10:06 +00:00
Ilia Alshanetsky 728eacbf52 A better fix for bug #20110. 2002-10-28 03:45:21 +00:00
Wez Furlong dabf1053cd Refine stream_select() to work with streams that have data in their read
buffers.
When selecting for read, the streams are examined; if any of them have
pending read data, no actual select(2) call is performed; instead the
streams with buffered data are returned; just like a regular select
call.
Prevent erroneous warning in stream_select when obtaining the fd.
2002-10-21 22:54:37 +00:00
Wez Furlong 829f1855fd made fgets() binary safe.
php_stream_gets is now a macro which calls php_stream_get_line. The latter
has an option argument to return the number of bytes in the line.
Functions like fgetcsv(), fgetss() can be made binary safe by calling
php_stream_get_line directly.

# HEADS UP: You will need to make clean after updating your CVS, as the
# binary signature has changed.
2002-10-19 13:11:48 +00:00
Ilia Alshanetsky 4b83b189fe Fixed bug #19971 (optimized the file() function).
The file() function is now also binary safe.
2002-10-18 20:39:49 +00:00
Wez Furlong 077fe52d8b This seems to resolve the issues with fgets.
I've moved EOF detection into the streams layer; a stream reader
implementation should set stream->eof when it detects EOF.
Fixed test for user streams - it still fails but that is due to an output
buffering bug.
2002-10-05 10:35:13 +00:00
Wez Furlong 9c5883bdf6 replace dont_block with a flag. 2002-10-04 18:59:34 +00:00
Sascha Schumann 4f7e6dadd8 Improve the general behaviour of stream_gets and fix its semantics
with regard to sockets. The behaviour should be aligned with PHP 4.2 now.
This has been verified to some degree.

If the underlying stream operations block when no new data is readable,
we need to take extra precautions.

If there is buffered data available, we check for a EOL. If it exists,
we pass the data immediately back to the caller. This saves a call
to the read implementation and will not block where blocking
is not necessary at all.

If the stream buffer contains more data than the caller requested,
we can also avoid that costly step and simply return that data.
2002-10-04 18:21:40 +00:00
Wez Furlong 393d57d5be Differentiate between write buffer and streams read buffer sizes.
Add options for timeout and chunk size; previously these were only
set-able for socket streams.
2002-09-28 22:10:47 +00:00
Wez Furlong 84e0df3dfe Allow user streams/wrappers to implement fstat(), opendir() and stat(). 2002-09-28 13:05:47 +00:00
Wez Furlong 3a67c67737 Rename file_get_wrapper_data -> file_get_meta_data.
It now always returns useful information for all streams.
Unified that data with socket_get_status and made socket_get_status
an alias for file_get_meta_data.

Fix Location header following which was broken in this commit:
http://cvs.php.net/diff.php/php4/ext/standard/http_fopen_wrapper.c?r1=1.41&r2=1.42&ty=h
2002-09-26 10:14:41 +00:00
Wez Furlong 696e0a2301 Implement persistent streams. (for pfsockopen).
Juggle some includes/definitions.
Tidy up streams use in ext/standard/file.c
2002-09-25 15:25:12 +00:00
Wez Furlong 031f019351 Enable include("http://....") under win32 by downloading to a temporary
stream so that flex will get on nicely with the content.
# untested; theoretically it should work just fine.
2002-09-23 19:07:38 +00:00
Wez Furlong ad4afdf827 fix some warnings. 2002-09-23 14:50:21 +00:00
Wez Furlong 9e84b3d5b5 Revise buffer/seek code a little.
Tidy up user streams even more.
Make test case quite aggressive.
2002-09-23 13:22:10 +00:00
Wez Furlong 4d8a07d529 Implement read buffering in streams.
Eliminate similar code from network.c.
Implement fgets equivalent at the streams level, which can detect
the mac, dos and unix line endings and handle them appropriately.
The default behaviour is unix (and dos) line endings.
An ini option to control this behaviour will follow.
# Don't forget to make clean!
# I've done some testing but would appreciate feedback from
# people with scripts/extensions that seek around a lot.
2002-09-23 01:47:04 +00:00
Wez Furlong 3df412cf9b Fix a couple of bad pointer indirections (oops).
Lets stick to a single category of "http" for the "user_agent"
context override.
2002-09-07 20:58:30 +00:00
Anantha Kesari H Y 8b8f1e0590 NetWare related additions/modifications 2002-09-05 14:25:07 +00:00
Wez Furlong c7be7b55d1 Add a "closing" parameter for filters to determine if a flush is the last
flush before the stream is closed.  This allows filters to finish a chunk
and write footers etc.
2002-08-25 10:26:58 +00:00
Wez Furlong 27adb75585 Remove php_stream_error as discussed with Rasmus.
Unify error messages for ext/ftp. (which was using php_stream_error).
2002-08-25 10:10:23 +00:00
Wez Furlong 9d348ea800 Implement filter API for streams.
Filters can be stacked onto a stream; more details will follow in docs and
on php-dev.

Implement "string.rot13" filter

Allows the following script:

$fp = fopen("file.txt", "r");
stream_filter_prepend($fp, "string.rot13");

// File contents will be subject to a rot13 transformation before
// being output.
fpassthru($fp);
fclose($fp);
2002-08-20 20:47:47 +00:00
Wez Furlong 5f9a5a7c8e Remove php_stream_sock_set_blocking and replace with
php_stream_set_option which can be used in a similar way as ioctl()
to set options for streams.

Current options include buffering and blocking support.

o Buffer control is support for stdio based streams.
o Blocking/non-blocking is supported for stdio and socket based streams.
2002-08-19 22:59:10 +00:00
Wez Furlong c2cbae6dd3 Enhance Ilia's recent patch to query the wrapper subsystem to determine
if a filename is a URL and thus if safe-mode checks should be skipped.
2002-08-16 09:50:24 +00:00
Wez Furlong bcef712ad6 Properly implement TSRM parameters to the new log_error
function... (Thanks Marcus!)
Add a convenience macro for importing a stream from a zval.
2002-08-11 14:29:01 +00:00
Wez Furlong 5a21ab42cb Introduce an error stack for wrappers, to help prevent multiple errors
and warnings (some of which are bogus) when there are problems opening
streams.
Implement sanity check on the mode used to open ftp and http connections.
This fixes Bug 12004.
2002-08-11 10:53:10 +00:00
Hartmut Holzgraefe c39a3bc880 macro definition fixed, guess it was the usual kind of cut&past bug? 2002-06-11 09:36:48 +00:00
Markus Fischer 0cd40c2808 - Since streams are always enabled, instead of just printing 'enabled' we tell
what streams are currently registered.
2002-06-08 10:25:44 +00:00
Wez Furlong 37411dd674 Implement context option setting API.
Add/amend debugging code for sockets.
Add a flag that will help the http wrapper optimize itself when
it is not being used for include/require.
2002-04-30 00:16:00 +00:00
Wez Furlong b10b24d50c Always initialize wrappers, regardless of PG(allow_url_fopen).
Add is_url field to wrapper structure; the stream wrapper openers
will disallow opening is is_url && !PG(allow_url_fopen).
Add infrastructure for stat($url) and opendir($url).
Tidy up/centralize code that locates and instantiates wrappers for the
various operations.
Implement opendir for plain files.
Make the PHP opendir and dir functions use the streams implementations.
Add modelines for syntax highlighting the pear scripts in vim
2002-04-16 22:14:27 +00:00
Frank M. Kromann 643fb6dcdf Adding PHPAPI needed for exif on Win32 2002-04-15 22:22:53 +00:00
Wez Furlong e2f00a130f fix segfault 2002-04-12 18:17:19 +00:00