profile/ivi/libwebsockets.git
12 years agosockets were left open if connection could not be
Tobias Maier [Wed, 30 May 2012 04:46:42 +0000 (12:46 +0800)]
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>
12 years agolink lz explicitly for mips
yuval tal [Mon, 21 May 2012 02:16:06 +0000 (10:16 +0800)]
link lz explicitly for mips

    fix link error since libz is not linked in

Signed-off-by: yuval tal <yuvalt@boxee.tv>
12 years agonull exception with null extensions list
Andrew Chambers [Sun, 20 May 2012 00:17:09 +0000 (08:17 +0800)]
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>
--

12 years agorefresh autotools stuff
Andy Green [Sun, 20 May 2012 00:17:02 +0000 (08:17 +0800)]
refresh autotools stuff

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agoupdate test html now mozilla uses normal ws apis
Andy Green [Thu, 3 May 2012 04:48:14 +0000 (12:48 +0800)]
update test html now mozilla uses normal ws apis

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agostart migration to getnameinfo
Andy Green [Thu, 3 May 2012 04:32:38 +0000 (12:32 +0800)]
start migration to getnameinfo

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agoopenssl allow connect multiple packets for SSL_connect
Ken Atherton [Thu, 3 May 2012 03:45:04 +0000 (11:45 +0800)]
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>
12 years agocleanup extra wrapping needed on braced define
Andy Green [Thu, 3 May 2012 03:17:08 +0000 (11:17 +0800)]
cleanup extra wrapping needed on braced define

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agoandroid toolchain SHA1 endian fix
Peter Hillier [Tue, 1 May 2012 22:09:45 +0000 (06:09 +0800)]
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>
12 years agossize_t needs help on windows
David Brooks [Tue, 1 May 2012 22:02:45 +0000 (06:02 +0800)]
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>
12 years agointroduce libwebsocket_client_connect_extended
David Brooks [Fri, 20 Apr 2012 04:19:01 +0000 (12:19 +0800)]
introduce libwebsocket_client_connect_extended

Signed-off-by: David Brooks <dave@bcs.co.nz>
Signed-off-by: Andy Green <andy@warmcat.com>
--

12 years agointroduce LWS_CALLBACK_CLIENT_CONNECTION_ERROR
David Brooks [Fri, 20 Apr 2012 04:18:47 +0000 (12:18 +0800)]
introduce LWS_CALLBACK_CLIENT_CONNECTION_ERROR

Signed-off-by: David Brooks <dave@bcs.co.nz>
Signed-off-by: Andy Green <andy@warmcat.com>
--

12 years agoset connection callback before connection completed to allow early messages
David Brooks [Fri, 20 Apr 2012 04:16:52 +0000 (12:16 +0800)]
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(-)

12 years agoimprove callback prototypes to use single definition
David Brooks [Fri, 20 Apr 2012 04:13:50 +0000 (12:13 +0800)]
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>
--

12 years agoreduce debug spew
David Brooks [Fri, 20 Apr 2012 04:13:37 +0000 (12:13 +0800)]
reduce debug spew

Signed-off-by: David Brooks <dave@bcs.co.nz>
Signed-off-by: Andy Green <andy@warmcat.com>
--

12 years agoworkaround osx compiler bug
Pasi Mankinen [Fri, 13 Apr 2012 23:28:19 +0000 (07:28 +0800)]
workaround osx compiler bug

