platform/upstream/libwebsockets.git
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>
8 years agowindows another uv_poll_init
Andy Green [Tue, 19 Apr 2016 01:10:08 +0000 (09:10 +0800)]
windows another uv_poll_init

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoConditionally define snprintf on Windows
Lucas Terra [Mon, 18 Apr 2016 19:15:37 +0000 (16:15 -0300)]
Conditionally define snprintf on Windows

snprintf is already defined in MSVC 2015. If you redefine it <stdio.h> will cry about it and abort the compilation.

8 years agoScript and config to make tracking ABI/API changes easy.
Roger A. Light [Mon, 18 Apr 2016 13:32:55 +0000 (14:32 +0100)]
Script and config to make tracking ABI/API changes easy.

AG: enhance the script a bit and fix the make instructions

8 years agoclient http
Andy Green [Mon, 18 Apr 2016 09:26:14 +0000 (17:26 +0800)]
client http

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agopolarssl implementation
Andy Green [Sun, 17 Apr 2016 03:28:43 +0000 (11:28 +0800)]
polarssl implementation

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoFix inet_ntop linking error on Windows
Lucas Terra [Sun, 17 Apr 2016 22:26:04 +0000 (19:26 -0300)]
Fix inet_ntop linking error on Windows

8 years agoplugin lws server status
Andy Green [Fri, 15 Apr 2016 06:01:29 +0000 (14:01 +0800)]
plugin lws server status

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agovh doubly linked list for wsi on same protocol
Andy Green [Sat, 16 Apr 2016 00:40:35 +0000 (08:40 +0800)]
vh doubly linked list for wsi on same protocol

This trades off a couple of wsi pointers for vastly increased speed
for the callback when writeable "all protocol" variants when there
are many kinds of wsi active.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoredirects need fake content metadata
Andy Green [Fri, 15 Apr 2016 12:09:36 +0000 (20:09 +0800)]
redirects need fake content metadata

Chrome deals with it without on desktop, but Android chrome
waits for the connection to time out before actioning the
redirect, since it feels there might be html payload coming.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocontext settable server string
Andy Green [Fri, 15 Apr 2016 05:33:52 +0000 (13:33 +0800)]
context settable server string

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolws normalize http response
Andy Green [Fri, 15 Apr 2016 04:29:06 +0000 (12:29 +0800)]
lws normalize http response

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolws access log option and lwsws conf
Andy Green [Fri, 15 Apr 2016 04:00:23 +0000 (12:00 +0800)]
lws access log option and lwsws conf

This adds the ability to store apache-compatible logs to a file given at
vhost-creation time.

lwsws conf can set it per-vhost using "access-log": "<filepath>"

The feature defaults to disabled at cmake, it can be set independently but
LWS_WITH_LWSWS set it on.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agorecv treat zero return as error
Justin Chen [Thu, 14 Apr 2016 13:40:53 +0000 (21:40 +0800)]
recv treat zero return as error

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

8 years agojson dump vhost
Andy Green [Thu, 14 Apr 2016 07:07:44 +0000 (15:07 +0800)]
json dump vhost

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agovhost collect rx tx stats
Andy Green [Fri, 15 Apr 2016 05:02:25 +0000 (13:02 +0800)]
vhost collect rx tx stats

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agostrict transport security vhost option flag and lwsws conf support
Andy Green [Thu, 14 Apr 2016 04:37:21 +0000 (12:37 +0800)]
strict transport security vhost option flag and lwsws conf support

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolwsws conf unix sockets support vhost conf option
Andy Green [Thu, 14 Apr 2016 04:18:33 +0000 (12:18 +0800)]
lwsws conf unix sockets support vhost conf option

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agounix sockets make vhost option
Andy Green [Thu, 14 Apr 2016 04:11:51 +0000 (12:11 +0800)]
unix sockets make vhost option

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolwsws conf move interface to be vhost attribute
Andy Green [Thu, 14 Apr 2016 03:50:05 +0000 (11:50 +0800)]
lwsws conf move interface to be vhost attribute

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agovhost should have his own options
Andy Green [Thu, 14 Apr 2016 07:09:01 +0000 (15:09 +0800)]
vhost should have his own options

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoAdd testapps support for client certs and CRLs
Alexander Bruines [Wed, 13 Apr 2016 20:17:05 +0000 (22:17 +0200)]
Add testapps support for client certs and CRLs

