Commit Graph

119 Commits

Author SHA1 Message Date
foobar
5bd93221a8 bump year and license version 2006-01-01 12:51:34 +00:00
foobar
23e671a51e - Bumber up year 2005-08-03 14:08:58 +00:00
Antony Dovgal
79d649e173 fix memleak when connection fails (and we still keep trying) 2005-06-20 23:16:27 +00:00
Ilia Alshanetsky
aa52c68a7a bzero > memset 2005-06-14 13:09:04 +00:00
Ilia Alshanetsky
b36d4ae02c Added bindto socket context option. 2005-06-14 02:39:42 +00:00
Anantha Kesari H Y
1d7a8a9e69 removed unwanted NEW_LIBC checks 2004-10-06 13:22:21 +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
Wez Furlong
f1072c2ae9 Ensure that port numbers get set in the peer/socket name functions.
(duh!)
2004-07-28 23:30:23 +00:00
Wez Furlong
637c424d64 Fix #29431: crash when parsing an invalid network address 2004-07-28 23:15:25 +00:00
Sara Golemon
3feae65f70 BugFix: Copy/Paste mistake referenced undefined variable on platforms without gettimeofday() 2004-04-09 19:18:59 +00:00
Andi Gutmans
dbeb4158d2 - A belated happy holidays and PHP 5 2004-01-08 08:18:22 +00:00
Wez Furlong
dbb152b96a Detect and enable IPv6 support under win32.
The ws2tcpip.h header links to IPv6 functions dynamically
and the generated binary will run on win98 and later.
2003-12-06 00:00:31 +00:00
Wez Furlong
5e4eac57bd Export these so that ftp extension can be build as shared ext. 2003-12-02 23:13:43 +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
Ilia Alshanetsky
93bcd55eaf emalloc -> safe_emalloc 2003-08-12 00:58:52 +00:00
Marcus Boerger
3466a48add Initialize this variable to 0 as suggested by sara 2003-08-10 21:30:36 +00:00
Wez Furlong
8dfe385215 Merge getaddrinfo() tidy-up from PHP_4_3 branch. 2003-06-28 11:12:48 +00:00
James Cox
f68c7ff249 updating license information in the headers. 2003-06-10 20:04:29 +00:00
Ilia Alshanetsky
56ba9b4ae5 emalloc -> safe_emalloc 2003-05-13 01:57:54 +00:00
Marcus Boerger
d0fbdef419 fix warnings - one left 2003-03-08 16:53:54 +00:00
Moriyoshi Koizumi
6716188356 Reverted my previous commit 2003-03-01 18:47:18 +00:00
Moriyoshi Koizumi
3de8b87cba Fixed build 2003-03-01 15:49:06 +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
Ilia Alshanetsky
e089944308 compiler warning fixed. 2003-02-28 00:08:00 +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
Wez Furlong
c1bdf163ed Add comment about thread-safety of gethostbyname on win32.
Set the correct path to the win32 config.h file in the .dsp file.
2003-02-21 14:06:55 +00:00
foobar
8e3f23e3c0 ws fixes + missing $Id$ tags, headers added 2003-02-19 08:40:19 +00:00
Zeev Suraski
4934744b93 Win32 build improvements 2003-02-17 13:29:59 +00:00
Wez Furlong
0a18a9d744 A add much more useful select(2) implementation than is provided by
windows sockets.  The winsock implementation will only work with sockets;
our implementation works with sockets and file descriptors.
By association, stream_select() will now operate correctly with files, pipes and sockets.

This change required linking against the winsock2 library.  In terms of
compatibility, only older versions of windows 95 do not have winsock2
installed by default.  It is available as a redistributable file, and is most likely installed by any OS patches (eg: Internet Explorer) applied by the user.

Also, add a win32 compatible pipe test when opening a stream from a pipe.  This test will only work on NT, win2k and XP platforms.  Without this test, interleaved fread() and select() calls would cause the read buffer to be clobbered.  I will be working on a fix for this issue for win9x.
2003-02-16 03:48:49 +00:00
Wez Furlong
77b98f8615 Potential fixes for #21809 and #22099. 2003-02-13 14:35:47 +00:00
Sebastian Bergmann
2c5d4b8c23 Bump year. 2002-12-31 15:59:15 +00:00
Wez Furlong
90c478664a A Simple fix for Bug #12360 (fsockopen timeout doesn't work).
Analysis:
On systems with HAVE_GETADDRINFO and IPV6 support, php_hostconnect would
attempt to connect to each possible address that matched the requested IP.

If the remote host:port combination are dropping packets this would cause the
first connection to timeout (after waiting for the full timeout duration).

PHP would then attempt the second address and wait the full duration again.

Solution:
If the first connection attempt times out, abort the connection loop.
2002-12-22 13:55:45 +00:00
Wez Furlong
f8486bc344 Fix for #19508 by poleson@verio.net. 2002-10-29 14:57:12 +00:00
Ilia Alshanetsky
ec400b8d16 Silence compile warning, when compiling --with-openssl. 2002-10-19 17:05:08 +00:00
Ilia Alshanetsky
8ca0b28b6a Fixed a typo. 2002-10-19 16:50:07 +00:00
Wez Furlong
7de1f45aaa Revert my last bogus commit.
Change the comparison to something that is less likely to inspire me to
make the same mistake again...
2002-10-18 17:14:32 +00:00
Wez Furlong
e0c0264935 Improve EOF detection. Fixes #19970. 2002-10-18 12:15:04 +00:00
Wez Furlong
be5606504c Implement better SSL error handling. 2002-10-14 01:27:43 +00:00
Wez Furlong
0bcd2ccb2c A much better probable fix for #16114. 2002-10-13 23:43:21 +00:00
Wez Furlong
bc0948bbda Probable fix for #16114 2002-10-13 23:21:05 +00:00
Wez Furlong
70b796b143 (php_socket_errno) win32 errno compatible macro.
(php_socket_strerror) win32 compatible strerror replacement.
Add an E_NOTICE when a socket write fails.
2002-10-13 22:01:40 +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
Sascha Schumann
a4ec211e9e Add a few notes 2002-10-04 19:08:43 +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
9509c20941 remove chunk size setting code (it's now in streams.c).
Move timeout setting code.
2002-09-28 22:12:23 +00:00