mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
6ce9fc5bdf
5 changed files with 43 additions and 11 deletions
|
@ -85,7 +85,7 @@ struct libwebsocket *__libwebsocket_client_connect_2(
|
|||
|
||||
if (context->http_proxy_port) {
|
||||
|
||||
n = send(wsi->sock, context->service_buffer, plen, 0);
|
||||
n = send(wsi->sock, context->service_buffer, plen, MSG_NOSIGNAL);
|
||||
if (n < 0) {
|
||||
compatible_close(wsi->sock);
|
||||
lwsl_debug("ERROR writing to proxy socket\n");
|
||||
|
|
|
@ -229,7 +229,7 @@ int lws_client_socket_service(struct libwebsocket_context *context,
|
|||
else
|
||||
#endif
|
||||
n = send(wsi->sock, context->service_buffer,
|
||||
p - (char *)context->service_buffer, 0);
|
||||
p - (char *)context->service_buffer, MSG_NOSIGNAL);
|
||||
lws_latency(context, wsi,
|
||||
"send or SSL_write LWS_CONNMODE...HANDSHAKE",
|
||||
n, n >= 0);
|
||||
|
|
15
lib/output.c
15
lib/output.c
|
@ -311,7 +311,7 @@ LWS_VISIBLE int libwebsocket_write(struct libwebsocket *wsi, unsigned char *buf,
|
|||
int m;
|
||||
#endif
|
||||
|
||||
if (len == 0 && protocol != LWS_WRITE_CLOSE) {
|
||||
if (len == 0 && protocol != LWS_WRITE_CLOSE && protocol != LWS_WRITE_PING && protocol != LWS_WRITE_PONG) {
|
||||
lwsl_warn("zero length libwebsocket_write attempt\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -504,7 +504,6 @@ send_raw:
|
|||
LWS_VISIBLE int libwebsockets_serve_http_file_fragment(
|
||||
struct libwebsocket_context *context, struct libwebsocket *wsi)
|
||||
{
|
||||
int ret = 0;
|
||||
int n, m;
|
||||
|
||||
while (!lws_send_pipe_choked(wsi)) {
|
||||
|
@ -516,7 +515,7 @@ LWS_VISIBLE int libwebsockets_serve_http_file_fragment(
|
|||
if (m < 0)
|
||||
return -1;
|
||||
|
||||
wsi->u.http.filepos += n;
|
||||
wsi->u.http.filepos += m;
|
||||
if (m != n)
|
||||
/* adjust for what was not sent */
|
||||
lseek(wsi->u.http.fd, m - n, SEEK_CUR);
|
||||
|
@ -525,23 +524,23 @@ LWS_VISIBLE int libwebsockets_serve_http_file_fragment(
|
|||
if (n < 0)
|
||||
return -1; /* caller will close */
|
||||
|
||||
if (n < sizeof(context->service_buffer) ||
|
||||
wsi->u.http.filepos == wsi->u.http.filelen) {
|
||||
if (wsi->u.http.filepos == wsi->u.http.filelen) {
|
||||
wsi->state = WSI_STATE_HTTP;
|
||||
|
||||
if (wsi->protocol->callback)
|
||||
ret = user_callback_handle_rxflow(
|
||||
/* ignore callback returned value */
|
||||
user_callback_handle_rxflow(
|
||||
wsi->protocol->callback, context, wsi,
|
||||
LWS_CALLBACK_HTTP_FILE_COMPLETION,
|
||||
wsi->user_space, NULL, 0);
|
||||
return ret;
|
||||
return 1; /* >0 indicates completed */
|
||||
}
|
||||
}
|
||||
|
||||
lwsl_notice("choked before able to send whole file (post)\n");
|
||||
libwebsocket_callback_on_writable(context, wsi);
|
||||
|
||||
return ret;
|
||||
return 0; /* indicates further processing must be done */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -215,7 +215,7 @@ sha1_step(struct sha1_ctxt *ctxt)
|
|||
|
||||
/*------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
static void
|
||||
sha1_init(struct sha1_ctxt *ctxt)
|
||||
{
|
||||
bzero(ctxt, sizeof(struct sha1_ctxt));
|
||||
|
|
33
scripts/FindLibWebSockets.cmake
Normal file
33
scripts/FindLibWebSockets.cmake
Normal file
|
@ -0,0 +1,33 @@
|
|||
# This module tries to find libWebsockets library and include files
|
||||
#
|
||||
# LIBWEBSOCKETS_INCLUDE_DIR, path where to find libwebsockets.h
|
||||
# LIBWEBSOCKETS_LIBRARY_DIR, path where to find libwebsockets.so
|
||||
# LIBWEBSOCKETS_LIBRARIES, the library to link against
|
||||
# LIBWEBSOCKETS_FOUND, If false, do not try to use libWebSockets
|
||||
#
|
||||
# This currently works probably only for Linux
|
||||
|
||||
FIND_PATH ( LIBWEBSOCKETS_INCLUDE_DIR libwebsockets.h
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
FIND_LIBRARY ( LIBWEBSOCKETS_LIBRARIES websockets
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
GET_FILENAME_COMPONENT( LIBWEBSOCKETS_LIBRARY_DIR ${LIBWEBSOCKETS_LIBRARIES} PATH )
|
||||
|
||||
SET ( LIBWEBSOCKETS_FOUND "NO" )
|
||||
IF ( LIBWEBSOCKETS_INCLUDE_DIR )
|
||||
IF ( LIBWEBSOCKETS_LIBRARIES )
|
||||
SET ( LIBWEBSOCKETS_FOUND "YES" )
|
||||
ENDIF ( LIBWEBSOCKETS_LIBRARIES )
|
||||
ENDIF ( LIBWEBSOCKETS_INCLUDE_DIR )
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
LIBWEBSOCKETS_LIBRARY_DIR
|
||||
LIBWEBSOCKETS_INCLUDE_DIR
|
||||
LIBWEBSOCKETS_LIBRARIES
|
||||
)
|
Loading…
Add table
Reference in a new issue