Commit graph

1528 commits

Author SHA1 Message Date
Andy Green
952fcdede1 per vhost options struct explicitly const
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-02 06:01:59 +08:00
Andy Green
4664f71ed3 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>
2016-05-02 04:59:54 +08:00
Patrick Farrell
72e0e2a516 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
2016-04-30 02:07:13 +08:00
Stephan Eberle
ff32d01742 Fixed misspelled size_t 2016-04-27 07:36:41 +08:00
Stephan Eberle
f14f7237dc Fixed build failure under Linux with GNU 4.8.4 2016-04-27 07:32:56 +08:00
Stephan Eberle
3f41a9de5b Fixes for building with MinGW
Added fixes to avoid compile errors and warnings when building under
Windows using MinGW
2016-04-27 07:31:22 +08:00
Andy Green
12aeba73c0 server status add getloadavg and lib version and more css
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-26 14:54:09 +08:00
Andy Green
f79534e0a4 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>
2016-04-25 10:04:49 +08:00
Alexander Bruines
119bdaadc2 Android needs sys/resource.h 2016-04-23 17:18:46 +08:00
Andy Green
8dd32ae7c1 http2 handle error path on ensure_user_space
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-23 09:36:18 +08:00
Andy Green
2f216280f8 pollin shouldnt always win over pollout
https://github.com/warmcat/libwebsockets/issues/501

Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-23 09:26:11 +08:00
Andy Green
a2757c74b1 coverity 160162 check fcntl return
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-23 08:16:18 +08:00
Andy Green
16146cdad8 coverity 160163 LWS_WARN_UNUSED_RESULT needed on header apis
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-23 08:16:18 +08:00
Andy Green
516f388585 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>
2016-04-23 08:16:17 +08:00
Andy Green
5dd57a9430 coverity 160165 dead code
Yes... extension selection is not wired up yet

Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-23 08:16:17 +08:00
Andy Green
5bf2ce193b debug spew reduce
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-23 07:14:03 +08:00
Andy Green
2110ce9727 cruft remove sigusr2 handling
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-22 21:57:10 +08:00
Andy Green
81bf43b34f client account for retries
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-22 12:29:44 +08:00
Andy Green
42e8b189dc 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>
2016-04-22 08:53:49 +08:00
Andy Green
748a2210bd cgi lifecycle logging
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-21 17:50:58 +08:00
hgrundy
d02028bf25 Update libwebsockets.h
Fix for FreeBSD
2016-04-21 17:50:55 +08:00
Andy Green
5c3a3c5e95 access_log reset transaction size when using keepalive
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-20 05:58:01 +08:00
Andy Green
912c42f291 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>
2016-04-19 10:10:53 +08:00
Andy Green
5f947cdcd9 windows another uv_poll_init
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-19 09:10:08 +08:00
Lucas Terra
1759e32c7b 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.
2016-04-19 08:23:13 +08:00
Andy Green
c673125ce0 client http
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-18 20:05:43 +08:00
Andy Green
451cee5d47 polarssl implementation
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-18 20:05:43 +08:00
Lucas Terra
19f61e59b0 Fix inet_ntop linking error on Windows 2016-04-18 20:05:43 +08:00
Andy Green
980614035f plugin lws server status
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-18 20:05:43 +08:00
Andy Green
4714cf02f4 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>
2016-04-16 08:40:35 +08:00
Andy Green
7e2c3851bf 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>
2016-04-15 20:09:36 +08:00
Andy Green
b21c20b5ff context settable server string
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-15 13:58:24 +08:00
Andy Green
cec2fd55a8 lws normalize http response
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-15 13:58:24 +08:00
Andy Green
2f0bc93d46 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>
2016-04-15 13:58:24 +08:00
Justin Chen
30cdb3ac8f recv treat zero return as error
https://github.com/warmcat/libwebsockets/issues/475
2016-04-15 13:58:24 +08:00
Andy Green
f3e9c7347e json dump vhost
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-15 13:57:22 +08:00
Andy Green
57f2007105 vhost collect rx tx stats
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-15 13:57:20 +08:00
Andy Green
868b9f2ecb strict transport security vhost option flag and lwsws conf support
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-14 21:27:38 +08:00
Andy Green
144594dd43 unix sockets make vhost option
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-14 21:27:38 +08:00
Andy Green
cc3c6fb047 vhost should have his own options
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-14 21:27:38 +08:00
Yeonjun Lim
44182452c8 Support for abstract socket 2016-04-14 20:59:16 +08:00
Yeonjun Lim
3c6a8c1a24 Add unix domain socket 2016-04-14 20:59:16 +08:00
Andy Green
b46e4a866d vhost keepalive timeout
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-14 20:59:16 +08:00
Andy Green
5b95081000 ssl server init failure info
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-14 20:59:16 +08:00
Andy Green
5e799a45cc ssl store vhost in ssl private data not context
Only used by the ssl verify callback

Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-14 20:59:16 +08:00
Andy Green
f5efa74cb7 cgi post
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-13 11:53:40 +08:00
Andy Green
22d6f39e7f 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>
2016-04-13 11:53:40 +08:00
Andy Green
a5e73a1a4b lwsws cgi integration
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-13 11:53:40 +08:00
Andy Green
0a183545b2 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>
2016-04-13 11:53:40 +08:00
Andy Green
e01a551a17 vhost if explicit vhosts only enable protocols with pvo mentions
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-13 11:53:16 +08:00