Commit graph

54 commits

Author SHA1 Message Date
Andy Green
ab620ffde3 release v1.5
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-28 08:39:09 +08:00
Andy Green
4c79ee7598 LWS_WITHOUT_BUILTIN_SHA1
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-15 11:20:40 +08:00
Andy Green
6d59f59745 LWS_SERVER_OPTION_PEER_CERT_NOT_REQUIRED
Requested by Bruce Perens

http://ml.libwebsockets.org/pipermail/libwebsockets/2015-June/001834.html

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-10-15 09:12:58 +08:00
MGadkari
020c53c8cc Pass HTTP reject error code returned by server to client
AG: added changelog and documentation comment

Signed-off-by: Gadkari Mugdha <mugdha.gadkari@siemens.com>
Reviewed-by: Roger Meier <r.meier@siemens.com>

HTTP reject error code returned by server during HTTP handshake is extracted and sent to the client application.
With this fix, the Connection error callback will include the HTTP reject status code and response frame received from server. This string passed in Connection error callback can be read or ignored by client application based on client application requirement
2015-10-12 07:51:34 +08:00
Andy Green
16fb0132ce prepare for v1.4
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-03-28 11:35:40 +08:00
joseph.urciuoli
4d9c8fc01a ssl allow externally managed SSL_CTX
Signed-off-by: joseph.urciuoli <trac90@UNKNOWN.org>
2014-10-16 08:53:19 +08:00
Andy Green
917f43ab82 http2 able to send test.html to nghttp2
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-10-12 14:31:47 +08:00
Andy Green
14425eae4e introduce lws_partial_buffered
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-18 22:49:39 +08:00
Andy Green
822241c2a7 deprecate no_buffer_all_partials
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-18 22:21:51 +08:00
Andy Green
b128ccccca add lws_is_ssl api
Suggested by Michael Harbler on the mailing list

Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-16 09:54:27 +08:00
Andy Green
eabed8defe protocol struct add user controlled id member
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-11 12:11:36 +08:00
Oleh
faeac3c419 ssl allow passing cert passphrase
https://github.com/warmcat/libwebsockets/issues/152
2014-07-29 23:18:41 +08:00
Andy Green
c1fdd10ff8 update changelog for 1.3
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-07-06 09:56:11 +08:00
Andy Green
055f2979ec ipv6 integration fixes
Disable for build using -DLWS_IPV6= on the cmake line
2014-03-24 23:08:38 +08:00
James Devine
3f13ea2264 add ipv6 support
(changed to support runtime disable + integration by andy@warmcat.com)
2014-03-24 16:09:25 +08:00
Andrew Canaday
9769f4f293 libev port
merged by andy@warmcat.com via https://github.com/gaby64/libwebsockets-libev

To use, you need to both

 - cmake ---> -DLWS_USE_LIBEV=1

 - info->options must have LWS_SERVER_OPTION_LIBEV set when creating the context

this is so a single library can be built for distros to support apps that use
normal polling and apps that use libev polling.
2014-03-23 13:25:07 +08:00
Andy Green
d2ec7adbab ssl client use OS CA root certs by default
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-03-15 10:39:29 +08:00
Patrick Gansterer
148b945f7f Allow setting the HTTP proxy via creation info
If the user provides a proxy via the info object it is used
in favor over the http_proxy environment variable.
2014-02-28 09:39:21 +08:00
Andy Green
7a1327977a add locking callback for fds
This adds two new callbacks in protocols[0] that are optional for allowing limited thread
access to libwebsockets, LWS_CALLBACK_LOCK_POLL and LWS_CALLBACK_UNLOCK_POLL.

If you use them, they protect internal and external poll list changes, but if you want to use
external thread access to libwebsocket_callback_on_writable() you have to implement your
locking here even if you don't use external poll support.

