Commit graph

86 commits

Author SHA1 Message Date
Andy Green
88b9682e22 avoid using deallocated things during context dedtroy
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:12:31 +08:00
Andy Green
6d5143548d remove double free attempts from no ACCEPT server response cleanup path
The generic wsi close code is smart enough to clean up after these allocations itself

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 08:44:07 +08:00
Andy Green
26ba55a6fc fuzzer rx overflow mitigate
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 08:40:14 +08:00
Fabian Kurz
f54715bd5f accept http1.1 from proxy 2015-10-14 14:52:28 +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
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
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
wonder-mice
bd2a6c6477 Subject: [PATCH] Fix broken libev support in client mode 2015-04-23 06:06:10 +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
1dce6c06ea client avoid double free on error path
via dj1yfk on trac #99

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-02-01 07:19:46 +08:00
Alejandro Mery
31f9eeb9d6 client: fix verification of the accepted protocol
to properly take ", *" as delimiter

Signed-off-by: Alejandro Mery <amery@geeks.cl>
2014-12-13 14:00:42 +08:00
Alejandro Mery
ac3ec39bb1 Subject: [PATCH] Introduce lws_free2() helper to free and re-NULL pointers
Signed-off-by: Alejandro Mery <amery@geeks.cl>
2014-12-05 07:27:52 +08:00
Alejandro Mery
6ff28248aa Subject: [PATCH] Use custom allocator
Signed-off-by: Alejandro Mery <amery@geeks.cl>
2014-12-05 07:26:26 +08:00
Andy Green
62fe015455 revert 187
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-12-01 19:28:28 +08:00
Andy Green
47afcddccf 83674 dereference after NULL check
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-11-30 12:43:51 +08:00
Andy Green
77c209c412 ssl: improve client error message on server cert probs 2014-11-18 09:28:06 +08:00
Andy Green
44c116172d lws_union_transition
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-11-08 11:18:47 +08:00
kulwik
76fc5fc88d Subject: [PATCH] ssl fix self-singed certificate acceptation 2014-10-31 12:52:48 +08:00
Rene Jager
c0eb2c3e9d Subject: [PATCH] fixes for handling multiple protocols in handshake 2014-10-29 09:39:34 +08:00
Andy Green
1f5c9f0c31 ssl_capable_read add context param
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-10-09 08:14:30 +08:00
Andy Green
024eb6c80c http2 can keep upgraded connection up
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-10-08 12:00:53 +08:00
Andy Green
104316eb8f internal SHA1 users all use libwebsockets_SHA1
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-09-26 05:56:23 +08:00
Andrew Canaday
74b4a65745 Added optional per-header length limits:
- libwebsockets.h:
 - * added struct lws_token_limits
   * added token limits pointer to lws_context_creation_info
 - private-libwebsockets.h: added token limits pointer to lws_context_creation_info
 - context.c: copy token limits in create_context
 - client.c / server.c: pass context when invoking libwebsocket_parse
 - parsers.c:
 - * libwebsocket_parse takes context pointer
   * issue_char takes context pointer and checks header length against context limits, if defined
   * issue_char returns 1 (not -1/0) for header too long, and spill: sets the state to WSI_TOKEN_SKIPPING
2014-07-06 09:33:40 +08:00
vpeter4
590fb70102 Conditionally declare variable 2014-04-28 07:32:14 +08:00
vpeter4
e035f2ea3e Compile with older OpenSSL library (missing symbol SSL_set_tlsext_host_name) 2014-04-28 07:32:13 +08:00
Andy Green
d7340c141f clean=various ifdef reduction
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-10 14:08:10 +08:00
Andy Green
47e0c91e2f move SNI temp var back one
Reported as making trouble on Windows by spayton

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-08 16:15:02 +01:00
Andy Green
78f266a525 refactor use unified ssl read write functions
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-06 07:24:45 +01:00
Andy Green
c57037a555 refactor ssl related code into ssl.c
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 10:17:00 +08:00
Andy Green
aad2eac48e refactor handshake client and server handling into client.c and server.c
Eliminate more #ifdefs

Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 09:03:37 +08:00
Andy Green
e38031a394 refactor migrate client and server specific context init into client.c and server.c
Eliminate some NO_CLIENT and NO_SERVER

Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 08:24:29 +08:00
Andy Green
2c24ec0211 refactor out most NO_EXTENSIONS
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-02 19:45:42 +08:00
Andy Green
158e804cb7 refactor out WIN32 tests from code
This gets rid of all the platform-dependent #ifdef stuff and
migrates it into the new lws-plat-xxx.c files.