Signed-off-by: Pasi Mankinen <pasi.t.mankinen@student.jyu.fi>
12 years agodocument mingw build
Andy Green [Thu, 12 Apr 2012 05:32:47 +0000 (13:32 +0800)]
document mingw build

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agomingw add win32helper to lib and fix extpoll
Andy Green [Thu, 12 Apr 2012 05:26:49 +0000 (13:26 +0800)]
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>
12 years agodoc add explanation missing from per context provate data
Andy Green [Thu, 12 Apr 2012 03:15:23 +0000 (11:15 +0800)]
doc add explanation missing from per context provate data

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agomingw add zlib paths
Andy Green [Thu, 12 Apr 2012 03:11:10 +0000 (11:11 +0800)]
mingw add zlib paths

Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agoremove duplicated netdb include from client handshake
Andy Green [Thu, 12 Apr 2012 03:08:55 +0000 (11:08 +0800)]
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>
12 years agochange DATADIR to INSTALL_DATADIR solve mingw conflict
Andy Green [Thu, 12 Apr 2012 03:06:05 +0000 (11:06 +0800)]
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>
12 years agomingw gettimeofday avoid missing include
Andy Green [Thu, 12 Apr 2012 03:02:06 +0000 (11:02 +0800)]
mingw gettimeofday avoid missing include

Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agomingw add in missing poll defs
Andy Green [Thu, 12 Apr 2012 02:56:20 +0000 (10:56 +0800)]
mingw add in missing poll defs

Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agomingw hide some missing includes
Andy Green [Thu, 12 Apr 2012 02:54:22 +0000 (10:54 +0800)]
mingw hide some missing includes

Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agoautoconf introduce enable mingw and adapt compiler options
Andy Green [Thu, 12 Apr 2012 02:11:29 +0000 (10:11 +0800)]
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>
12 years agostyle cleaning
Andy Green [Mon, 9 Apr 2012 07:09:01 +0000 (15:09 +0800)]
style cleaning

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agofix onopen browser context patch
Andy Green [Mon, 9 Apr 2012 07:23:47 +0000 (15:23 +0800)]
fix onopen browser context patch

Signed-off-by: Andy Green <andy.green@linaro.org>
12 years agoallow message processing from onopen browser context
Yonathan Yusim [Sun, 8 Apr 2012 22:42:39 +0000 (06:42 +0800)]
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>
12 years agouse ssize_t instead of size_t for return values of read/recv/SSL_read
Tobias Maier [Thu, 5 Apr 2012 09:57:12 +0000 (11:57 +0200)]
use ssize_t instead of size_t for return values of read/recv/SSL_read

Signed-off-by: Tobias Maier <tobias.maier@netplace.com>
12 years agomake duplicate headers append instead of get ignored
Nick Dowell [Thu, 5 Apr 2012 02:31:48 +0000 (10:31 +0800)]
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>
12 years agoclose connection if socket recv() fails.
Nick Dowell [Thu, 5 Apr 2012 02:29:39 +0000 (10:29 +0800)]
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>
12 years agofix heap corruption if HTTP callback calls libwebsocket_close_and_free_session
Nick Dowell [Thu, 5 Apr 2012 02:29:29 +0000 (10:29 +0800)]
fix heap corruption if HTTP callback calls libwebsocket_close_and_free_session

Signed-off-by: Nick Dowell <nick@nickdowell.com>
12 years agomap wsorigin on to origin at an early point and stop dupe header mem leaks
Andy Green [Tue, 3 Apr 2012 15:02:20 +0000 (17:02 +0200)]
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>
12 years agohandle unsupported protocol correctly
Nick Dowell [Tue, 3 Apr 2012 16:22:19 +0000 (17:22 +0100)]
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>
12 years agofix issuing null extension header if none supported
Andy Green [Thu, 29 Mar 2012 01:27:13 +0000 (09:27 +0800)]
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>
12 years agoDon't care for the human-readable part of "HTTP/1.1 101" reply
Artem Egorkine [Wed, 23 Nov 2011 08:46:24 +0000 (10:46 +0200)]
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".

12 years agocleanup fixes tested on win32 compiler
Dan Zhang [Wed, 9 Nov 2011 07:55:16 +0000 (15:55 +0800)]
cleanup fixes tested on win32 compiler

