1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
Commit graph

350 commits

Author SHA1 Message Date
Andy Green
f7609e9ada logging ensure everyone has a newline
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-15 15:41:15 +08:00
Andy Green
3fc2c65d2f replace ifdefs around close socket with compatible_close
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-15 15:41:05 +08:00
Larry Hayes
455d1fed06 ssl client certs fix crash
I run a web socket server that requires clients to present a certificate.

context_ssl_ = libwebsocket_create_context(wssPort_, wssIpAddr_.c_str(), protocols_ssl,

                           libwebsocket_internal_extensions,

                           cert_path.c_str(), key_path.c_str(), -1, -1,

		LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT);

I am getting a crash in the OpenSSL_verify_callback().

The SSL_get_ex_data() call is returning NULL

I could not find a call to SSL_set_ex_data() for server mode operation.

Has anyone seen this crash in the newer versions?

Signed-off-by: Larry Hayes <larry.hayes@prodeasystems.com>
2013-01-15 01:03:58 +08:00
Andy Green
c0d6b63c83 expose compiletime constants to setting from configure
This patch allows control of the main compiletime constants in libwebsockets
from the configure commandline.

README is updated with documentation on what's available, how to set them
and the defaults.

The constants are logged with "info" severity (not visible by default) at
context create time.

The zlib constant previously exposed like this is moved to private-libwebsockets.h
so it can be printed along with the rest.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-12 23:42:17 +08:00
David
c4ef7b1609 introduce getifaddrs for toolchains without it
David found that uclibc did not provide this slightly esoteric api
and provided one from BSD that can be built by the library internally.

AG: Made contingent on configure option --enable-builtin-getifaddrs

Signed-off-by: David <cymerio@gmail.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-12 20:39:47 +08:00
Andy Green
41c5803d0f audit and make all malloc check for OOM
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-12 13:21:08 +08:00
Andy Green
8a26509800 logging add timestamp
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-12 09:31:11 +08:00
Andy Green
de8f27a80b logging extend level set api to allow setting emission function
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-12 09:17:42 +08:00
Andy Green
43db045ff8 introduce logging api and convert all library output to use it
- multiple debug context calls lwsl_ err, warn, debug, parser, ext, client

 - api added to set which contexts output to stderr using a bitfield log_level

 - --disable-debug on configure removes all code that is not err or warn severity

 - err and warn contexts always output to stderr unless disabled by log_level

 - err and warn enabled by default in log_level

Signed-off-by: Andy Green <andy@warmcat.com>
2013-01-10 22:16:37 +08:00
Aaron Zinman
4550f1d7b5 compile in xcode, privatize debug macro 2013-01-10 22:14:52 +08:00
David Galeano
ed3c840ed6 Avoid leaking a socket when SSL_accept fails. 2013-01-10 12:45:54 +08:00
David Galeano
7c8d98924b Print error string on accept failure. 2013-01-10 12:45:54 +08:00
David Galeano
7ffbe1bfca Fixed to keep reading data until the SSL internal buffer is empty.
Before this fix only 2048 bytes were read,
the rest were buffered inside SSL until another message arrived!!!
2013-01-10 12:45:54 +08:00
David Galeano
4fbc40c07d Added no-cache headers to client handshake:
http://www.ietf.org/mail-archive/web/hybi/current/msg09841.html
2013-01-10 12:45:54 +08:00
David Galeano
cc148e4029 Check if macro SSL_OP_NO_COMPRESSION is defined before trying to use it. 2013-01-10 12:45:53 +08:00
David Galeano
f177f2a15e Added private macro CIPHERS_LIST_STRING to define ciphers list string. 2013-01-10 12:45:53 +08:00
David Galeano
77a677c2bd When choosing a cipher, use the server's preferences. 2013-01-10 12:45:53 +08:00
David Galeano
c72f6f9fa0 Disable compression for SSL socket,
it is a waste of CPU when using compression extensions.
2013-01-10 12:45:53 +08:00
David Galeano
9b3d4b2152 Using "SSL_CTX_use_certificate_chain_file" instead of "SSL_CTX_use_certificate_file"
to support server certificates signed by intermediaries.
2013-01-10 12:45:53 +08:00
David Galeano
369730921e Set listen backlog to SOMAXCONN. 2013-01-10 09:58:24 +08:00
David Galeano
b88e096e19 Fixed operator precedence bug. 2013-01-10 09:54:10 +08:00
David Galeano
4c38f14527 Allow extensions when no protocol was specified. 2013-01-09 19:49:50 +08:00
David Galeano
e2cf992571 Added support for extensions that only manipulate application data. 2013-01-09 18:17:42 +08:00
David Galeano
c9f1ff843f Added private macro AWAITING_TIMEOUT instead of harcoded value 5. 2013-01-09 18:17:42 +08:00
David Galeano
2f82be89d5 Added context creation parameter for CA certificates file. 2013-01-09 16:25:54 +08:00
David Galeano
aa0bc86143 Changed client handshake to use "Origin" instead of "Sec-WebSocket-Origin" as defined by RFC 6455 when using version 13 of the protocol. 2013-01-09 15:31:46 +08:00
David Galeano
cb19368e14 Fixed compiler warnings on Windows. 2013-01-09 15:29:00 +08:00
Andy Green
788c4a8fa8 add context construction option to skip server hostname lookup
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-10-22 12:29:57 +01:00
Andy Green
15e31f373d add missing docs for new context user pointer
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-10-19 18:36:28 +08:00
Alon Levy
dc93b7f2e7 libwebsocket_service_fd: EAGAIN is harmless, treat like EINTR
Only tested on linux.

