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

4481 commits

Author SHA1 Message Date
Peter Hinz
56885f3084 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>
2011-03-02 22:03:47 +00:00
Andy Green
385e7ad034 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>
2011-03-01 21:06:02 +00:00
Andy Green
eeaacb39c7 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>
2011-03-01 20:44:24 +00:00
Andy Green
a54986f36e 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>
2011-02-28 07:48:27 +00:00
Andy Green
d4302734d7 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>
2011-02-28 07:45:29 +00:00
Andy Green
4eaa86b291 only have nonce requirement and processing for exactly 04
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-26 11:17:48 +00:00
Andy Green
9514bf8839 carry over 05 specific stuff to 06
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-26 11:13:56 +00:00
Andy Green
193306ca2d change default client version to 06
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-26 11:08:46 +00:00
Andy Green
6da560c63c remove duplicated poll handling in hangup on client
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-26 11:06:27 +00:00
Andy Green
687b0188bc require close reason argument on close and free session
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-26 11:04:01 +00:00
Andy Green
06de513612 introduce 06 close status codes
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-26 10:40:02 +00:00
Andy Green
6274baf8c0 only send sec webscoket nonce on 04
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-26 10:31:41 +00:00
Andy Green
7942dfe282 make origin optional on server
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-26 10:28:15 +00:00
Andy Green
08d33926eb make origin optional on client
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-26 10:22:49 +00:00
Andy Green
6901cb3b4e add callback for OpenSSL client cert verification action
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-21 08:06:47 +00:00
Andy Green
c6bf2c2186 add callback to allow additional server verification certs
This adds a LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS callback
which offers a chance for the server context to be loaded with additional
certtificates allowing it to verify incoming client certs.  The callback
always comes to protocol[0].

It also introduces the context option LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT
which will enforce client cert checking on any ssl connection.

Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-20 11:10:47 +00:00
Andy Green
0894bda184 add callback to allow additional client verification certs
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-19 09:09:11 +00:00
Andy Green
32375b7e9e introduce listen on specific interface
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-19 08:32:53 +00:00
Andy Green
8c4041591e README update configure advice for apple
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-16 18:50:01 +00:00
Andy Green
1f9bf527ec fix ssl support and confirm builds clean when not configured
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-14 21:14:37 +00:00
Andy Green
038d582bde add include for gettimeofday even without ssl
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-14 20:58:26 +00:00
Darin Willits
db9ba42aad Only include anything from openssl if configured for it
Signed-off-by: Darin Willits <darin@willits.ca>
2011-02-14 20:56:24 +00:00
Andy Green
b3ae0a36af make test client notice if server closed on him
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-14 20:25:43 +00:00
Andy Green
be93fefa76 break client connect into states and apply timeout
Doing a client connect was atomic until now, blocking
all the other service while it waited for proxy and / or
server response.

This patch uses the new timeout system and breaks the
client connect sequence into three states handled by
the normal poll() processing.  It means that there are
now no blocking network delays and it's all handled
by the main state machine.

Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-14 20:25:43 +00:00
Andy Green
a71eafce5a introduce timeout system
This adds a concept of timeouts for operations enforced by
connection closure if the timeout is reached.

Once a second all sockets are checked for timing out, every time
there is a service call it checks to see if a second has passed since
the last check and checks if so.

You can also call libwebsocket_service_fd() with a NULL fd to give
the timeouts a chance to be detected; if it's less than a second since
the last check it returns immediately.

Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-14 17:59:43 +00:00
Timothy J Fontaine
b86d64eaa9 Fix refactor damage from missed debug-only print arg
Just a quick follow up there is a compile error at the moment, which I
think is resolved as the following?

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2011-02-14 17:55:27 +00:00
Darin Willits
c19456f64a Apple / iOS build compatability patch
This allows build on iOS platform, thanks Darin!

Signed-off-by: Darin Willits <darin@willits.ca>
2011-02-14 17:52:39 +00:00
Andy Green
62c54d2f56 introduce this param in callback fix server close on client socket
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-14 09:14:25 +00:00
Andy Green
abbf461998 eliminate dummy 76 challenge content in 04 plus
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-14 09:14:24 +00:00
Andy Green
4b6fbe125e unify server and client close
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-14 08:03:48 +00:00
Andy Green
de6ab32861 clean-out-poll-array-when-hanging-up-on-client.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-13 09:15:10 +00:00
Andy Green
764ff98b2a uplevel-rpm-spec-to-include-new-extpoll-sample.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-13 09:08:11 +00:00
Andy Green
e2acfc86b3 use-new-peer-name-api-in-ping.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-13 09:05:54 +00:00
Andy Green
f7ee549a58 introduce-libwebsockets_hangup_on_client.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-13 09:04:21 +00:00
Andy Green
38c4f0c556 add-example-protocol-handshake-filter-callback.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-13 08:54:05 +00:00
Andy Green
863d4d25e7 add-example-network-filter-callback.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-13 08:40:37 +00:00
Andy Green
0703409235 introduce-network-connect-filter-callback.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-13 08:37:12 +00:00
Andy Green
c85619dbcd introduce-user-handshake-filter-callback.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-13 08:25:26 +00:00
Andy Green
e7981dc65a document-external-poll-support.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-12 21:24:03 +00:00
Andy Green
2a5aa6537d add-ext-poll-callbacks-in-extpoll-test.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-12 13:15:04 +00:00
Andy Green
3221f92b1e introduce-external-poll-callbacks.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-12 13:14:11 +00:00
Andy Green
2e5de82da2 introduce-libwebsockets-test-server-extpoll.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-12 12:07:23 +00:00
Andy Green
9f99034f7e export-libwebsocket_service_fd-api.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-12 11:57:45 +00:00
Andy Green
0d33833764 decouple-service-from-fd-array-index.patch
This patch removes the relationship between position in the
pollfd[] array and any meaning about the type of socket.

It also refactors the service loop so there is a per-fd
function that detects the mode of the connection and services
it accordingly.

The context wsi * array is removed and a hashtable introduced
allowing fast wsi lookup from just the fd that it is
associated with

Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-12 11:57:43 +00:00
Andy Green
44eee688ac optimize-random-device-open.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-10 09:32:24 +00:00
Andy Green
92970baa90 optimize-server-for-all-zero-nonce-case.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-10 09:22:35 +00:00
Andy Green
5e1fa17a6c introduce-new-05-socket-closure-rules.patch
Signed-off-by: Andy Green <andy.green@linaro.org>
2011-02-10 09:07:05 +00:00
Andy Green
18910c5920 parse-and-reject-extensions-header.patch
Signed-off-by: Andy Green <andy@linaro.org>
2011-02-09 08:58:42 +00:00
Andy Green
bfb051f3a3 introduce-ietf-05-framing-and-commandline-options.patch
This adds 05 support, and -v switches on test-client and test-ping
to allow setting their ietf protocol version to 4 or 5.

It also optimizes the masking to us a function pointer, which
takes some conditionals out of the fast path.

Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-09 08:49:14 +00:00
Andy Green
f3d3b40364 change-client-mode-to-enum.patch
Signed-off-by: Andy Green <andy@warmcat.com>
2011-02-09 07:16:34 +00:00