platform/upstream/libwebsockets.git
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>
13 years agoUse IPPROTO_TCP instead of SOL_TCP
Pavel Borzenkov [Fri, 15 Apr 2011 12:16:32 +0000 (13:16 +0100)]
Use IPPROTO_TCP instead of SOL_TCP

This change fixes compilation on *BSD systems.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@auriga.com>
13 years agoHTTP headers may be case-sensitive
Pavel Borzenkov [Tue, 12 Apr 2011 08:47:50 +0000 (09:47 +0100)]
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>
13 years agoselect raw zlib compression
Andy Green [Tue, 22 Mar 2011 09:06:52 +0000 (09:06 +0000)]
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>
13 years agopass ext pointer in ext callback
Andy Green [Tue, 22 Mar 2011 09:04:01 +0000 (09:04 +0000)]
pass ext pointer in ext callback

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoupdate win32 support for zlib
Peter Hinz [Thu, 10 Mar 2011 18:19:10 +0000 (18:19 +0000)]
update win32 support for zlib

Signed-off-by: Peter Hinz <cerebusrc@gmail.com>
13 years agoRe: Windows port of your libwebsocket
Peter Hinz [Thu, 10 Mar 2011 18:14:01 +0000 (18:14 +0000)]
Re: Windows port of your libwebsocket

The latest code changed need some win32 fixes:

Signed-off-by: Peter Hinz <cerebusrc@gmail.com>
13 years agotry to cover AF_LOCAL in libwebsockets_get_peer_addresses
Andy Green [Wed, 9 Mar 2011 15:13:52 +0000 (15:13 +0000)]
try to cover AF_LOCAL in libwebsockets_get_peer_addresses

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agouse unsigned peer dotted quad
Andy Green [Wed, 9 Mar 2011 15:02:20 +0000 (15:02 +0000)]
use unsigned peer dotted quad

Reported-by: Pierre-Paul Lavoie <ppl@idios.org>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agobeautify fraggle
Andy Green [Wed, 9 Mar 2011 09:21:24 +0000 (09:21 +0000)]
beautify fraggle

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agolibwebsockets - gcc warnings
Patrick McManus [Wed, 9 Mar 2011 07:18:28 +0000 (07:18 +0000)]
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>
13 years agodisable nagle algorithm
Andy Green [Tue, 8 Mar 2011 08:56:57 +0000 (08:56 +0000)]
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>
13 years agoclean fraggle
Andy Green [Tue, 8 Mar 2011 08:43:59 +0000 (08:43 +0000)]
clean fraggle

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce fraggle test app
Andy Green [Mon, 7 Mar 2011 21:40:59 +0000 (21:40 +0000)]
introduce fraggle test app

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce libwebsocket_is_final_fragment
Andy Green [Mon, 7 Mar 2011 21:16:31 +0000 (21:16 +0000)]
introduce libwebsocket_is_final_fragment

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agofix misunderstood fragmentation restriction
Andy Green [Mon, 7 Mar 2011 21:14:23 +0000 (21:14 +0000)]
fix misunderstood fragmentation restriction

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoadd CONTINUATION write mode
Andy Green [Mon, 7 Mar 2011 20:47:41 +0000 (20:47 +0000)]
add CONTINUATION write mode

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoexpose SHA1 api
Andy Green [Mon, 7 Mar 2011 20:47:41 +0000 (20:47 +0000)]
expose SHA1 api

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoexpose random api
Andy Green [Mon, 7 Mar 2011 20:47:40 +0000 (20:47 +0000)]
expose random api

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoadd separate server writeable and change naming to match rest of callbacks
Andy Green [Mon, 7 Mar 2011 20:47:39 +0000 (20:47 +0000)]
add separate server writeable and change naming to match rest of callbacks

Notice that the naming is changed, the notification to a server that it can write to
the client is now called LWS_CALLBACK_SERVER_WRITEABLE, and the notification to a client
that it can write to a server is LWS_CALLBACK_CLIENT_WRITEABLE.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoremove bogus bytes on first line of websockets.c
Andy Green [Mon, 7 Mar 2011 17:54:06 +0000 (17:54 +0000)]
remove bogus bytes on first line of websockets.c