Signed-off-by: Alon Levy <alevy@redhat.com>
2012-10-19 18:27:40 +08:00
Alon Levy
0291eb3b95 libwebsocket_context: add userspace pointer for use before wsi creation
Signed-off-by: Alon Levy <alevy@redhat.com>
2012-10-19 18:27:19 +08:00
Andy Green
5e8967a54e always taking an interest in ppid wont hurt
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-10-17 20:10:44 +08:00
Andy Green
fa3f405d1d stop being so fragile on socket lifecycle
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-10-07 20:40:35 +08:00
Andy Green
3928f6178a restore accept error as closure signal
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-07-20 12:58:38 +08:00
Artem Baguinski
915316644c check for prctl, poll parent PID if not present
this allows forking code to be used on non-linux systems
2012-07-20 10:04:45 +08:00
Paulo Roberto Urio
1e32663805 Fixing uninitialised memory
These were found with valgrind tool.
Signed-off-by: Paulo Roberto Urio <paulourio@gmail.com>
2012-06-04 10:52:19 +08:00
Andy Green
5513fe0577 add missing sa_data init to canonical hostname code
Shay noticed we're no longer initializing the initial lookup of
server canonical hostname correctly

Reported-by: Shay Zuker <shay@boxee.tv>
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-06-04 08:53:26 +08:00
Paulo Roberto Urio
1f680abb7d Fixed segfault in libwebsocket_context_destroy.
When creating a context with NULL extensions list,
a segmentation fault was yelled when trying to
destroy the context.  This checks if the
extension list is NULL before go through the list.
Signed-off-by: Paulo Roberto Urio <paulourio@gmail.com>
2012-06-04 08:40:28 +08:00
Andrew Chambers
d5512179fc null exception with null extensions list
I was under the impression extensions could be null, so heres a patch to fix this error in libwebsockets. Cheers!

Signed-off-by: Andrew Chambers <andrewchamberss@gmail.com>

--
2012-05-20 08:17:09 +08:00
Andy Green
a69f051870 start migration to getnameinfo
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-05-03 12:32:38 +08:00
Ken Atherton
8360a47011 openssl allow connect multiple packets for SSL_connect
Ken found over the internet with real delays, SSL_connect can
fail to work.  This patch adapts his workaround to stay in the
connect state until we either run out of time for the connect
or succeed.

Signed-off-by: Andy Green <andy.green@linaro.org>
Signed-off-by: Ken Atherton <katherton@echofirst.com>
2012-05-03 11:45:04 +08:00
David Brooks
2c60d9584e introduce libwebsocket_client_connect_extended
Signed-off-by: David Brooks <dave@bcs.co.nz>
Signed-off-by: Andy Green <andy@warmcat.com>
--
2012-04-20 12:28:14 +08:00
David Brooks
80a44975e9 introduce LWS_CALLBACK_CLIENT_CONNECTION_ERROR
Signed-off-by: David Brooks <dave@bcs.co.nz>
Signed-off-by: Andy Green <andy@warmcat.com>
--
2012-04-20 12:28:11 +08:00
David Brooks
ee2213d365 reduce debug spew
Signed-off-by: David Brooks <dave@bcs.co.nz>
Signed-off-by: Andy Green <andy@warmcat.com>
--
2012-04-20 12:13:37 +08:00
Andy Green
aa6fc44b0a mingw add win32helper to lib and fix extpoll
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:32:19 +08:00
Andy Green
6ee372fcd8 style cleaning
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-09 15:24:22 +08:00
Andy Green
7b5af9af15 fix onopen browser context patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-09 15:23:47 +08:00
Yonathan Yusim
3ae39ff796 allow message processing from onopen browser context
Found an issue in libwebsockets - if a server sends a message within its "onopen" context then the message is getting swallowed and not passed to calling client (means LWS_CALLBACK_CLIENT_RECEIVE is never getting called).
I've fixed the bug - pls find attached patch.

Signed-off-by: Yonathan Yusim <yonathan@boxee.tv>
Signed-off-by: Andy Green <andy@warmcat.com>
2012-04-09 06:42:39 +08:00
Tobias Maier
e8c9b565a4 use ssize_t instead of size_t for return values of read/recv/SSL_read
Signed-off-by: Tobias Maier <tobias.maier@netplace.com>
2012-04-05 18:24:53 +08:00
Nick Dowell
c04c193dc3 close connection if socket recv() fails.
This prevents a problem observed on Windows whereby a client that
disconnects before fully establishing the WebSocket would cause the
server to use 100% CPU since recv() would continually return -1 for that
socket.

Signed-off-by: Nick Dowell <nick@nickdowell.com>
2012-04-05 10:29:39 +08:00