platform/upstream/libwebsockets.git
7 years agoAdd BSD license 22/89822/3 upstream_2.0.3 accepted/tizen/common/20160928.164328 accepted/tizen/ivi/20160929.002038 accepted/tizen/mobile/20160929.001940 accepted/tizen/tv/20160929.001932 accepted/tizen/wearable/20160929.002055 submit/tizen/20160928.065254
Dmitry Kovalenko [Thu, 24 Mar 2016 06:13:01 +0000 (09:13 +0300)]
Add BSD license

Change-Id: I311b83ba5a32b9379ed99882f946a215520c61bd
Signed-off-by: Dmitry Kovalenko <d.kovalenko@samsung.com>
7 years agoRemove win32port 21/89821/2
Dmitry Kovalenko [Tue, 27 Sep 2016 06:23:51 +0000 (15:23 +0900)]
Remove win32port

Change-Id: Ie86a385633932f0cb63506fff502ba461b9ce152
Signed-off-by: Dmitry Kovalenko <d.kovalenko@samsung.com>
7 years agoAdd packaging code 20/89820/2
Dmitry Kovalenko [Fri, 4 Mar 2016 07:33:07 +0000 (10:33 +0300)]
Add packaging code

Change-Id: I2af8f30582212bc9a1846f18ba247bf11f7e6b3a
Signed-off-by: Dmitry Kovalenko <d.kovalenko@samsung.com>
7 years agov2.0.3 upstream/2.0.3
Andy Green [Wed, 14 Sep 2016 19:07:35 +0000 (03:07 +0800)]
v2.0.3

7 years agolws_snprintf
Andy Green [Wed, 14 Sep 2016 18:54:32 +0000 (02:54 +0800)]
lws_snprintf

Thanks to Fabrice Gilot for reporting the problem that led to uncovering this.

Due to a misunderstanding of the return value of snprintf (it is not truncated according
to the max size passed in) in several places relying on snprintf to truncate the length
overflows are possible.

This patch wraps snprintf with a new lws_snprintf() which does truncate its length to allow
the buffer limiting scheme to work properly.

All users should update with these fixes.

7 years agohandle rx flow control active when consuming payload
Andy Green [Fri, 9 Sep 2016 20:44:56 +0000 (04:44 +0800)]
handle rx flow control active when consuming payload

https://github.com/warmcat/libwebsockets/issues/622

7 years agoadopt_socket_vhost: error path doesn't remove us from timeout list
Andy Green [Fri, 9 Sep 2016 00:31:56 +0000 (08:31 +0800)]
adopt_socket_vhost: error path doesn't remove us from timeout list

As found by "github user 7"

https://github.com/warmcat/libwebsockets/issues/621

7 years agocoverity 169271 - take care about sockfd of -1 on close
Andy Green [Sun, 28 Aug 2016 01:54:30 +0000 (09:54 +0800)]
coverity 169271 - take care about sockfd of -1 on close

7 years agoUpdate badges in README.md
Patrick Gansterer [Fri, 26 Aug 2016 21:42:04 +0000 (23:42 +0200)]
Update badges in README.md

Fix the link to Appveyor and use SVG images.

7 years ago Remove unneeded #include <stdint.h>
Patrick Gansterer [Fri, 26 Aug 2016 08:49:29 +0000 (10:49 +0200)]
Remove unneeded #include <stdint.h>

    This fixes the build for Visual Studio 2008.

7 years agoupdate changelog for v2.0.2 release that went out without it
Andy Green [Thu, 25 Aug 2016 23:37:25 +0000 (07:37 +0800)]
update changelog for v2.0.2 release that went out without it

7 years agoAdd error handling for SSL_new() of clients
Patrick Gansterer [Sun, 14 Aug 2016 11:54:12 +0000 (19:54 +0800)]
Add error handling for SSL_new() of clients

Do not access wsi->ssl if SSL_new() failed and log the error.

7 years agoserver max protocol element 64
Andy Green [Wed, 10 Aug 2016 21:53:54 +0000 (05:53 +0800)]
server max protocol element 64

https://github.com/warmcat/libwebsockets/issues/601

7 years agoSNI-vhost-matching-fallback-to-wildcard
Andy Green [Mon, 11 Jul 2016 01:56:56 +0000 (09:56 +0800)]
SNI-vhost-matching-fallback-to-wildcard

