Commit graph

2159 commits

Author SHA1 Message Date
Andy Green
6ab0bba068 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>
2011-05-25 12:16:00 +01:00
Jean-Pierre Gygax
f4a7c6944b add gitignore
Signed-off-by: Jean-Pierre Gygax <gygax@practicomp.ch>
2011-05-25 09:51:48 +01:00
Jean-Pierre Gygax
b422887874 win32 update for vc 2010 contributed
Signed-off-by: Jean-Pierre Gygax <gygax@practicomp.ch>
2011-05-25 09:50:58 +01:00
Andy Green
d3b421e112 remove use mux blocks macro
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-25 09:48:03 +01:00
Andy Green
a59bb9016c x google mux change to new compact channel index scheme
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-24 23:08:05 +01:00
Andy Green
69b6808358 x google mux introduce sticky mux opcode usage if ever used in channel
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-24 22:57:41 +01:00
Andy Green
66a16f393e 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>
2011-05-24 22:07:45 +01:00
Andy Green
7448c7ee0b test client add flag to defeat mux extension
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-24 22:06:17 +01:00
Andy Green
4084af1745 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>
2011-05-24 22:06:17 +01:00
Michel Archembault
0054401f21 Modify Zlib VS project to be able to build in 64 bit
Signed-off-by: Michel Archembault <marchamb@matrox.com>
2011-05-24 19:07:16 +01:00
Michel Archambault
03bec393a5 Move include of gettimeofday.h to be able to build in C and C++
Signed-off-by: Michel Archambault <marchamb@matrox.com>
2011-05-24 17:15:25 +01:00
Michel Archembault
6a1b904c95 move win32 zlib to correct place
Signed-off-by: Michel Archembault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-24 16:42:42 +01:00
Andy Green
2d1301e8cb dump active protocols and extensions at context create
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-24 10:14:41 +01:00
Andy Green
0059754e35 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>
2011-05-24 09:40:59 +01:00
Andy Green
3293c2a6f7 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>
2011-05-24 09:34:50 +01:00
Andy Green
a41314f3bf 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>
2011-05-23 10:00:03 +01:00
Michel Archambault
8214a0447e win32 update projects
Signed-off-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-14 16:01:02 +02:00
Andy Green
b75c026613 remove line end at 72 for base64 encode
Reported-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-14 15:08:00 +02:00
Andy Green
9c5c8385fc win32 use binary flag on opening http file
Reported-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-14 15:08:00 +02:00
Andy Green
ec7e0dc0f6 make base 64 helper apis public
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-14 15:07:59 +02:00
Andy Green
f94e058e52 win32 move gettimeofday include inside extern c
Reported-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-14 15:07:56 +02:00
Andy Green
8f5f91f7c8 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>
2011-05-14 13:15:09 +02:00
Andy Green
b1dab512c1 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>
2011-05-14 13:12:01 +02:00
Andy Green
66a36ff577 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>
2011-04-29 17:43:06 +08:00
Andy Green
043a0ba854 move send pipe choked api to public exports
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-04-25 23:54:11 +08:00
Andy Green
bc15798f65 handle new masking order and fixups
Signed-off-by: Andy Green <andy@warmcat.com>
2011-04-24 08:12:38 +01:00
Andy Green
23545dbb90 interpret new opcode map when 07
Signed-off-by: Andy Green <andy@warmcat.com>
2011-04-24 06:19:22 +01:00
Andy Green
53b6385399 issue new opcodes when 07
Signed-off-by: Andy Green <andy@warmcat.com>
2011-04-24 06:05:29 +01:00
Andy Green
4e752248eb write client frames the new way for 07
Signed-off-by: Andy Green <andy@warmcat.com>
2011-04-24 06:04:03 +01:00
Andy Green
33872cd376 carry over 06 stuff to 07
Signed-off-by: Andy Green <andy@warmcat.com>
2011-04-24 05:49:44 +01:00
Andy Green
283d0a2046 add 07 support
Signed-off-by: Andy Green <andy@warmcat.com>
2011-04-24 05:46:23 +01:00
Andy Green
5fd55cd3a9 introduce 07 opcode ordering
Signed-off-by: Andy Green <andy@warmcat.com>
2011-04-23 10:54:53 +01:00
Andy Green
27a0b91333 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>
2011-04-16 10:54:28 +01:00
Andy Green
72c34321d3 Revert Pavel's patch looping in recv
Signed-off-by: Andy Green <andy@warmcat.com>
2011-04-16 10:46:21 +01:00
Pavel Borzenkov
4b65a562a5 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>
2011-04-15 13:17:26 +01:00
Pavel Borzenkov
876534b0d5 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>
2011-04-15 13:16:58 +01:00
Pavel Borzenkov
71ea500081 Use IPPROTO_TCP instead of SOL_TCP
This change fixes compilation on *BSD systems.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@auriga.com>
2011-04-15 13:16:32 +01:00
Pavel Borzenkov
2af39964dc HTTP headers may be case-sensitive
For the IETF revision 00 send 'Upgrade: WebSocket' header
instead of 'Upgrade: websocket' as described in the IETF standard.
Some servers (for example, phpdaemon) are case-sensitive.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@auriga.com>
2011-04-12 09:47:50 +01:00
Andy Green
26111bc4c6 select raw zlib compression
Patrick McManus from Mozilla pointed out that the spec requires a specific kind
of zlib compression, which is raw.  You can select that by using a funny api in
zlib.  Mozilla are correcting their compression to this, pywebsockets already did
it right in the first place, libwebsockets should now work OK with those.

Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-22 09:06:52 +00:00
Andy Green
46c2ea0d6f pass ext pointer in ext callback
Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-22 09:04:01 +00:00
Peter Hinz
6eeadae1ab update win32 support for zlib
Signed-off-by: Peter Hinz <cerebusrc@gmail.com>
2011-03-10 18:19:10 +00:00
Peter Hinz
bb45a90037 Re: Windows port of your libwebsocket
The latest code changed need some win32 fixes:

Signed-off-by: Peter Hinz <cerebusrc@gmail.com>
2011-03-10 18:14:01 +00:00
Andy Green
7627af52a3 try to cover AF_LOCAL in libwebsockets_get_peer_addresses
Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-09 15:13:52 +00:00
Andy Green
f92def7eef use unsigned peer dotted quad
Reported-by: Pierre-Paul Lavoie <ppl@idios.org>
Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-09 15:02:20 +00:00
Andy Green
5948865eb6 beautify fraggle
Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-09 09:21:24 +00:00
Patrick McManus
4bf91d7224 libwebsockets - gcc warnings
you have your makefiles set up to treat warnings as errors, and my gcc
4.4.5 (64 bit) compiler generates 3 warnings that need fixing:

(that sprintf() one is a real bug.. if ext_name contains formatting
characters you are looking at a potential segv).

Signed-off-by: Patrick McManus <mcmanus@ducksong.com>
2011-03-09 07:18:28 +00:00
Andy Green
6c9395529e disable nagle algorithm
Ago noticed that some Windows clients experience small packets
from the server being aggregated and set after a long delay
(200-300ms).

He found that TCP_NODELAY on the socket solved this, I tested it
and it didn't have any noticable bad effect, so I implemented it
for all sockets, client and server.

Thans Ago for debugging this and notifying the cause.

Reported-by: Ago Allikmaa <maxorator@gmail.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-08 08:56:57 +00:00
Andy Green
98a623fa46 clean fraggle
Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-08 08:43:59 +00:00
Andy Green
e9739ed203 introduce fraggle test app
Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-07 21:40:59 +00:00
Andy Green
82c3d54c10 introduce libwebsocket_is_final_fragment
Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-07 21:16:31 +00:00