Reported-by: Pierre-Paul Lavoie <ppl@idios.org>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoadd explicit libz inclusion
Andy Green [Mon, 7 Mar 2011 17:52:00 +0000 (17:52 +0000)]
add explicit libz inclusion

Reported-by: Pierre-Paul Lavoie <ppl@idios.org>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoflush extensions when closing
Andy Green [Mon, 7 Mar 2011 07:08:18 +0000 (07:08 +0000)]
flush extensions when closing

Extensions might be caching stuff that we should spill before a controlled close.
It's not allowed to send anything on the wire after the close request, so we need
to make the extensions spill just before.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoadd extra state for waiting on close ack with timeout
Andy Green [Mon, 7 Mar 2011 07:08:12 +0000 (07:08 +0000)]
add extra state for waiting on close ack with timeout

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce test server close testing switch
Andy Green [Mon, 7 Mar 2011 07:08:07 +0000 (07:08 +0000)]
introduce test server close testing switch

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointerop notes - libwebsocket -06 close
Pat McManus @Mozilla [Mon, 7 Mar 2011 06:06:36 +0000 (06:06 +0000)]
interop notes - libwebsocket -06 close

... this afternoon I was just doing a little
interoperability testing around close... in my test-server I added

 libwebsocket_close_and_free_session(this, wsi, LWS_CLOSE_STATUS_NORMAL);

in order to generate a server driven close.. I hope that was the right
way to go about it. In any event, in generated an invalid websocket
frame - I think you want this patch, or something like it:

Signed-off-by: \"Pat McManus @Mozilla\" <mcmanus@ducksong.com>
13 years agoconfigure add requirement for zlib.h
Andy Green [Sun, 6 Mar 2011 13:37:10 +0000 (13:37 +0000)]
configure add requirement for zlib.h

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoadd compression defeat switch to test client
Andy Green [Sun, 6 Mar 2011 13:32:53 +0000 (13:32 +0000)]
add compression defeat switch to test client

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce deflate compression extension
Andy Green [Sun, 6 Mar 2011 13:32:53 +0000 (13:32 +0000)]
introduce deflate compression extension

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoallow extensions for parsing
Andy Green [Sun, 6 Mar 2011 13:15:34 +0000 (13:15 +0000)]
allow extensions for parsing

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce internal extensions array
Andy Green [Sun, 6 Mar 2011 13:15:32 +0000 (13:15 +0000)]
introduce internal extensions array

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoinstantiate extensions server accepted
Andy Green [Sun, 6 Mar 2011 13:15:31 +0000 (13:15 +0000)]
instantiate extensions server accepted

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agodynamically create client extensions offer from extensions list
Andy Green [Sun, 6 Mar 2011 13:15:29 +0000 (13:15 +0000)]
dynamically create client extensions offer from extensions list

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agodocument extension callback reasons
Andy Green [Sun, 6 Mar 2011 13:14:46 +0000 (13:14 +0000)]
document extension callback reasons

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agocallback each active extension on packet tx pre send
Andy Green [Sun, 6 Mar 2011 13:14:42 +0000 (13:14 +0000)]
callback each active extension on packet tx pre send

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agocallback each active extension on packet rx pre parse
Andy Green [Sun, 6 Mar 2011 13:14:15 +0000 (13:14 +0000)]
callback each active extension on packet rx pre parse

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce lws_send_pipe_choked
Andy Green [Sun, 6 Mar 2011 10:29:39 +0000 (10:29 +0000)]
introduce lws_send_pipe_choked

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce lws_issue_raw
Andy Green [Sun, 6 Mar 2011 10:29:38 +0000 (10:29 +0000)]
introduce lws_issue_raw

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agodeallocate extension contexts on connection close
Andy Green [Sun, 6 Mar 2011 10:29:38 +0000 (10:29 +0000)]
deallocate extension contexts on connection close

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agocreate server extension response dynamically
Andy Green [Sun, 6 Mar 2011 10:29:35 +0000 (10:29 +0000)]
create server extension response dynamically

This goes through the extentsions the client requested, selects the ones
that we support at the server, and then further calls back to the appropriate
protocol callback in user code to check it's OK to actually use that
extension in this context.  If it is (callback unhandled == it is) then
it's added to the list of extensions sent back to the client.

