Commit graph

1722 commits

Author SHA1 Message Date
Andy Green
bc10edb359 client ssl add flag to control server cert hostname check
This is a simplified version of a patch that went on master before v2.1

675c349cc5

It enforces hostname checking for client SSL certs; perviously it was
not performed.

On v2.1+, you can control if this checking is applied or not.  But to
avoid changing to public API, it is enforced on v2.0-stable.

There is no legit reason to disable this check... if you want to disable it,
upgrade to v2.1+ or stay on v2.0-stable behind this patch.

https://github.com/warmcat/libwebsockets/issues/715
2016-12-14 19:27:46 +08:00
Andy Green
b75680a15f client: avoid possible NULL deref on error path
https://github.com/warmcat/libwebsockets/issues/672
2016-12-12 20:39:03 +08:00
Andy Green
dff4f2613d ws-server: restrict returned Sec-Websocket-Protocol to the chosen name only
https://libwebsockets.org/pipermail/libwebsockets/2016-November/002948.html

Updated to fix a problem with no protocol

https://github.com/warmcat/libwebsockets/issues/705
2016-12-10 09:14:37 +08:00
sjames1958gm
65cefdf879 client stash: update path variable to larger size 2016-11-22 09:01:34 +08:00
Andy Green
ba5f80a00a lws_socket_bind: use lws_sockfd_type 2016-11-16 09:01:02 +08:00
Andy Green
aba9ad0ea0 client: protect againt losing ah by lws_client_connect_2 2016-11-15 17:00:35 +08:00
Joerg Pommnitz
b40c0b8f1c some compilers need void param explicitly 2016-10-10 20:07:46 +08:00
Yuchen Xie
a9db080b6c Correct the library name of LIBHUBBUB_LIBRARIES
It should be `hubbub` in `find_library` to make the function work.
2016-10-10 20:07:37 +08:00
Andy Green
67f2bfe4da docs: explain lws_write handling of truncated sends better 2016-10-08 18:13:24 +08:00
Andy Green
3213c56516 document extpoll forced service problem on v2.0 2016-10-07 20:04:19 +08:00
Andy Green
7fc6515dc6 travis: explicitly point to openssl on osx
One day this started failing at CMake autofind. This forces it to look at the right place.
2016-10-05 10:16:28 +08:00
Andy Green
f7dd9d027a port forced service checking from libuv
Related to second part of

https://github.com/warmcat/libwebsockets/issues/638
2016-10-05 08:49:53 +08:00
Andy Green
846a3caf80 closing drops any pending ah rx immediately 2016-10-05 08:46:54 +08:00
Andy Piper
0a0377b143 windows detect client connection error 2016-10-04 21:43:22 +08:00
Peter Pentchev
01c47d0622 Remove the cleanup functions with OpenSSL 1.1. 2016-10-03 21:20:54 +08:00
Peter Pentchev
0af47a0b8d Subject: Fix some typographical and grammatical errors. 2016-10-03 21:19:06 +08:00
Andy Green
ab9c2f329c lws_header_table_reset: make caller responsibility to clear down ah rx buffer
There are two kinds of reaason to call lws_header_table_reset(), one is we are reallocating
a destroyed ah to another wsi, and the other is we are moving to the next pipelined header set
still on the same wsi, and we need a "weaker" reset that only clears down the state related
to the header parsing, not everything about the ah context including the ah rx buffer.

This patch moves the ah rxbuffer rxpos and rxlen resetting out of lws_header_table_reset() and to
be the responsibility of the caller.  Callers who are moving the ah to another wsi are
patched to deal with resetting rxpos and rxlen and lws_http_transaction_completed() who only
resets the ah when moving to the next pipelined headers, no longer wrongly clears the ah rxbuf.

https://github.com/warmcat/libwebsockets/issues/638
2016-09-29 10:38:26 +08:00
Brown, Matthew
3d48ce8f09 Added option to build the static library with PIC 2016-09-27 05:37:58 +08:00
Patrick Gansterer
a2241384e7 Add SVG to lws_get_mimetype() 2016-09-23 06:31:50 +08:00
Andy Green
5a247a57d2 v2.0.3 2016-09-15 03:07:47 +08:00
Andy Green
1f02bd2e66 lws_snprintf
Thanks to Fabrice Gilot for reporting the problem that led to uncovering this.

