for details on that struct.
.SH EXAMPLE
.nf
-
+ size_t rlen;
+ struct curl_ws_frame *meta;
+ char buffer[256];
+ CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta);
.fi
.SH AVAILABILITY
Added in 7.86.0.
.SH RETURN VALUE
-
+Returns \fBCURLE_OK\fP if everything is okay, and a non-zero number for
+errors. Returns \fBCURLE_GOT_NOTHING\fP if the associated connection is
+closed.
.SH "SEE ALSO"
.BR curl_easy_setopt "(3), " curl_easy_perform "(3), "
.BR curl_easy_getinfo "(3), "
if(result)
return result;
if(!n)
- /* still have nothing */
- goto out;
+ /* connection closed */
+ return CURLE_GOT_NOTHING;
wsp->stillb = data->state.buffer;
wsp->stillblen = n;
}
wsp->stillb = NULL;
}
}
-out:
*metap = &wsp->frame;
return CURLE_OK;
}
return CURLE_OK;
/* raw mode sends exactly what was requested, and this is from within
the write callback */
- if(Curl_is_in_callback(data))
+ if(Curl_is_in_callback(data)) {
+ if(!data->conn) {
+ failf(data, "No associated connection");
+ return CURLE_SEND_ERROR;
+ }
result = Curl_write(data, data->conn->writesockfd, buffer, buflen,
&written);
+ }
else
result = Curl_senddata(data, buffer, buflen, &written);