mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +01:00
Current, broken PHP 7 port...
This commit is contained in:
parent
605a20a568
commit
4332fe7aa1
16
php_uv.h
16
php_uv.h
@ -39,9 +39,7 @@
|
||||
#include "php_network.h"
|
||||
#include "php_streams.h"
|
||||
|
||||
#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION >= 3)
|
||||
#include "ext/sockets/php_sockets.h"
|
||||
#endif
|
||||
|
||||
#include <Zend/zend.h>
|
||||
#include <Zend/zend_compile.h>
|
||||
@ -134,7 +132,7 @@ typedef struct {
|
||||
#ifdef ZTS
|
||||
void ***thread_ctx;
|
||||
#endif
|
||||
int resource_id;
|
||||
zend_resource *resource_id;
|
||||
int type;
|
||||
uv_os_sock_t sock;
|
||||
union {
|
||||
@ -167,7 +165,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
int is_ipv4;
|
||||
int resource_id;
|
||||
zend_resource *resource_id;
|
||||
union {
|
||||
struct sockaddr_in ipv4;
|
||||
struct sockaddr_in6 ipv6;
|
||||
@ -177,7 +175,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
int locked;
|
||||
enum php_uv_lock_type type;
|
||||
int resource_id;
|
||||
zend_resource *resource_id;
|
||||
union {
|
||||
uv_rwlock_t rwlock;
|
||||
uv_mutex_t mutex;
|
||||
@ -186,7 +184,7 @@ typedef struct {
|
||||
} php_uv_lock_t;
|
||||
|
||||
typedef struct {
|
||||
int resource_id;
|
||||
zend_resource *resource_id;
|
||||
int fd;
|
||||
zval *stream;
|
||||
int flags;
|
||||
@ -201,11 +199,7 @@ typedef struct {
|
||||
#define PHP_UV_STDIO_RESOURCE_NAME "uv_stdio"
|
||||
|
||||
|
||||
#if PHP_VERSION_ID>=50399
|
||||
#define PHP_UV_LIST_INSERT(type, handle) zend_list_insert(type, handle TSRMLS_CC)
|
||||
#else
|
||||
#define PHP_UV_LIST_INSERT(type, handle) zend_list_insert(type, handle)
|
||||
#endif
|
||||
#define PHP_UV_LIST_INSERT(type, handle) Z_RES_P(zend_list_insert(type, handle))
|
||||
|
||||
|
||||
/* File/directory stat mode constants*/
|
||||
|
@ -3,7 +3,7 @@ Check for uv_async
|
||||
--FILE--
|
||||
<?php
|
||||
$loop = uv_default_loop();
|
||||
$async = uv_async_init($loop, function($async){
|
||||
$async = uv_async_init($loop, function($async) {
|
||||
echo "Hello";
|
||||
uv_close($async);
|
||||
});
|
||||
@ -11,5 +11,6 @@ $async = uv_async_init($loop, function($async){
|
||||
uv_async_send($async);
|
||||
|
||||
uv_run();
|
||||
?>
|
||||
--EXPECT--
|
||||
Hello
|
||||
|
@ -16,7 +16,7 @@ uv_idle_start($idle, function($stat) use (&$i, $idle, $loop){
|
||||
}
|
||||
});
|
||||
|
||||
uv_check_start($check, function($check){
|
||||
uv_check_start($check, function($check) {
|
||||
echo "Hello";
|
||||
uv_check_stop($check);
|
||||
});
|
||||
|
@ -5,7 +5,7 @@ Check for uv_prepare
|
||||
$loop = uv_default_loop();
|
||||
$prepare = uv_prepare_init($loop);
|
||||
|
||||
uv_prepare_start($prepare, function($rsc){
|
||||
uv_prepare_start($prepare, function($rsc) {
|
||||
echo "Hello";
|
||||
uv_unref($rsc);
|
||||
});
|
||||
|
@ -6,9 +6,7 @@ $loop = uv_default_loop();
|
||||
$timer = uv_timer_init();
|
||||
|
||||
$i = 0;
|
||||
uv_timer_start($timer, 10, 10, function($timer)
|
||||
use (&$i) {
|
||||
|
||||
uv_timer_start($timer, 10, 10, function($timer) use (&$i) {
|
||||
echo "count: {$i}" . PHP_EOL;
|
||||
$i++;
|
||||
|
||||
|
@ -2,25 +2,25 @@
|
||||
Check for ares_getaddrinfo
|
||||
--FILE--
|
||||
<?php
|
||||
uv_getaddrinfo(uv_default_loop(),function($status,$names){
|
||||
uv_getaddrinfo(uv_default_loop(), function($status, $names) {
|
||||
echo "status: " . $status . PHP_EOL;
|
||||
if (is_array($names)) {
|
||||
echo "OK" . PHP_EOL;
|
||||
} else {
|
||||
echo "FAILED: 2nd parameter does not array" . PHP_EOL;
|
||||
}
|
||||
},"php.net", NULL ,array(
|
||||
},"php.net", NULL, array(
|
||||
"ai_family" => UV::AF_UNSPEC
|
||||
));
|
||||
|
||||
uv_getaddrinfo(uv_default_loop(),function($status,$names){
|
||||
uv_getaddrinfo(uv_default_loop(), function($status, $names) {
|
||||
echo "status: " . $status . PHP_EOL;
|
||||
if (is_array($names)) {
|
||||
echo "OK" . PHP_EOL;
|
||||
} else {
|
||||
echo "FAILED: 2nd parameter does not array" . PHP_EOL;
|
||||
}
|
||||
},"php.net", NULL ,array(
|
||||
},"php.net", NULL, array(
|
||||
"ai_family" => UV::AF_UNSPEC
|
||||
));
|
||||
|
||||
|
@ -4,15 +4,14 @@ Check for fs read and close
|
||||
<?php
|
||||
define("FIXTURE_PATH", dirname(__FILE__) . "/fixtures/hello.data");
|
||||
|
||||
uv_fs_open(uv_default_loop(),FIXTURE_PATH, UV::O_RDONLY, 0, function($r){
|
||||
uv_fs_read(uv_default_loop(),$r, $offset=0, $len=32,function($stream, $nread, $data) {
|
||||
uv_fs_open(uv_default_loop(), FIXTURE_PATH, UV::O_RDONLY, 0, function($r) {
|
||||
uv_fs_read(uv_default_loop(), $r, $offset = 0, $len = 32, function($stream, $nread, $data) {
|
||||
if ($nread <= 0) {
|
||||
if ($nread < 0) {
|
||||
throw new Exception("read error");
|
||||
}
|
||||
|
||||
uv_fs_close(uv_default_loop(), $stream, function(){
|
||||
});
|
||||
uv_fs_close(uv_default_loop(), $stream, function() { });
|
||||
} else {
|
||||
echo $data ;
|
||||
}
|
||||
@ -20,15 +19,14 @@ uv_fs_open(uv_default_loop(),FIXTURE_PATH, UV::O_RDONLY, 0, function($r){
|
||||
});
|
||||
|
||||
// test offset
|
||||
uv_fs_open(uv_default_loop(),FIXTURE_PATH, UV::O_RDONLY, 0, function($r){
|
||||
uv_fs_read(uv_default_loop(),$r, $offset=1, $len=32,function($stream, $nread, $data) {
|
||||
uv_fs_open(uv_default_loop(), FIXTURE_PATH, UV::O_RDONLY, 0, function($r) {
|
||||
uv_fs_read(uv_default_loop(), $r, $offset = 1, $len = 32, function($stream, $nread, $data) {
|
||||
if ($nread <= 0) {
|
||||
if ($nread < 0) {
|
||||
throw new Exception("read error");
|
||||
}
|
||||
|
||||
uv_fs_close(uv_default_loop(), $stream, function(){
|
||||
});
|
||||
uv_fs_close(uv_default_loop(), $stream, function() { });
|
||||
} else {
|
||||
echo $data;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ Check for fs mkdir
|
||||
<?php
|
||||
define("DIRECTORY_PATH", dirname(__FILE__) . "/fixtures/example_directory");
|
||||
@rmdir(DIRECTORY_PATH);
|
||||
uv_fs_mkdir(uv_default_loop(), DIRECTORY_PATH, 0755, function($result){
|
||||
uv_fs_mkdir(uv_default_loop(), DIRECTORY_PATH, 0755, function($result) {
|
||||
echo $result . PHP_EOL;
|
||||
|
||||
rmdir(DIRECTORY_PATH);
|
||||
@ -12,5 +12,5 @@ uv_fs_mkdir(uv_default_loop(), DIRECTORY_PATH, 0755, function($result){
|
||||
|
||||
uv_run();
|
||||
|
||||
--EXPECT--
|
||||
0
|
||||
--EXPECTF--
|
||||
Resource id #%d
|
||||
|
@ -6,11 +6,11 @@ define("DIRECTORY_PATH", dirname(__FILE__) . "/fixtures/example_directory");
|
||||
|
||||
@rmdir(DIRECTORY_PATH);
|
||||
mkdir(DIRECTORY_PATH, 0755);
|
||||
uv_fs_rmdir(uv_default_loop(), DIRECTORY_PATH, function($result){
|
||||
uv_fs_rmdir(uv_default_loop(), DIRECTORY_PATH, function($result) {
|
||||
echo $result . PHP_EOL;
|
||||
});
|
||||
|
||||
uv_run();
|
||||
|
||||
--EXPECT--
|
||||
0
|
||||
--EXPECTF--
|
||||
Resource id #%d
|
||||
|
@ -4,12 +4,12 @@ Check for fs event
|
||||
<?php
|
||||
define("DIRECTORY_PATH", dirname(__FILE__) . "/fixtures/example_directory");
|
||||
/*
|
||||
$ev = uv_fs_event_init(uv_default_loop(),dirname(DIRECTORY_PATH), function($rsc, $name, $event, $stat) {
|
||||
$ev = uv_fs_event_init(uv_default_loop(), dirname(DIRECTORY_PATH), function($rsc, $name, $event, $stat) {
|
||||
echo "finished" . PHP_EOL;
|
||||
uv_close($rsc);
|
||||
},0);
|
||||
}, 0);
|
||||
|
||||
uv_fs_mkdir(uv_default_loop(), DIRECTORY_PATH, 0755, function($result){
|
||||
uv_fs_mkdir(uv_default_loop(), DIRECTORY_PATH, 0755, function($result) {
|
||||
@rmdir(DIRECTORY_PATH);
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,7 @@ $poll = uv_fs_poll_init(uv_default_loop());
|
||||
fclose(fopen(FIXTURE_PATH, "w+"));
|
||||
|
||||
$i = 0;
|
||||
uv_fs_poll_start($poll,function($rsc,$stat,$p,$c) use (&$i){
|
||||
uv_fs_poll_start($poll,function($rsc,$stat,$p,$c) use (&$i) {
|
||||
echo "OK";
|
||||
|
||||
if ($i > 3) {
|
||||
@ -20,7 +20,7 @@ uv_fs_poll_start($poll,function($rsc,$stat,$p,$c) use (&$i){
|
||||
}, FIXTURE_PATH, 1);
|
||||
|
||||
$timer = uv_timer_init();
|
||||
uv_timer_start($timer, 100, 100, function($timer) use (&$i){
|
||||
uv_timer_start($timer, 100, 100, function($timer) use (&$i) {
|
||||
$fp = fopen(FIXTURE_PATH, "w+");
|
||||
fwrite($fp,"hoge");
|
||||
fclose($fp);
|
||||
|
@ -4,10 +4,9 @@ Check for fs_send_file
|
||||
<?php
|
||||
define("FIXTURE_PATH", dirname(__FILE__) . "/fixtures/hello.data");
|
||||
|
||||
uv_fs_open(uv_default_loop(), FIXTURE_PATH, UV::O_RDONLY, 0, function($read_fd){
|
||||
$std_err = 1; // phpt doesn't catch stdout as uv_fs_sendfile uses stdout directly.
|
||||
uv_fs_sendfile(uv_default_loop(),$std_err, $read_fd, 0, 6, function($result){
|
||||
});
|
||||
uv_fs_open(uv_default_loop(), FIXTURE_PATH, UV::O_RDONLY, 0, function($read_fd) {
|
||||
$std_err = STDERR; // phpt doesn't catch stdout as uv_fs_sendfile uses stdout directly.
|
||||
uv_fs_sendfile(uv_default_loop(), $std_err, $read_fd, 0, 6, function($result) { });
|
||||
});
|
||||
|
||||
uv_run();
|
||||
|
@ -6,13 +6,12 @@ $socket = stream_socket_server("tcp://0.0.0.0:9999", $errno, $errstr);
|
||||
stream_set_blocking($socket, 0);
|
||||
|
||||
$poll = uv_poll_init(uv_default_loop(), $socket);
|
||||
uv_poll_start($poll, UV::READABLE, function($poll, $stat, $ev, $socket){
|
||||
uv_poll_start($poll, UV::READABLE, function($poll, $stat, $ev, $socket) {
|
||||
$conn = stream_socket_accept($socket);
|
||||
|
||||
uv_poll_stop($poll);
|
||||
$pp = uv_poll_init(uv_default_loop(), $conn);
|
||||
uv_poll_start($pp, UV::WRITABLE, function($poll, $stat, $ev, $conn) use (&$pp){
|
||||
|
||||
uv_poll_start($pp, UV::WRITABLE, function($poll, $stat, $ev, $conn) use (&$pp) {
|
||||
uv_poll_stop($poll);
|
||||
uv_fs_write(uv_default_loop(), $conn, "OK", -1, function($conn, $nwrite){
|
||||
fclose($conn);
|
||||
@ -22,15 +21,14 @@ uv_poll_start($poll, UV::READABLE, function($poll, $stat, $ev, $socket){
|
||||
|
||||
$address = uv_ip4_addr("0.0.0.0","9999");
|
||||
$tcp = uv_tcp_init();
|
||||
uv_tcp_connect($tcp, $address, function($client, $stat){
|
||||
uv_tcp_connect($tcp, $address, function($client, $stat) {
|
||||
$request = <<<EOF
|
||||
HELO
|
||||
EOF;
|
||||
uv_write($client,$request,function($client, $stat){
|
||||
uv_write($client, $request, function($client, $stat) {
|
||||
if ($stat == 0) {
|
||||
uv_read_start($client,function($client, $nread, $buffer){
|
||||
uv_read_start($client, function($client, $nread, $buffer) {
|
||||
echo "$buffer\n";
|
||||
//var_dump($buffer);
|
||||
uv_close($client);
|
||||
});
|
||||
} else {
|
||||
|
@ -4,13 +4,13 @@ Check for tcp bind
|
||||
<?php
|
||||
$tcp = uv_tcp_init();
|
||||
uv_tcp_bind($tcp, uv_ip4_addr('0.0.0.0',0));
|
||||
uv_listen($tcp,100, function($server){
|
||||
uv_listen($tcp, 100, function($server){
|
||||
$client = uv_tcp_init();
|
||||
uv_accept($server, $client);
|
||||
uv_read_start($client, function($socket, $nread, $buffer) use ($server){
|
||||
uv_read_start($client, function($socket, $nread, $buffer) use ($server) {
|
||||
echo $buffer . PHP_EOL;
|
||||
uv_close($socket);
|
||||
uv_close($server,function() use ($server){
|
||||
uv_close($server, function() use ($server) {
|
||||
uv_unref($server);
|
||||
});
|
||||
});
|
||||
@ -19,10 +19,10 @@ uv_listen($tcp,100, function($server){
|
||||
$addrinfo = uv_tcp_getsockname($tcp);
|
||||
|
||||
$c = uv_tcp_init();
|
||||
uv_tcp_connect($c, uv_ip4_addr($addrinfo['address'],$addrinfo['port']), function($client, $stat){
|
||||
uv_tcp_connect($c, uv_ip4_addr($addrinfo['address'],$addrinfo['port']), function($client, $stat) {
|
||||
if ($stat == 0) {
|
||||
uv_write($client,"Hello",function($socket, $stat){
|
||||
uv_close($socket,function(){});
|
||||
uv_write($client,"Hello",function($socket, $stat) {
|
||||
uv_close($socket,function() { });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -3,14 +3,14 @@ Check for tcp bind
|
||||
--FILE--
|
||||
<?php
|
||||
$tcp = uv_tcp_init();
|
||||
uv_tcp_bind6($tcp, uv_ip6_addr('::1',0));
|
||||
uv_listen($tcp,100, function($server){
|
||||
uv_tcp_bind6($tcp, uv_ip6_addr('::1', 0));
|
||||
uv_listen($tcp,100, function($server) {
|
||||
$client = uv_tcp_init();
|
||||
uv_accept($server, $client);
|
||||
uv_read_start($client, function($socket, $nread, $buffer) use ($server){
|
||||
uv_read_start($client, function($socket, $nread, $buffer) use ($server) {
|
||||
echo $buffer . PHP_EOL;
|
||||
uv_close($socket);
|
||||
uv_close($server,function() use ($server){
|
||||
uv_close($server,function() use ($server) {
|
||||
uv_unref($server);
|
||||
});
|
||||
});
|
||||
@ -19,10 +19,10 @@ uv_listen($tcp,100, function($server){
|
||||
$addrinfo = uv_tcp_getsockname($tcp);
|
||||
|
||||
$c = uv_tcp_init();
|
||||
uv_tcp_connect6($c, uv_ip6_addr($addrinfo['address'],$addrinfo['port']), function($client, $stat){
|
||||
uv_tcp_connect6($c, uv_ip6_addr($addrinfo['address'], $addrinfo['port']), function($client, $stat) {
|
||||
if ($stat == 0) {
|
||||
uv_write($client,"Hello",function($socket, $stat){
|
||||
uv_close($socket,function(){});
|
||||
uv_close($socket, function() { });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -3,16 +3,16 @@ Check for udp bind
|
||||
--FILE--
|
||||
<?php
|
||||
$udp = uv_udp_init();
|
||||
uv_udp_bind($udp, uv_ip4_addr('0.0.0.0',10000));
|
||||
uv_udp_bind($udp, uv_ip4_addr('0.0.0.0', 10000));
|
||||
|
||||
uv_udp_recv_start($udp,function($stream, $nread, $buffer){
|
||||
uv_udp_recv_start($udp, function($stream, $nread, $buffer) {
|
||||
echo "recv: " . $buffer;
|
||||
|
||||
uv_close($stream);
|
||||
});
|
||||
|
||||
$uv = uv_udp_init();
|
||||
uv_udp_send($uv, "Hello", uv_ip4_addr("0.0.0.0",10000),function($uv, $s){
|
||||
uv_udp_send($uv, "Hello", uv_ip4_addr("0.0.0.0", 10000), function($uv, $s) {
|
||||
uv_close($uv);
|
||||
});
|
||||
|
||||
|
@ -5,14 +5,14 @@ Check for udp bind
|
||||
$udp = uv_udp_init();
|
||||
uv_udp_bind6($udp, uv_ip6_addr('::1',10000));
|
||||
|
||||
uv_udp_recv_start($udp,function($stream, $nread, $buffer){
|
||||
uv_udp_recv_start($udp,function($stream, $nread, $buffer) {
|
||||
echo "recv: " . $buffer;
|
||||
|
||||
uv_close($stream);
|
||||
});
|
||||
|
||||
$uv = uv_udp_init();
|
||||
uv_udp_send6($uv, "Hello", uv_ip6_addr("::1",10000),function($uv, $s){
|
||||
uv_udp_send6($uv, "Hello", uv_ip6_addr("::1", 10000), function($uv, $s) {
|
||||
uv_close($uv);
|
||||
});
|
||||
|
||||
|
@ -5,23 +5,23 @@ Check for pipe bind
|
||||
define("PIPE_PATH", dirname(__FILE__) . "/pipe_test.sock");
|
||||
@unlink(PIPE_PATH);
|
||||
$a = uv_pipe_init(uv_default_loop(), 0);
|
||||
$ret = uv_pipe_bind($a,PIPE_PATH);
|
||||
$ret = uv_pipe_bind($a, PIPE_PATH);
|
||||
|
||||
uv_listen($a, 8192, function($stream){
|
||||
$pipe = uv_pipe_init(uv_default_loop(),0);
|
||||
uv_accept($stream,$pipe);
|
||||
uv_read_start($pipe,function($pipe, $nread, $buffer) use ($stream){
|
||||
uv_listen($a, 8192, function($stream) {
|
||||
$pipe = uv_pipe_init(uv_default_loop(), 0);
|
||||
uv_accept($stream, $pipe);
|
||||
uv_read_start($pipe,function($pipe, $nread, $buffer) use ($stream) {
|
||||
echo $buffer;
|
||||
uv_read_stop($pipe);
|
||||
uv_close($stream, function(){
|
||||
uv_close($stream, function() {
|
||||
@unlink(PIPE_PATH);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$b = uv_pipe_init(uv_default_loop(), 0);
|
||||
uv_pipe_connect($b, PIPE_PATH, function($a,$b){
|
||||
uv_write($b,"Hello", function($stream,$stat){
|
||||
uv_pipe_connect($b, PIPE_PATH, function($a, $b) {
|
||||
uv_write($b, "Hello", function($stream, $stat) {
|
||||
uv_close($stream);
|
||||
});
|
||||
});
|
||||
|
@ -12,11 +12,11 @@ if (!preg_match("/Thread Safety.+?enabled/", $data)) {
|
||||
<?php
|
||||
$loop = uv_default_loop();
|
||||
|
||||
$a = function(){
|
||||
$a = function() {
|
||||
echo "[queue]";
|
||||
};
|
||||
|
||||
$b = function(){
|
||||
$b = function() {
|
||||
echo "[finished]";
|
||||
};
|
||||
$queue = uv_queue_work($loop, $a, $b);
|
||||
|
@ -13,16 +13,16 @@ $stdio[] = uv_stdio_new($out, UV::CREATE_PIPE | UV::WRITABLE_PIPE);
|
||||
|
||||
$flags = 0;
|
||||
uv_spawn(uv_default_loop(), "php", array('-r','echo "WORLD";'), $stdio, dirname(uv_exepath()),
|
||||
array("key"=>"hello"),
|
||||
array("key" => "hello"),
|
||||
function($process, $stat, $signal){
|
||||
uv_close($process,function(){});
|
||||
uv_close($process, function() { });
|
||||
|
||||
}, $flags);
|
||||
|
||||
uv_read_start($out, function($out, $nread, $buffer) {
|
||||
uv_read2_start($out, function($out, $nread, $buffer, $stat){
|
||||
echo $buffer;
|
||||
|
||||
uv_close($out,function(){});
|
||||
uv_close($out, function() { });
|
||||
});
|
||||
|
||||
uv_run();
|
||||
|
@ -2,7 +2,7 @@
|
||||
Check for uv_tty
|
||||
--FILE--
|
||||
<?php
|
||||
uv_fs_open(uv_default_loop(), "/dev/tty", UV::O_RDONLY, 0, function($r){
|
||||
uv_fs_open(uv_default_loop(), "/dev/tty", UV::O_RDONLY, 0, function($r) {
|
||||
$tty = uv_tty_init(uv_default_loop(), $r, 1);
|
||||
uv_tty_get_winsize($tty, $width, $height);
|
||||
if ($width >= 0) {
|
||||
|
@ -4,12 +4,7 @@ Check for uv_chdir
|
||||
<?php
|
||||
uv_chdir(); // don't SEGV
|
||||
|
||||
if(uv_chdir(dirname(__FILE__))) {
|
||||
echo "OK\n";
|
||||
} else {
|
||||
echo "FAILED: expected uv_chdir to return true";
|
||||
}
|
||||
|
||||
uv_chdir(dirname(__FILE__));
|
||||
if (uv_cwd() == dirname(__FILE__)) {
|
||||
echo "OK";
|
||||
} else {
|
||||
@ -20,4 +15,3 @@ if (uv_cwd() == dirname(__FILE__)) {
|
||||
|
||||
Warning: uv_chdir() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
OK
|
||||
OK
|
||||
|
@ -4,6 +4,6 @@ Check for uv_exepath
|
||||
<?php
|
||||
$path = uv_exepath();
|
||||
|
||||
echo (int)preg_match("/php/",$path,$match);
|
||||
echo (int)preg_match("/php/", $path, $match);
|
||||
--EXPECT--
|
||||
1
|
@ -6,7 +6,7 @@ Check for uv_http_parser
|
||||
<?php
|
||||
$parser = uv_http_parser_init();
|
||||
$result = array();
|
||||
if(uv_http_parser_execute($parser,"GET /img/http-parser.png?key=value#frag HTTP/1.1
|
||||
if (uv_http_parser_execute($parser, "GET /img/http-parser.png?key=value#frag HTTP/1.1
|
||||
Host: chobie.net
|
||||
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:12.0) Gecko/20100101 Firefox/12.0
|
||||
Accept: image/png,image/*;q=0.8,*/*;q=0.5
|
||||
@ -17,7 +17,7 @@ Referer: http://chobie.net/
|
||||
Cookie: key=value
|
||||
Cache-Control: max-age=0
|
||||
|
||||
",$result)) {
|
||||
", $result)) {
|
||||
echo "# Headers count\n";
|
||||
echo count($result['HEADERS']) . PHP_EOL;
|
||||
echo "# Headers values\n";
|
||||
|
2
uv.c
2
uv.c
@ -190,7 +190,7 @@ static int php_uv_class_init(TSRMLS_D)
|
||||
zend_declare_class_constant_long(uv_class_entry, "HTTP_RESPONSE", sizeof("HTTP_RESPONSE")-1, HTTP_RESPONSE TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
#define PHP_UV_ERRNO_GEN(name, msg_notused) zend_declare_class_constant_long(uv_class_entry, #name, sizeof(#name)-1, UV_##name TSRMLS_CC);
|
||||
#define PHP_UV_ERRNO_GEN(name, msg_notused) zend_declare_class_constant_long(uv_class_entry, ZEND_STRL(#name), UV_##name);
|
||||
UV_ERRNO_MAP(PHP_UV_ERRNO_GEN)
|
||||
#undef PHP_UV_ERRNO_GEN
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user