Commit Graph

47 Commits

Author SHA1 Message Date
Wez Furlong
d3d757d95a don't crash... 2004-12-23 05:56:50 +00:00
Wez Furlong
419bbffeef Make it really build... 2004-12-13 13:52:01 +00:00
Wez Furlong
d10b86f8f4 Add stream_socket_pair(), a streams based version of socketpair().
Modified patch from Vincent [six at t0x dot net]
2004-12-12 16:10:35 +00:00
Ilia Alshanetsky
2390ca71f1 MFH: Added optional offset parameter to stream_get_contents(). 2004-10-12 23:25:24 +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
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
Wez Furlong
d0ce6368b1 Avoid possible segfault when using stream_socket_client with bogus flags. 2004-08-06 14:08:17 +00:00
Wez Furlong
47e7fef08e Allow win32 stuff to build non-zts.
Fix stream crypto func (again? didn't I already commit that?)
2004-07-31 17:28:27 +00:00
Ilia Alshanetsky
45ddc6a5cd Better address availability check. 2004-07-28 23:34:27 +00:00
Ilia Alshanetsky
445daac3ab Fixed possible crash in stream_socket_recvfrom() when length parameter has
a negative value.
2004-07-28 23:21:54 +00:00
Wez Furlong
17adf438a2 Added stream_context_get_default() which returns the default context option.
You may then set options that affect streams operations for the whole script.

Added stream_socket_enable_crypto() which allows you to turn on or off a crypto
layer (eg: SSL/TLS) on stream, if supported by the underlying transport.

Registered a bunch of constants for that.
2004-07-22 12:12:28 +00:00
Ard Biesheuvel
5232a5afea 64-bit bugsquash party 2004-06-16 23:57:25 +00:00
Ard Biesheuvel
81f05c18f5 Wordsize fixes 2004-02-25 20:16:27 +00:00
Ard Biesheuvel
b2bc520067 64-bit fixes 2004-02-23 16:26:34 +00:00
Andi Gutmans
dbeb4158d2 - A belated happy holidays and PHP 5 2004-01-08 08:18:22 +00:00
Wez Furlong
7a9cf22ed1 Probable fix for #26534 2003-12-05 20:25:14 +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
Ilia Alshanetsky
e1bdc33d18 More memory leak fixes for stream contexts. 2003-11-28 18:33:14 +00:00
Wez Furlong
43698d6dbb initialize this one to be safe 2003-11-27 17:37:35 +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
Wez Furlong
628afb40b6 Implement stream_get_contents, which is somewhat akin to file_get_contents,
except that it works on an already opened stream.
2003-10-08 10:07:25 +00:00
Jason Greene
7eea6525a7 Fix EINVAL errors for OS's (Solaris + BSD) that do not appreciate microseconds >= 1 second
Patch submitted from meebery@php.net
2003-07-22 07:20:55 +00:00
Wez Furlong
5ecc91c27d Merge selectable descriptor casting from PHP_4_3 branch. 2003-06-28 11:24:47 +00:00
Sara Golemon
2e4ef86e10 MFB
Plug leak in context notifiers, implement notifier->dtor
2003-06-27 16:23:58 +00:00
Sara Golemon
496d17b98d Quiet down decode_context_param when stream (not context) is passed.
Switch stream_socket_*() to use macro for retrieving context from zval.
2003-06-19 22:30:54 +00:00
Ilia Alshanetsky
7ef01f01b9 Reverting previous patch (not necessary, thanks Pollita ;) ) 2003-06-19 21:04:43 +00:00
Ilia Alshanetsky
a370ceb742 Fixed memory leak, when invalid context is specified. 2003-06-19 16:35:17 +00:00
Ilia Alshanetsky
cbfb63c1c4 Fixed possible crashes in streams code 2003-06-19 16:10:54 +00:00
Sara Golemon
897e6a4069 No need to allocate a hashtable when return_value is just going to be overwriten 2003-06-17 18:38:56 +00:00
Sara Golemon
2f4e91bf8a optionvalue is being copied via zval_copy_ctor, there's no need to addref the original 2003-06-16 18:19:14 +00:00
Sara Golemon
99db19661a Plug leak (context options not freed)
Make contexts auto-registered, ensures userland contexts
and C API contexts are both dealt with on request shutdown.
Also brings contexts in keeping with streams which are already
auto-registered.
2003-06-13 21:33:59 +00:00
James Cox
f68c7ff249 updating license information in the headers. 2003-06-10 20:04:29 +00:00
Wez Furlong
1011d196b1 Add "seekable" flag to stream_get_meta_data()
# Caveat Emptor: some streams don't know if they are seekable until
# sometime tries to seek first (user streams).
2003-06-02 16:36:10 +00:00
Wez Furlong
2d1a6e5dc2 MFB context refcounting and text-mode fopen fixes 2003-05-21 13:33:55 +00:00
Sara Golemon
7c8c09b3cf Revert change to stream_copy_to_stream() 2003-04-20 01:18:58 +00:00
Sara Golemon
6dde464ce7 Let stream_copy_to_stream() accept either stream resource or filename/url string. If filename, open the file, do the copy, then close it. 2003-04-19 02:47:16 +00:00
Moriyoshi Koizumi
49b43ad115 Changed stream filter factory to be capable of accepting a zval as a parameter
instead of a string
2003-04-16 14:30:25 +00:00
Wez Furlong
c64256e671 Warning fix 2003-04-04 21:09:25 +00:00
Sara Golemon
a65564f0fa User shouldn't have to initialize this pass-by-ref parameter 2003-04-04 20:43:36 +00:00
Wez Furlong
0148c0cb02 Simplify and enhance readability. 2003-04-04 08:57:40 +00:00
Sara Golemon
b2d4514580 Added stream_get_transports() 2003-04-04 05:21:03 +00:00
Wez Furlong
0fd995f9fc Add the mode string that was used to open the stream to the meta data,
as requested by Philip Olson.
2003-03-18 23:45:27 +00:00
Wez Furlong
558db0d87a Expose php_stream_copy_to_stream as stream_copy_to_stream(); a high
performance alternative to looping reads and writes.
2003-03-01 01:27:50 +00:00
Wez Furlong
349ce76f96 Tidy up stupid signed/unsigned issues with win32 by introducing a php_socket_t typedef. 2003-02-28 21:03:36 +00:00
Wez Furlong
1b53a2d12e New user-space functions:
. stream_socket_client() - similar to fsockopen(), but more powerful.
  . stream_socket_server() - Creates a server socket.
  . stream_socket_accept() - Accept a client connection.
  . stream_socket_get_name() - Get local or remote name of socket.

Tidy up some leaks and debug printfs.
Move more streams functions into streamsfuncs.c and streamsfuncs.h.
2003-02-28 19:53:21 +00:00
Wez Furlong
493ef36299 Update win32 build.
Since msvc sucks, I had to rename ext/standard/streams.c to ext/standed/streamsfuncs.c
2003-02-27 22:43:51 +00:00