Signed-off-by: Dan Zhang <emaildanzhang@gmail.com>
12 years agowin32 poll emulation clean and address PEEK issue
Andy Green [Tue, 8 Nov 2011 23:28:45 +0000 (07:28 +0800)]
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>
12 years agodebug move most spew into debug macro
Andy Green [Mon, 7 Nov 2011 11:53:23 +0000 (19:53 +0800)]
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>
12 years agoAdd libwebsockets_ensure_user_space
Alex Bligh [Mon, 7 Nov 2011 09:19:25 +0000 (17:19 +0800)]
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>
13 years agoadd missing win32 zlib pieces
David Galeano [Tue, 4 Oct 2011 12:59:24 +0000 (20:59 +0800)]
add missing win32 zlib pieces

Signed-off-by: David Galeano <davidgaleano@turbulenz.biz>
13 years agohttp charsets have case insensitive tokens
Oleg Golosovskiy [Tue, 4 Oct 2011 12:20:14 +0000 (20:20 +0800)]
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>
13 years agoAdded support for Windows XP.
David Galeano [Tue, 4 Oct 2011 11:55:18 +0000 (19:55 +0800)]
Added support for Windows XP.

13 years agoAdded BYTE_ORDER definition for win32 builds.
David Galeano [Mon, 3 Oct 2011 11:30:27 +0000 (19:30 +0800)]
Added BYTE_ORDER definition for win32 builds.

13 years agodoc LWS_EXTERN
Andy Green [Mon, 3 Oct 2011 11:30:22 +0000 (19:30 +0800)]
doc LWS_EXTERN

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agozlib update
David Galeno [Mon, 26 Sep 2011 16:33:45 +0000 (17:33 +0100)]
zlib update

Signed-off-by: David Galeno <davidgaleano@turbulenz.biz>
13 years agoAdded "Release DLL" configuration.
David Galeano [Mon, 26 Sep 2011 16:30:34 +0000 (17:30 +0100)]
Added "Release DLL" configuration.

13 years agoAdded LWS_EXTERN to allow building a DLL.
David Galeano [Mon, 26 Sep 2011 11:17:20 +0000 (12:17 +0100)]
Added LWS_EXTERN to allow building a DLL.
Signed-off-by: David Galeano <davidgaleano@turbulenz.biz>
13 years agoFixed compiler warnings.
David Galeano [Mon, 26 Sep 2011 11:09:54 +0000 (12:09 +0100)]
Fixed compiler warnings.
Signed-off-by: David Galeano <davidgaleano@turbulenz.biz>
13 years agoIgnoring Release build and opensdf files.
David Galeano [Mon, 26 Sep 2011 11:09:20 +0000 (12:09 +0100)]
Ignoring Release build and opensdf files.

Signed-off-by: David Galeano <davidgaleano@turbulenz.biz>
13 years agofix failure to limit 7bit lengths
Andy Green [Sun, 25 Sep 2011 09:46:31 +0000 (10:46 +0100)]
fix failure to limit 7bit lengths

Reported-by: Tran Le Hung <tranhung44@gmail.com>
Reported-by: Tobias Maier <tobias.maier@netplace.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoFix compile issue on Apple
M K [Sun, 25 Sep 2011 09:34:35 +0000 (10:34 +0100)]
Fix compile issue on Apple

Signed-off-by: M K <mkroehnert42@googlemail.com>
13 years agocorrect cpp extern only being on win32
Andy Green [Sun, 25 Sep 2011 09:30:26 +0000 (10:30 +0100)]
correct cpp extern only being on win32

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agotest html uplevel detect browser and MozWebSocket
Andy Green [Sun, 25 Sep 2011 09:01:02 +0000 (10:01 +0100)]
test html uplevel detect browser and MozWebSocket

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agov08v13 add support v13 default
Andy Green [Sun, 25 Sep 2011 08:32:54 +0000 (09:32 +0100)]
v08v13 add support v13 default

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agov08 receiver ignore frame with unhandled ext opcode
Andy Green [Sun, 25 Sep 2011 07:47:57 +0000 (08:47 +0100)]
v08 receiver ignore frame with unhandled ext opcode

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agov08 change ignore incoming set ext bits
Andy Green [Sun, 25 Sep 2011 07:47:53 +0000 (08:47 +0100)]
v08 change ignore incoming set ext bits

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agomy compiler version didn't find it, but there is an uninitialized usage of
Andy Green [Sun, 26 Jun 2011 09:27:28 +0000 (10:27 +0100)]
my compiler version didn't find it, but there is an uninitialized usage of
len pointed out by Sonic on the blog