AG: plumb into cmake to avoid travis mac blowing up

8 years agoSupport for abstract socket
Yeonjun Lim [Sun, 10 Apr 2016 04:19:16 +0000 (13:19 +0900)]
Support for abstract socket

8 years agoAdd unix domain socket
Yeonjun Lim [Thu, 31 Mar 2016 05:47:02 +0000 (22:47 -0700)]
Add unix domain socket

8 years agovhost keepalive timeout
Andy Green [Tue, 12 Apr 2016 08:26:03 +0000 (16:26 +0800)]
vhost keepalive timeout

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agossl server init failure info
Andy Green [Tue, 12 Apr 2016 01:02:32 +0000 (09:02 +0800)]
ssl server init failure info

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agossl store vhost in ssl private data not context
Andy Green [Mon, 11 Apr 2016 23:59:53 +0000 (07:59 +0800)]
ssl store vhost in ssl private data not context

Only used by the ssl verify callback

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocgi post
Andy Green [Wed, 13 Apr 2016 03:42:53 +0000 (11:42 +0800)]
cgi post

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agohttp2 update integration
Andy Green [Sun, 10 Apr 2016 01:33:54 +0000 (09:33 +0800)]
http2 update integration

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

This

1) fixes the vhost changes on master

2) works around the ah pool changes

3) fixes some other build problems that appeared

4) hacks out physical flow control for internal streams

5) updates the advertised protocol to h2 needed by, eg, chrome 51

That gets it able to serve small (<4K, ie, one packet) files over http2

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolwsws cgi integration
Andy Green [Wed, 13 Apr 2016 03:49:07 +0000 (11:49 +0800)]
lwsws cgi integration

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolwsws specifically signed char return lejp
Andy Green [Sat, 9 Apr 2016 01:32:01 +0000 (09:32 +0800)]
lwsws specifically signed char return lejp

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolwsws conf and plugins convert to libuv apis
Andy Green [Fri, 8 Apr 2016 23:22:40 +0000 (07:22 +0800)]
lwsws conf and plugins convert to libuv apis

After discussion here

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

scandir usage in

 - lwsws conf.c
 - lws plugin support

and

 - lws plugin apis for dl

are converted to us libuv apis so they can work cross-platform easily.

lws itself remains not requiring libuv, although it's an option.

 - LWS_WITH_LWSWS
 - LWS_WITH_PLUGINS

now force LWS_WITH_LIBUV if selected... both of these are new features
only in master atm and both are off by default in CMake.

There's a complication libuv can be too old to offer the necessary apis,
this is the case in Travis Trusty instance.  In that case, UV_VERSION_MAJOR ==0,
then the unix-only plugin implementation is used instead.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agovhost if explicit vhosts only enable protocols with pvo mentions
Andy Green [Tue, 12 Apr 2016 08:41:31 +0000 (16:41 +0800)]
vhost if explicit vhosts only enable protocols with pvo mentions

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolwsws redirect and correct vhost selection before accept
Andy Green [Fri, 8 Apr 2016 10:30:45 +0000 (18:30 +0800)]
lwsws redirect and correct vhost selection before accept

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolwsws protocol filter and options
Andy Green [Fri, 8 Apr 2016 05:25:34 +0000 (13:25 +0800)]
lwsws protocol filter and options

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agowindows snprintf is _snprintf
Meir Yanovich [Fri, 8 Apr 2016 08:11:27 +0000 (16:11 +0800)]
windows snprintf is _snprintf

https://github.com/warmcat/libwebsockets/issues/411#issuecomment-207290650

8 years agoandroid fix rlimit
Galen Ma [Fri, 8 Apr 2016 08:02:59 +0000 (16:02 +0800)]
android fix rlimit

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

8 years agoextensions add api for user code option manipulation
Andy Green [Fri, 8 Apr 2016 01:45:49 +0000 (09:45 +0800)]
extensions add api for user code option manipulation

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agourldecode forbid malformed
Andy Green [Thu, 7 Apr 2016 02:08:35 +0000 (10:08 +0800)]
urldecode forbid malformed