These are then included in a one-time test in libwebsockets.c
according basically to Windows or not.

The idea is from now on, all Windows-specific code should go in
lws-plat-win.c, where any kind of Windows perversion like DWORD
is fine.

Any new functions going in there should be named lws_plat_...
and be defined in all the lws-plat-xxx.c file (currently just
win32 and unix platforms are supported).

Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-02 14:25:10 +08:00
Patrick Gansterer
b47f87b04b Introduce LWS_POLLIN, LWS_POLLOUT and LWS_POLLHUP 2014-03-30 09:18:05 +02:00
Patrick Gansterer
73882e49fc Remove websock-w32.h 2014-03-29 08:25:58 +01:00
Andy Green
145ecece10 cyassl skip setting SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
It's already the default and no "SSL_set_mode" in CYASSL

Reported by Chris Conlon <chris@wolfssl.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2014-03-28 14:00:01 +08:00
erauhut
03203aba93 trac 58 ssl enable SNI per vhost certs
http://libwebsockets.org/trac/libwebsockets/ticket/58#no1
2014-03-23 12:24:40 +08:00
Andy Green
35c80f9885 ssl add SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER to server and client
gaby64 at githib found this option is necessary when using SSL with the
truncated send support

Signed-off-by: Andy Green <andy.green@linaro.org>
2014-03-23 11:53:07 +08:00
Patrick Gansterer
2dbd837c41 WSAGetLastError() instead of errno on Windows
Error codes set by Windows Sockets are not made available through the errno
variable. Checking them via WSAGetLastError() is the corret solution.
2014-02-28 20:08:55 +08:00
Patrick Gansterer
e5720a347e Cleanup include statements
Remove useless includes and add some preprocessor conditions for platform specific headers.
2014-02-28 08:51:35 +08:00
Patrick Gansterer
ce8079c09b Add explicit cast to setsockopt() calls
Implicit cast from size_t* to const char* throws an error on some compilers.
2014-02-28 08:45:19 +08:00
Andy Green
91f19d8d79 unify all pollfd lock management
This provides a single place for pollfd event changing,
external locking for that and extpoll management.

It saves about 85 lines of duplication and simplifies the callers.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-12-21 11:18:34 +08:00
Andy Green
7a1327977a add locking callback for fds
This adds two new callbacks in protocols[0] that are optional for allowing limited thread
access to libwebsockets, LWS_CALLBACK_LOCK_POLL and LWS_CALLBACK_UNLOCK_POLL.

If you use them, they protect internal and external poll list changes, but if you want to use
external thread access to libwebsocket_callback_on_writable() you have to implement your
locking here even if you don't use external poll support.

If you will use another thread for this, take a lot of care about managing your list of
live wsi by doing it from ESTABLISHED and CLOSED callbacks (with your own locking).

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-12-18 09:48:26 +08:00
Jonti
e01cb9a49d Subject: [PATCH] Fixed the logging of OpenSSL errors to report the correct
details for the current OpenSSL error
2013-11-24 14:24:02 +08:00
Markus Elfring
7521233176 make header protection unique remove __prefix
Signed-off-by: Markus Elfring <markus.elfring@web.de>
2013-10-26 20:23:00 +08:00
shys
cfa8ac34c7 cover-proxy-read-EAGAIN.patch
Subject: [PATCH] Because of nonblocking sockets reading from  proxy might not
 work in one turn. We should check for EAGAIN.
2013-10-25 22:30:25 +08:00
shys
6b5c1af439 Subject: [PATCH] On iOS with nonblocking sockets I experience SSL error which
is not really an error (
 http://lists.freeradius.org/pipermail/freeradius-users/2009-August/040155.html
 ). Added check for that. Additional fixes for comments and logging.
2013-10-25 22:26:36 +08:00
u0u0
44e260e004 fix origin
And fix client header of Origin, add prefix "http://" to make a valid URI, to make golang websocket server happy.
2013-10-25 22:17:21 +08:00
shys
24f4eb648b wait ssl connect completion on client proxy path
Subject: [PATCH] We can ran into situation (at least on iOS) when with openssl
 nonblocking BIO and http proxy we don't perform ssl_connect straight away so
 we need to retry until we finish ssl_connect. If we don't do that we will
 fail in LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY when testing for "HTTP/1.0
 200" successful connection.

Signed-off-by: shys <shyswork@zoho.com>
2013-10-24 22:27:08 +08:00