Accepted extensions are also added to the connection's active extension
list and the private "user" memory allocation for the extension context is
done and bound to the connection.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce struct libwebsocket_extension
Andy Green [Sat, 5 Mar 2011 16:12:15 +0000 (16:12 +0000)]
introduce struct libwebsocket_extension

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agofix openssl breakage from win32
Andy Green [Sat, 5 Mar 2011 16:12:04 +0000 (16:12 +0000)]
fix openssl breakage from win32

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agowin32 build fixup missing includes
Andy Green [Sat, 5 Mar 2011 09:04:23 +0000 (09:04 +0000)]
win32 build fixup missing includes

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce win32 build capability
Peter Hinz [Wed, 2 Mar 2011 22:03:47 +0000 (22:03 +0000)]
introduce win32 build capability

This adds win32 build compatability to libwebsockets.

The patch is from Peter Hinz, Andy Green has cleaned it up a bit and
possibly broken win32 compatability since I can't test it, so there
may be followup patches.  It compiles fine under Linux after this
patch anyway.

Much of the patch is changing a reserved keyword for Visual C compiler
"this" to "context", but there is no real C99 support in the MSFT
compiler even though it is 2011 so C99 style array declarations
have been mangled back into "ancient C" style.

Some windows-isms are also added like closesocket() but these are
quite localized.  Win32 random is just using C library random() call
at the moment vs Linux /dev/urandom.  canonical hostname detection is
broken in win32 at the moment.

Signed-off-by: Peter Hinz <cerebusrc@gmail.com>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER
Andy Green [Tue, 1 Mar 2011 21:06:02 +0000 (21:06 +0000)]
introduce LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER

This adds a callback to protocols[0] which happens when the
Client HTTP handshake packet is being composed.  After all the
headers for the websocket handshake to the server have been
added, the callback is called with a pointer to a char *
that allows extra headers to be added.  See the comments in
libwebsocket.h or the api documentation for example code.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce 76 00 client support
Andy Green [Tue, 1 Mar 2011 20:44:24 +0000 (20:44 +0000)]
introduce 76 00 client support

This adds 76/00 client support to libwebsockets.  It's still shipped
by browsers and more importantly still the only version supported by
server stuff like socket.io.

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoupdate README with known good OSX configure
Andy Green [Mon, 28 Feb 2011 07:48:27 +0000 (07:48 +0000)]
update README with known good OSX configure

Christopher Baker sent in a working OSX configure string,
add it to the README

Reported-by: Christopher Baker <me@christopherbaker.net>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agofix null protocol dereference when closing session
Andy Green [Mon, 28 Feb 2011 07:45:29 +0000 (07:45 +0000)]
fix null protocol dereference when closing session

Thanks to Christopher Baker for pointing out that when we close a session,
if the close is coming before a protocol was negotiated for the connection
or when the protocol was otherwise left at NULL, we'll blow a segfault.

This implements his proposed fix.

Reported-by: Christopher Baker <me@christopherbaker.net>
Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoonly have nonce requirement and processing for exactly 04
Andy Green [Sat, 26 Feb 2011 11:17:48 +0000 (11:17 +0000)]
only have nonce requirement and processing for exactly 04

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agocarry over 05 specific stuff to 06
Andy Green [Sat, 26 Feb 2011 11:13:56 +0000 (11:13 +0000)]
carry over 05 specific stuff to 06

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agochange default client version to 06
Andy Green [Sat, 26 Feb 2011 11:08:46 +0000 (11:08 +0000)]
change default client version to 06

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoremove duplicated poll handling in hangup on client
Andy Green [Sat, 26 Feb 2011 11:06:27 +0000 (11:06 +0000)]
remove duplicated poll handling in hangup on client

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agorequire close reason argument on close and free session
Andy Green [Sat, 26 Feb 2011 11:04:01 +0000 (11:04 +0000)]
require close reason argument on close and free session

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agointroduce 06 close status codes
Andy Green [Sat, 26 Feb 2011 10:40:02 +0000 (10:40 +0000)]
introduce 06 close status codes

Signed-off-by: Andy Green <andy@warmcat.com>
13 years agoonly send sec webscoket nonce on 04
Andy Green [Sat, 26 Feb 2011 10:31:41 +0000 (10:31 +0000)]
only send sec webscoket nonce on 04

Signed-off-by: Andy Green <andy@warmcat.com>