Due to a misunderstanding of the return value of snprintf (it is not truncated according
to the max size passed in) in several places relying on snprintf to truncate the length
overflows are possible.

This patch wraps snprintf with a new lws_snprintf() which does truncate its length to allow
the buffer limiting scheme to work properly.

All users should update with these fixes.
2016-09-15 02:54:32 +08:00
Andy Green
d7fb6ad9cf handle rx flow control active when consuming payload
https://github.com/warmcat/libwebsockets/issues/622
2016-09-10 04:44:56 +08:00
Andy Green
2aa6f1bccd adopt_socket_vhost: error path doesn't remove us from timeout list
As found by "github user 7"

https://github.com/warmcat/libwebsockets/issues/621
2016-09-09 08:31:56 +08:00
Andy Green
0f7e4dbd48 coverity 169271 - take care about sockfd of -1 on close 2016-08-28 09:54:30 +08:00
Patrick Gansterer
6a75dca024 Update badges in README.md
Fix the link to Appveyor and use SVG images.
2016-08-27 05:59:43 +08:00
Patrick Gansterer
b7473a354d Remove unneeded #include <stdint.h>
This fixes the build for Visual Studio 2008.
2016-08-26 19:41:31 +08:00
Andy Green
a86666cfe5 update changelog for v2.0.2 release that went out without it 2016-08-26 07:37:25 +08:00
Patrick Gansterer
4324ea598b Add error handling for SSL_new() of clients
Do not access wsi->ssl if SSL_new() failed and log the error.
2016-08-14 19:54:12 +08:00
Andy Green
d4410f1d07 server max protocol element 64
https://github.com/warmcat/libwebsockets/issues/601
2016-08-11 05:53:54 +08:00
Andy Green
f0789545e7 SNI-vhost-matching-fallback-to-wildcard 2016-07-11 09:56:56 +08:00
Robin Rowe
7d45a746d6 fix __x86_64__ check
https://github.com/warmcat/libwebsockets/issues/574
2016-06-30 02:14:03 +08:00
Andy Green
3382efe5d6 client confirm server hostname in cert
Openssl v1.0.2 and above have support for checking the hostname
the client side connected to against the hostname on the cert the
server presented.

This enables that feature if the necessary API is available in the
openssl version, meaning the connection will fail at ssl negotiation if the
cert isn't for the requested server

It's very easy to test, add a fake entry to /etc/hosts for the server IP with
a different name, using that will fail at ssl but using the correct dns name
matching the certificate will work.
2016-06-28 20:25:46 +08:00
Gadkari Mugdha
c1e14e7f6c fix for https connection code 2016-06-13 17:20:27 +08:00
Karl Palsson
27b7055ac6 non-openssl: only check for openssl ecdh in openssl builds
See also
https://github.com/warmcat/libwebsockets/issues/559

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-06-07 19:52:13 +08:00
Andy Green
f6f2dfc7fd client CONNECTION_ERROR also allow in LWSS_CLIENT_UNCONNECTED
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-07 17:26:11 +08:00
Andy Green
e746a993d0 lws_ssl_client_connect2 remove duplicate close on error path
https://github.com/warmcat/libwebsockets/issues/532

Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-07 01:34:02 +08:00
Andy Green
5f0dc8f4e6 ARRAY_SIZE dont redefine
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-06 20:34:33 +08:00
Andy Green
b064fb5bc9 v2.0.2
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-06 19:59:30 +08:00
Martin C Drohmann
15bb297fbb Revert changes in daemonize.c from commit 22d6f39e7f 2016-06-02 13:06:32 +08:00
Young
83a79ec381 update document for lws_get_context 2016-06-01 08:38:39 +08:00
Fabian Kurz
9694e5194c lwsl_timestamp month off by one 2016-06-01 08:38:27 +08:00
Andy Green
0f222cdc77 output size trimming with default rxbuf fix
5e203f78e2 accidentally
trashed the "zero rz_buffer_size means 4096" handling
for tx chunking.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-15 09:01:43 +08:00
Andy Green
62a8b0cb33 appveyor libuv integration
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-15 09:01:30 +08:00
Andy Green
73f859d9e7 lwsws conf mount extra mimetypes
This patch adds the ability to provide extra mimtypes on a mount.

