Commit Graph

126 Commits

Author SHA1 Message Date
Ilia Alshanetsky
9d9727aac5 Fixed compiler warnings. 2003-08-28 19:17:34 +00:00
Sascha Schumann
af8e15b8db kill warnings 2003-08-28 17:07:40 +00:00
Ilia Alshanetsky
a326bde2e8 Prevent a crash when expand_filepath() fails. 2003-08-27 01:10:10 +00:00
Sascha Schumann
602d1b0045 One bit fields need to be unsigned, otherwise there is no storage for
the sign bit

"A signed bit field has a length of 1 bit."
2003-08-17 13:49:52 +00:00
Ilia Alshanetsky
4d98e9ec97 Finalize the closing process of persistent streams. The current
behavior/API is as follows:

1) To close a persistent use php_stream_pclose(), it will close the stream
and remove it from the persistent list.

2) Inside PHP code only explicit fclose() will close persistent streams,
all other actions such as unset() or assigning a value to stream handle
will not.

3) Regular streams can still be closed by either fclose(), unset() or an
assignment of a value to the stream handler.
2003-07-29 18:26:34 +00:00
Ilia Alshanetsky
37ee0e57cc Fixed a double free bug when freeing persistent streams. 2003-07-28 18:57:28 +00:00
Wez Furlong
5cf5248b00 Fix for mips compiler. 2003-07-14 19:38:13 +00:00
Wez Furlong
fa342d2404 MFB: binary mode by default under win32. 2003-07-05 08:25:25 +00:00
Sara Golemon
444615e74c Introduce connection pooling API. I'll use these in http/ftp fopen wrappers soon. 2003-07-02 22:18:59 +00:00
Wez Furlong
49228bd5e2 more size_t -> socklen_t.
Noticed by tychay@php.net
2003-07-02 21:11:35 +00:00
Wez Furlong
989500b347 socklen_t needs this.
We might need some more magic to ensure that socklen_t gets defined in
the correct places; lets see if any more problems arise...
2003-07-02 01:35:39 +00:00
Wez Furlong
17cbf83404 size_t -> socklen_t
fixes warnings under macosx
2003-07-01 19:51:06 +00:00
Wez Furlong
5ecc91c27d Merge selectable descriptor casting from PHP_4_3 branch. 2003-06-28 11:24:47 +00:00
Wez Furlong
c0c20ef6f6 Fix for mips compiler 2003-06-28 11:06:11 +00:00
Sara Golemon
2e4ef86e10 MFB
Plug leak in context notifiers, implement notifier->dtor
2003-06-27 16:23:58 +00:00
Sara Golemon
ac79577776 MFB PHP_4_3 main/streams.c r-1.125.2.70 2003-06-27 04:27:18 +00:00
Sara Golemon
730ce7b06f Add context property to userspace streams object. 2003-06-16 19:13:39 +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
Edin Kadribasic
6e2743023b Win32 build fixes for openssl 2003-06-15 23:34:46 +00:00
Marcus Boerger
f304458bdb Fix ZTS mode (hopefully all is working fine now again) 2003-06-14 19:30:42 +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
Hartmut Holzgraefe
ac2606bf58 fix for crashbug with user level wrapper implementations of stream_stat 2003-05-29 20:19:03 +00:00
Wez Furlong
2d1a6e5dc2 MFB context refcounting and text-mode fopen fixes 2003-05-21 13:33:55 +00:00
Sara Golemon
83b7b75c3c Implement default contexts. For the moment this is useless
but it will be used soon for connection pooling.
2003-05-21 04:04:50 +00:00
Hartmut Holzgraefe
b5bef8f7b3 always return timestamps as 'atime', 'mtime' and 'ctime'
no matter what names the underlying platform uses for them
2003-05-20 13:09:11 +00:00
Wez Furlong
192f632e2e MFB fix for persistent streams recycling. 2003-05-19 22:58:34 +00:00
Marcus Boerger
f10a7b90b2 Fix warning 2003-05-19 18:48:15 +00:00
Marcus Boerger
1b0fdbf63a Fix memleaks 2003-05-19 18:46:59 +00:00
Derick Rethans
92f0da58e6 - Rename stream_register_filter() to stream_filter_register(),
stream_register_wrapper() to stream_wrapper_register() and added an alias for
  the latter change.
