platform/upstream/libwebsockets.git
7 years agossl close improvement
Silas Parker [Tue, 21 Feb 2017 11:27:47 +0000 (19:27 +0800)]
ssl close improvement

7 years agoraw: adoption and processing
Andy Green [Sun, 12 Feb 2017 12:32:49 +0000 (20:32 +0800)]
raw: adoption and processing

7 years agourl-parser: handle ipv6 [] addresses
Silas Parker [Mon, 20 Feb 2017 23:27:07 +0000 (07:27 +0800)]
url-parser: handle ipv6 [] addresses

7 years agovhost: also free per-vhost protocols list even when no PLUGINS
Namowen [Sun, 19 Feb 2017 22:20:56 +0000 (06:20 +0800)]
vhost: also free per-vhost protocols list even when no PLUGINS

7 years agossl close: do explicit ssl shutdown instead of socket shutdown if ssl mode
Andy Green [Sun, 19 Feb 2017 21:44:56 +0000 (05:44 +0800)]
ssl close: do explicit ssl shutdown instead of socket shutdown if ssl mode

7 years agocosmetic CR missing on some errs
Namowen [Sat, 18 Feb 2017 21:35:55 +0000 (05:35 +0800)]
cosmetic CR missing on some errs

7 years agoESP32 platform
Andy Green [Sat, 18 Feb 2017 09:26:40 +0000 (17:26 +0800)]
ESP32 platform

This is enough for all the test app features to work on ESP32 without
SSL.

7 years agoFix typo
Yuchen Xie [Sat, 18 Feb 2017 07:51:34 +0000 (15:51 +0800)]
Fix typo

7 years agoclient: fix X509_V_ERR_CERT_HAS_EXPIRED
Namowen [Fri, 17 Feb 2017 23:51:27 +0000 (07:51 +0800)]
client: fix X509_V_ERR_CERT_HAS_EXPIRED

7 years agoclient: direct _APPEND_HANDSHAKE_HEADER at wsi protocol
Joel Winarske [Thu, 16 Feb 2017 07:29:08 +0000 (15:29 +0800)]
client: direct _APPEND_HANDSHAKE_HEADER at wsi protocol

7 years agoCorrect Cross compiling commandline
Yongwen Zhuang [Wed, 15 Feb 2017 09:58:39 +0000 (17:58 +0800)]
Correct Cross compiling commandline

7 years agoclient: allow http[s] to select targeted protocol name in vhost
Andy Green [Wed, 15 Feb 2017 01:12:39 +0000 (09:12 +0800)]
client: allow http[s] to select targeted protocol name in vhost

7 years agowindows: changes to build with VS2015
Joel Winarske [Tue, 14 Feb 2017 19:17:09 +0000 (11:17 -0800)]
windows: changes to build with VS2015

7 years agofix close packet index coding
Silas Parker [Tue, 14 Feb 2017 15:14:09 +0000 (23:14 +0800)]
fix close packet index coding

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

7 years agogcc-format-strings: ipv6
Silas Parker [Tue, 14 Feb 2017 09:55:13 +0000 (17:55 +0800)]
gcc-format-strings: ipv6

7 years agogzip fixes
Per Bothner [Tue, 14 Feb 2017 01:44:57 +0000 (09:44 +0800)]
gzip fixes

7 years agoclient: close without spinning
Andy Green [Tue, 14 Feb 2017 01:26:53 +0000 (09:26 +0800)]
client: close without spinning

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

7 years agofile_ops: add compression flags and convert open flags to pointer
Andy Green [Sun, 12 Feb 2017 10:15:15 +0000 (18:15 +0800)]
file_ops: add compression flags and convert open flags to pointer

ihttps://libwebsockets.org/pipermail/libwebsockets/2017-February/003127.html

7 years agofile_ops: use wrappers for names
Andy Green [Sun, 12 Feb 2017 10:11:11 +0000 (18:11 +0800)]
file_ops: use wrappers for names

7 years agoclient redirect: make sure there is a leading / on path
Andy Green [Fri, 10 Feb 2017 03:00:38 +0000 (11:00 +0800)]
client redirect: make sure there is a leading / on path

7 years agoappveyor: make zip artifact
Andy Green [Thu, 9 Feb 2017 23:37:35 +0000 (07:37 +0800)]
appveyor: make zip artifact