If you will use another thread for this, take a lot of care about managing your list of
live wsi by doing it from ESTABLISHED and CLOSED callbacks (with your own locking).

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-12-18 09:48:26 +08:00
James Devine
5b34c975ae Optionally allow non-SSL connections on same port as SSL
If enabled one listening socket will accept both SSL and plain HTTP connections.

Do not enable if you regard SSL handshake as some kind of security, eg, use
client-side certs to restrict access.

AG: changed flag names, added extra comments, changelog, add -a in test server

Signed-off-by: James Devine <fxmulder@gmail.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2013-12-14 11:41:29 +08:00
kapejod
ce64fb0f58 Support for HTTP POST.
Rewritten by Andy Green to use chunks, add timeout, use extra states in handshake not parser.

Signed-off-by: Andy Green <andy@warmcat.com>
2013-11-24 10:36:37 +08:00
Andy Green
7900256c8a allow other headers in http send file
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-11-09 11:40:38 +08:00
Andy Green
81877e6a4c v1.2.3 changelog update
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-10-26 20:36:08 +08:00
Andy Green
5dc62ead9d trac 40 client connection properly nonblocking
As spotted by JM on Trac#40

http://libwebsockets.org/trac/libwebsockets/ticket/40

client connect didn't do anything about being truly nonblocking.  This patch
should hopefully solve that.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-09-20 20:26:12 +08:00
Andy Green
96d48fdc28 change LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION user param usage
Also audit the bail_nuke_ah usage as Daniel Griscom suggested.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-09-18 08:32:55 +08:00
Andy Green
0c9563bbd2 add LWS_CALLBACK_CLOSED_HTTP
Adds a callback to allow handling HTTP protocol connections
closing.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-06-10 22:54:40 +08:00
Andy Green
b55451c6d2 introduce api for unthrottle all connections of protocol
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-03-16 12:43:22 +08:00
Andy Green
0097a99082 remove autotools build
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-03-09 13:06:37 +08:00
Andy Green
58f214ea0c document revent clearing scheme
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-03-09 13:03:53 +08:00
Andy Green
fc7c5e4539 reflect send completeness in lws_write return
under load, writing packet sizes to the socket that are normally fine
can do partial writes, eg asking to write 4096 may only take 2800 of
it and return 2800 from the actual send.

Until now lws assumed that if it was safe to send, it could take any
size buffer, that's not the case under load.

This patch changes lws_write to return the amount actually taken...
that and the meaning of it becomes tricky when dealing with
compressed links, the amount taken and the amount sent differ.  Also
there is no way to recover at the moment from a protocol-encoded
frame only being partially accepted... however for http file send
content it can and does recover now.

Small frames don't have to take any care about it but large atomic
sends (> 2K) have been seen to fail under load.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-23 10:50:10 +08:00
Andy Green
2672fb2d68 move ssl cipher list from compiletime to context creation time option
More flexible this way... NULL for the new member means use
the ssl library default set of ciphers, so as long as your info
struct is zerod by bss or memset, you don't need to do anything
about this change unless you want to set the cipher list.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-22 09:54:35 +08:00
Edwin van den Oetelaar
8c8a8e149d provide socketfd at in param for LWS_CALLBACK_FILTER_NETWORK_CONNECTION
Signed-off-by: Edwin van den Oetelaar <oetelaar.automatisering@gmail.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-20 20:56:59 +08:00
Andy Green
dc914cfebb document ensure_user_space going private
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 16:54:26 +08:00
Andy Green
50097dd078 api change deliver socket fd to in param of extpoll callbacks
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-15 22:36:30 +08:00
Andy Green
54cb346320 introduce LWS_CALLBACK_HTTP_WRITEABLE
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 22:23:54 +08:00
Andy Green
53a4678608 update 1.21 changelog
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 11:23:49 +08:00
Andy Green
182cb9ae5f update changelog
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-13 11:54:08 +08:00
Andy Green
c3ef0d600a add cyassl keepalive valgrind minimal mem to changelog
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-12 10:50:49 +08:00
Andy Green
508946cefd api make close api private only
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-12 10:19:08 +08:00
Andy Green
70edd6fb80 api remove hangup_on_client
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-12 10:15:25 +08:00
Andy Green
a7109e6ebf valgrind introduce protocol init and destroy user callbacks
To get a clean bill of health from valgrind, we have to have a way to
inform the user code that we're going down and it should free everything
it is holding that was malloc'd.

