[PHP-DEV] [patch] allow socket_[gs]et_options() to work on streams

2011-03-05 Thread Vincent NEGRIER

Hi internals,

The goal of this patch is to allow user handling of low level socket 
options for stream sockets created with stream_socket_*() or fsockopen() 
functions.


I choose to extend the socket_get_options() and socket_set_options() 
functions and keep the functionality inside the sockets extension so 
this won't add seldom used bloat to streams if built without it.


With the patch, these two functions check if their first argument is a 
stream, and then attempt to cast it to php_sock before trying to fetch 
it as a socket resource.


Patch is here: http://si.kz/php-sockets-stream-options.diff.txt

Anyone with karma care to comment / commit ? :)

Regards,
Vincent

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] [patch] bug 45808

2009-10-12 Thread Vincent NEGRIER

Hi everyone,

I have made a patch to fix this bug: http://bugs.php.net/bug.php?id=45808

Diff against 5.3.0 is here: http://si.kz/php-bug-45808.diff.txt

As far as I have tested, everything works as expected with this patch 
applied. Can someone with karma please review it and apply to HEAD 
and/or 5.3 branch ?


Regards,
Vincent

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Re: [PATCH] implement stream_set_write_buffer for sockets

2007-12-03 Thread Vincent NEGRIER
I made a wrong assumption in the first patch and although it worked, 
stream_set_write_buffer() did return an error.


This one is fixes the return value issue :

--- main/streams/xp_socket.c.orig   2007-12-01 16:56:29.0 +0100
+++ main/streams/xp_socket.c2007-12-03 21:07:02.0 +0100
@@ -254,6 +254,7 @@
int oldmode, flags;
php_netstream_data_t *sock = 
(php_netstream_data_t*)stream-abstract;

php_stream_xport_param *xparam;
+   size_t size;

switch(option) {
case PHP_STREAM_OPTION_CHECK_LIVENESS:
@@ -388,6 +389,14 @@
return 
PHP_STREAM_OPTION_RETURN_NOTIMPL;

}

+   case PHP_STREAM_OPTION_WRITE_BUFFER:
+   if (ptrparam)
+   size = *(size_t *)ptrparam;
+   else
+   size = CHUNK_SIZE;
+   php_stream_set_chunk_size(stream, size);
+   return PHP_STREAM_OPTION_RETURN_OK;
+
default:
return PHP_STREAM_OPTION_RETURN_NOTIMPL;
}




Hello,

Currently stream_set_write_buffer() only works with file streams. If 
used on socket streams it always returns -1 and does nothing. This can 
be quite problematic when using datagram sockets because any datagram 
bigger than the default 8Kb gets chopped and more than one datagram get 
sent, eventually messing up with the receiving side.


This small patch adds support for sockets in stream_set_write_buffer(), 
I have tested it and it fixed my problem, but if it needs refinements 
i'd be glad to try and help more.


diff against 5.2.5 is here: 
http://rectophobia.com/~six/socket_write_buffer.diff


Regards,
Vincent


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] [PATCH] implement stream_set_write_buffer for sockets

2007-12-02 Thread Vincent NEGRIER

Hello,

Currently stream_set_write_buffer() only works with file streams. If 
used on socket streams it always returns -1 and does nothing. This can 
be quite problematic when using datagram sockets because any datagram 
bigger than the default 8Kb gets chopped and more than one datagram get 
sent, eventually messing up with the receiving side.


This small patch adds support for sockets in stream_set_write_buffer(), 
I have tested it and it fixed my problem, but if it needs refinements 
i'd be glad to try and help more.


diff against 5.2.5 is here: 
http://rectophobia.com/~six/socket_write_buffer.diff


Regards,
Vincent

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php