Commit graph

898 commits

Author SHA1 Message Date
Stephan Eberle
b820e2c2cc Implemented fixes allowing libwebsockets to be built under Windows using MinGM/MSYS
Improvemed patches to address travis and appveyor build errors

Reduced WINVER and _WIN32_WINNT to 0x0501 to be less restrictive

Refined CMakeLists.txt to allow for normal Windows and MinGW-specific OpenSSL certificate generation

Simplified include path to gettimeofday.h

Removed unnecessary list(APPEND LWS_LIBRARIES zlib_internal) export

Added back #include <windows.h> to gettimeofday.c to fix build for normal Windows

Made sure that pollfd gets defined on libwebsockets side when _WIN32_WINNT < 0x0600

Made sure that WINVER and _WIN32_WINNT don't get overridden by libwebsockets headers when already set to something greater than 0x0501

Added missing declaration of WSAPoll function for WINVER < 0x0600 in libwebsockets.h, eliminated invalid usages of pollfd instead of libwebsocket_pollfd in test-server.c

Cleaned up duplicate content in gettimeofday.c, removed header inclusions from gettimeofday.h and fixed include order in test-echo.c, test-ping.c and test-server.c to enable build with normal Windows and MinGW

Re-enabled debug_level in test-echo.c and made sure that the call to lws_set_log_level() is also active under Windows (just like in test-server.c); replaced all WIN32 occurrences by _WIN32 in test-echo.c, test-ping.c, and test-server.c

Removed build-msys.sh and added new section about how to build libwebsockets using MinGW to README.build.md
2015-10-30 00:16:40 +01:00
Krishnaraj R Bhat
1662c624ef Define getdtablesize() for android
getdtablesize() has been removed from headers since android-21.
Its value was 1024 in previous android api levels
2015-10-28 21:02:31 +05:30
Andy Green
0c8a8541c6 client only one error callback
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-28 19:50:41 +08:00
Andy Green
c6f95d3f27 keepalive close file when send completes dont wait for wsi close processing
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-27 07:07:14 +08:00
Andy Green
29ddc84a5c check errno for ssl non ssl
After thomgree

https://github.com/warmcat/libwebsockets/issues/313

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-22 20:32:55 +08:00
Alexander Lukichev
fe6030a62b Make LWS_SEND_BUFFER_PRE_PADDING preprocessor if-friendly
Commit 173e9c4e made LWS_SEND_BUFFER_SIZE a multiple of a certain
value returned by _LWS_PAD_SIZE macro. This macro expanded to
"sizeof(void *)" on non-x86_64 architectures, which made it
unsuitable to use LWS_SEND_BUFFER_SIZE in preprocessor #if
expressions in the library user code.

This patch preserves the padding logic since commit 173e9c4e but
makes it more preprocessor-friendly for applications using
libwebsockets by setting _LWS_PAD_SIZE to the size of "void *"
determined by cmake when libwebsockets is configured for the
target platform.

Signed-off-by: Alexander Lukichev <alexander.lukichev@gmail.com>
2015-10-21 12:52:15 +02:00
Andy Green
2721e3ca9d qualify server specific api with LWS_NO_SERVER
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-21 09:23:21 +08:00
Andy Green
2627148523 keepalive fix flow now forced closed removed
Since 0d89f3cbed added recently,
http1.1 keepalive tries to actually keep alive.

Some updates are needed to keepalive flow to solve problems coming from
changes that were hidden until now by keepalive basically closing until
recently.  It's not very noticable since clients will retry as close is
the default 1.0 behaviour... anyway this lets me do

wget http://localhost:7681/test.html http://localhost:7681/test.html

using keepalive correctly on the test server.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-21 08:16:34 +08:00
Ash 20001
0d89f3cbed detect http1 close connection header properly 2015-10-20 12:12:12 +08:00
Andy Green
b5cf69fdb5 correct error handling path in client handshake
After Vikas Gahlan

http://ml.libwebsockets.org/pipermail/libwebsockets/2015-October/001955.html

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-18 18:51:36 +08:00
Andy Green
dbbd31141a if ssl and non ssl allowed insist to wait for something to discriminate by
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-16 11:39:23 +08:00
Andy Green
2488c46c9b attempt to get correct close flow banning writeable cb when closing
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-16 11:07:52 +08:00
Andy Green
f7e2a85e11 complain if zero ka_interval used with positive ka_time
https://github.com/warmcat/libwebsockets/issues/308

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-16 10:54:04 +08:00
Andrejs Hanins
f94dd2ea3e Fix getaddrinfo memory leak 2015-10-15 21:27:25 +08:00
Mark Likness
dbe624de76 allow EAGAIN and friends on straight read 2015-10-15 21:21:06 +08:00
Stepan Vondrak
fc6c274596 fix missing parenthesis protection 2015-10-15 21:05:54 +08:00
Peter Pentchev
e46f4125ef Fix some typographical and grammatical errors 2015-10-15 11:58:54 +08:00
Andy Green
4c79ee7598 LWS_WITHOUT_BUILTIN_SHA1
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-15 11:20:40 +08:00
Andy Green
6d59f59745 LWS_SERVER_OPTION_PEER_CERT_NOT_REQUIRED
Requested by Bruce Perens

http://ml.libwebsockets.org/pipermail/libwebsockets/2015-June/001834.html

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-15 09:12:58 +08:00
Andy Green
a739f75ee2 ssl set session id context
Via Bruce Perens

http://ml.libwebsockets.org/pipermail/libwebsockets/2015-June/001833.html

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-15 09:00:31 +08:00
Andy Green
940a75503c avoid changing wrong revents if connection closed
As reported by Bruce Perens

http://ml.libwebsockets.org/pipermail/libwebsockets/2015-May/001814.html

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-15 08:34:21 +08:00
Andy Green
1963c9aa7f improve callback close checking
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-15 07:39:33 +08:00
Fabian Kurz
f54715bd5f accept http1.1 from proxy 2015-10-14 14:52:28 +08:00
bdavis
353fdc383e fd test will fail under windows, where file descriptors can be large numbers 2015-10-14 10:17:20 +08:00
Bruce Perens
173e9c4ea2 padding align to ptr size
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-13 09:17:39 +08:00
Thomas Greenslade
a2a4b0b084 additional https post fix
https://github.com/warmcat/libwebsockets/pull/298#issuecomment-147316562
2015-10-12 16:06:26 +08:00
Roger A. Light
b9f28ac8df Attempt to fix server problems receiving large https POSTS.
Without this change the pending list ends up having
wsi->pending_read_list_next == wsi, which causes a loop in
lws_plat_unix().
2015-10-12 11:30:37 +08:00
Andrew Canaday
79d09fcc37 WHOOPS! Stuck the sigint init int the wrong function. 2015-10-12 11:19:55 +08:00
Andrew Canaday
6740b70aaf Set default libev-related SIGINT handling at context create
to avoid breaking backwards compatibility with existing deploys.
2015-10-12 11:18:23 +08:00
Andrew Canaday
a8f47c9844 Added libwebsocket_sigint_cfg for libev builds to provide
runtime configuration of sigint behavior.
2015-10-12 11:16:46 +08:00
Marc Aldorasi
89f5eec5ac Pass the correct hostname when using a proxy
The proxy doesn't modify the SNI request, so we need to pass the name of
the host we're trying to reach instead of the proxy we're reaching it
through.
2015-10-12 10:37:49 +08:00
Roger A. Light
7a474b4e2d Separate private defines in lws_config_private.h
So we don't expose all HAVE_ macros and such to the world.
2015-10-12 10:10:20 +08:00
=?UTF-8?q?Joakim=20S=C3=B6derberg?=
caf7e3d63b Fix potential memory leak
- Got rid of ifdef _WIN32 stuff adn moved to plat_ files instead.
- Also, check all calls to lws_zalloc, was potential failure on WIN32
- Made context destory enable to destroy a half inited context as well. This way I got get rid of some of the error handling complexity in libwebsocket_create_context
- Added TODOs for some potential problems I see where things might be leaking and such
2015-10-12 10:05:18 +08:00
=?UTF-8?q?Joakim=20S=C3=B6derberg?=
8361d34ff9 Bugfix: SSL code should not free wsi
The SSL code should not do lws_free(new_wsi) here. The caller should clean up the wsi in libwebsocket_close_and_free_session. Instead this can potentially cause a crash during that call.

Also if we fail to create the SSL for hte listener we should indicate failure to the caller.
2015-10-12 10:03:41 +08:00
=?UTF-8?q?Joakim=20S=C3=B6derberg?=
cefab311d6 Use LWS_HAVE_ instead of just HAVE_
Since we include lws_config.h in the public headers, at least our HAVE_ macros should be kind of unique, so that we don't get redefinitions when used with other libraries using config files as well.
2015-10-12 09:53:17 +08:00
Andy Green
6f1e8849bd use send MSG_NOSIGNAL
after

810dbadd6b

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-12 08:43:36 +08:00
ABruines
80a7068ec8 Allow using CyaSSL in stead of wolfSSL 2015-10-12 08:17:55 +08:00
Alexander Bruines
c3bcb89d01 Move from CyaSSL to wolfSSL
This patch lets libwebsockets use the lastest version of wolfSSL (the new name for CyaSSL).
The reason for the patch is that allthough wolfSSL provides compatibility headers for (old) projects using CyaSSL,
these are incomplete and do not work for libwebsockets.

The patch also fixes a typo in CMakeLists.txt where CYASSL_LIBRARIES was added to include_directories() instead of CYASSL_INCLUDE_DIRS.

Signed-off-by: ABruines <alexander.bruines@gmail.com>
2015-10-12 08:14:50 +08:00
=?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?=
4c0ba02771 fix #309. Receive large messages over WSS
Read the full incoming TLS/SSL record at once in libwebsocket_service_fd().

SSL_read() is called until no more pending data for the current record is buffered in SSL.
SSL_read() is never requested more than the pending data size for the current record
to ensure that the fd is not read again for new data, which would be copied in the SSL buffer otherwise.
2015-10-12 08:07:38 +08:00
MGadkari
020c53c8cc Pass HTTP reject error code returned by server to client
AG: added changelog and documentation comment

Signed-off-by: Gadkari Mugdha <mugdha.gadkari@siemens.com>
Reviewed-by: Roger Meier <r.meier@siemens.com>

HTTP reject error code returned by server during HTTP handshake is extracted and sent to the client application.
With this fix, the Connection error callback will include the HTTP reject status code and response frame received from server. This string passed in Connection error callback can be read or ignored by client application based on client application requirement
2015-10-12 07:51:34 +08:00
Frugality
92b69635dd Fixing occasional failure of connect() on Windows
See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms737625(v=vs.85).aspx

Specifically the section reading:

"Until the connection attempt completes on a nonblocking socket, all subsequent calls to connect on the same socket will fail with the error code WSAEALREADY, and WSAEISCONN when the connection completes successfully. Due to ambiguities in version 1.1 of the Windows Sockets specification, error codes returned from connect while a connection is already pending may vary among implementations. As a result, it is not recommended that applications use multiple calls to connect to detect connection completion. If they do, they must be prepared to handle WSAEINVAL and WSAEWOULDBLOCK error values the same way that they handle WSAEALREADY, to assure robust operation."
2015-10-12 07:47:51 +08:00
John Tarlton
05fc6bab0d Added callback for PONG responses 2015-10-11 16:25:57 +08:00
=?UTF-8?q?Dalibor=20Ba=C4=8Da?=
5400f47efe [PATCH] added timeout reset in serve_http_file_fragment to prevent timeout on big files 2015-10-11 16:14:11 +08:00
Andy Green
b7a721f803 close CLIENT_WAITING_CONNECT should callback CONNECTION_ERROR
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-04-27 19:07:38 +08:00
Andy Green
4bca6cd367 close also enable pollout processing for post send close state
This should solve the 100% cpu at close problem reported by Bruce Perens

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-04-26 06:09:13 +08:00
Andy Green
82eccf7611 close send close ack control packet type
Noticed by Andrey Pokrovskiy

Close processing reused ping processing to save and send the payload,
and sets a flag to know it's close, but forgot to change the control
packet accordingly.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-04-26 05:32:03 +08:00
wonder-mice
644fea11c5 Subject: [PATCH] Fix unused n variable warning in http2.c 2015-04-24 07:25:51 +08:00
wonder-mice
0c5aa2f484 Subject: [PATCH] Add missing lib/header.c file
File was lost during merge to upstream.
2015-04-24 07:22:52 +08:00
wonder-mice
41802c7a98 From 04da2ccd1e8c5b582c4e2a77ee53f929ae8f22a0 Mon Sep 17 00:00:00 2001
Subject: [PATCH] Always include lws_config.h since now we have only CMake
 build
2015-04-23 06:10:51 +08:00
wonder-mice
bd2a6c6477 Subject: [PATCH] Fix broken libev support in client mode 2015-04-23 06:06:10 +08:00