Reported-by: Sven <sven@killig.de>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoextensions fix deflate stream vs mux and veto it on mux children
Andy Green [Sat, 28 May 2011 09:19:19 +0000 (10:19 +0100)]
extensions fix deflate stream vs mux and veto it on mux children

This patch gets deflate-stream working with x-google-mux.

It adds a clean veto system where are extension can veto the proposal
of any extension when opening a new connection.  x-google-mux uses that
in its callback to defeat any use of deflate-stream on mux children.

However deflate stream is allowed on the parent connection and works
transparently now alongside x-google-mux.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agox google mux handle illegal channel add indexes cleanup handle ch1 rx
Andy Green [Thu, 26 May 2011 11:59:13 +0000 (12:59 +0100)]
x google mux handle illegal channel add indexes cleanup handle ch1 rx

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoextensions introduce pre close veto
Andy Green [Wed, 25 May 2011 20:41:57 +0000 (21:41 +0100)]
extensions introduce pre close veto

This establishes a pre-close extension check to allow an extension to
veto a close.  x-google-mux then uses this to stop ch1 going down
(subchannel 1 is the original socket connection that turns into a mux
parent) if it has active mux children; it just marks ch1 as closed in
its conn struct in that case and returns 1 from the callback to veto.

Code is also added to take care of the case ch1 is 'closed', and the
last child is subsequently closed, it actively calls close on the mux
parent then.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoextensions change child count to highest child subchannel
Andy Green [Wed, 25 May 2011 20:07:20 +0000 (21:07 +0100)]
extensions change child count to highest child subchannel

This also changes the wsi_children array to be indexed by subchannel - 2,
non-existent channels are NULL in there and highest_child_subchannel
is a highwater mark for the highest subchannel ever used.  That way we
can immediately get the wsi for a subchannel at the cost of some extra
sparse skipping during management.

This also takes care of scanning for empty slots on allocation and
NULLing on close of subchannel instead of deletion.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoextensions ensure per conn allocation starts zeroed
Andy Green [Wed, 25 May 2011 19:46:18 +0000 (20:46 +0100)]
extensions ensure per conn allocation starts zeroed

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agox google mux complete introduction of MUX_REAL_CHILD_INDEX_OFFSET that got included...
Andy Green [Wed, 25 May 2011 11:16:00 +0000 (12:16 +0100)]
x google mux complete introduction of MUX_REAL_CHILD_INDEX_OFFSET that got included accidentally

Accidentally included half-done MUX_REAL_CHILD_INDEX_OFFSET addition a couple
of patches back after late night hacking, this patch completes it.

This makes mux added channels start at channel index 2.

1 is reserved for original carrier channel, 0 for as-yet badly defined global mux commands

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoadd gitignore
Jean-Pierre Gygax [Wed, 25 May 2011 08:51:48 +0000 (09:51 +0100)]
add gitignore

Signed-off-by: Jean-Pierre Gygax <gygax@practicomp.ch>
13 years agowin32 update for vc 2010 contributed
Jean-Pierre Gygax [Wed, 25 May 2011 08:50:58 +0000 (09:50 +0100)]
win32 update for vc 2010 contributed

Signed-off-by: Jean-Pierre Gygax <gygax@practicomp.ch>
13 years agoremove use mux blocks macro
Andy Green [Wed, 25 May 2011 08:48:03 +0000 (09:48 +0100)]
remove use mux blocks macro

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agox google mux change to new compact channel index scheme
Andy Green [Tue, 24 May 2011 22:08:05 +0000 (23:08 +0100)]
x google mux change to new compact channel index scheme

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agox google mux introduce sticky mux opcode usage if ever used in channel
Andy Green [Tue, 24 May 2011 21:57:41 +0000 (22:57 +0100)]
x google mux introduce sticky mux opcode usage if ever used in channel

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agox google mux implement child close
Andy Green [Tue, 24 May 2011 21:07:45 +0000 (22:07 +0100)]
x google mux implement child close