lwsws conf learns how to do them.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-14 10:48:28 +08:00
Andy Green
37320ced18 lejp handle name elements starting with dot
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-14 10:25:52 +08:00
Andy Green
3bd3a41e97 lwsws conf allow setting cipher list and ecdh curve
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-14 08:34:29 +08:00
Andy Green
bc3f77e977 win32 more build fixes
After alexgille

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

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-14 06:56:31 +08:00
Andy Green
7d259d885a access_log ensure no reuse of freed log area
Valgrind caught http/1.1 pipelining using dead user agent alloc
for logging... NULL it when we free it since the wsi can be
reused with keepalive

==16208== Invalid free() / delete / delete[] / realloc()
==16208==    at 0x4847ACC: free (vg_replace_malloc.c:530)
==16208==    by 0x4888DC3: _realloc (alloc.c:8)
==16208==    by 0x4888DFF: lws_realloc (alloc.c:16)
==16208==    by 0x487DBCB: lws_access_log (libwebsockets.c:2352)
==16208==    by 0x48956DF: lws_http_transaction_completed (server.c:1245)
==16208==    by 0x4893757: lws_http_serve (server.c:340)
==16208==    by 0x48946EF: lws_http_action (server.c:748)
==16208==    by 0x4894CEF: lws_handshake_server (server.c:900)
==16208==    by 0x48786BF: lws_read (handshake.c:120)
==16208==    by 0x4896103: lws_server_socket_service (server.c:1580)
==16208==    by 0x487FB6B: lws_service_fd_tsi (service.c:779)
==16208==    by 0x48803B7: lws_service_fd (service.c:1079)
==16208==  Address 0x552e5f8 is 0 bytes inside a block of size 86 free'd
==16208==    at 0x4847ACC: free (vg_replace_malloc.c:530)
==16208==    by 0x4888DC3: _realloc (alloc.c:8)
==16208==    by 0x4888DFF: lws_realloc (alloc.c:16)
==16208==    by 0x487DBCB: lws_access_log (libwebsockets.c:2352)
==16208==    by 0x48956DF: lws_http_transaction_completed (server.c:1245)
==16208==    by 0x4893757: lws_http_serve (server.c:340)
==16208==    by 0x48946EF: lws_http_action (server.c:748)
==16208==    by 0x4894CEF: lws_handshake_server (server.c:900)
==16208==    by 0x48786BF: lws_read (handshake.c:120)
==16208==    by 0x4896103: lws_server_socket_service (server.c:1580)
==16208==    by 0x487FB6B: lws_service_fd_tsi (service.c:779)
==16208==    by 0x48803B7: lws_service_fd (service.c:1079)
==16208==  Block was alloc'd at
==16208==    at 0x4846498: malloc (vg_replace_malloc.c:298)
==16208==    by 0x4848D57: realloc (vg_replace_malloc.c:785)
==16208==    by 0x4888DA7: _realloc (alloc.c:6)
==16208==    by 0x4888DFF: lws_realloc (alloc.c:16)
==16208==    by 0x4893EAF: lws_http_action (server.c:565)
==16208==    by 0x4894CEF: lws_handshake_server (server.c:900)
==16208==    by 0x48786BF: lws_read (handshake.c:120)
==16208==    by 0x4896103: lws_server_socket_service (server.c:1580)
==16208==    by 0x487FB6B: lws_service_fd_tsi (service.c:779)
==16208==    by 0x48803B7: lws_service_fd (service.c:1079)
==16208==    by 0x48994B7: lws_io_cb (libuv.c:101)
==16208==    by 0x4AE7B1F: ??? (in /usr/lib/libuv.so.1.0.0)


Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-13 11:00:45 +08:00
Andy Green
9c0cc42707 asserts log which
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-13 10:59:44 +08:00
Sterling Jensen
85213516d3 Fix leak caused by undestroyed pthread mutex 2016-05-13 09:42:58 +08:00