7 years agoclient: fix redirects and allow ssl / non-ssl redirects
Andy Green [Thu, 9 Feb 2017 07:25:01 +0000 (15:25 +0800)]
client: fix redirects and allow ssl / non-ssl redirects

7 years agochunked http client: support in test-client and document
Andy Green [Thu, 9 Feb 2017 01:10:57 +0000 (09:10 +0800)]
chunked http client: support in test-client and document

This improves the test client to

 - dump http content if INFO log level enabled
 - handle chunked content correctly
 - document lws_http_client_read()

7 years agolwsl_visible
Andy Green [Thu, 9 Feb 2017 01:11:17 +0000 (09:11 +0800)]
lwsl_visible

7 years agotest client: some compilers dont accept void * as const char *
Johnny [Tue, 7 Feb 2017 19:09:34 +0000 (20:09 +0100)]
test client: some compilers dont accept void * as const char *

This fixes a conversion error from a void pointer to a string.

7 years agogcc-format-strings: LWS_PLAT_OPTEE
Andy Green [Mon, 6 Feb 2017 06:35:30 +0000 (14:35 +0800)]
gcc-format-strings: LWS_PLAT_OPTEE

7 years agoLWS_PLAT_OPTEE: Convert to use TEE_Malloc
Andy Green [Mon, 30 Jan 2017 07:02:54 +0000 (15:02 +0800)]
LWS_PLAT_OPTEE: Convert to use TEE_Malloc

OPTEE TAs should allocate via TEE_Malloc

7 years agocoverity 175437: forgot to add name to array for new USER log level
Andy Green [Mon, 6 Feb 2017 02:16:45 +0000 (10:16 +0800)]
coverity 175437: forgot to add name to array for new USER log level

7 years agocoverity 175438: server status plugin: off-by-one if you generate 32KB of content
Andy Green [Mon, 6 Feb 2017 02:14:47 +0000 (10:14 +0800)]
coverity 175438: server status plugin: off-by-one if you generate 32KB of content

7 years agocoverity 175435: seems bogus
Andy Green [Mon, 6 Feb 2017 02:10:41 +0000 (10:10 +0800)]
coverity 175435: seems bogus

7 years agocoverity 175436: dead cruft
Andy Green [Mon, 6 Feb 2017 02:04:04 +0000 (10:04 +0800)]
coverity 175436: dead cruft

7 years agogcc format strings: http2
Andy Green [Sun, 5 Feb 2017 14:48:12 +0000 (22:48 +0800)]
gcc format strings: http2

7 years agoLWS_FALLBACK_GETHOSTBYNAME
andSpace [Sun, 5 Feb 2017 13:47:08 +0000 (21:47 +0800)]
LWS_FALLBACK_GETHOSTBYNAME

Adapted by AG to not use-after-free and have LWS_FALLBACK_GETHOSTBYNAME

7 years agogcc- format strings: debug and extra plugins
Andy Green [Sun, 5 Feb 2017 14:07:34 +0000 (22:07 +0800)]
gcc- format strings: debug and extra plugins

7 years agoSubject: gcc format strings: Make GCC check format strings, fix found problems
Martin Milata [Sat, 4 Feb 2017 12:09:00 +0000 (13:09 +0100)]
Subject: gcc format strings: Make GCC check format strings, fix found problems

7 years agodocs: Correct string
Martin Milata [Sat, 4 Feb 2017 12:03:26 +0000 (13:03 +0100)]
docs: Correct string

7 years agopost processing: fix problem where hex cant straddle block correctly
Sven Hoffmann [Sun, 5 Feb 2017 13:25:39 +0000 (21:25 +0800)]
post processing: fix problem where hex cant straddle block correctly

7 years agoremove dump getaddrinfo result
Andy Green [Fri, 3 Feb 2017 12:55:56 +0000 (20:55 +0800)]
remove dump getaddrinfo result

7 years agoclient: decruft extensions
Andy Green [Fri, 3 Feb 2017 02:39:37 +0000 (10:39 +0800)]
client: decruft extensions

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

7 years agologging: cleanup and introduce LLL_USER
Andy Green [Tue, 31 Jan 2017 02:50:15 +0000 (10:50 +0800)]
logging: cleanup and introduce LLL_USER

7 years agohttp_proxy: deal with redundant protocol leader
Andy Green [Wed, 25 Jan 2017 23:27:11 +0000 (07:27 +0800)]
http_proxy: deal with redundant protocol leader

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

7 years agowsi remove unused 'upgraded' boolean field
Denis Osvald [Mon, 23 Jan 2017 11:36:56 +0000 (12:36 +0100)]
wsi remove unused 'upgraded' boolean field

It was introduced in 7df53c555009d599c0474e49c58d3f8a46792382
but was never used...

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
7 years agocontext new option LWS_SERVER_OPTION_JUST_USE_RAW_ORIGIN
Andy Green [Mon, 23 Jan 2017 11:52:27 +0000 (19:52 +0800)]
context new option LWS_SERVER_OPTION_JUST_USE_RAW_ORIGIN

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

7 years agossl pass real wsi to verify cert cb
Denis Osvald [Mon, 23 Jan 2017 11:35:00 +0000 (19:35 +0800)]
ssl pass real wsi to verify cert cb

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
7 years agossl expose public wsi->ssl getter
Denis Osvald [Mon, 23 Jan 2017 11:34:46 +0000 (19:34 +0800)]
ssl expose public wsi->ssl getter

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
7 years agowindows: reduce C99isms to something MS compiler can understand
Andy Green [Tue, 17 Jan 2017 23:20:09 +0000 (07:20 +0800)]
windows: reduce C99isms to something MS compiler can understand

7 years agoplat-optee and boringssl adaptations
Andy Green [Mon, 16 Jan 2017 23:01:02 +0000 (07:01 +0800)]
plat-optee and boringssl adaptations

7 years agowin32 fixes
Andy Green [Mon, 16 Jan 2017 22:51:11 +0000 (06:51 +0800)]
win32 fixes

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

7 years agoignore leading spaces when checking for a suitable subprotocol
Tobias [Mon, 16 Jan 2017 11:01:25 +0000 (12:01 +0100)]
ignore leading spaces when checking for a suitable subprotocol

My Browsers send as Subprotocols e.g. chat, superchat, mySubprotocol (with spaces after the ,). Libwebsockets now checked if ' mySubprotocol' was equal to 'mySubprotocol' which failed. With this fix the leading space is ignored and uses 'mySubprotocol' for comparision.

7 years agossl: add LWS_CALLBACK_OPENSSL_PERFORM_SERVER_CERT_VERIFICATION
Namowen [Tue, 10 Jan 2017 01:31:23 +0000 (09:31 +0800)]
ssl: add LWS_CALLBACK_OPENSSL_PERFORM_SERVER_CERT_VERIFICATION

7 years agossl: wolfssl doesn't have clear options
Andy Green [Tue, 10 Jan 2017 01:14:44 +0000 (09:14 +0800)]
ssl: wolfssl doesn't have clear options

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

7 years agossl-correct-option-clear-availability-version
Hai Vu [Tue, 10 Jan 2017 01:10:49 +0000 (09:10 +0800)]
ssl-correct-option-clear-availability-version

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

7 years agossl: correct version detection
Andy Green [Sat, 7 Jan 2017 03:29:32 +0000 (11:29 +0800)]
ssl: correct version detection

7 years agopolarssl: turn off missing tlsext
Andy Green [Sat, 7 Jan 2017 02:24:16 +0000 (10:24 +0800)]
polarssl: turn off missing tlsext

7 years agoopenssl: deal with missing OPENSSL_NO_TLSEXT on ancient versions
Andy Green [Fri, 6 Jan 2017 01:49:28 +0000 (09:49 +0800)]
openssl: deal with missing OPENSSL_NO_TLSEXT on ancient versions

7 years agocmake: boringssl helper
Andy Green [Wed, 4 Jan 2017 12:23:10 +0000 (20:23 +0800)]
cmake: boringssl helper

7 years agoclient: MORE_SERVICE is not an error
Andy Green [Wed, 4 Jan 2017 11:59:38 +0000 (19:59 +0800)]
client: MORE_SERVICE is not an error

7 years agocgi: 5s grace to send buffered if chunked
Andy Green [Tue, 3 Jan 2017 00:18:37 +0000 (08:18 +0800)]
cgi: 5s grace to send buffered if chunked

7 years agoserver: check listen(2) return value
Denis Osvald [Mon, 2 Jan 2017 16:33:26 +0000 (17:33 +0100)]
server: check listen(2) return value

The `listen` call can fail with EADDRINUSE after bind() succeeds, for
example because another process called listen on that port in the
meantime, or under some circumstances with IPv6-mapped-IPv4. This was
causing EINVAL on accept, with an infinite loop in case of libuv.

A reproducible example was to run nc -l -p 5555 ( OpenBSD netcat (Debian
patchlevel 1)) before starting test-server

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
7 years agolejp-conf: add timeout-secs
Andy Green [Mon, 2 Jan 2017 11:57:54 +0000 (19:57 +0800)]
lejp-conf: add timeout-secs

7 years agowindows: remove preprocessor business for [v]snprintf
Andy Green [Wed, 28 Dec 2016 07:23:34 +0000 (15:23 +0800)]
windows: remove preprocessor business for [v]snprintf

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

7 years agolws_plat_service_tsi: accessing context before checking for NULL
namowen [Fri, 23 Dec 2016 23:57:34 +0000 (07:57 +0800)]
lws_plat_service_tsi: accessing context before checking for NULL

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

7 years agotest server: add -P secs to allow pingpong test
Andy Green [Fri, 23 Dec 2016 23:37:40 +0000 (07:37 +0800)]
test server: add -P secs to allow pingpong test

7 years agoESP8266: LWS_POSIX fixes for basic auth and deprecated context
Andy Green [Thu, 22 Dec 2016 03:32:34 +0000 (11:32 +0800)]
ESP8266: LWS_POSIX fixes for basic auth and deprecated context

7 years agossl-server: Add CONTEXT_PORT_NO_LISTEN_SERVER
Alan Conway [Wed, 21 Dec 2016 01:32:44 +0000 (09:32 +0800)]
ssl-server: Add CONTEXT_PORT_NO_LISTEN_SERVER

Special port setting to disable listening for a server using socket adoption.
This contrasts with CONTEXT_PORT_NO_LISTEN which does the same for a client.

In particular, server-side SSL is not disabled by CONTEXT_PORT_NO_LISTEN_SERVER
as it is by CONTEXT_PORT_NO_LISTEN.

7 years agossl: improved error reporting for SSL_accept.
Alan Conway [Wed, 21 Dec 2016 01:32:25 +0000 (09:32 +0800)]
ssl: improved error reporting for SSL_accept.

The return value from SSL_get_error() is an integer switch value, not an error
code that can be interpreted by ERR_error_string()

Report the error code name, plus errno information if available for
SSL_ERROR_SYSCALL as per man page for SSL_get_error().

7 years agoserver: expose lws_adopt_socket_vhost() as public API
Alan Conway [Wed, 21 Dec 2016 01:32:16 +0000 (09:32 +0800)]
server: expose lws_adopt_socket_vhost() as public API

Allows a socket to be adopted and associated with an existing vhost.
Also added corresponding  lws_adopt_socket_vhost_readbuf()

7 years agocontext deprecation
Andy Green [Thu, 15 Dec 2016 23:37:43 +0000 (07:37 +0800)]
context deprecation

1) This makes lwsws run a parent process with the original permissions.
But this process is only able to respond to SIGHUP, it doesn't do anything
else.

2) You can send this parent process a SIGHUP now to cause it to

 - close listening sockets in existing lwsws processes

 - mark those processes as to exit when the number of active connections
   on the falls to zero

 - spawn a fresh child process from scratch, using latest configuration
   file content, latest plugins, etc.  It can now reopen listening sockets
   if it chooses to, or open different listen ports or whatever.

Notes:

1) lws_context_destroy() has been split into two pieces... the reason for
the split is the first part closes the per-vhost protocols, but since
they may have created libuv objects in the per-vhost protocol storage,
these cannot be freed until after the loop has been run.

That's the purpose of the second part of the context destruction,
lws_context_destroy2().

For compatibility, if you are not using libuv, the first part calls the
second part.  However if you are using libuv, you must now call the
second part from your own main.c after the first part.

7 years agouv: dont try to touch watcher until after loop initialized
Andy Green [Fri, 16 Dec 2016 00:41:16 +0000 (08:41 +0800)]
uv: dont try to touch watcher until after loop initialized

7 years agoecho: fix debug build
Namowen [Thu, 15 Dec 2016 23:02:59 +0000 (07:02 +0800)]
echo: fix debug build

https://github.com/warmcat/libwebsockets/issues/716#issuecomment-267377856

7 years agoclient ssl hostname check: trim any port on host header
Andy Green [Thu, 15 Dec 2016 05:22:40 +0000 (13:22 +0800)]
client ssl hostname check: trim any port on host header

7 years agotest-client: fix broken protocol names
Andy Green [Thu, 15 Dec 2016 05:25:25 +0000 (13:25 +0800)]
test-client: fix broken protocol names

7 years agoipv6-allow-binding-to-ipv6-address-in-iface
Andy Green [Thu, 15 Dec 2016 01:58:20 +0000 (09:58 +0800)]
ipv6-allow-binding-to-ipv6-address-in-iface

ipv4 and ipv6 binding to a named interface works OK.  ipv4 binding to an IP also
works, but we need some extra ipv6 magic to identify the ipv6 interface from an
ipv6 address.

This patch based on code from "user3546716" at
http://stackoverflow.com/questions/13504934/binding-sockets-to-ipv6-addresses

adds the necessary magic.

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

7 years agoclient: if NULL protocol vhost same linked list entry
Andy Green [Thu, 15 Dec 2016 00:33:53 +0000 (08:33 +0800)]
client: if NULL protocol vhost same linked list entry

Lws maintains a linked-list of wsi that are on the same vhost protocol...
it walks it to perform ..._all_protocol() type apis.

Client connections also participate in this list, but in the case the
selected protocol is not given during negotation (a legal case where
the server default protocol is selected) we missed adding the new
ws negotiated client wsi to the list.

This patch makes sure we add the wsi to the vhost protocols[0] list
in that case.

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

7 years agoclient: avoid possible NULL deref on error path
Andy Green [Mon, 12 Dec 2016 12:37:28 +0000 (20:37 +0800)]
client: avoid possible NULL deref on error path

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

7 years agoRFC7233 HTTP Ranges support for server
Andy Green [Mon, 12 Dec 2016 05:36:25 +0000 (13:36 +0800)]
RFC7233 HTTP Ranges support for server

This adds a serverside implementation of RFC7233 HTTP ranges.

 - LWS_WITH_RANGES is on by default at cmake

 - Accept-Ranges: bytes is added if LWS_WITH_RANGES is enabled

 - Both single ranges and multipart (2+) ranges are supported

Test with curl like this

Single

$ $ curl -s -r 64-95  http://localhost:7681/libwebsockets.org-logo.png  | hexdump -C
00000000  2e 01 fd 9d 12 27 00 00  00 19 74 45 58 74 53 6f  |.....'....tEXtSo|
00000010  66 74 77 61 72 65 00 77  77 77 2e 69 6e 6b 73 63  |ftware.www.inksc|

Multipart

$ curl -s -r 64-95,128-143  http://localhost:7681/libwebsockets.org-logo.png  | hexdump -C

00000000  5f 6c 77 73 0d 0a 43 6f  6e 74 65 6e 74 2d 54 79  |_lws..Content-Ty|
00000010  70 65 3a 20 69 6d 61 67  65 2f 70 6e 67 0d 0a 43  |pe: image/png..C|
00000020  6f 6e 74 65 6e 74 2d 52  61 6e 67 65 3a 20 62 79  |ontent-Range: by|
00000030  74 65 73 20 36 34 2d 39  35 2f 37 30 32 39 0d 0a  |tes 64-95/7029..|
00000040  0d 0a 2e 01 fd 9d 12 27  00 00 00 19 74 45 58 74  |.......'....tEXt|
00000050  53 6f 66 74 77 61 72 65  00 77 77 77 2e 69 6e 6b  |Software.www.ink|
00000060  73 63 5f 6c 77 73 0d 0a  43 6f 6e 74 65 6e 74 2d  |sc_lws..Content-|
00000070  54 79 70 65 3a 20 69 6d  61 67 65 2f 70 6e 67 0d  |Type: image/png.|
00000080  0a 43 6f 6e 74 65 6e 74  2d 52 61 6e 67 65 3a 20  |.Content-Range: |
00000090  62 79 74 65 73 20 31 32  38 2d 31 34 33 2f 37 30  |bytes 128-143/70|
000000a0  32 39 0d 0a 0d 0a 05 14  50 40 05 15 a5 c4 60 43  |29......P@....`C|
000000b0  91 c4 4a d4 c4 fc 5f 6c  77 73 0d 00              |..J..._lws..|

The corresponding header part is like this

0x0030:            4854 5450 2f31 2e31 2032 3036      HTTP/1.1.206
0x0040:  200d 0a73 6572 7665 723a 206c 7773 7773  ...server:.lwsws
0x0050:  0d0a 636f 6e74 656e 742d 7479 7065 3a20  ..content-type:.
0x0060:  6d75 6c74 6970 6172 742f 6279 7465 7261  multipart/bytera
0x0070:  6e67 6573 0d0a 6163 6365 7074 2d72 616e  nges..accept-ran
0x0080:  6765 733a 2062 7974 6573 0d0a 636f 6e74  ges:.bytes..cont
0x0090:  656e 742d 6c65 6e67 7468 3a20 3138 380d  ent-length:.188.
0x00a0:  0a63 6163 6865 2d63 6f6e 7472 6f6c 3a20  .cache-control:.
0x00b0:  7072 6976 6174 6520 6d61 782d 6167 653a  private.max-age:
0x00c0:  2036 300d 0a63 6f6e 6e65 6374 696f 6e3a  .60..connection:
0x00d0:  206b 6565 702d 616c 6976 650d 0a65 7461  .keep-alive..eta
0x00e0:  673a 2030 3030 3031 4237 3535 3444 3433  g:.00001B7554D43
0x00f0:  3033 330d 0a0d 0a                        033....

7 years agoclean: usused accidental global wsi
Andy Green [Thu, 8 Dec 2016 23:05:03 +0000 (07:05 +0800)]
clean: usused accidental global wsi

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

7 years agolwsgt: fix check against forgot password flow defeating existing pw check
Andy Green [Thu, 8 Dec 2016 09:32:08 +0000 (17:32 +0800)]
lwsgt: fix check against forgot password flow defeating existing pw check

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

This fixes a problem where the check for the existing pw was
skipped when a logged-in user is changing his password.

It's not good but because the user has to be logged in, it only affected
the situation someone changes his password on his logged in session.

7 years agotoken:x-forwarded-for
Andy Green [Thu, 8 Dec 2016 00:14:15 +0000 (08:14 +0800)]
token:x-forwarded-for

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

7 years agocontext: external_baggage_free_on_destroy
Andy Green [Sat, 3 Dec 2016 23:34:05 +0000 (07:34 +0800)]
context: external_baggage_free_on_destroy

This adds a context creation-time member that points to something
that should be freed when the context is destroyed.

It's in preparation for context deprecation, when a context might
be destroyed asynchronously... a related external with the
lifetime of thee context should also be freed at that time.

Adapt lwsws to use it with the context "strings" (also used for
aligned structs created by the config) allocation.

7 years agobasic-auth
Andy Green [Sat, 3 Dec 2016 07:13:15 +0000 (15:13 +0800)]
basic-auth

7 years agojust finalize startup once
Andy Green [Sat, 3 Dec 2016 07:23:00 +0000 (15:23 +0800)]
just finalize startup once

7 years agovhost: allow adding vhosts after server init
Bablooos [Tue, 29 Nov 2016 23:05:13 +0000 (07:05 +0800)]
vhost: allow adding vhosts after server init

This should allow adding vhosts "late", ie, after the server is up and
running with its initial vhost(s).  The necessary housekeeping is folded
into lws_create_vhost() itself so it should be transparent.

Notice though that at the point the server starts to do service after it
starts initially, if it was requested that the UID / GID change, that
is performed at that point and is not reversible.

So vhosts added "late" find themselves running under the unprivileged
UID / GID from the very start, whereas vhosts added "early" initially
run under the UID / GID the process started with.  If protocols the
vhost uses want to, eg, open privileged files at init and then use
them unprivileged, that will fail if the vhost is added late because
the initial privs are already gone.

AG: also deal with lws_protocol_init() on late vhost init (does the
callbacks for per vh protocol creation), add comments

7 years agoUpdate CMakeLists.txt for BSD + libdl
Bablooos [Tue, 29 Nov 2016 12:45:37 +0000 (20:45 +0800)]
Update CMakeLists.txt for BSD + libdl

Fixing build failure of libwebsockets-test-fraggle  on FreeBSD when LWS_WITH_PLUGINS.
Solution: FreeBSD has no libdl

7 years agogeneric-sessions: move auth level check to after mount protocol selection
Andy Green [Sat, 26 Nov 2016 12:46:04 +0000 (20:46 +0800)]
generic-sessions: move auth level check to after mount protocol selection

7 years agows-server: restrict returned Sec-Websocket-Protocol to the chosen name only
Andy Green [Sat, 26 Nov 2016 01:50:40 +0000 (09:50 +0800)]
ws-server: restrict returned Sec-Websocket-Protocol to the chosen name only

https://libwebsockets.org/pipermail/libwebsockets/2016-November/002948.html

Updated to fix a problem with no protocol

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

7 years agoserver: portable option for setsockopt
Iblis Lin [Wed, 23 Nov 2016 15:02:13 +0000 (23:02 +0800)]
server: portable option for setsockopt

From linux ipv6(7) manual (section `Note`):

        SOL_IP, SOL_IPV6, SOL_ICMPV6 and other SOL_* socket options are
        nonportable variants of IPPROTO_*.  See also ip(7).

Ref: http://man7.org/linux/man-pages/man7/ipv6.7.html

7 years agoclient stash: update path variable to larger size
sjames1958gm [Mon, 21 Nov 2016 15:23:17 +0000 (09:23 -0600)]
client stash: update path variable to larger size

7 years agolws_socket_bind: use lws_sockfd_type
Andy Green [Wed, 16 Nov 2016 00:59:47 +0000 (08:59 +0800)]
lws_socket_bind: use lws_sockfd_type

7 years agoclient: protect againt losing ah by lws_client_connect_2
Andy Green [Tue, 15 Nov 2016 08:33:18 +0000 (16:33 +0800)]
client: protect againt losing ah by lws_client_connect_2

7 years agopost file upload: dont lose sight of end of upload just because we hit end of incomin...
Andy Green [Mon, 14 Nov 2016 10:13:39 +0000 (18:13 +0800)]
post file upload: dont lose sight of end of upload just because we hit end of incoming post data

7 years agodocs update
Andy Green [Mon, 14 Nov 2016 10:12:31 +0000 (18:12 +0800)]
docs update

7 years agoAdded flag to allow expired certificates.
Joachim Bauch [Fri, 11 Nov 2016 11:19:53 +0000 (12:19 +0100)]
Added flag to allow expired certificates.

7 years agoBetter support for MINW32
Rainer Poisel [Mon, 7 Nov 2016 20:36:05 +0000 (21:36 +0100)]
Better support for MINW32

7 years agoFrom 7f84bc3e864b52eb13c670362a4b53bc3505393e Mon Sep 17 00:00:00 2001
Yannick Kiekens [Thu, 3 Nov 2016 09:03:18 +0000 (10:03 +0100)]
From 7f84bc3e864b52eb13c670362a4b53bc3505393e Mon Sep 17 00:00:00 2001
Subject: [PATCH] Fix typo in lws_create_context documentation

7 years agoclient: add lws_http_client_http_response api
Andy Green [Fri, 21 Oct 2016 15:12:21 +0000 (23:12 +0800)]
client: add lws_http_client_http_response api

7 years agoclient: treat 304 like 200
Andy Green [Fri, 21 Oct 2016 14:39:00 +0000 (22:39 +0800)]
client: treat 304 like 200

7 years agoalias lws_plat_service_tsi to lws_service_tsi in public api
Andy Green [Thu, 20 Oct 2016 01:09:56 +0000 (09:09 +0800)]
alias lws_plat_service_tsi to lws_service_tsi in public api

Via Dosvald

lws_service_tsi() which has been around a while actually just
calls through to lws_plat_service_tsi(), meaning there is no
need to expose both apis.

Rename the internal lws_plat_service_tsi() to _lws_plat_service_tsi()
and replace the api export with a #define to lws_service_tsi for
compatibility's sake.

8 years agoAdd reject service keywords list
Andy Green [Wed, 12 Oct 2016 22:32:57 +0000 (06:32 +0800)]
Add reject service keywords list

8 years agoadjust_timeout: with default lws_plat_service_tsi allow beings passed 0 timeout
Andy Green [Mon, 10 Oct 2016 12:34:34 +0000 (20:34 +0800)]
adjust_timeout: with default lws_plat_service_tsi allow beings passed 0 timeout

Some people are calling service with zero timeout, taking care of
not busywaiting by some other external arrangements.

Adapt the forced service signalling to survive this.