And update attack.sh to confirm the new test cases

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoplugins also link lwsws against websockets_shared
Andy Green [Wed, 6 Apr 2016 19:10:54 +0000 (03:10 +0800)]
plugins also link lwsws against websockets_shared

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoplugins link libwebsockets dynamically
Denis Osvald [Wed, 6 Apr 2016 16:07:37 +0000 (18:07 +0200)]
plugins link libwebsockets dynamically

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
8 years agoplugins
Andy Green [Wed, 6 Apr 2016 08:15:40 +0000 (16:15 +0800)]
plugins

This adds support for dynamically loaded plugins at runtime, which
can expose their own protocols or extensions transparently.

With these changes lwsws defaults to OFF in cmake, and if enabled it
automatically enables plugins and libuv support.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolibuv add idle processing to force service where needed
Andy Green [Wed, 6 Apr 2016 01:23:16 +0000 (09:23 +0800)]
libuv add idle processing to force service where needed

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

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolws_service_adjust_timeout optimize
Andy Green [Wed, 6 Apr 2016 00:36:30 +0000 (08:36 +0800)]
lws_service_adjust_timeout optimize

Make it exit quicker if something is pending

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agorevert 622d9f2 ssl pending handcrank
Andy Green [Tue, 5 Apr 2016 11:43:07 +0000 (19:43 +0800)]
revert 622d9f2 ssl pending handcrank

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

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agowin32 libuv build notes
Meir Yanovich [Tue, 5 Apr 2016 11:19:46 +0000 (19:19 +0800)]
win32 libuv build notes

8 years agowin32 needs strange strftime args
Meir Yanovich [Tue, 5 Apr 2016 11:15:34 +0000 (19:15 +0800)]
win32 needs strange strftime args

8 years agouri processing reject paths not starting with slash
Andy Green [Fri, 1 Apr 2016 23:36:17 +0000 (07:36 +0800)]
uri processing reject paths not starting with slash

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

Return 403 Forbidden if we don't end up with a uri path starting with /

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolibuv report init failure
Andy Green [Fri, 1 Apr 2016 08:57:00 +0000 (16:57 +0800)]
libuv report init failure

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agotest server libevuv set LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT on ssl
Andy Green [Fri, 1 Apr 2016 08:44:01 +0000 (16:44 +0800)]
test server libevuv set LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT on ssl

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolibuv win32 fixes 2
Meir Yanovich [Fri, 1 Apr 2016 07:56:48 +0000 (15:56 +0800)]
libuv win32 fixes 2

https://github.com/warmcat/libwebsockets/issues/411#issuecomment-204284368

8 years agotest server align rxbuf with permessage deflate rx buf size
Andy Green [Fri, 1 Apr 2016 00:43:13 +0000 (08:43 +0800)]
test server align rxbuf with permessage deflate rx buf size

Add a test html button that will send 9KB of junk to confirm it

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

permessage-deflate now checks the protocol rx buffer size for being
>=128, if not, permessage-deflate is disabled on that connection.

If it is >=128 but less than the zlib decompress buffer size, the
zlib decompress buffer size for that connection is reduced to the
nearest power of two of the protocol rx buf size.

To test this, dumb_increment is left violating the >= 128 rx buffer
size and permessage-deflte can be seen to be disabled on his
connections in the test html.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolibuv win32 fixes
Andy Green [Thu, 31 Mar 2016 12:11:53 +0000 (20:11 +0800)]
libuv win32 fixes

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agocmake libuv fix include forcing path
Andy Green [Thu, 31 Mar 2016 00:33:47 +0000 (08:33 +0800)]
cmake libuv fix include forcing path

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoFix build with musl libc
V.Krishn [Sun, 8 Mar 2015 09:35:27 +0000 (09:35 +0000)]
Fix build with musl libc

Fix building libwebsockets with the musl C libary.

<sys/cdefs.h> is an internal glibc header and should be avoided in user code.

__P() was used for compatibility with some old K&R C compilers, when there were
no prototypes (which were introduced to C with C89). As supporting legacy
non-ANSI compilers is nowadays not necessary anymore get rid of the unnecessary
function prototype using __P().

8 years agombedtls and polarssl first part
Andy Green [Mon, 28 Mar 2016 11:58:02 +0000 (19:58 +0800)]
mbedtls and polarssl first part

polarssl is the old name for mbedtls.  Unfortunately the two are confused in eg,
Fedora.  For our purposes, polarssl or mbedtls < 2.0 has includes in
/usr/include/polarssl and polarssl_ apis and we call that "polarssl".

polarssl or mbedtls >=2.0 has includes in /usr/include/mbedtls and mbedtls_ apis,
we call that "mbedtls".

This has to be spelled out clearly because eg Fedora has a package "mbedtls" which
is 1.3.x and has the polarssl_ apis and include path.  We will deal with that as
"polarssl" despite the package name then.

This patch lets you use LWS_USE_POLARSSL or LWS_USE_MBEDTLS and set the include and
library path like this

cmake .. -DLWS_USE_POLARSSL=1 -DLWS_POLARSSL_INCLUDE_DIRS=/usr/include -DLWS_POLARSSL_LIBRARIES=/usr/lib64/libmbedtls.so.9

This patch adds the cmake support and adapts [private-]libwebsockets.h but doesn't
modify the apis in ssl[-*].c yet.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agorevert cmake remove targets from install path
Andy Green [Tue, 29 Mar 2016 10:27:32 +0000 (18:27 +0800)]
revert cmake remove targets from install path

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agossl split out common server and client ssl sources
Andy Green [Tue, 29 Mar 2016 00:51:42 +0000 (08:51 +0800)]
ssl split out common server and client ssl sources

Most of ssl.c is under a #ifdef for client or server disabled...
let's get rid of it and have CMake just build the appropriate
files

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agossl migrate client pieces to ssl.c
Andy Green [Mon, 28 Mar 2016 04:43:55 +0000 (12:43 +0800)]
ssl migrate client pieces to ssl.c

Some ssl-specific code was still hiding out in client.c instead of
going in ssl.c

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolwsws Libwebsockets Web Server
Andy Green [Mon, 28 Mar 2016 02:12:37 +0000 (10:12 +0800)]
lwsws Libwebsockets Web Server

This makes a start on the LibWebSockets WebServer.

The app cmake build support and JSON config parsing are implemented and
the app can start, create the vhosts, listen and serve file:// mounts on
them.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agointroduce vhosts
Andy Green [Mon, 28 Mar 2016 02:10:43 +0000 (10:10 +0800)]
introduce vhosts

This patch splits out some lws_context members into a new lws_vhost struct.

 - ssl state and options per vhost
 - SSL_CTX for serving and client per vhost
 - protocols[] per vhost
 - extensions[] per vhost

lws_context maintains a linked list of lws_vhosts.

The same lws_context_creation_info struct is used to regulate both the
context creation and to create vhosts: for backward compatibility if you
didn't provide the new LWS_SERVER_OPTION_EXPLICIT_VHOSTS option, then
a default vhost is created at context creation time using the same info
data as the context itself.

If you will have multiple vhosts though, you should give the
LWS_SERVER_OPTION_EXPLICIT_VHOSTS option at context creation time,
create the context first and then the vhosts afterwards using

  lws_create_vhost(contest, &info);

Although there is a lot of housekeeping to implement this change, there
is almost no additional overhead if you don't use multiple vhosts and
very little api impact (no changes to test apps).

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoSNI for server side: receive callback
Andy Green [Wed, 23 Mar 2016 05:04:58 +0000 (13:04 +0800)]
SNI for server side: receive callback

This takes tha callback and binds the lws_context to the SSL_CTX so we can
get the lws_context in the callback.

It just logs the incoming hostname atm.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agohttp2 build with alpn capable ssl no debug
Andy Green [Fri, 25 Mar 2016 13:00:41 +0000 (21:00 +0800)]
http2 build with alpn capable ssl no debug

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agoLWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT to default to runtime ssl disable
Andy Green [Wed, 23 Mar 2016 01:22:11 +0000 (09:22 +0800)]
LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT to default to runtime ssl disable

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

Adds lws_check_opt() to regularize multibit flag checking.

There's a new context creation flag LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT,
this is included automatically if you give any other SSL-related option flag.
If you give no SSL-related option flag, nor this one directly, then even
though SSL support may be compiled in, it is never initialized nor used for the
whole lifetime of the lws context.

Conversely in order to prepare the context to use SSL, even though, eg, you
are not listening on SSL but will use SSL client connections later, you can
give this flag explicitly to make sure SSL is initialized.

Signed-off-by: Andy Green <andy@warmcat.com>
8 years agolibuv: sigint API cleanup
Denis Osvald [Tue, 22 Mar 2016 13:04:15 +0000 (14:04 +0100)]
libuv: sigint API cleanup

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>