From 0ff39c83d38ce538a9f5dba53eca0fa9cb16d9e6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:45:49 +0200 Subject: Adding upstream version 0.10.2+dfsg1. Signed-off-by: Daniel Baumann --- .../websocket/tests/scripts/client.close.json | 76 +++++ .../tests/scripts/client.connect-authed.json | 59 ++++ .../tests/scripts/client.connect-bad-context.json | 7 + .../tests/scripts/client.connect-context.json | 59 ++++ .../tests/scripts/client.connect-error.json | 23 ++ .../tests/scripts/client.connect-extended.json | 59 ++++ .../tests/scripts/client.connect-failed.json | 19 ++ .../tests/scripts/client.connect-headers.json | 59 ++++ .../tests/scripts/client.connect-invalid-key.json | 50 ++++ .../scripts/client.connect-invalid-upgrade.json | 50 ++++ .../tests/scripts/client.connect-persistent.json | 95 +++++++ .../tests/scripts/client.connect-timeout.json | 59 ++++ .../websocket/tests/scripts/client.connect.json | 59 ++++ .../websocket/tests/scripts/client.destruct.json | 23 ++ .../websocket/tests/scripts/client.reconnect.json | 100 +++++++ .../websocket/tests/scripts/close-remote.json | 55 ++++ .../websocket/tests/scripts/config-timeout.json | 24 ++ .../textalk/websocket/tests/scripts/ping-pong.json | 150 ++++++++++ .../tests/scripts/receive-bad-opcode.json | 18 ++ .../tests/scripts/receive-broken-read.json | 58 ++++ .../tests/scripts/receive-client-timeout.json | 50 ++++ .../tests/scripts/receive-empty-read.json | 58 ++++ .../tests/scripts/receive-fragmentation.json | 126 +++++++++ .../websocket/tests/scripts/send-bad-opcode.json | 9 + .../websocket/tests/scripts/send-broken-write.json | 43 +++ .../websocket/tests/scripts/send-convenicance.json | 86 ++++++ .../websocket/tests/scripts/send-failed-write.json | 43 +++ .../websocket/tests/scripts/send-receive-128.json | 50 ++++ .../tests/scripts/send-receive-65536.json | 113 ++++++++ .../tests/scripts/send-receive-multi-fragment.json | 112 ++++++++ .../websocket/tests/scripts/send-receive.json | 50 ++++ .../tests/scripts/server.accept-destruct.json | 315 +++++++++++++++++++++ .../tests/scripts/server.accept-error-connect.json | 18 ++ .../scripts/server.accept-failed-connect.json | 14 + .../tests/scripts/server.accept-failed-http.json | 265 +++++++++++++++++ .../tests/scripts/server.accept-failed-ws-key.json | 265 +++++++++++++++++ .../tests/scripts/server.accept-timeout.json | 289 +++++++++++++++++++ .../websocket/tests/scripts/server.accept.json | 287 +++++++++++++++++++ .../websocket/tests/scripts/server.close.json | 70 +++++ .../server.construct-error-socket-server.json | 28 ++ .../server.construct-failed-socket-server.json | 20 ++ .../websocket/tests/scripts/server.construct.json | 11 + 42 files changed, 3424 insertions(+) create mode 100644 vendor/textalk/websocket/tests/scripts/client.close.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-authed.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-bad-context.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-context.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-error.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-extended.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-failed.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-headers.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-invalid-key.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-invalid-upgrade.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-persistent.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect-timeout.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.connect.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.destruct.json create mode 100644 vendor/textalk/websocket/tests/scripts/client.reconnect.json create mode 100644 vendor/textalk/websocket/tests/scripts/close-remote.json create mode 100644 vendor/textalk/websocket/tests/scripts/config-timeout.json create mode 100644 vendor/textalk/websocket/tests/scripts/ping-pong.json create mode 100644 vendor/textalk/websocket/tests/scripts/receive-bad-opcode.json create mode 100644 vendor/textalk/websocket/tests/scripts/receive-broken-read.json create mode 100644 vendor/textalk/websocket/tests/scripts/receive-client-timeout.json create mode 100644 vendor/textalk/websocket/tests/scripts/receive-empty-read.json create mode 100644 vendor/textalk/websocket/tests/scripts/receive-fragmentation.json create mode 100644 vendor/textalk/websocket/tests/scripts/send-bad-opcode.json create mode 100644 vendor/textalk/websocket/tests/scripts/send-broken-write.json create mode 100644 vendor/textalk/websocket/tests/scripts/send-convenicance.json create mode 100644 vendor/textalk/websocket/tests/scripts/send-failed-write.json create mode 100644 vendor/textalk/websocket/tests/scripts/send-receive-128.json create mode 100644 vendor/textalk/websocket/tests/scripts/send-receive-65536.json create mode 100644 vendor/textalk/websocket/tests/scripts/send-receive-multi-fragment.json create mode 100644 vendor/textalk/websocket/tests/scripts/send-receive.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.accept-destruct.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.accept-error-connect.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.accept-failed-connect.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.accept-failed-http.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.accept-failed-ws-key.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.accept-timeout.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.accept.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.close.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.construct-error-socket-server.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.construct-failed-socket-server.json create mode 100644 vendor/textalk/websocket/tests/scripts/server.construct.json (limited to 'vendor/textalk/websocket/tests/scripts') diff --git a/vendor/textalk/websocket/tests/scripts/client.close.json b/vendor/textalk/websocket/tests/scripts/client.close.json new file mode 100644 index 0000000..d449c17 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.close.json @@ -0,0 +1,76 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [], + "return": 12 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return":[136, 154] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return":[98, 250, 210, 113] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 26 + ], + "return-op": "chr-array", + "return": [97, 18, 145, 29, 13, 137, 183, 81, 3, 153, 185, 31, 13, 141, 190, 20, 6, 157, 183, 21, 88, 218, 227, 65, 82, 202] + }, + { + "function": "fclose", + "params": [ + "@mock-stream" + ], + "return":true + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "Unknown" + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-authed.json b/vendor/textalk/websocket/tests/scripts/client.connect-authed.json new file mode 100644 index 0000000..6f75b6b --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-authed.json @@ -0,0 +1,59 @@ +[ + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "ssl:\/\/localhost:8000", + null, + null, + 5, + 4, + "@mock-stream-context" + ], + "return": "@mock-stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 5 + ], + "return": true + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return-op": "key-save", + "return": 248 + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n\r\n" + ], + "return-op": "key-respond", + "return": "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: {key}" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 13 + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-bad-context.json b/vendor/textalk/websocket/tests/scripts/client.connect-bad-context.json new file mode 100644 index 0000000..e084a84 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-bad-context.json @@ -0,0 +1,7 @@ +[ + { + "function": "get_resource_type", + "params": [], + "return": "@mock-bad-context" + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-context.json b/vendor/textalk/websocket/tests/scripts/client.connect-context.json new file mode 100644 index 0000000..0fcc279 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-context.json @@ -0,0 +1,59 @@ +[ + { + "function": "get_resource_type", + "params": [], + "return": "stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 5, + 4, + "@mock-stream-context" + ], + "return": "@mock-stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 5 + ], + "return": true + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return-op": "key-save", + "return": 199 + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n\r\n" + ], + "return-op": "key-respond", + "return": "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: {key}" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 13 + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-error.json b/vendor/textalk/websocket/tests/scripts/client.connect-error.json new file mode 100644 index 0000000..e6c523d --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-error.json @@ -0,0 +1,23 @@ +[ + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 5, + 4, + "@mock-stream-context" + ], + "error": { + "msg": "A PHP error", + "type": 512 + }, + "return": false + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-extended.json b/vendor/textalk/websocket/tests/scripts/client.connect-extended.json new file mode 100644 index 0000000..4659e3e --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-extended.json @@ -0,0 +1,59 @@ +[ + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 5, + 4, + "@mock-stream-context" + ], + "return": "@mock-stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 5 + ], + "return": true + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return-op": "key-save", + "return": 224 + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n\r\n" + ], + "return-op": "key-respond", + "return": "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: {key}" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 13 + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-failed.json b/vendor/textalk/websocket/tests/scripts/client.connect-failed.json new file mode 100644 index 0000000..47725c2 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-failed.json @@ -0,0 +1,19 @@ +[ + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 5, + 4, + "@mock-stream-context" + ], + "return": false + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-headers.json b/vendor/textalk/websocket/tests/scripts/client.connect-headers.json new file mode 100644 index 0000000..69808ce --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-headers.json @@ -0,0 +1,59 @@ +[ + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 5, + 4, + "@mock-stream-context" + ], + "return": "@mock-stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 5 + ], + "return": true + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return-op": "key-save", + "return": 255 + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n\r\n" + ], + "return-op": "key-respond", + "return": "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: {key}" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 13 + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-invalid-key.json b/vendor/textalk/websocket/tests/scripts/client.connect-invalid-key.json new file mode 100644 index 0000000..6472317 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-invalid-key.json @@ -0,0 +1,50 @@ +[ + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 5, + 4, + "@mock-stream-context" + ], + "return": "@mock-stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 5 + ], + "return": true + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 199 + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n\r\n" + ], + "return": "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: BAD" + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-invalid-upgrade.json b/vendor/textalk/websocket/tests/scripts/client.connect-invalid-upgrade.json new file mode 100644 index 0000000..28cbc7e --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-invalid-upgrade.json @@ -0,0 +1,50 @@ +[ + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 5, + 4, + "@mock-stream-context" + ], + "return": "@mock-stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 5 + ], + "return": true + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 199 + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n\r\n" + ], + "return": "Invalid upgrade response" + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-persistent.json b/vendor/textalk/websocket/tests/scripts/client.connect-persistent.json new file mode 100644 index 0000000..d95af01 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-persistent.json @@ -0,0 +1,95 @@ +[ + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 5, + 5, + "@mock-stream-context" + ], + "return": "@mock-stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "persistent stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "persistent stream" + }, + { + "function": "ftell", + "params": [ + "@mock-stream" + ], + "return": 0 + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 5 + ], + "return": true + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return-op": "key-save", + "return": 248 + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n\r\n" + ], + "return-op": "key-respond", + "return": "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: {key}" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 13 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "persistent stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "persistent stream" + }, + { + "function": "fclose", + "params": [ + "@mock-stream" + ], + "return":true + } +] + diff --git a/vendor/textalk/websocket/tests/scripts/client.connect-timeout.json b/vendor/textalk/websocket/tests/scripts/client.connect-timeout.json new file mode 100644 index 0000000..c1ae6b5 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect-timeout.json @@ -0,0 +1,59 @@ +[ + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 300, + 4, + "@mock-stream-context" + ], + "return": "@mock-stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 300 + ], + "return": true + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return-op": "key-save", + "return": 199 + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n\r\n" + ], + "return-op": "key-respond", + "return": "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: {key}" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 13 + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.connect.json b/vendor/textalk/websocket/tests/scripts/client.connect.json new file mode 100644 index 0000000..eb7ecd2 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.connect.json @@ -0,0 +1,59 @@ +[ + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 5, + 4, + "@mock-stream-context" + ], + "return": "@mock-stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 5 + ], + "return": true + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return-op": "key-save", + "return": 199 + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n\r\n" + ], + "return-op": "key-respond", + "return": "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: {key}" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 13 + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.destruct.json b/vendor/textalk/websocket/tests/scripts/client.destruct.json new file mode 100644 index 0000000..c04755b --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.destruct.json @@ -0,0 +1,23 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fclose", + "params": [ + "@mock-stream" + ], + "return": true + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/client.reconnect.json b/vendor/textalk/websocket/tests/scripts/client.reconnect.json new file mode 100644 index 0000000..9d505fe --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/client.reconnect.json @@ -0,0 +1,100 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "Unknown" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_context_create", + "params": [], + "return": "@mock-stream-context" + }, + { + "function": "stream_socket_client", + "params": [ + "tcp:\/\/localhost:8000", + null, + null, + 5, + 4, + "@mock-stream-context" + ], + "return": "@mock-stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 5 + ], + "return": true + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return-op": "key-save", + "return": 199 + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n\r\n" + ], + "return-op": "key-respond", + "return": "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: {key}" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [129, 147] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [33, 111, 149, 174] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 19 + ], + "return-op": "chr-array", + "return": [115, 10, 246, 203, 72, 25, 252, 192, 70, 79, 244, 142, 76, 10, 230, 221, 64, 8, 240] + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/close-remote.json b/vendor/textalk/websocket/tests/scripts/close-remote.json new file mode 100644 index 0000000..d2eea02 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/close-remote.json @@ -0,0 +1,55 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [136, 137] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [54, 79, 233, 244] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 9 + ], + "return-op": "chr-array", + "return": [117, 35, 170, 152, 89, 60, 128, 154, 81] + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [], + "return": 33 + }, + { + "function": "fclose", + "params": [ + "@mock-stream" + ], + "return": true + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/config-timeout.json b/vendor/textalk/websocket/tests/scripts/config-timeout.json new file mode 100644 index 0000000..243ae22 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/config-timeout.json @@ -0,0 +1,24 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 300 + ], + "return": true + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/ping-pong.json b/vendor/textalk/websocket/tests/scripts/ping-pong.json new file mode 100644 index 0000000..b647e91 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/ping-pong.json @@ -0,0 +1,150 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 17 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 6 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [138, 139] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [1, 1, 1, 1] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 11 + ], + "return-op": "chr-array", + "return": [82, 100, 115, 119, 100, 115, 33, 113, 104, 111, 102] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [138, 128] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [1, 1, 1, 1] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [137, 139] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [180, 77, 192, 201] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 11 + ], + "return-op": "chr-array", + "return": [247, 33, 169, 172, 218, 57, 224, 185, 221, 35, 167] + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 17 + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [129, 147] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [33, 111, 149, 174] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 19 + ], + "return-op": "chr-array", + "return": [115, 10, 246, 203, 72, 25, 252, 192, 70, 79, 244, 142, 76, 10, 230, 221, 64, 8, 240] + } +] diff --git a/vendor/textalk/websocket/tests/scripts/receive-bad-opcode.json b/vendor/textalk/websocket/tests/scripts/receive-bad-opcode.json new file mode 100644 index 0000000..27dd2ba --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/receive-bad-opcode.json @@ -0,0 +1,18 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [140, 115] + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/receive-broken-read.json b/vendor/textalk/websocket/tests/scripts/receive-broken-read.json new file mode 100644 index 0000000..15e3fa9 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/receive-broken-read.json @@ -0,0 +1,58 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [], + "return": false + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": true, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 2, + "seekable": false + } + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": true, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 2, + "seekable": false + } + }, + { + "function": "fclose", + "params": [ + "@mock-stream" + ], + "return":true + } +] diff --git a/vendor/textalk/websocket/tests/scripts/receive-client-timeout.json b/vendor/textalk/websocket/tests/scripts/receive-client-timeout.json new file mode 100644 index 0000000..5a258b0 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/receive-client-timeout.json @@ -0,0 +1,50 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [], + "return": false + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": true, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 0, + "seekable": false + } + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fclose", + "params": [ + "@mock-stream" + ], + "return":true + } +] diff --git a/vendor/textalk/websocket/tests/scripts/receive-empty-read.json b/vendor/textalk/websocket/tests/scripts/receive-empty-read.json new file mode 100644 index 0000000..f752017 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/receive-empty-read.json @@ -0,0 +1,58 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [], + "return": "" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 0, + "seekable": false + } + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": true, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 2, + "seekable": false + } + }, + { + "function": "fclose", + "params": [ + "@mock-stream" + ], + "return":true + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/receive-fragmentation.json b/vendor/textalk/websocket/tests/scripts/receive-fragmentation.json new file mode 100644 index 0000000..5ae9572 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/receive-fragmentation.json @@ -0,0 +1,126 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [1, 136] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [105, 29, 187, 18] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 8 + ], + "return-op": "chr-array", + "return": [36, 104, 215, 102, 0, 61, 221, 96] + }, + + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [138, 139] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [1, 1, 1, 1] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 11 + ], + "return-op": "chr-array", + "return": [82, 100, 115, 119, 100, 115, 33, 113, 104, 111, 102] + }, + + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [0, 136] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [221, 240, 46, 69] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 8 + ], + "return-op": "chr-array", + "return": [188, 151, 67, 32, 179, 132, 14, 49] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [128, 131] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [9, 60, 117, 193] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 3 + ], + "return-op": "chr-array", + "return": [108, 79, 1] + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/send-bad-opcode.json b/vendor/textalk/websocket/tests/scripts/send-bad-opcode.json new file mode 100644 index 0000000..c0859d1 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/send-bad-opcode.json @@ -0,0 +1,9 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/send-broken-write.json b/vendor/textalk/websocket/tests/scripts/send-broken-write.json new file mode 100644 index 0000000..838c826 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/send-broken-write.json @@ -0,0 +1,43 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 18 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": true, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 2, + "seekable": false + } + }, + { + "function": "fclose", + "params": [], + "return": true + } +] diff --git a/vendor/textalk/websocket/tests/scripts/send-convenicance.json b/vendor/textalk/websocket/tests/scripts/send-convenicance.json new file mode 100644 index 0000000..194cb5a --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/send-convenicance.json @@ -0,0 +1,86 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 26 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 6 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 6 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_socket_get_name", + "params": [ + "@mock-stream" + ], + "return": "127.0.0.1:12345" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_socket_get_name", + "params": [ + "@mock-stream" + ], + "return": "127.0.0.1:8000" + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_socket_get_name", + "params": [ + "@mock-stream" + ], + "return": "127.0.0.1:12345" + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/send-failed-write.json b/vendor/textalk/websocket/tests/scripts/send-failed-write.json new file mode 100644 index 0000000..ea3d46b --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/send-failed-write.json @@ -0,0 +1,43 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": true, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 2, + "seekable": false + } + }, + { + "function": "fclose", + "params": [], + "return": true + } +] diff --git a/vendor/textalk/websocket/tests/scripts/send-receive-128.json b/vendor/textalk/websocket/tests/scripts/send-receive-128.json new file mode 100644 index 0000000..66abea7 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/send-receive-128.json @@ -0,0 +1,50 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 132 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [129, 126] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [0, 128] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 128 + ], + "return-op": "file", + "return": ["payload.128.txt", 0, 132] + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/send-receive-65536.json b/vendor/textalk/websocket/tests/scripts/send-receive-65536.json new file mode 100644 index 0000000..67604b5 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/send-receive-65536.json @@ -0,0 +1,113 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 65546 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [129, 127] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 8 + ], + "return-op": "chr-array", + "return": [0, 0, 0, 0, 0, 1, 0, 0] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 65536 + ], + "return-op": "file", + "return": ["payload.65536.txt", 0, 16374] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 49162 + ], + "return-op": "file", + "return": ["payload.65536.txt", 16374, 8192] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 40970 + ], + "return-op": "file", + "return": ["payload.65536.txt", 24566, 8192] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 32778 + ], + "return-op": "file", + "return": ["payload.65536.txt", 32758, 8192] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 24586 + ], + "return-op": "file", + "return": ["payload.65536.txt", 40950, 8192] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 16394 + ], + "return-op": "file", + "return": ["payload.65536.txt", 49142, 8192] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 8202 + ], + "return-op": "file", + "return": ["payload.65536.txt", 57334, 8192] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 10 + ], + "return-op": "file", + "return": ["payload.65536.txt", 65526, 10] + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/send-receive-multi-fragment.json b/vendor/textalk/websocket/tests/scripts/send-receive-multi-fragment.json new file mode 100644 index 0000000..426434e --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/send-receive-multi-fragment.json @@ -0,0 +1,112 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [], + "return": 14 + }, + { + "function": "fwrite", + "params": [], + "return": 14 + }, + { + "function": "fwrite", + "params": [], + "return": 9 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [1, 136] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [105, 29, 187, 18] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 8 + ], + "return-op": "chr-array", + "return": [36, 104, 215, 102, 0, 61, 221, 96] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [0, 136] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [221, 240, 46, 69] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 8 + ], + "return-op": "chr-array", + "return": [188, 151, 67, 32, 179, 132, 14, 49] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [128, 131] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [9, 60, 117, 193] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 3 + ], + "return-op": "chr-array", + "return": [108, 79, 1] + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/send-receive.json b/vendor/textalk/websocket/tests/scripts/send-receive.json new file mode 100644 index 0000000..7ad0350 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/send-receive.json @@ -0,0 +1,50 @@ +[ + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 23 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [129, 147] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [33, 111, 149, 174] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 19 + ], + "return-op": "chr-array", + "return": [115, 10, 246, 203, 72, 25, 252, 192, 70, 79, 244, 142, 76, 10, 230, 221, 64, 8, 240] + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.accept-destruct.json b/vendor/textalk/websocket/tests/scripts/server.accept-destruct.json new file mode 100644 index 0000000..970286b --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.accept-destruct.json @@ -0,0 +1,315 @@ +[ + { + "function": "stream_socket_accept", + "params": [ + "@mock-socket" + ], + "return": "@mock-stream" + }, + { + "function": "stream_socket_get_name", + "params": [ + "@mock-stream" + ], + "return": "127.0.0.1:12345" + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "GET \/my\/mock\/path HTTP\/1.1" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 171, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "host: localhost:8000" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 149, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "user-agent: websocket-client-php" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 115, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "connection: Upgrade" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 94, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "upgrade: websocket" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 74, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "sec-websocket-key: cktLWXhUdDQ2OXF0ZCFqOQ==" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 29, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "sec-websocket-version: 13" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 2, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + } + , + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 0, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "fwrite", + "params": [ + "@mock-stream", + "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: YmysboNHNoWzWVeQpduY7xELjgU=\r\n\r\n" + ], + "return": 129 + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [129, 147] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [33, 111, 149, 174] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 19 + ], + "return-op": "chr-array", + "return": [115, 10, 246, 203, 72, 25, 252, 192, 70, 79, 244, 142, 76, 10, 230, 221, 64, 8, 240] + }, + + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fclose", + "params": [ + "@mock-stream" + ], + "return": true + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.accept-error-connect.json b/vendor/textalk/websocket/tests/scripts/server.accept-error-connect.json new file mode 100644 index 0000000..f0fef27 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.accept-error-connect.json @@ -0,0 +1,18 @@ +[ + { + "function": "stream_socket_accept", + "params": [], + "error": { + "msg": "A PHP error", + "type": 512 + }, + "return": false + }, + { + "function": "fclose", + "params": [ + false + ], + "return": true + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.accept-failed-connect.json b/vendor/textalk/websocket/tests/scripts/server.accept-failed-connect.json new file mode 100644 index 0000000..24692db --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.accept-failed-connect.json @@ -0,0 +1,14 @@ +[ + { + "function": "stream_socket_accept", + "params": [], + "return": false + }, + { + "function": "fclose", + "params": [ + false + ], + "return": true + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.accept-failed-http.json b/vendor/textalk/websocket/tests/scripts/server.accept-failed-http.json new file mode 100644 index 0000000..ab66db4 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.accept-failed-http.json @@ -0,0 +1,265 @@ +[ + { + "function": "stream_socket_accept", + "params": [ + "@mock-socket" + ], + "return": "@mock-stream" + }, + { + "function": "stream_socket_get_name", + "params": [ + "@mock-stream" + ], + "return": "127.0.0.1:12345" + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "missing http header" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 171, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "host: localhost:8000" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 149, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "user-agent: websocket-client-php" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 115, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "connection: Upgrade" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 94, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "upgrade: websocket" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 74, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "no key in upgrade request" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 29, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "sec-websocket-version: 13" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 2, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + } + , + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 0, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.accept-failed-ws-key.json b/vendor/textalk/websocket/tests/scripts/server.accept-failed-ws-key.json new file mode 100644 index 0000000..06bf4e6 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.accept-failed-ws-key.json @@ -0,0 +1,265 @@ +[ + { + "function": "stream_socket_accept", + "params": [ + "@mock-socket" + ], + "return": "@mock-stream" + }, + { + "function": "stream_socket_get_name", + "params": [ + "@mock-stream" + ], + "return": "127.0.0.1:12345" + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "GET \/my\/mock\/path HTTP\/1.1" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 171, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "host: localhost:8000" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 149, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "user-agent: websocket-client-php" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 115, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "connection: Upgrade" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 94, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "upgrade: websocket" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 74, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "no key in upgrade request" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 29, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "sec-websocket-version: 13" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 2, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + } + , + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 0, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.accept-timeout.json b/vendor/textalk/websocket/tests/scripts/server.accept-timeout.json new file mode 100644 index 0000000..17a5660 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.accept-timeout.json @@ -0,0 +1,289 @@ +[ + { + "function": "stream_socket_accept", + "params": [ + "@mock-socket", + 300 + ], + "return": "@mock-stream" + }, + { + "function": "stream_set_timeout", + "params": [ + "@mock-stream", + 300 + ], + "return": true + }, + { + "function": "stream_socket_get_name", + "params": [ + "@mock-stream" + ], + "return": "127.0.0.1:12345" + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "GET \/my\/mock\/path HTTP\/1.1" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 171, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "host: localhost:8000" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 149, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "user-agent: websocket-client-php" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 115, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "connection: Upgrade" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 94, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "upgrade: websocket" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 74, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "sec-websocket-key: cktLWXhUdDQ2OXF0ZCFqOQ==" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 29, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "sec-websocket-version: 13" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 2, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + } + , + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 0, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "fwrite", + "params": [ + "@mock-stream", + "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: YmysboNHNoWzWVeQpduY7xELjgU=\r\n\r\n" + ], + "return": 129 + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 13 + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.accept.json b/vendor/textalk/websocket/tests/scripts/server.accept.json new file mode 100644 index 0000000..a1463dc --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.accept.json @@ -0,0 +1,287 @@ +[ + { + "function": "stream_socket_accept", + "params": [ + "@mock-socket" + ], + "return": "@mock-stream" + }, + { + "function": "stream_socket_get_name", + "params": [ + "@mock-stream" + ], + "return": "127.0.0.1:12345" + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "GET \/my\/mock\/path HTTP\/1.1" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 171, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "host: localhost:8000" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 149, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "user-agent: websocket-client-php" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 115, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "connection: Upgrade" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 94, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "upgrade: websocket" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 74, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "sec-websocket-key: cktLWXhUdDQ2OXF0ZCFqOQ==" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 29, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "sec-websocket-version: 13" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 2, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + } + , + { + "function": "stream_get_line", + "params": [ + "@mock-stream", + 1024, + "\r\n" + ], + "return": "" + }, + { + "function": "stream_get_meta_data", + "params": [ + "@mock-stream" + ], + "return": { + "timed_out": false, + "blocked": true, + "eof": false, + "stream_type": "tcp_socket\/ssl", + "mode": "r+", + "unread_bytes": 0, + "seekable": false + } + }, + { + "function": "feof", + "params": [ + "@mock-stream" + ], + "return": false + }, + { + "function": "fwrite", + "params": [ + "@mock-stream", + "HTTP\/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: YmysboNHNoWzWVeQpduY7xELjgU=\r\n\r\n" + ], + "return": 129 + }, + { + "function": "fwrite", + "params": [ + "@mock-stream" + ], + "return": 13 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.close.json b/vendor/textalk/websocket/tests/scripts/server.close.json new file mode 100644 index 0000000..b6e045c --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.close.json @@ -0,0 +1,70 @@ +[ + + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": true + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fwrite", + "params": [], + "return":12 + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "stream" + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 2 + ], + "return-op": "chr-array", + "return": [136,154] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 4 + ], + "return-op": "chr-array", + "return": [245,55,62,8] + }, + { + "function": "fread", + "params": [ + "@mock-stream", + 26 + ], + "return-op": "chr-array", + "return": [246,223,125,100,154,68,91,40,148,84,85,102,154,64,82,109,145,80,91,108,207,23,15,56,197,7] + }, + { + "function": "fclose", + "params": [ + "@mock-stream" + ], + "return": true + }, + { + "function": "get_resource_type", + "params": [ + "@mock-stream" + ], + "return": "Unknown" + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.construct-error-socket-server.json b/vendor/textalk/websocket/tests/scripts/server.construct-error-socket-server.json new file mode 100644 index 0000000..3f4909f --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.construct-error-socket-server.json @@ -0,0 +1,28 @@ +[ + { + "function": "stream_socket_server", + "params": [ + "tcp://0.0.0.0:9999", + null, + null + ], + "error": { + "msg": "A PHP error", + "type": 512 + }, + "return": false + }, + { + "function": "stream_socket_server", + "params": [ + "tcp://0.0.0.0:10000", + null, + null + ], + "error": { + "msg": "A PHP error", + "type": 512 + }, + "return": false + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.construct-failed-socket-server.json b/vendor/textalk/websocket/tests/scripts/server.construct-failed-socket-server.json new file mode 100644 index 0000000..30d1ea6 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.construct-failed-socket-server.json @@ -0,0 +1,20 @@ +[ + { + "function": "stream_socket_server", + "params": [ + "tcp://0.0.0.0:9999", + null, + null + ], + "return": false + }, + { + "function": "stream_socket_server", + "params": [ + "tcp://0.0.0.0:10000", + null, + null + ], + "return": false + } +] \ No newline at end of file diff --git a/vendor/textalk/websocket/tests/scripts/server.construct.json b/vendor/textalk/websocket/tests/scripts/server.construct.json new file mode 100644 index 0000000..c3181f3 --- /dev/null +++ b/vendor/textalk/websocket/tests/scripts/server.construct.json @@ -0,0 +1,11 @@ +[ + { + "function": "stream_socket_server", + "params": [ + "tcp://0.0.0.0:8000", + null, + null + ], + "return": "@mock-socket" + } +] \ No newline at end of file -- cgit v1.2.3