7 years agofix __x86_64__ check
Robin Rowe [Wed, 29 Jun 2016 18:14:03 +0000 (02:14 +0800)]
fix __x86_64__ check

https://github.com/warmcat/libwebsockets/issues/574

7 years agoclient confirm server hostname in cert
Andy Green [Tue, 28 Jun 2016 12:25:46 +0000 (20:25 +0800)]
client confirm server hostname in cert

Openssl v1.0.2 and above have support for checking the hostname
the client side connected to against the hostname on the cert the
server presented.

This enables that feature if the necessary API is available in the
openssl version, meaning the connection will fail at ssl negotiation if the
cert isn't for the requested server

It's very easy to test, add a fake entry to /etc/hosts for the server IP with
a different name, using that will fail at ssl but using the correct dns name
matching the certificate will work.

7 years agofix for https connection code
Gadkari Mugdha [Mon, 13 Jun 2016 09:20:27 +0000 (17:20 +0800)]
fix for https connection code

7 years agonon-openssl: only check for openssl ecdh in openssl builds
Karl Palsson [Mon, 6 Jun 2016 15:03:09 +0000 (15:03 +0000)]
non-openssl: only check for openssl ecdh in openssl builds

See also
https://github.com/warmcat/libwebsockets/issues/559

Signed-off-by: Karl Palsson <karlp@etactica.com>
7 years agoclient CONNECTION_ERROR also allow in LWSS_CLIENT_UNCONNECTED
Andy Green [Tue, 7 Jun 2016 09:26:11 +0000 (17:26 +0800)]
client CONNECTION_ERROR also allow in LWSS_CLIENT_UNCONNECTED

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agolws_ssl_client_connect2 remove duplicate close on error path
Andy Green [Mon, 6 Jun 2016 17:34:02 +0000 (01:34 +0800)]
lws_ssl_client_connect2 remove duplicate close on error path

https://github.com/warmcat/libwebsockets/issues/532

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoARRAY_SIZE dont redefine
Andy Green [Mon, 6 Jun 2016 12:34:33 +0000 (20:34 +0800)]
ARRAY_SIZE dont redefine

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agov2.0.2
Andy Green [Mon, 6 Jun 2016 11:59:30 +0000 (19:59 +0800)]
v2.0.2

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoRevert changes in daemonize.c from commit 22d6f39e7fb270d0c011bae820d2f8adc8b19061
Martin C Drohmann [Wed, 1 Jun 2016 19:12:44 +0000 (12:12 -0700)]
Revert changes in daemonize.c from commit 22d6f39e7fb270d0c011bae820d2f8adc8b19061

7 years agoupdate document for lws_get_context
Young [Wed, 1 Jun 2016 00:38:39 +0000 (08:38 +0800)]
update document for lws_get_context

7 years agolwsl_timestamp month off by one
Fabian Kurz [Wed, 1 Jun 2016 00:38:27 +0000 (08:38 +0800)]
lwsl_timestamp month off by one

7 years agooutput size trimming with default rxbuf fix
Andy Green [Sun, 15 May 2016 01:01:43 +0000 (09:01 +0800)]
output size trimming with default rxbuf fix

5e203f78e21ee3313d763d8ee6d499fa0163f51a accidentally
trashed the "zero rz_buffer_size means 4096" handling
for tx chunking.

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoappveyor libuv integration
Andy Green [Sun, 15 May 2016 01:01:30 +0000 (09:01 +0800)]
appveyor libuv integration

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agolwsws conf mount extra mimetypes
Andy Green [Sat, 14 May 2016 02:48:28 +0000 (10:48 +0800)]
lwsws conf mount extra mimetypes

This patch adds the ability to provide extra mimtypes on a mount.

lwsws conf learns how to do them.

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agolejp handle name elements starting with dot
Andy Green [Sat, 14 May 2016 02:25:52 +0000 (10:25 +0800)]
lejp handle name elements starting with dot

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agolwsws conf allow setting cipher list and ecdh curve
Andy Green [Sat, 14 May 2016 00:34:29 +0000 (08:34 +0800)]
lwsws conf allow setting cipher list and ecdh curve

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agowin32 more build fixes
Andy Green [Fri, 13 May 2016 22:56:31 +0000 (06:56 +0800)]
win32 more build fixes

After alexgille

https://github.com/warmcat/libwebsockets/issues/526

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoaccess_log ensure no reuse of freed log area
Andy Green [Fri, 13 May 2016 03:00:45 +0000 (11:00 +0800)]
access_log ensure no reuse of freed log area

Valgrind caught http/1.1 pipelining using dead user agent alloc
for logging... NULL it when we free it since the wsi can be
reused with keepalive

==16208== Invalid free() / delete / delete[] / realloc()
==16208==    at 0x4847ACC: free (vg_replace_malloc.c:530)
==16208==    by 0x4888DC3: _realloc (alloc.c:8)
==16208==    by 0x4888DFF: lws_realloc (alloc.c:16)
==16208==    by 0x487DBCB: lws_access_log (libwebsockets.c:2352)
==16208==    by 0x48956DF: lws_http_transaction_completed (server.c:1245)
==16208==    by 0x4893757: lws_http_serve (server.c:340)
==16208==    by 0x48946EF: lws_http_action (server.c:748)
==16208==    by 0x4894CEF: lws_handshake_server (server.c:900)
==16208==    by 0x48786BF: lws_read (handshake.c:120)
==16208==    by 0x4896103: lws_server_socket_service (server.c:1580)
==16208==    by 0x487FB6B: lws_service_fd_tsi (service.c:779)
==16208==    by 0x48803B7: lws_service_fd (service.c:1079)
==16208==  Address 0x552e5f8 is 0 bytes inside a block of size 86 free'd
==16208==    at 0x4847ACC: free (vg_replace_malloc.c:530)
==16208==    by 0x4888DC3: _realloc (alloc.c:8)
==16208==    by 0x4888DFF: lws_realloc (alloc.c:16)
==16208==    by 0x487DBCB: lws_access_log (libwebsockets.c:2352)
==16208==    by 0x48956DF: lws_http_transaction_completed (server.c:1245)
==16208==    by 0x4893757: lws_http_serve (server.c:340)
==16208==    by 0x48946EF: lws_http_action (server.c:748)
==16208==    by 0x4894CEF: lws_handshake_server (server.c:900)
==16208==    by 0x48786BF: lws_read (handshake.c:120)
==16208==    by 0x4896103: lws_server_socket_service (server.c:1580)
==16208==    by 0x487FB6B: lws_service_fd_tsi (service.c:779)
==16208==    by 0x48803B7: lws_service_fd (service.c:1079)
==16208==  Block was alloc'd at
==16208==    at 0x4846498: malloc (vg_replace_malloc.c:298)
==16208==    by 0x4848D57: realloc (vg_replace_malloc.c:785)
==16208==    by 0x4888DA7: _realloc (alloc.c:6)
==16208==    by 0x4888DFF: lws_realloc (alloc.c:16)
==16208==    by 0x4893EAF: lws_http_action (server.c:565)
==16208==    by 0x4894CEF: lws_handshake_server (server.c:900)
==16208==    by 0x48786BF: lws_read (handshake.c:120)
==16208==    by 0x4896103: lws_server_socket_service (server.c:1580)
==16208==    by 0x487FB6B: lws_service_fd_tsi (service.c:779)
==16208==    by 0x48803B7: lws_service_fd (service.c:1079)
==16208==    by 0x48994B7: lws_io_cb (libuv.c:101)
==16208==    by 0x4AE7B1F: ??? (in /usr/lib/libuv.so.1.0.0)

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoasserts log which
Andy Green [Fri, 13 May 2016 02:59:44 +0000 (10:59 +0800)]
asserts log which

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoFix leak caused by undestroyed pthread mutex
Sterling Jensen [Fri, 13 May 2016 01:22:35 +0000 (20:22 -0500)]
Fix leak caused by undestroyed pthread mutex

7 years agowin32 libuv related build fixes
Andy Green [Fri, 13 May 2016 00:22:03 +0000 (08:22 +0800)]
win32 libuv related build fixes

https://github.com/warmcat/libwebsockets/issues/526

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agov2.0.1
Andy Green [Thu, 12 May 2016 14:29:06 +0000 (22:29 +0800)]
v2.0.1

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agocheck oom on lws_malloc
Andy Green [Thu, 12 May 2016 13:53:57 +0000 (21:53 +0800)]
check oom on lws_malloc

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agowindows no chown on log file generation
Andy Green [Wed, 11 May 2016 11:00:15 +0000 (19:00 +0800)]
windows no chown on log file generation

https://github.com/warmcat/libwebsockets/issues/524

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agooutput allow LWS_PRE+4 on top of rx_buffer_size for max send chunk
Andy Green [Tue, 10 May 2016 13:37:58 +0000 (21:37 +0800)]
output allow LWS_PRE+4 on top of rx_buffer_size for max send chunk

https://github.com/warmcat/libwebsockets/issues/522

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agologging migrate user stimulated logging to info
Andy Green [Mon, 9 May 2016 05:32:53 +0000 (13:32 +0800)]
logging migrate user stimulated logging to info

https://github.com/warmcat/libwebsockets/issues/520

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoPOST handling dont autocomplete transaction
Andy Green [Mon, 9 May 2016 02:08:13 +0000 (10:08 +0800)]
POST handling dont autocomplete transaction

Until now lws has finished the HTTP transaction when the POST body was
completely received.

However that needlessly makes it impossible to send a HTTP 200 and a
response without a redirect.

This changes lws behaviour after sending the LWS_CALLBACK_HTTP_BODY_COMPLETION
callback to no longer terminate the HTTP transaction.

If you want the old behaviour, you can terminate the transaction with
lws_http_transaction_completed() in the LWS_CALLBACK_HTTP_BODY_COMPLETION
callback.

Otherwise it's now possible to call lws_callback_on_writable() from
LWS_CALLBACK_HTTP_BODY_COMPLETION.

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agolibuv tidy up destroy and disable timer races during shutdown
Andy Green [Sun, 8 May 2016 09:11:19 +0000 (17:11 +0800)]
libuv tidy up destroy and disable timer races during shutdown

Also don't make us wait 1s for init to finish.

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoclient fix for operation with libuv
Andy Green [Sun, 8 May 2016 09:11:07 +0000 (17:11 +0800)]
client fix for operation with libuv

 - libuv socket init binding was missing for client

 - failures like no ws protocol match are deferred until the
   ah is bound.  Check for these failures and make sure we
   tell the guy trying to set up the client connection the
   wsi is NULL if it has already failed and closed.

 - pfd.events was not initialized for the client init path

With this general client function is more robust but also
client connections work properly with libuv.

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agocontext only destroy protocols if init got sent
Andy Green [Sun, 8 May 2016 09:10:51 +0000 (17:10 +0800)]
context only destroy protocols if init got sent

If for some reason we exit before the protocol init action
(which is delayed for libuv) we should not send the protocol
destroy messages

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoclient handle connection fail at second phase properly
Andy Green [Sun, 8 May 2016 09:10:38 +0000 (17:10 +0800)]
client handle connection fail at second phase properly

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agotest server post also take care about POST len termination
Andy Green [Sun, 8 May 2016 09:10:24 +0000 (17:10 +0800)]
test server post also take care about POST len termination

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoupdate api docs v2.0
Andy Green [Sat, 7 May 2016 06:26:32 +0000 (14:26 +0800)]
update api docs v2.0

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agofix %3d handling in path part and add attack.sh
Andy Green [Sat, 7 May 2016 00:32:44 +0000 (08:32 +0800)]
fix %3d handling in path part and add attack.sh

https://github.com/warmcat/libwebsockets/issues/518

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoprotocol plugins default also add example in test server v2.0
Andy Green [Fri, 6 May 2016 07:57:17 +0000 (15:57 +0800)]
protocol plugins default also add example in test server v2.0

This shows how to deliver per-vhost, per-protocol option
name:value pairs using code.

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoprotocol plugins set default
Andy Green [Fri, 6 May 2016 06:42:37 +0000 (14:42 +0800)]
protocol plugins set default

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agomimetypes add additional canned
Andy Green [Fri, 6 May 2016 00:08:48 +0000 (08:08 +0800)]
mimetypes add additional canned

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agoMSVC from 2015 up has vsnprintf
OndraCo [Thu, 5 May 2016 23:50:44 +0000 (07:50 +0800)]
MSVC from 2015 up has vsnprintf

7 years agoDisabled static link handling for WIN_CE to temporarily avoid the fact that it has...
OndraCo [Thu, 5 May 2016 23:50:30 +0000 (07:50 +0800)]
Disabled static link handling for WIN_CE to temporarily avoid the fact that it has no stat struct

7 years agoChanges to enable WIN CE support
OndraCo [Thu, 5 May 2016 23:50:17 +0000 (07:50 +0800)]
Changes to enable WIN CE support

7 years agolib/server.c: fix ipv6 support
Enno Boland [Thu, 5 May 2016 23:50:04 +0000 (07:50 +0800)]
lib/server.c: fix ipv6 support

7 years agolib/ssl.c: fix libre- and boringssl
Enno Boland [Thu, 5 May 2016 23:49:49 +0000 (07:49 +0800)]
lib/ssl.c: fix libre- and boringssl

7 years agov2.0.0
Andy Green [Thu, 5 May 2016 01:40:18 +0000 (09:40 +0800)]
v2.0.0

Signed-off-by: Andy Green <andy@warmcat.com>
7 years agorecv revert treating zero as hangup
Andy Green [Thu, 5 May 2016 01:06:09 +0000 (09:06 +0800)]
recv revert treating zero as hangup

While checking with ab, I found
commit 30cdb3ac8f24a4c289a3b4e8a41d6c5f2e6ec959
Author: Justin Chen <justinchen00@github.invalid.com>
Date:   Thu Apr 14 21:40:53 2016 +0800

    recv treat zero return as error

    https://github.com/warmcat/libwebsockets/issues/475

turned ab performance to crap, reverting it made everything fast again.

recv manpage says there is three ways to get zero returned

1)       When a stream socket peer has performed an orderly shutdown, the return value will be 0  (the  traditional  "end-of-file"
       return).

2)       Datagram  sockets  in  various  domains  (e.g., the UNIX and Internet domains) permit zero-length datagrams.  When such a
       datagram is received, the return value is 0.

3)       The value 0 may also be returned if the requested number of bytes to receive from a stream socket was 0.

we can't just assume it means the peer shut down.

If the peer shut down, then the event loop should get an event on the socket like POLLHUP and deal with it that way.

So the patch mentioned above is simply reverted here.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agostats upgrade rx tx to long long
Andy Green [Wed, 4 May 2016 07:59:27 +0000 (15:59 +0800)]
stats upgrade rx tx to long long

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocgi add generic wait as antizombie defence
Andy Green [Wed, 4 May 2016 04:23:27 +0000 (12:23 +0800)]
cgi add generic wait as antizombie defence

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoclean build warning on windows
Andy Green [Wed, 4 May 2016 03:11:15 +0000 (11:11 +0800)]
clean build warning on windows

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoappveyor openssl 1.0.2h
Andy Green [Wed, 4 May 2016 02:36:23 +0000 (10:36 +0800)]
appveyor openssl 1.0.2h

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolibuv fixes for foreign loop test
Andy Green [Wed, 4 May 2016 00:27:56 +0000 (08:27 +0800)]
libuv fixes for foreign loop test

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agotest server foreign loop
Denis Osvald [Tue, 3 May 2016 13:21:18 +0000 (15:21 +0200)]
test server foreign loop

AG: adapt to use switch on existing test-server-libuv app
AG: correct the foreign lifecycle to be valgrind clean

This adds a switch -f --foreign that makes the test-server-libuv test
create his own libuv loop outside of lws, and use lws on it before
destroying lws and then his own loop.

If selected, the foreign loop runs for 5s before lws and 10s after
lws is stopped, for testing purposes.

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
8 years agoclient provide user_space on LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER
Andy Green [Tue, 3 May 2016 13:39:16 +0000 (21:39 +0800)]
client provide user_space on LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER

https://github.com/warmcat/libwebsockets/issues/509

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoclient fix reaction to tls failure
Andy Green [Mon, 2 May 2016 23:26:10 +0000 (07:26 +0800)]
client fix reaction to tls failure

https://github.com/warmcat/libwebsockets/issues/508

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoplugins_dir convert to array
Andy Green [Mon, 2 May 2016 02:03:25 +0000 (10:03 +0800)]
plugins_dir convert to array

If OOT lws plugins will be packaged as separate projects,
they're going to want to install their plugins somewhere
that makes sense for the package instead of one big lws
plugin dir.

This patch changes info to have a const char ** to a NULL
terminated array of directories it should search for
plugins.  lwsws knows about this and you can add to the
dir array using config fragments like

{
  "global": {
   "plugin-dir": "/usr/local/share/coherent-timeline/plugins"
  }
}

if the config fragment in /etc/lwsws/conf.d/ is also managed by the
package with the plugin, it can very cleanly add and remove itself
from lwsws based on package install status.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoplugin standalone example for oot build
Andy Green [Sun, 1 May 2016 23:43:04 +0000 (07:43 +0800)]
plugin standalone example for oot build

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoprovide default empty protocol zero handler if NULL protocols in info
Andy Green [Sun, 1 May 2016 22:58:16 +0000 (06:58 +0800)]
provide default empty protocol zero handler if NULL protocols in info

Move the dummy stub protocol into the library as the default
if NULL protocols given, since that is likely to become popular.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolibwebsockets-test-server-v2.0 showing how to use mounts and plugins
Andy Green [Sun, 1 May 2016 21:58:07 +0000 (05:58 +0800)]
libwebsockets-test-server-v2.0 showing how to use mounts and plugins

No dependency on test-server.h (just libwebsockets.h and getopt.h / syslog.h)

No need for any user callback code and all in one short file.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoper vhost options struct explicitly const
Andy Green [Sun, 1 May 2016 22:01:59 +0000 (06:01 +0800)]
per vhost options struct explicitly const

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocreate_vhost move mounts list to info
Andy Green [Sun, 1 May 2016 20:59:54 +0000 (04:59 +0800)]
create_vhost move mounts list to info

There's no reason to not have the mounts linked list init also in the info
struct, rather than provide as a paramater to lws_create_vhost().  Now
is a good time to normalize that since this api only exists in master.

This also allows oldstyle "do everything at context creation time in one
vhost" guys to leverage mounts.

Also there's no reason the mounts linked-list pointer and all uses in lws
are non-const, so make them all explicitly const *.

Update the info struct docs to clarify which members are used when creating
a vhost and which for context creation.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoAdd warn_unused_result check, attribute only supported by GCC 3.4 or later
Patrick Farrell [Tue, 5 Apr 2016 20:59:07 +0000 (16:59 -0400)]
Add warn_unused_result check, attribute only supported by GCC 3.4 or later

warn_unused_result was introduced in GCC version 3.4.

Change-Id: I6c2cc938d2b868ddfe0889cc41d7fa9d70e1b907

8 years agoEliminated compile warning in test-client.c
Stephan Eberle [Tue, 26 Apr 2016 20:51:20 +0000 (22:51 +0200)]
Eliminated compile warning in test-client.c

8 years agoFixed misspelled size_t
Stephan Eberle [Tue, 26 Apr 2016 20:52:16 +0000 (22:52 +0200)]
Fixed misspelled size_t

8 years agoFixed build failure under Visual Studio 14 2015
Stephan Eberle [Tue, 26 Apr 2016 20:28:08 +0000 (22:28 +0200)]
Fixed build failure under Visual Studio 14 2015

8 years agoFixed build failure under Linux with GNU 4.8.4
Stephan Eberle [Tue, 26 Apr 2016 20:38:42 +0000 (22:38 +0200)]
Fixed build failure under Linux with GNU 4.8.4

8 years agoFixes for building with MinGW
Stephan Eberle [Tue, 26 Apr 2016 20:05:19 +0000 (22:05 +0200)]
Fixes for building with MinGW

Added fixes to avoid compile errors and warnings when building under
Windows using MinGW

8 years agologs document logrotate configuration for lwsws
Andy Green [Tue, 26 Apr 2016 11:07:17 +0000 (19:07 +0800)]
logs document logrotate configuration for lwsws

After discussion here

https://libwebsockets.org/pipermail/libwebsockets/2016-April/002304.html

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoserver status add getloadavg and lib version and more css
Andy Green [Mon, 25 Apr 2016 23:45:45 +0000 (07:45 +0800)]
server status add getloadavg and lib version and more css

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agopost example in test server
Andy Green [Mon, 25 Apr 2016 02:04:49 +0000 (10:04 +0800)]
post example in test server

https://github.com/warmcat/libwebsockets/issues/501

This demonstrates how to do a 303 redirect on POST and provide
the results there, in both libwebsockets-test-server and the
plugin version.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agodocs vhosts and mounts
Andy Green [Sun, 24 Apr 2016 18:01:25 +0000 (02:01 +0800)]
docs vhosts and mounts

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoandroid make script contrib
Alexander Bruines [Sat, 23 Apr 2016 10:28:03 +0000 (18:28 +0800)]
android make script contrib

This is based on

http://stackoverflow.com/questions/11929773/compiling-the-latest-openssl-for-android/

8 years agoAndroid needs sys/resource.h
Alexander Bruines [Sat, 23 Apr 2016 09:10:18 +0000 (11:10 +0200)]
Android needs sys/resource.h

8 years agohttp2 handle error path on ensure_user_space
Andy Green [Sat, 23 Apr 2016 01:36:18 +0000 (09:36 +0800)]
http2 handle error path on ensure_user_space

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agopollin shouldnt always win over pollout
Andy Green [Sat, 23 Apr 2016 01:26:11 +0000 (09:26 +0800)]
pollin shouldnt always win over pollout

https://github.com/warmcat/libwebsockets/issues/501

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocoverity 160162 check fcntl return
Andy Green [Fri, 22 Apr 2016 23:59:38 +0000 (07:59 +0800)]
coverity 160162 check fcntl return

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocoverity 160163 LWS_WARN_UNUSED_RESULT needed on header apis
Andy Green [Fri, 22 Apr 2016 23:53:46 +0000 (07:53 +0800)]
coverity 160163 LWS_WARN_UNUSED_RESULT needed on header apis

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocoverity 160166 readlink doesnt NUL terminate
Andy Green [Fri, 22 Apr 2016 23:49:57 +0000 (07:49 +0800)]
coverity 160166 readlink doesnt NUL terminate

Ah a real bug... well done coverity, that could have been nasty.

readlink unusually doesn't NUL terminate the result... take care about it.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocoverity 160165 dead code
Andy Green [Fri, 22 Apr 2016 23:46:37 +0000 (07:46 +0800)]
coverity 160165 dead code

Yes... extension selection is not wired up yet

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocoverity 160167 resource_path set at cmake may overflow buffer
Andy Green [Fri, 22 Apr 2016 23:40:34 +0000 (07:40 +0800)]
coverity 160167 resource_path set at cmake may overflow buffer

resource_path is configured at cmake time (it's like /usr/share/libwebsockets-test-server)
it's true if you gave a >255 char path there it would blow up.

It's fixed but again not network-accessible.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocoverity 160160/160161 test server commanline args strncpy NUL management
Andy Green [Fri, 22 Apr 2016 23:21:48 +0000 (07:21 +0800)]
coverity 160160/160161 test server commanline args strncpy NUL management

Just test app argument string handling, it is "HIGH" impact as Coverity
says but it's not network-accessible or in the library.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agodebug spew reduce
Andy Green [Fri, 22 Apr 2016 23:14:03 +0000 (07:14 +0800)]
debug spew reduce

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocruft remove sigusr2 handling
Andy Green [Fri, 22 Apr 2016 13:57:10 +0000 (21:57 +0800)]
cruft remove sigusr2 handling

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoclient account for retries
Andy Green [Fri, 22 Apr 2016 04:29:44 +0000 (12:29 +0800)]
client account for retries

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agohttp cache policy
Andy Green [Fri, 22 Apr 2016 00:53:49 +0000 (08:53 +0800)]
http cache policy

This allows mounts to define the caching policy of the files inside them.

Support is added in lwsws for controlling it from the config files.

The api for serializing a mount struct opaquely is removed and lws_http_mount struct
made public... it was getting out of control trying to hide the options.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocgi lifecycle logging
Andy Green [Tue, 19 Apr 2016 22:10:56 +0000 (06:10 +0800)]
cgi lifecycle logging

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoUpdate libwebsockets.h
hgrundy [Thu, 21 Apr 2016 09:20:10 +0000 (17:20 +0800)]
Update libwebsockets.h

Fix for FreeBSD

8 years agoaccess_log reset transaction size when using keepalive
Andy Green [Tue, 19 Apr 2016 21:58:01 +0000 (05:58 +0800)]
access_log reset transaction size when using keepalive

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoah try for ah when adopting socket to vhost
Andy Green [Tue, 19 Apr 2016 02:10:53 +0000 (10:10 +0800)]
ah try for ah when adopting socket to vhost

https://github.com/warmcat/libwebsockets/issues/496

Even if no ah available, we will be on the ah waiting list and get triggered
when one is freed and we're next in line.

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