2003-05-19 15:35:06 +00:00
Sebastian Bergmann
85a13e3e9a Fix warnings. 2003-05-17 06:21:34 +00:00
Sara Golemon
44743cf9ec Implement userspace wrapper support for unlink method 2003-05-14 18:30:49 +00:00
Sara Golemon
65d359d71a Fold 'options' parameter into wops->unlink method 2003-05-14 15:12:07 +00:00
Sara Golemon
5126fbe556 Setup unlink() method in wrapper_ops structure, implement unlink in plainfiles wrapper, explicitly set method NULL in other wrappers (for now), and rewrite unlink userland function to call into wrapper_ops 2003-05-14 06:10:04 +00:00
Marcus Boerger
b09aa87120 Don't access what is already freed (noticed by Sascha) 2003-04-16 17:30:03 +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
Marcus Boerger
75c8f37c03 Make it static 2003-04-13 20:30:57 +00:00
Marcus Boerger
887d5ec9c1 Speling 2003-04-13 20:12:54 +00:00
Marcus Boerger
bff63db577 Fix persistent stream closing (that one took me at least 3 days) 2003-04-13 19:47:55 +00:00
Sara Golemon
d6c24de842 Add IPv6 support to stream_socket_client/server() 2003-04-05 02:42:12 +00:00
Sara Golemon
c985b780a5 Prevent php_stream_get_record from grabbing more than maxlen characters 2003-04-04 01:34:00 +00:00
Moriyoshi Koizumi
8d2dd87d89 Fixed bug #22538 (stream filter problem) 2003-03-31 23:22:10 +00:00
Ilia Alshanetsky
62909237c4 WS 2003-03-31 22:13:01 +00:00
Wez Furlong
e451d88399 Fix for persistent stream shutdown under debug builds 2003-03-20 01:23:04 +00:00
Wez Furlong
7379f47518 Sanity check for when a stream is requested to be persistent but the wrapper
does not respect the flag.
2003-03-19 00:17:15 +00:00
Wez Furlong
86fb577d59 Implement persistent plain file streams.
Usage:

php_stream *stream = php_stream_fopen("/path/to/file", "r+b", NULL,
	STREAM_OPEN_PERSISTENT | ENFORCE_SAFE_MODE | REPORT_ERRORS);

the filename and mode are combined to form the hash key for the persistent
list; they must be identical for this same stream to be returned again in the
next request.

Calling php_stream_close() on a persistent stream *will* close it, as is
usual with all persistent resources in PHP/ZE.

This is deliberately *not* exposed to user-space PHP at this time.
2003-03-18 23:37:54 +00:00
Wez Furlong
6a87651006 Q} 2003-03-18 22:26:02 +00:00
Wez Furlong
ce01fd9526 Avoid using FILE* where possible.
Tidy up handling of potential error situations for the php:// wrapper.
2003-03-18 16:40:29 +00:00
Wez Furlong
267db80b21 avoid unsigned issues. 2003-03-18 15:15:10 +00:00
Wez Furlong
7c2ccb5f65 Fix for #22721 (poor file() performance on systems without mmap) 2003-03-18 14:35:01 +00:00
Ilia Alshanetsky
e15cc99415 Win32 build fix. 2003-03-17 22:25:55 +00:00
Ilia Alshanetsky
27a7eaf4e7 Fixed bug #22538 (failed stat on stdio/stdin/stderr streams). 2003-03-17 18:32:15 +00:00
Wez Furlong
16e705a547 64bit fixes 2003-03-15 13:29:56 +00:00
Stefan Esser
af4aa97d1e Fixing functionicalls with variable number of parameters... 2003-03-06 20:31:20 +00:00
Ilia Alshanetsky
fb4dab36f4 Compiler warning fix. 2003-03-03 19:57:18 +00:00
Wez Furlong
c3e6bcd398 Ensure that all fields are initialized to NULL. 2003-03-01 17:27:23 +00:00
Wez Furlong
242166d601 Don't shutdown() unix sockets.
It causes the server end to close down/break.
2003-03-01 15:22:21 +00:00
Wez Furlong
a3cf1ab8f6 Folding fixes 2003-03-01 15:20:42 +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
cd98ed7b0a Implement memory mapping for win32.
Could do with some rigorous testing; simple readfile() tests here appear to work.
2003-02-28 01:47:28 +00:00
Wez Furlong
cfd8150b30 Add a generic meta data api for streams. 2003-02-27 19:10:24 +00:00
Wez Furlong
203068d055 Fixup build for win32 2003-02-27 18:06:31 +00:00
Wez Furlong
fd61f69077 Another big commit (tm).
Main Changes:
- Implement a socket transport layer for use by all code that needs to open
  some kind of "special" socket for network or IPC.
