mirror of
https://github.com/curl/curl.git
synced 2026-06-07 10:14:14 +03:00
In CURLWS_RAW_MODE, to not add an encoding reader, so clients can send raw frames.
This commit is contained in:
parent
e2bbfc437b
commit
f61706cbac
2 changed files with 19 additions and 9 deletions
|
|
@ -39,6 +39,7 @@ Available bits in the bitmask
|
|||
## CURLWS_RAW_MODE (1)
|
||||
|
||||
Deliver "raw" WebSocket traffic to the CURLOPT_WRITEFUNCTION(3)
|
||||
callback. Read "raw" WebSocket traffic from the CURLOPT_READFUNCTION(3)
|
||||
callback.
|
||||
|
||||
In raw mode, libcurl does not handle pings or any other frame for the
|
||||
|
|
|
|||
27
lib/ws.c
27
lib/ws.c
|
|
@ -1185,15 +1185,17 @@ CURLcode Curl_ws_accept(struct Curl_easy *data,
|
|||
if(result)
|
||||
goto out;
|
||||
|
||||
/* Add our client readerr encoding WS BINARY frames */
|
||||
result = Curl_creader_create(&ws_enc_reader, data, &ws_cr_encode,
|
||||
CURL_CR_CONTENT_ENCODE);
|
||||
if(result)
|
||||
goto out;
|
||||
result = Curl_creader_add(data, ws_enc_reader);
|
||||
if(result)
|
||||
goto out;
|
||||
ws_enc_reader = NULL; /* owned by transfer now */
|
||||
if(!data->set.ws_raw_mode) {
|
||||
/* Add our client readerr encoding WS BINARY frames */
|
||||
result = Curl_creader_create(&ws_enc_reader, data, &ws_cr_encode,
|
||||
CURL_CR_CONTENT_ENCODE);
|
||||
if(result)
|
||||
goto out;
|
||||
result = Curl_creader_add(data, ws_enc_reader);
|
||||
if(result)
|
||||
goto out;
|
||||
ws_enc_reader = NULL; /* owned by transfer now */
|
||||
}
|
||||
|
||||
/* start over with sending */
|
||||
data->req.eos_read = FALSE;
|
||||
|
|
@ -1723,6 +1725,13 @@ CURL_EXTERN CURLcode curl_ws_start_frame(CURL *d,
|
|||
CURLcode result = CURLE_OK;
|
||||
struct Curl_easy *data = d;
|
||||
|
||||
if(!GOOD_EASY_HANDLE(data))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
if(data->set.ws_raw_mode) {
|
||||
failf(data, "cannot curl_ws_start_frame() with CURLWS_RAW_MODE enabled");
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
CURL_TRC_WS(data, "curl_start_frame(flags=%x, frame_len=%" FMT_OFF_T,
|
||||
flags, frame_len);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue