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

4776 commits

Author SHA1 Message Date
Paulo Roberto Urio
4144e83c9d some toolchains need stddef
Signed-off-by: Paulo Roberto Urio <paulourio@gmail.com>
2012-06-04 09:04:33 +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
Tobias Maier
d1db83c650 sockets were left open if connection could not be
established resulting in a mass of unusable open file
 descriptors

Signed-off-by: Tobias Maier <tobias.maier@netplace.com>
2012-05-30 12:46:42 +08:00
yuval tal
e59d477c07 link lz explicitly for mips
fix link error since libz is not linked in

Signed-off-by: yuval tal <yuvalt@boxee.tv>
2012-05-21 10:16:06 +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
13f7791d0c refresh autotools stuff
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-05-20 08:17:02 +08:00
Andy Green
86e82ab22f update test html now mozilla uses normal ws apis
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-05-03 12:48:14 +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
Andy Green
cf56e4dd0f cleanup extra wrapping needed on braced define
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-05-03 11:17:08 +08:00
Peter Hillier
05c66f7e4e android toolchain SHA1 endian fix
Android toolchain needs an extra include if it's not to confuse
SHA-1 code probably with incorrect endian-ness from missing /bits/

Signed-off-by: Peter Hillier <peterhillier@yahoo.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2012-05-02 06:09:45 +08:00
David Brooks
06fbcee703 ssize_t needs help on windows
ssize_t is needed, but absent in Windows.

This patch typedefs it to an int in that case as recommended by Tobias.

Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: David Brooks <dave@bcs.co.nz>
Signed-off-by: Tobias Maier <tobias.maier@netplace.com>
Reported-by: Rich Gossweiler <rich.gossweiler@gmail.com>
2012-05-02 06:02:45 +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
993343b5e4 set connection callback before connection completed to allow early messages
Signed-off-by: David Brooks <dave@bcs.co.nz>
Signed-off-by: Andy Green <andy@warmcat.com>
--

 lib/client-handshake.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
2012-04-20 12:27:24 +08:00
David Brooks
6c6a3d3caf improve callback prototypes to use single definition
Not sure all compilers can hack this, but give it a try

Signed-off-by: David Brooks <dave@bcs.co.nz>
Signed-off-by: Andy Green <andy@warmcat.com>
--
2012-04-20 12:13:50 +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
Pasi Mankinen
4d80662a65 workaround osx compiler bug
Signed-off-by: Pasi Mankinen <pasi.t.mankinen@student.jyu.fi>
2012-04-14 07:30:25 +08:00
Andy Green
9c5436cb57 document mingw build
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:32:47 +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
dc36192435 doc add explanation missing from per context provate data
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:32:03 +08:00
Andy Green
39347de0e0 mingw add zlib paths
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:31:49 +08:00
Andy Green
796ce7ab15 remove duplicated netdb include from client handshake
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:31:36 +08:00
Andy Green
cce2a81e85 change DATADIR to INSTALL_DATADIR solve mingw conflict
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:31:25 +08:00
Andy Green
a3147888d6 mingw gettimeofday avoid missing include
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:31:12 +08:00
Andy Green
eeeddf030d mingw add in missing poll defs
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:30:55 +08:00
Andy Green
2a480ea83c mingw hide some missing includes
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:30:42 +08:00
Andy Green
0dbef49e54 autoconf introduce enable mingw and adapt compiler options
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 10:11:29 +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
3059263e3f make duplicate headers append instead of get ignored
The code to prevent memory leaks caused by reallocating a wsi->utf8_token
was also causing wsi->parser_state to not be updated, preventing the
handshake from completing.

This patch changes the logic to append to previous allocation which is
correct behaviour actually.

Signed-off-by: Nick Dowell <nick@nickdowell.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2012-04-05 10:31:48 +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
Nick Dowell
f803c0d9df fix heap corruption if HTTP callback calls libwebsocket_close_and_free_session
Signed-off-by: Nick Dowell <nick@nickdowell.com>
2012-04-05 10:29:29 +08:00
Andy Green
fd96330920 map wsorigin on to origin at an early point and stop dupe header mem leaks
Carlo wrote

''I'm interested to use the libwebsockets server (C based) with a Java
websocket client. I was able to implement a Java websocket client based
on JWebSocket library that works fine with the libwebsockets server, but
I was obliged to patch the libwebsockets server in order to reach my
goal. In particular I patched the handshake_00() function because
JWebSocket library uses hixie 76 version. The problem was that the
JWebSocket library sends only WSI_TOKEN_SWORIGIN token instead
WSI_TOKEN_ORIGIN token. For this reason the handshake_00 failed because
the token length of WSI_TOKEN_ORIGIN was 0. I have written a patch in
order to control if at least one of the two tokens (WSI_TOKEN_SWORIGIN
and WSI_TOKEN_ORIGIN) is defined. I have attached into the e-mail the
patch. Probably it can be written better, but in any case I think that
this problem should be fixed for client/server compatibility.''