- Extensions can register (and override) transports.
- Implement ftruncate() on streams via the ioctl-alike option interface.
- Implement mmap() on streams via the ioctl-alike option interface.
- Implement generic crypto API via the ioctl-alike option interface.
  (currently only supports OpenSSL, but could support other SSL toolkits,
  and other crypto transport protocols).

Impact:
- tcp sockets can be overloaded by the openssl capable sockets at runtime,
  removing the link-time requirement for ssl:// and https:// sockets and
  streams.
- checking stream types using PHP_STREAM_IS_SOCKET is deprecated, since
  there are now a range of possible socket-type streams.

Working towards:
- socket servers using the new transport layer
- mmap support under win32
- Cleaner code.

# I will be updating the win32 build to add the new files shortly
# after this commit.
2003-02-27 17:43:38 +00:00
Ilia Alshanetsky
5e118977cd Fixed various compiler warnings. 2003-02-25 01:44:57 +00:00
Ilia Alshanetsky
9e0fb1a33c Use native flock() whenever possible. 2003-02-25 01:41:58 +00:00
Ilia Alshanetsky
862634ffa5 Added locking to streams.
Allow PHP to automatically release locks on files when terminating the
stream.
Fixed bugs in the handling of the 3rd optional parameter to flock().
2003-02-25 01:39:06 +00:00
Moriyoshi Koizumi
4759048194 Removed unnecessary asserts 2003-02-24 23:13:40 +00:00
Wez Furlong
088e2692c3 MFB: Bunch of streams related fixes. 2003-02-24 21:40:23 +00:00
foobar
8e3f23e3c0 ws fixes + missing $Id$ tags, headers added 2003-02-19 08:40:19 +00:00
Wez Furlong
4c4d77d23e Fix incorrect TSRMLS_CC usage.
Fix com_create_guid()
2003-02-18 19:03:44 +00:00
Sara Golemon
6fe4ab41f0 Fix stream_filter_(ap|pre)pend to allow attaching on the read and/or write chains. Automagically decide what to do if noone tells us. 2003-02-18 02:53:24 +00:00
Wez Furlong
952d5f548e TSRMLS! 2003-02-18 01:39:26 +00:00
Wez Furlong
32165a5546 Implement new filter API, stage 1.
This breaks user-space filters (for the time being), and those
weird convert.* filters in ext/standard/filters.c

The filters stack has been separated into one chain for read and one chain
for write.

The user-space stream_filter_append() type functions currently only operate
on the read chain. They need extending to work with the write chain too.
2003-02-18 01:22:21 +00:00
Wez Furlong
6e296c5cbb Move some of the streams header into supplementary files
# Just when you thought you had learned your way around the streams code;
# I like to keep you all on your toes!
2003-02-17 00:20:38 +00:00
Wez Furlong
2cc68ad7ad Move streams files around a bit, to ease maintenance.
I will update the win32 .dsp in a moment.
2003-02-16 22:19:28 +00:00