This patch introduces LWS_CALLBACK_PROTOCOL_DESTROY which each protocol
gets when the context is being destroyed and no more activity will come
after that call.  They can get rid of everything there.

To match it, LWS_CALLBACK_PROTOCOL_INIT is introduced which would allow
one-time init per protocol too.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-11 12:05:54 +08:00
Andy Green
16ab3185c4 replace per header mallocs with single malloc 3 level struct
This big patch replaces the malloc / realloc per header
approach used until now with a single three-level struct
that gets malloc'd during the header union phase and freed
in one go when we transition to a different union phase.

It's more expensive in that we malloc a bit more than 4Kbytes,
but it's a lot cheaper in terms of malloc, frees, heap fragmentation,
no reallocs, nothing to configure.  It also moves from arrays of
pointers (8 bytes on x86_64) to unsigned short offsets into the
data array, (2 bytes on all platforms).

The 3-level thing is all in one struct

 - array indexed by the header enum, pointing to first "fragment" index
	(ie, header type to fragment lookup, or 0 for none)

 - array of fragments indexes, enough for 2 x the number of known headers
	(fragment array... note that fragments can point to a "next"
	fragment if the same header is spread across multiple entries)

 - linear char array where the known header payload gets written
	(fragments point into null-terminated strings stored in here,
	only the known header content is stored)

http headers can legally be split over multiple headers of the same
name which should be concatenated.  This scheme does not linearly
conatenate them but uses a linked list in the fragment structs to
link them.  There are apis to get the total length and copy out a
linear, concatenated version to a buffer.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-11 11:10:57 +08:00
Andy Green
895d56d4ce remove minimum frame size for deflate
The idea here seems wrong, if we have a mixture of frames of varying
sizes above and below the limit, we segfault in deflate after skipping
it once.

If the protocol doesn't want compression because many frames are
small, it should veto the extension in the user callback.  If only
a few frames are tiny, the overhead for compressing it all is tiny.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-11 10:18:31 +08:00
Andy Green
a3957ef804 stop O2 override
Now we are building with -O0 -g and debug enabled by default.
--disable-debug in configure will get you a -04 without -g

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-11 09:31:43 +08:00
Andy Green
a47865fa19 dont try set per socket keepalive timing on bsds
As per http://libwebsockets.org/trac/ticket/10
BSD doesn't support setting keepalive info per-socket

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-10 09:39:47 +08:00
Andy Green
a690cd066e introduce keepalive option and make common socket options function
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-09 14:27:38 +08:00
Andy Green
1b26527e72 change context creation params to struct
*** This patch changes an API all apps use ***

Context creation parameters are getting a bit out of control, this
patch creates a struct to contain them.

All the test apps are updated accordingly.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-09 14:01:09 +08:00
Andy Green
5449511d3e remove fixed rx buffer allow definition per protocol
A new protocol member is defined that controls the size of rx
buffer allocation per connection.  For compatibility 0 size
allocates 4096, but you should adapt your protocol definition
array in the user code to declare an appropriate value.

See the changelog for more detail.

The advantage is the rx frame buffer size is now tailored to
what is expected from the protocol, rather than being fixed
to a default of 4096.  If your protocol only sends frames of
a dozen bytes this allows you to only allocate an rx frame
buffer of the same size.

For example the per-connection allocation (excluding headers)
for the test server fell from ~4500 to < 750 bytes with this.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-08 13:16:07 +08:00
Andy Green
9b09dc0213 remove all PATH_MAX or MAX_PATH
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-08 13:11:47 +08:00
Andy Green
ed334463e8 changelog header lifecycle
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-07 21:14:33 +08:00