I found a simpler approach which is convert WSORIGIN processing to
go into ORIGIN token at the earliest point, then everything else can
stay the same.

I also noticed we would leak on duplicated headers and fixed that.

Reported-by: Carlo PARATA <carlo.parata@st.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2012-04-04 08:29:08 +08:00
Nick Dowell
5519d9f054 handle unsupported protocol correctly
Hi Andy,

First off, thanks for libwebsockets :-)

I've encountered a crash when a client connects to a libwebsockets server
but speicifies an unsupported protocol (Sec-WebSocket-Protocol).
handshake.c should probably be checking that wsi->protocol->name is not
null before doing a strcmp with it...
Attached is a patch for your consideration.

Cheers!
Nick

Signed-off-by: Nick Dowell <nick@nickdowell.com>
2012-04-04 08:27:35 +08:00
Andy Green
15601fd8f1 fix issuing null extension header if none supported
Josh realized that with new Chrome, because we don't support the type of
compression extension yet we returned a null extension header.

This patch fixes that by deferring issuing the extension header until we
find we have something to say.

tested OK on google-chrome 19.0.1081.2-129295

Reported-by: Josh Roberson <josh@asteriasgi.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
2012-03-29 09:27:13 +08:00
Artem Egorkine
d515ddd51d Don't care for the human-readable part of "HTTP/1.1 101" reply
While the protocol specification gives example of the
human-readable message associated with a 101-code reply,
nowhere does it actually enforce it. Ws4py gevent middleware
is known to have a message other than "Switching Protocols".
2012-02-19 17:26:17 +01:00
Dan Zhang
f2e5e985c3 cleanup fixes tested on win32 compiler
Signed-off-by: Dan Zhang <emaildanzhang@gmail.com>
2011-11-09 15:55:16 +08:00
Andy Green
20b66e9939 win32 poll emulation clean and address PEEK issue
Dan Zhang needed to defeat the recv() with PEEK in order to get working
poll() emulation on 64-bit windows.

I cleaned up the style in that file and made a version of his workaround
(which was force recv result to 0).  I can't test the result so it may
need more work.

Reported-by: Dan Zhang <emaildanzhang@gmail.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2011-11-09 07:28:45 +08:00
Andy Green
cc01247c50 debug move most spew into debug macro
This quietens the spew so all typical debug info now is coming from
the user code (mirror protocol in the sample server / client case).

Signed-off-by: Andy Green <andy@warmcat.com>
2011-11-07 19:53:23 +08:00
Alex Bligh
49146dbcce Add libwebsockets_ensure_user_space
This patch unifies the code for per-connection user allocation, and allows
it to be allocated earlier, duiring HTTP service time.  It's also OK to
attempt allocation multiple times, it will just return any existing
allocation.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
2011-11-07 17:19:25 +08:00
David Galeano
2f5b9bd30e add missing win32 zlib pieces
Signed-off-by: David Galeano <davidgaleano@turbulenz.biz>
2011-10-04 20:59:24 +08:00
Oleg Golosovskiy
2ef75057cd http charsets have case insensitive tokens
Andy,

According http://www.ietf.org/rfc/rfc2616.txt HTTP character sets are identified by case-insensitive tokens.

Please replase

                     if (strcmp(lws_tokens[n].token, wsi->name_buffer))
                           continue;

to

                     if (stricmp(lws_tokens[n].token, wsi->name_buffer))
                           continue;

Oleg

Also introduce strcasecmp definition for win32

Signed-off-by: Oleg Golosovskiy <ogolosovskiy@unison.com>
2011-10-04 20:20:14 +08:00
David Galeano
7b11fec7ca Added support for Windows XP. 2011-10-04 19:55:18 +08:00
David Galeano
08d60f1876 Added BYTE_ORDER definition for win32 builds. 2011-10-03 19:30:27 +08:00
Andy Green
07b56e6a8c doc LWS_EXTERN
Signed-off-by: Andy Green <andy@warmcat.com>
2011-10-03 19:30:22 +08:00
David Galeno
0644779c62 zlib update
Signed-off-by: David Galeno <davidgaleano@turbulenz.biz>
2011-09-26 17:33:45 +01:00