Commit graph

117 commits

Author SHA1 Message Date
Andy Green
5b85e39d99 mbed3 remove unused allocations
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-26 13:23:11 +08:00
Andy Green
3246ebb3f5 deprecate LWS_SEND_BUFFER_POST_PADDING
The only guy who cared about this for a long while
(since I eliminated the pre-standard protocol variants)
was sending a close frame.

 - Set it to 0 so old code remains happy.  It only affects
user code buffer commit, if there's overcommit no harm
done so no effect directly on user ABI.

 - Remove all uses inside the library.  The sample apps
don't have it any more and that's the recommendation now.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-26 12:03:06 +08:00
Andy Green
3df580066b http header malloc pool implement pool
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-25 14:34:20 +08:00
Andy Green
9e8d148912 changelog pre v1.6.0
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 11:01:03 +08:00
Andy Green
6d64539fcb lws_get_context not _ctx
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-17 18:25:25 +08:00
Andy Green
00c6d1579c public api remove context from user callback API BREAK
Since struct lws (wsi) now has his own context pointer,
we were able to remove the need for passing context
almost everywhere in the apis.

In turn, that means there's no real use for context being
passed to every callback; in the rare cases context is
needed user code can get it with lws_get_ctx(wsi)

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-17 07:54:44 +08:00
Andy Green
11c05bfa09 public api remove superfluous context params API BREAK
Extend the cleanout caused by wsi having a context pointer
into the public api.

There's no point keeping the 1.5 compatibility work,
we have changed the api in several places and
rebuilt wasn't going to be enough a while ago.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-16 18:19:08 +08:00
Andy Green
3f59996e67 changelog update file api about wsi
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 07:21:42 +08:00
Andy Green
3f62870e67 introduce lws_wsi_user
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 07:16:32 +08:00
Andy Green
1a366bf946 changelog explain protocols related api changes
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 07:02:51 +08:00
Andy Green
4e442b7743 lws_plat_fd implement platform default handlers
This is a rewrite of the patch from Soapyman here

https://github.com/warmcat/libwebsockets/pull/363

The main changes compared to Soapyman's original patch are

 - There's no new stuff in the info struct user code does any overrides
   it may want to do explicitly after lws_context_create returns

 - User overrides for file ops can call through (subclass) to the original
   platform implementation using lws_get_fops_plat()

 - A typedef is provided for plat-specific fd type

 - Public helpers are provided to allow user code to be platform-independent
   about file access, using the lws platform file operations underneath:

static inline lws_filefd_type
lws_plat_file_open(struct lws_plat_file_ops *fops, const char *filename,
		   unsigned long *filelen, int flags)

static inline int
lws_plat_file_close(struct lws_plat_file_ops *fops, lws_filefd_type fd)

static inline unsigned long
lws_plat_file_seek_cur(struct lws_plat_file_ops *fops, lws_filefd_type fd,
		       long offset_from_cur_pos)

static inline int
lws_plat_file_read(struct lws_plat_file_ops *fops, lws_filefd_type fd,
		   unsigned long *amount, unsigned char *buf, unsigned long len)

static inline int
lws_plat_file_write(struct lws_plat_file_ops *fops, lws_filefd_type fd,
		    unsigned long *amount, unsigned char *buf, unsigned long len)

There's example documentation and implementation in the test server.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-10 11:01:59 +08:00
Andy Green
6d41720233 api rationalization add cmake switch to export old api wrappers
This is off by default, use

 -D LWS_WITH_OLD_API_WRAPPERS=1

on cmake to get the old api names exported from the library as wrappers
around the new api names.

This allows the library to continue to be compatible with apps that are
not rebuilt with the new libwebsockets.h api compatibility defines.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-04 10:39:23 +08:00
Peter Pentchev
bb085dab04 Fix some minor typos. 2015-12-03 22:32:59 +08:00
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