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

123 commits

Author SHA1 Message Date
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
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
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
7b11fec7ca Added support for Windows XP. 2011-10-04 19:55:18 +08:00
David Galeano
f70093583b Fixed compiler warnings.
Signed-off-by: David Galeano <davidgaleano@turbulenz.biz>
2011-09-26 12:09:54 +01:00
Andy Green
c15cb38d13 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>
2011-06-26 10:27:28 +01:00
Andy Green
0922650b53 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>
2011-05-28 10:19:19 +01:00
Andy Green
68b4504329 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>
2011-05-25 21:41:57 +01:00
Andy Green
f6652412f3 extensions ensure per conn allocation starts zeroed
Signed-off-by: Andy Green <andy@warmcat.com>
2011-05-25 20:46:18 +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
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
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
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
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
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
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
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
82c3d54c10 introduce libwebsocket_is_final_fragment
Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-07 21:16:31 +00:00
Andy Green
2836c641cf expose SHA1 api
Signed-off-by: Andy Green <andy@warmcat.com>
2011-03-07 20:47:41 +00:00
Andy Green
9e4c2b6e35 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>
2011-03-07 20:47:39 +00:00
Andy Green
58eaa74fd0 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>
2011-03-07 17:54:06 +00:00