This implements clean client and server close for mux child connections,
and deals with accounting for parent child lists.

The mux link can then survive constant connection bringup and teardown
found in the new test client.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agotest client add flag to defeat mux extension
Andy Green [Tue, 24 May 2011 21:06:17 +0000 (22:06 +0100)]
test client add flag to defeat mux extension

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agotest client make mirror data source channel open and close all the time
Andy Green [Tue, 24 May 2011 21:06:17 +0000 (22:06 +0100)]
test client make mirror data source channel open and close all the time

This changes the test client so that for the mirror protocol socket,
the lifetime of the connection is decided randomly to last on the order
of a second or so, then the connection is closed and a new one opened when
the close is complete.

This is to enhance testing of connection bringup and teardown especially
in mux case.

The overall functionality remains the same, spamming circles to all clients.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoModify Zlib VS project to be able to build in 64 bit
Michel Archembault [Tue, 24 May 2011 18:07:16 +0000 (19:07 +0100)]
Modify Zlib VS project to be able to build in 64 bit

Signed-off-by: Michel Archembault <marchamb@matrox.com>
13 years agoMove include of gettimeofday.h to be able to build in C and C++
Michel Archambault [Tue, 24 May 2011 16:15:25 +0000 (17:15 +0100)]
Move include of gettimeofday.h to be able to build in C and C++

Signed-off-by: Michel Archambault <marchamb@matrox.com>
13 years agomove win32 zlib to correct place
Michel Archembault [Tue, 24 May 2011 15:42:42 +0000 (16:42 +0100)]
move win32 zlib to correct place

Signed-off-by: Michel Archembault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agodump active protocols and extensions at context create
Andy Green [Tue, 24 May 2011 09:14:41 +0000 (10:14 +0100)]
dump active protocols and extensions at context create

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agofix parser reaction to zero length payloads
Andy Green [Tue, 24 May 2011 08:40:59 +0000 (09:40 +0100)]
fix parser reaction to zero length payloads

Zero length payloads aren't handled properly.  This patch
should solve that.

Reported-by: Chee Wooi Saw <cheewooi@gtwholdings.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agofix server ping coming as client payload
Andy Green [Tue, 24 May 2011 08:34:50 +0000 (09:34 +0100)]
fix server ping coming as client payload

Client does auto-service server's ping, but then it
fell through and issued it as payload.  This fixes that
so there is no payload issued.

Reported-by: Chee Wooi Saw <cheewooi@gtwholdings.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce x google mux very draft indeed
Andy Green [Mon, 23 May 2011 09:00:03 +0000 (10:00 +0100)]
introduce x google mux very draft indeed

This is initial x-google-mux support.  It's disabled by default
since it's very pre-alpha.

1) To enable it, reconfigure with --enable-x-google-mux

2) It conflicts with deflate-stream, use the -u switch on
   the test client to disable deflate-stream

3) It deviates from the google standard by sending full
   headers in the addchannel subcommand rather than just
   changed ones from original connect

4) Quota is not implemented yet

5) Close of subchannel is not really implemented yet

6) Google opcode 0xf is changed to 0x7 to account for
   v7 protocol changes to opcode layout

However despite those caveats, in fact it can run the
test client reliably over one socket (both dumb-increment
and lws-mirror-protocol), you can open a browser on the
same test server too and see the circles, etc.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agowin32 update projects
Michel Archambault [Sat, 14 May 2011 14:01:02 +0000 (16:01 +0200)]
win32 update projects

Signed-off-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoremove line end at 72 for base64 encode
Andy Green [Sat, 14 May 2011 13:08:00 +0000 (15:08 +0200)]
remove line end at 72 for base64 encode

Reported-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agowin32 use binary flag on opening http file
Andy Green [Sat, 14 May 2011 13:08:00 +0000 (15:08 +0200)]
win32 use binary flag on opening http file

Reported-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agomake base 64 helper apis public
Andy Green [Sat, 14 May 2011 13:07:59 +0000 (15:07 +0200)]
make base 64 helper apis public

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agowin32 move gettimeofday include inside extern c
Andy Green [Sat, 14 May 2011 13:07:56 +0000 (15:07 +0200)]
win32 move gettimeofday include inside extern c

Reported-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agowin32 nuke autogenerated files from tree
Andy Green [Sat, 14 May 2011 11:15:09 +0000 (13:15 +0200)]
win32 nuke autogenerated files from tree

These guys aren't needed in git

Reported-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agowin32 fix release build
Andy Green [Sat, 14 May 2011 11:12:01 +0000 (13:12 +0200)]
win32 fix release build

static inline blows up release builds on VC

Reported-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agofix deflate window
Andy Green [Fri, 29 Apr 2011 09:43:06 +0000 (17:43 +0800)]
fix deflate window

Mozilla implementationcan issue window of up to 15,
need to match it

Reported-by: Patrick McManus <pmcmanus@mozilla.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agomove send pipe choked api to public exports
Andy Green [Mon, 25 Apr 2011 15:54:11 +0000 (23:54 +0800)]
move send pipe choked api to public exports

Signed-off-by: Andy Green <andy.green@linaro.org>
13 years agohandle new masking order and fixups
Andy Green [Sun, 24 Apr 2011 07:12:38 +0000 (08:12 +0100)]
handle new masking order and fixups

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointerpret new opcode map when 07
Andy Green [Sun, 24 Apr 2011 05:19:22 +0000 (06:19 +0100)]
interpret new opcode map when 07

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoissue new opcodes when 07
Andy Green [Sun, 24 Apr 2011 05:05:29 +0000 (06:05 +0100)]
issue new opcodes when 07

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agowrite client frames the new way for 07
Andy Green [Sun, 24 Apr 2011 05:04:03 +0000 (06:04 +0100)]
write client frames the new way for 07

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agocarry over 06 stuff to 07
Andy Green [Sun, 24 Apr 2011 04:49:44 +0000 (05:49 +0100)]
carry over 06 stuff to 07

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoadd 07 support
Andy Green [Sun, 24 Apr 2011 04:46:23 +0000 (05:46 +0100)]
add 07 support

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce 07 opcode ordering
Andy Green [Sat, 23 Apr 2011 09:54:53 +0000 (10:54 +0100)]
introduce 07 opcode ordering

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agofix frgmented server reply
Andy Green [Sat, 16 Apr 2011 09:54:28 +0000 (10:54 +0100)]
fix frgmented server reply

Server handshake reply might not come in one packet as pointed out by
Pavel Borzenkov.  This replaces his fix with one directly in the packet
state machine.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoRevert Pavel's patch looping in recv
Andy Green [Sat, 16 Apr 2011 09:46:21 +0000 (10:46 +0100)]
Revert Pavel's patch looping in recv

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoFix segfault in libwebsocket_write()
Pavel Borzenkov [Fri, 15 Apr 2011 12:17:26 +0000 (13:17 +0100)]
Fix segfault in libwebsocket_write()

Since 'shift' has unsigned integer type,
the following code may lead to infinite cycle
and segfault:

    while (shift >= 0) {
     if (shift)
     buf[0 - pre + n] =
     ((len >> shift) & 127) | 0x80;
     else
     buf[0 - pre + n] =
     ((len >> shift) & 127);
     n++;
     shift -= 7;
    }

Change type to signed integer.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@auriga.com>
13 years agorecv() may not return all data
Pavel Borzenkov [Fri, 15 Apr 2011 12:16:58 +0000 (13:16 +0100)]
recv() may not return all data

While performing handshake recv() is called only once.
It may return only part of the data and handshake
will fail. This patch modifies libwebsocket_service_fd()
to ensure that there is not data left in the socket.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@auriga.com>