platform/upstream/libwebsockets.git
7 years agolws_remove_child_from_any_parent: clear parent pointer and fix failure message
Andy Green [Thu, 30 Mar 2017 00:31:36 +0000 (08:31 +0800)]
lws_remove_child_from_any_parent: clear parent pointer and fix failure message

7 years agoev: stop event listeners during context destroy
Olivier Basson [Wed, 29 Mar 2017 00:20:42 +0000 (08:20 +0800)]
ev: stop event listeners during context destroy

I think I've found a bug in libev backend, in function lws_libev_io(). I'm using latest version from master branch.

When deleting a context with active connections via lws_context_destroy(), context->being_destroyed is set to 1 early in the function, before the loop calling lws_close_free_wsi() on each active connection.
lws_close_free_wsi() calls remove_wsi_socket_from_fds(), which calls lws_libev_io(), and here is my problem :

lws_libev_io() returns without doing anything if context->being_destroyed is set, so libev callbacks for deleted connections file descriptors stay registered after context is destroyed, which may lead to segfault/undefined behaviour if these file descriptors get reused later (which would trigger the callbacks).

I think the "if (!pt->io_loop_ev || context->being_destroyed) return;" statement should be replaced with " if (!pt->io_loop_ev) return;"

This fixes the problem for me and I have not seen any side effect yet. Moreover, libuv backend does not have such a test.

7 years agoservice: always restrict rx to serve_buf_size
Andy Green [Tue, 28 Mar 2017 00:51:37 +0000 (08:51 +0800)]
service: always restrict rx to serve_buf_size

7 years agopmd: handle case we are already on drain list
Andy Green [Sun, 26 Mar 2017 02:08:35 +0000 (10:08 +0800)]
pmd: handle case we are already on drain list

Provide internal helper for adding to list that takes care of the
case we are already on the list.

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

7 years agopmd: align client rx sm with server one
Andy Green [Sat, 25 Mar 2017 00:42:35 +0000 (08:42 +0800)]
pmd: align client rx sm with server one

7 years agoclient: zero length read indicates peer shutdown
Andy Green [Sat, 25 Mar 2017 00:47:06 +0000 (08:47 +0800)]
client: zero length read indicates peer shutdown

7 years agosolaris: handle big-endian
luk65 [Thu, 23 Mar 2017 15:56:25 +0000 (23:56 +0800)]
solaris: handle big-endian

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

7 years agospa: reject junk after finalization
Andy Green [Thu, 23 Mar 2017 11:30:12 +0000 (19:30 +0800)]
spa: reject junk after finalization

7 years agotest-server-v2.0: disable setting default protocol
Andy Green [Wed, 22 Mar 2017 13:18:48 +0000 (21:18 +0800)]
test-server-v2.0: disable setting default protocol

7 years agodebug: reduce spew for debug log level
Andy Green [Wed, 22 Mar 2017 13:16:00 +0000 (21:16 +0800)]
debug: reduce spew for debug log level

7 years agocgi: avoid spin on php
Andy Green [Wed, 22 Mar 2017 12:15:01 +0000 (20:15 +0800)]
cgi: avoid spin on php

7 years agoSubject: Libevent: Initial Support
Aditya Tirumala [Wed, 15 Mar 2017 14:11:11 +0000 (19:41 +0530)]
Subject: Libevent: Initial Support

* Added libevent support functionality into lib/libevent.c
* Added test-server-libevent for testing

7 years agotest-server-v2.0: add string.h include
Andy Green [Tue, 21 Mar 2017 21:29:22 +0000 (05:29 +0800)]
test-server-v2.0: add string.h include

via Joel Winarske on ml

7 years agoCMake: add option to avoid GISPIPE IGN for Android 7+
Andy Green [Tue, 21 Mar 2017 03:34:49 +0000 (11:34 +0800)]
CMake: add option to avoid GISPIPE IGN for Android 7+

7 years agoext: pmd: improve dealing with partial input usage with drain
Andy Green [Mon, 20 Mar 2017 11:07:19 +0000 (19:07 +0800)]
ext: pmd: improve dealing with partial input usage with drain

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

7 years agorpm: added missing file to %files section of spec file
Steffen Vogel [Sat, 18 Mar 2017 03:06:37 +0000 (00:06 -0300)]
rpm: added missing file to %files section of spec file

7 years agowindows: cannot use fstat
Andy Green [Fri, 17 Mar 2017 03:43:45 +0000 (11:43 +0800)]
windows: cannot use fstat

7 years agodocs: lws_callback_all_protocol: fix cut-n-paste error and explain it is probably...
Andy Green [Tue, 14 Mar 2017 23:28:51 +0000 (07:28 +0800)]
docs: lws_callback_all_protocol: fix cut-n-paste error and explain it is probably not what you want

7 years agowindows: don't use LWS_EXTERN outside of function declarations
Andy Green [Tue, 14 Mar 2017 23:25:36 +0000 (07:25 +0800)]
windows: don't use LWS_EXTERN outside of function declarations

7 years agoesp32: openssl
Andy Green [Sat, 11 Mar 2017 03:51:06 +0000 (11:51 +0800)]
esp32: openssl

7 years agoesp32: move helper code into lws
Andy Green [Fri, 10 Mar 2017 06:29:21 +0000 (14:29 +0800)]
esp32: move helper code into lws

7 years agossl: close sometimes continuously asserting POLLIN until timeout
Silas Parker [Thu, 9 Mar 2017 23:46:05 +0000 (07:46 +0800)]
ssl: close sometimes continuously asserting POLLIN until timeout

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

7 years agofops_zip: require libz
Silas Parker [Thu, 9 Mar 2017 11:21:40 +0000 (19:21 +0800)]
fops_zip: require libz

7 years agogcc-format-strings: 32-bit build
Silas Parker [Thu, 9 Mar 2017 10:52:10 +0000 (18:52 +0800)]
gcc-format-strings: 32-bit build

7 years agohttp2: fix log compile errors
honjane [Thu, 9 Mar 2017 05:17:07 +0000 (13:17 +0800)]
http2: fix log compile errors

7 years agov2.2.0
Andy Green [Mon, 6 Mar 2017 07:35:45 +0000 (15:35 +0800)]
v2.2.0

7 years agocoverity 177526: pointer difference already scaled
Andy Green [Wed, 8 Mar 2017 06:10:31 +0000 (14:10 +0800)]
coverity 177526: pointer difference already scaled

7 years agoesp32: align fops member name defines
Andy Green [Wed, 8 Mar 2017 03:11:41 +0000 (11:11 +0800)]
esp32: align fops member name defines

7 years agoreduce log spew on POST processing
Andy Green [Wed, 8 Mar 2017 02:52:49 +0000 (10:52 +0800)]
reduce log spew on POST processing

7 years agoserver-name: add_server_header add LWSAHH_FLAG_NO_SERVER_NAME
Andy Green [Tue, 7 Mar 2017 23:51:47 +0000 (07:51 +0800)]
server-name: add_server_header add LWSAHH_FLAG_NO_SERVER_NAME

Also clean up usage of status code defines in lws

7 years agoserver-name: default to no server name unless set in context
Andy Green [Tue, 7 Mar 2017 23:35:27 +0000 (07:35 +0800)]
server-name: default to no server name unless set in context

7 years agoraw: enable server and client raw sockets
Andy Green [Tue, 7 Mar 2017 08:06:05 +0000 (16:06 +0800)]
raw: enable server and client raw sockets

7 years agoext: use arguments and reply with them
Andy Green [Tue, 7 Mar 2017 02:07:37 +0000 (10:07 +0800)]
ext: use arguments and reply with them

7 years agocoverity 177409: dont bother assigning ignored second SSL_shutdown return value
Andy Green [Mon, 6 Mar 2017 06:01:46 +0000 (14:01 +0800)]
coverity 177409: dont bother assigning ignored second SSL_shutdown return value

No security impact

7 years agocoverity 177410: check seek return value inside fops-zip
Andy Green [Mon, 6 Mar 2017 05:59:27 +0000 (13:59 +0800)]
coverity 177410: check seek return value inside fops-zip

Truncated or corrupted zip on server side would read garbage instead of fail.

7 years agotest-client: only take data from LWS_CALLBACK_RECEIVE_CLIENT_HTTP
Andy Green [Mon, 6 Mar 2017 04:42:08 +0000 (12:42 +0800)]
test-client: only take data from LWS_CALLBACK_RECEIVE_CLIENT_HTTP

7 years agofops-zip
Andy Green [Fri, 3 Mar 2017 04:38:10 +0000 (12:38 +0800)]
fops-zip

7 years agorx flow: handle child state change during parent cb
Andy Green [Sun, 5 Mar 2017 07:32:47 +0000 (15:32 +0800)]
rx flow: handle child state change during parent cb

7 years agojunzip: style and migrate header into private-libwebsockets.h
Andy Green [Fri, 3 Mar 2017 01:19:14 +0000 (09:19 +0800)]
junzip: style and migrate header into private-libwebsockets.h

Also introduce CMake LWS_WITH_ZIP_FOPS defaulting to ON that builds junzip.c and
make sure this is exported in lws_config.h (included by libwebsockets.h)

Improve lws handling of stdint.h import or simulate it.

7 years agojunzip: import from DomTerm 912add15f3d0aec
Andy Green [Fri, 3 Mar 2017 00:44:04 +0000 (08:44 +0800)]
junzip: import from DomTerm 912add15f3d0aec

From https://github.com/PerBothner/DomTerm.git

7 years agoev: fix build
Andy Green [Fri, 3 Mar 2017 00:18:16 +0000 (08:18 +0800)]
ev: fix build

7 years agoadopt: allow binding to parent at same time
Per Bothner [Thu, 2 Mar 2017 23:36:08 +0000 (07:36 +0800)]
adopt: allow binding to parent at same time

 - if protocol set, allocate own user_space

   If the child wsi wants the parent wsi user_space, it can use

       lws_wsi_user(lws_get_parent(child_wsi))

 - raw file close processing handles parent-child relationship

7 years agoSubject: Buffer index protection in the case where client does not
Michael Behrns-Miller [case-ubuntu] [Thu, 2 Mar 2017 14:46:41 +0000 (09:46 -0500)]
Subject: Buffer index protection in the case where client does not
 receive content length from HTTP server

7 years agodocs: mac: add info from github
Whisperbyte [Wed, 1 Mar 2017 09:57:38 +0000 (17:57 +0800)]
docs: mac: add info from github

7 years agofops: allow setting from context creation and introduce lws_select_fops_by_vfs_path
Andy Green [Wed, 1 Mar 2017 06:28:56 +0000 (14:28 +0800)]
fops: allow setting from context creation and introduce lws_select_fops_by_vfs_path

1) There's now a .fops pointer that can be set in the context creation info.  If set, the array of
fops it points to (terminated by an entry with .open = NULL) is walked to find out the best vfs filesystem
path match (comparing the vfs path to fops.path_prefix) for which fops to use.

If none given (.fops is NULL in info) then behaviour is as before, fops are the platform-provided one only.

2) The built in fileserving now walks any array of fops looking for the best fops match automatically.

3) lws_plat_file_... apis are renamed to lws_vfs_file_...

7 years agoadoption: make union for socket and file fds
Andy Green [Mon, 27 Feb 2017 04:55:56 +0000 (12:55 +0800)]
adoption: make union for socket and file fds

This lets lws support adopting raw file FDs and raw socket fds.

A test plugin creates a FIFO and prints data sent on it, using
the lws event loop.

7 years agofops: add path_prefix member
Andy Green [Wed, 1 Mar 2017 00:56:25 +0000 (08:56 +0800)]
fops: add path_prefix member

7 years agoclient: allow change externally-defined wsi user_data
Lukas Geyer [Tue, 28 Feb 2017 13:17:25 +0000 (21:17 +0800)]
client: allow change externally-defined wsi user_data

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

AG: add explanation in doxygen comment and check user_space was externally set

7 years agodocs: remove in-tree version
Andy Green [Mon, 27 Feb 2017 04:54:58 +0000 (12:54 +0800)]
docs: remove in-tree version

It's a nice idea having them in-tree, but it leaves too much jumk
in the patches.

The up-to-date api for master will continue to be here

https://libwebsockets.org/lws-api-doc-master/html/index.html

7 years agocosmetic fix trailing newline on log
Silas Parker [Tue, 28 Feb 2017 10:29:57 +0000 (18:29 +0800)]
cosmetic fix trailing newline on log

7 years agocmake: create build/include
Andy Green [Mon, 27 Feb 2017 23:51:56 +0000 (07:51 +0800)]
cmake: create build/include

7 years agoclient: take care of rx close during pending partial same as server does
Andy Green [Mon, 27 Feb 2017 20:03:26 +0000 (04:03 +0800)]
client: take care of rx close during pending partial same as server does

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

7 years agofops: refactor around lws_fops_fd_t
Andy Green [Sat, 25 Feb 2017 04:42:45 +0000 (12:42 +0800)]
fops: refactor around lws_fops_fd_t

7 years agossl: avoid EVP errors
Namowen [Sat, 25 Feb 2017 20:24:40 +0000 (04:24 +0800)]
ssl: avoid EVP errors

7 years agoPrevent SSL downgrade during redirect
Silas Parker [Wed, 22 Feb 2017 11:25:47 +0000 (11:25 +0000)]
Prevent SSL downgrade during redirect

7 years agoAdd client support for relative reference redirects
Silas Parker [Wed, 22 Feb 2017 09:25:24 +0000 (09:25 +0000)]
Add client support for relative reference redirects

7 years agodocs: catch up with decruft
Andy Green [Wed, 22 Feb 2017 02:26:42 +0000 (10:26 +0800)]
docs: catch up with decruft

7 years agombedtls: remove abortive attempt to avoid confusing people
Andy Green [Wed, 22 Feb 2017 01:54:47 +0000 (09:54 +0800)]
mbedtls: remove abortive attempt to avoid confusing people

Basically we support openssl api compatibles only.

If we ever try something different we need a shim making it openssl api or a proper abstraction layer added first.

7 years agombed3: sayonara
Andy Green [Wed, 22 Feb 2017 01:50:11 +0000 (09:50 +0800)]
mbed3: sayonara

The port was technically worthwhile and laid the groundwork for ESP support.

But now it is just useless cruft like mbed3 itself...

7 years agoclient: allow setting client ssl certs from lwsws and connection info separate from...
Joel Winarske [Tue, 21 Feb 2017 23:28:13 +0000 (07:28 +0800)]
client: allow setting client ssl certs from lwsws and connection info separate from server ssl certs

7 years agossl config for http client
Joel Winarske [Tue, 21 Feb 2017 04:53:58 +0000 (20:53 -0800)]
ssl config for http client

7 years agogcc format strings: couple more
Martin Milata [Tue, 21 Feb 2017 22:39:59 +0000 (23:39 +0100)]
gcc format strings: couple more

Found on MIPS

7 years agoclient: move redirects and c_port out of union
Andy Green [Tue, 21 Feb 2017 22:55:12 +0000 (06:55 +0800)]
client: move redirects and c_port out of union

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

7 years agoclient connect: oom4 clean up timeout list
Andy Green [Tue, 21 Feb 2017 15:38:40 +0000 (23:38 +0800)]
client connect: oom4 clean up timeout list

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

7 years agoclient redirect: choose correct error path after resetting client connection
Andy Green [Tue, 21 Feb 2017 14:59:00 +0000 (22:59 +0800)]
client redirect: choose correct error path after resetting client connection

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

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