Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC?] Add curl websocket bindings #18249

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Zend/Optimizer/zend_func_infos.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ static const func_info_t func_infos[] = {
F1("curl_share_init_persistent", MAY_BE_OBJECT),
F1("curl_strerror", MAY_BE_STRING|MAY_BE_NULL),
F1("curl_version", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
#if LIBCURL_VERSION_NUM >= 0x075600 /* Available since 7.86.0 */
F1("curl_ws_meta", MAY_BE_OBJECT),
F1("curl_ws_recv", MAY_BE_STRING|MAY_BE_FALSE),
#endif
F1("date", MAY_BE_STRING),
F1("gmdate", MAY_BE_STRING),
F1("strftime", MAY_BE_STRING|MAY_BE_FALSE),
Expand Down
45 changes: 45 additions & 0 deletions ext/curl/curl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -3634,6 +3634,16 @@
* @cvalue CURLWS_RAW_MODE
*/
const CURLWS_RAW_MODE = UNKNOWN;
/**
* @var int
* @cvalue CURLWS_CONT
*/
const CURLWS_CONT = UNKNOWN;
/**
* @var int
* @cvalue CURLWS_OFFSET
*/
const CURLWS_OFFSET = UNKNOWN;
#endif

#if LIBCURL_VERSION_NUM >= 0x075700 /* Available since 7.87.0 */
Expand Down Expand Up @@ -3696,6 +3706,28 @@ final class CurlSharePersistentHandle
public readonly array $options;
}

enum CurlWsMessageType
{
case Binary;
case Text;
case Close;
case Ping;
case Pong;
}

/**
* @strict-properties
* @not-serializable
*/
final readonly class CurlWsFrame
{
public CurlWsMessageType $type;
public bool $continued;
public int $offset;
public int $bytesLeft;
public int $length;
}

function curl_close(CurlHandle $handle): void {}

/** @refcount 1 */
Expand Down Expand Up @@ -3789,3 +3821,16 @@ function curl_strerror(int $error_code): ?string {}
* @refcount 1
*/
function curl_version(): array|false {}

#if LIBCURL_VERSION_NUM >= 0x075600 /* Available since 7.86.0 */
/** @refcount 1 */
function curl_ws_meta(CurlHandle $handle): CurlWsFrame {}

/**
* @param CurlWsFrame $meta
* @refcount 1
*/
function curl_ws_recv(CurlHandle $handle, int $length, &$meta = null): string|false {}

function curl_ws_send(CurlHandle $handle, string $buffer, CurlWsMessageType $type = CurlWsMessageType::Text, int $frag_size = 0, int $flags = 0): int {}
#endif
94 changes: 93 additions & 1 deletion ext/curl/curl_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading