Commit graph

1528 commits

Author SHA1 Message Date
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
wonder-mice
dd32c24df6 refactor allow http parse also for client 2015-04-23 05:37:46 +08:00
Joe Kilner
ba8a2f095c Ensure proper cleanup is performed if last websocket is
closed.
2015-04-22 15:57:17 +08:00
Pokrovskiy
20636ec970 Fix broken libev support in client mode
Maybe it will be better to move all lws_libev_io() inside
lws_change_pollfd() to avoid similar problems in future.
The same for lws_libev_accept() and insert_wsi_socket_into_fds().
2015-04-22 07:50:44 +08:00
Andy Green
40d5abc2aa close reply must use writable control reply path
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-04-17 20:29:58 +08:00
Andy Green
bb90f9b7e6 client error on timeout before connection
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-04-16 19:55:42 +08:00
Andy Green
d3efcd9461 windows check for NULL getprotobyname
From maxkaro on trac #110
https://libwebsockets.org/trac/libwebsockets/ticket/110

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-04-16 04:24:38 +08:00
Andy Green
408f537975 timeout counts as pernmanently unusable close
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-04-12 08:17:26 +08:00
Danomi Czaski
7fb366a9ef client getaddrinfo valgrind fix
Signed-off-by: Danomi Czaski <djczaski@gmail.com>
2015-04-11 07:00:51 +08:00
Andy Green
8fb338f71c parser restrict unknown header paranoia to server methods
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-04-07 08:19:30 +08:00
Andy Green
9f02c5dc24 close cover flush stored send with timeout
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-04-01 05:34:18 +08:00
Andy Green
2a5774edca unsigned char by default compiler compatibility
http://ml.libwebsockets.org/pipermail/libwebsockets/2015-March/001705.html

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-03-30 18:56:52 +08:00
Andy Green
bddb3dcce9 context destroy just kill wsis ugh add missing bit
Unsaved file...

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-03-28 10:35:53 +08:00
Jose Luis Millan
45a04b6240 set server listening wsi use_ssl status
If the server option to allow non-ssl is enabled,
it will force this cleared when it sees that has happened
2015-03-28 10:20:50 +08:00
Andy Green
8ec7802935 context destroy just kill wsis
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-03-25 01:53:58 +08:00
Andy Green
106d4a8a50 ping client ping handling use same infrastructure as server
First part of this:

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-03-24 21:22:52 +08:00
Andy Green
2fd6e6fb55 ping allow zero length PING
Part of

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-03-24 21:07:01 +08:00
Andy Green
ec86b4e6c4 documentation add info http_proxy members
From https://libwebsockets.org/trac/libwebsockets/ticket/104

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-03-11 08:35:15 +08:00
banthonywalker
dd020b4b04 Subject: [PATCH 1/2] fix win32 context memory leak 2015-03-10 21:53:17 +08:00
Andy Green
c67dace4be clean remove x perm on two sources
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-03-04 19:21:40 +08:00
Andy Green
3a9f79e693 use initgroups in plat unix
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-03-04 16:16:41 +08:00