mirror of
https://github.com/curl/curl.git
synced 2026-08-26 05:03:33 +03:00
WebSockets: make support official (non-experimental)
Inverts the configure/cmake options to instead provide options that disable WebSockets and have them (ws + wss) enabled by default. Closes #14936
This commit is contained in:
parent
cfae354a9a
commit
d78e129d50
26 changed files with 108 additions and 107 deletions
12
lib/ws.c
12
lib/ws.c
|
|
@ -24,7 +24,7 @@
|
|||
#include "curl_setup.h"
|
||||
#include <curl/curl.h>
|
||||
|
||||
#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
|
||||
#if !defined(CURL_DISABLE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
|
||||
|
||||
#include "urldata.h"
|
||||
#include "bufq.h"
|
||||
|
|
@ -930,9 +930,7 @@ CURL_EXTERN CURLcode curl_ws_recv(struct Curl_easy *data, void *buffer,
|
|||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
struct websocket *ws;
|
||||
bool done = FALSE; /* not filled passed buffer yet */
|
||||
struct ws_collect ctx;
|
||||
CURLcode result;
|
||||
|
||||
if(!conn) {
|
||||
/* Unhappy hack with lifetimes of transfers and connection */
|
||||
|
|
@ -961,7 +959,9 @@ CURL_EXTERN CURLcode curl_ws_recv(struct Curl_easy *data, void *buffer,
|
|||
ctx.buffer = buffer;
|
||||
ctx.buflen = buflen;
|
||||
|
||||
while(!done) {
|
||||
while(1) {
|
||||
CURLcode result;
|
||||
|
||||
/* receive more when our buffer is empty */
|
||||
if(Curl_bufq_is_empty(&ws->recvbuf)) {
|
||||
ssize_t n = Curl_bufq_slurp(&ws->recvbuf, nw_in_recv, data, &result);
|
||||
|
|
@ -984,7 +984,6 @@ CURL_EXTERN CURLcode curl_ws_recv(struct Curl_easy *data, void *buffer,
|
|||
ws_dec_info(&ws->dec, data, "need more input");
|
||||
continue; /* nothing written, try more input */
|
||||
}
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
else if(result) {
|
||||
|
|
@ -994,7 +993,6 @@ CURL_EXTERN CURLcode curl_ws_recv(struct Curl_easy *data, void *buffer,
|
|||
/* The decoded frame is passed back to our caller.
|
||||
* There are frames like PING were we auto-respond to and
|
||||
* that we do not return. For these `ctx.written` is not set. */
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1387,4 +1385,4 @@ CURL_EXTERN const struct curl_ws_frame *curl_ws_meta(struct Curl_easy *data)
|
|||
(void)data;
|
||||
return NULL;
|
||||
}
|
||||
#endif /* USE_WEBSOCKETS */
|
||||
#endif /* !CURL_DISABLE_WEBSOCKETS */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue