platform/upstream/libwebsockets.git
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.

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

7 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.

7 years agosome compilers need void param explicitly
Joerg Pommnitz [Mon, 10 Oct 2016 12:10:39 +0000 (20:10 +0800)]
some compilers need void param explicitly

7 years agoCorrect the library name of LIBHUBBUB_LIBRARIES
Yuchen Xie [Mon, 10 Oct 2016 12:10:34 +0000 (20:10 +0800)]
Correct the library name of LIBHUBBUB_LIBRARIES

It should be `hubbub` in `find_library` to make the function work.

7 years agodocs: explain lws_write handling of truncated sends better
Andy Green [Sat, 8 Oct 2016 10:08:03 +0000 (18:08 +0800)]
docs: explain lws_write handling of truncated sends better

7 years agopublicly document lws_service_fd timeout servicing
Denis Osvald [Fri, 7 Oct 2016 09:27:46 +0000 (11:27 +0200)]
publicly document lws_service_fd timeout servicing

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
7 years agotest-server-extpoll: add 1-per-second timeout servicing
Denis Osvald [Thu, 6 Oct 2016 13:45:25 +0000 (15:45 +0200)]
test-server-extpoll: add 1-per-second timeout servicing

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
7 years agotest-server-extpoll: check for forced service before looping again
Denis Osvald [Fri, 7 Oct 2016 08:57:02 +0000 (10:57 +0200)]
test-server-extpoll: check for forced service before looping again

Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
7 years agov2.1.0
Andy Green [Thu, 6 Oct 2016 13:48:20 +0000 (21:48 +0800)]
v2.1.0

Bump soname to 9

7 years agoextpoll: expose forced service apis
Andy Green [Thu, 6 Oct 2016 19:19:17 +0000 (03:19 +0800)]
extpoll: expose forced service apis

7 years agoupdate attack.sh
Andy Green [Thu, 6 Oct 2016 12:40:28 +0000 (20:40 +0800)]
update attack.sh

Lws cares about trailing \n on a lot of these tests now.  Make it check it still cares on one and remove
the trailing \n on the others.

There's 2 changes in the results about /..//?, it seems to apply / to uri arg 1.  But it doesn't seem
to make a problem so just adapt the results for now.

7 years agoubuntu: fix uv detection for lwsws
Andy Green [Wed, 5 Oct 2016 05:49:46 +0000 (13:49 +0800)]
ubuntu: fix uv detection for lwsws

7 years agotravis: explicitly point to openssl on osx
Andy Green [Wed, 5 Oct 2016 01:52:39 +0000 (09:52 +0800)]
travis: explicitly point to openssl on osx

One day this started failing at CMake autofind. This forces it to look at the right place.

7 years agofix cosmetic if end if name tag error
Andy Green [Wed, 5 Oct 2016 02:15:16 +0000 (10:15 +0800)]
fix cosmetic if end if name tag error

7 years agoclosing drops any pending ah rx immediately
Andy Green [Tue, 4 Oct 2016 10:05:10 +0000 (18:05 +0800)]
closing drops any pending ah rx immediately

7 years agoport forced service checking from libuv
Andy Green [Tue, 4 Oct 2016 00:39:14 +0000 (08:39 +0800)]
port forced service checking from libuv

Related to second part of

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

7 years agopost form parsing fix retry as new boundary start needed after mismatching boundary
Andy Green [Tue, 4 Oct 2016 00:24:00 +0000 (08:24 +0800)]
post form parsing fix retry as new boundary start needed after mismatching boundary

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

7 years agoRemove the cleanup functions with OpenSSL 1.1.
Peter Pentchev [Sat, 1 Oct 2016 23:21:20 +0000 (02:21 +0300)]
Remove the cleanup functions with OpenSSL 1.1.

The thread support in OpenSSL has been rewritten almost completely
and the cleanup functions are now executed automatically.

7 years agoSubject: Fix some typographical and grammatical errors.
Peter Pentchev [Sat, 1 Oct 2016 23:21:03 +0000 (02:21 +0300)]
Subject: Fix some typographical and grammatical errors.

7 years agolws_header_table_reset: make caller responsibility to clear down ah rx buffer
Andy Green [Thu, 29 Sep 2016 02:31:06 +0000 (10:31 +0800)]
lws_header_table_reset: make caller responsibility to clear down ah rx buffer

There are two kinds of reaason to call lws_header_table_reset(), one is we are reallocating
a destroyed ah to another wsi, and the other is we are moving to the next pipelined header set
still on the same wsi, and we need a "weaker" reset that only clears down the state related
to the header parsing, not everything about the ah context including the ah rx buffer.

This patch moves the ah rxbuffer rxpos and rxlen resetting out of lws_header_table_reset() and to
be the responsibility of the caller.  Callers who are moving the ah to another wsi are
patched to deal with resetting rxpos and rxlen and lws_http_transaction_completed() who only
resets the ah when moving to the next pipelined headers, no longer wrongly clears the ah rxbuf.

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

7 years agoAdded option to build the static library with PIC
Brown, Matthew [Mon, 26 Sep 2016 21:32:40 +0000 (05:32 +0800)]
Added option to build the static library with PIC

7 years agofix build problem on systems without X509_VERIFY_PARAM type
Benjamin Ness [Mon, 26 Sep 2016 19:18:16 +0000 (14:18 -0500)]
fix build problem on systems without X509_VERIFY_PARAM type

7 years agoAdd SVG to lws_get_mimetype()
Patrick Gansterer [Thu, 22 Sep 2016 22:04:40 +0000 (00:04 +0200)]
Add SVG to lws_get_mimetype()

7 years agolwsws license to cc0
Andy Green [Mon, 19 Sep 2016 11:16:47 +0000 (19:16 +0800)]
lwsws license to cc0

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

7 years agolws_snprintf
Andy Green [Wed, 14 Sep 2016 18:22:57 +0000 (02:22 +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:43:07 +0000 (04:43 +0800)]
handle rx flow control active when consuming payload

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

7 years agogeneric-table: format-security
Andy Green [Fri, 9 Sep 2016 20:27:27 +0000 (04:27 +0800)]
generic-table: format-security

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

7 years agolws_status protect against pss list changing
Andy Green [Fri, 9 Sep 2016 14:15:43 +0000 (22:15 +0800)]
lws_status protect against pss list changing

7 years agoadopt_socket_vhost: error path doesn't remove us from timeout list
Andy Green [Fri, 9 Sep 2016 00:29:32 +0000 (08:29 +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 agoDo not use ps fax on Solaris.
Fredrik Skogman [Thu, 8 Sep 2016 22:51:43 +0000 (06:51 +0800)]
Do not use ps fax on Solaris.

7 years agoUpdated test programs to build on Solaris. Some whitespaces cleanup.
Fredrik Skogman [Thu, 8 Sep 2016 22:50:41 +0000 (06:50 +0800)]
Updated test programs to build on Solaris. Some whitespaces cleanup.

7 years agoAdded build support for Solaris.
Fredrik Skogman [Thu, 8 Sep 2016 22:49:44 +0000 (06:49 +0800)]
Added build support for Solaris.

7 years agoCheck for sys/sockio.h.
Fredrik Skogman [Thu, 8 Sep 2016 22:48:24 +0000 (06:48 +0800)]
Check for sys/sockio.h.

7 years agoclient http: extra read notification after close
Andy Green [Tue, 6 Sep 2016 07:36:51 +0000 (15:36 +0800)]
client http: extra read notification after close

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

7 years agowindows: WCHAR in lws_plat_inet_ntop needs double the final allocation
Andy Green [Mon, 5 Sep 2016 07:03:37 +0000 (15:03 +0800)]
windows: WCHAR in lws_plat_inet_ntop needs double the final allocation

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

7 years agocoverity 169276-9 - false positive assuming 8b char: char limits index size
Andy Green [Sun, 28 Aug 2016 01:39:21 +0000 (09:39 +0800)]
coverity 169276-9 - false positive assuming 8b char: char limits index size

7 years agocoverity 169274 - lwsgt dirlisting ignore files that cant be statted
Andy Green [Sun, 28 Aug 2016 01:34:27 +0000 (09:34 +0800)]
coverity 169274 - lwsgt dirlisting ignore files that cant be statted

7 years agocoverity 169273 - off-by-one on cgi chunking swallow limit
Andy Green [Sun, 28 Aug 2016 01:28:55 +0000 (09:28 +0800)]
coverity 169273 - off-by-one on cgi chunking swallow limit

7 years agocoverity 169272 - off-by-one possible on CGI buffer limit
Andy Green [Sun, 28 Aug 2016 01:24:06 +0000 (09:24 +0800)]
coverity 169272 - off-by-one possible on CGI buffer limit

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

7 years agocoverity 169269 - dont issue NULL cce
Andy Green [Sun, 28 Aug 2016 01:18:17 +0000 (09:18 +0800)]
coverity 169269 - dont issue NULL cce

7 years agocoverity 169268 + 169270- dead code plus repeat NULL check on error path
Andy Green [Sun, 28 Aug 2016 01:15:26 +0000 (09:15 +0800)]
coverity 169268 + 169270- dead code plus repeat NULL check on error path

7 years agocoverity 169275 - lwsgt check string bounds
Andy Green [Sun, 28 Aug 2016 01:12:39 +0000 (09:12 +0800)]
coverity 169275 - lwsgt check string bounds

7 years agocoverity 169267 - lwsgt strncpy may fill buffer without NUL
Andy Green [Sun, 28 Aug 2016 01:10:40 +0000 (09:10 +0800)]
coverity 169267 - lwsgt strncpy may fill buffer without NUL

7 years agoper-vhost headers and lwsws conf support
Andy Green [Sat, 27 Aug 2016 09:07:06 +0000 (17:07 +0800)]
per-vhost headers and lwsws conf support

This l;ets you add per-vhost arbitrary headers on served files, eg

     "headers": [{
        "X-Content-Type-Options": "nosniff",
        "X-XSS-Protection": "1; mode=block",
        "x-frame-options": "SAMEORIGIN"
        }],

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 agoRemove 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 agotest html: js date uses ms
Andy Green [Tue, 23 Aug 2016 10:29:17 +0000 (18:29 +0800)]
test html: js date uses ms

7 years agocgi-retain-timeout-after-POST-send
Andy Green [Tue, 23 Aug 2016 06:20:11 +0000 (14:20 +0800)]
cgi-retain-timeout-after-POST-send

Sending the POST data isn't enough to let us off the hook for timeout checks, if we
are doing a CGI on it.

7 years agoquench logging
Andy Green [Sun, 21 Aug 2016 23:07:10 +0000 (07:07 +0800)]
quench logging

7 years agocgi: deal with all methods correctly
Andy Green [Fri, 19 Aug 2016 22:34:46 +0000 (06:34 +0800)]
cgi: deal with all methods correctly

7 years agouv: dont handle SIGSEGV, SIGFPE
Andy Green [Fri, 19 Aug 2016 21:47:29 +0000 (05:47 +0800)]
uv: dont handle SIGSEGV, SIGFPE

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

7 years agoRemove context from lws_context_per_thread for non-libuv builds
Patrick Gansterer [Sun, 14 Aug 2016 12:04:56 +0000 (14:04 +0200)]
Remove context from lws_context_per_thread for non-libuv builds

The variable is never read when built without libuv.

7 years agoAdd error handling for SSL_new() of clients
Patrick Gansterer [Sun, 14 Aug 2016 10:51:15 +0000 (12:51 +0200)]
Add error handling for SSL_new() of clients

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

7 years agoFix signature of lws_create_vhost() in README.coding.md
Patrick Gansterer [Sun, 14 Aug 2016 10:38:03 +0000 (12:38 +0200)]
Fix signature of lws_create_vhost() in README.coding.md

7 years agoAllow serving files without known mimetype
Patrick Gansterer [Sat, 13 Aug 2016 09:17:53 +0000 (11:17 +0200)]
Allow serving files without known mimetype

RFC2616 only says that any HTTP/1.1 message containing an entity-body
SHOULD include a Content-Type header field defining the media type of
that body.
RFC2119 defines SHOULD as: This word mean that there may exist valid
reasons in particular circumstances to ignore a particular item, but
the full implications must be understood and carefully weighed before
choosing a different course.

AG: this isn't an oversight, it's paranoia about sending out /etc/passwd
or /etc/shadow accidentally.

I agree it should be allowed if people really want to override it.  But
the default should remain like it is I think.

I adapted the patch to allow the extra mimetype "*": "" to be declared on
a mount, as a wildcard match that serves the file without a Content-Type.

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

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

7 years agoclient-add-PUSH-http-body-capability
Andy Green [Mon, 8 Aug 2016 13:54:30 +0000 (21:54 +0800)]
client-add-PUSH-http-body-capability

Support HTTP body sending on client connections.

Add demo to test-client.

Run the normal test server, then

$ libwebsockets-test-client http://localhost:7681/formtest -o

It will post the string "hello" to the POST test using application/x-www-form-urlencoded

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

Also ensures any of the Client HTTP transient modes will call back LWS_CALLBACK_CLOSED_CLIENT_HTTP
if they close

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

7 years agoclient fixups after esp8266
Andy Green [Sun, 7 Aug 2016 00:33:08 +0000 (08:33 +0800)]
client fixups after esp8266

7 years agoesp8266 initial support
Andy Green [Sat, 23 Jul 2016 06:18:25 +0000 (14:18 +0800)]
esp8266 initial support

7 years agobase64 decode fix lengths
Andy Green [Wed, 3 Aug 2016 19:18:36 +0000 (03:18 +0800)]
base64 decode fix lengths

7 years agoah detach: don't print held time if actually detached
Andy Green [Tue, 19 Jul 2016 01:38:48 +0000 (09:38 +0800)]
ah detach: don't print held time if actually detached

Confusingly an ah held time was printed for a previously detached ah.

Clear down the time field when detaching the ah so this can't happen any more.

7 years agows ping pong on idle connections
Andy Green [Fri, 15 Jul 2016 05:41:38 +0000 (13:41 +0800)]
ws ping pong on idle connections

This adds a new member to the context creation info struct "ws_ping_pong_interval".

If nonzero, it sets the number of seconds that established ws connections are
allowed to be idle before a PING is forced to be sent.  If zero (the default) then
tracking of idle connection is disabled for backwards compatibility.

Timeouts cover both the period between decision to send the ping and it being
sent (because it needs the socket to become writeable), and the period between
the ping being sent and the PONG coming back.

INFO debug logs are issues when the timeout stuff is operating.

You can test the server side by running the test server hacked to set ws_ping_pong_interval
and debug log mask of 15.  Both the mirror protocol and the server-status protocol are
idle if nothing is happening and will trigger the PING / PONG testing.  (You can also
test using lwsws and /etc/lwsws/conf with "ws-pingpong-secs": "20" in the global section)

For client, run the test client with -n -P 20 for 20s interval.  -n stops the test client
writing using the mirror protocol, so it will be idle and trigger the PING / PONGs.

The timeout interval may be up to +10s late, as lws checks for affected connections every
10s.

7 years agoPlugin server-status cleanup
Andy Green [Wed, 13 Jul 2016 03:35:16 +0000 (11:35 +0800)]
Plugin server-status cleanup

7 years agoplugins-dim-webpage-when-connection-lost
Andy Green [Wed, 13 Jul 2016 00:45:22 +0000 (08:45 +0800)]
plugins-dim-webpage-when-connection-lost

7 years agoplugin table dirlisting
Andy Green [Sat, 25 Jun 2016 22:29:20 +0000 (06:29 +0800)]
plugin table dirlisting

7 years agodoxygen use sections
Andy Green [Wed, 13 Jul 2016 00:14:57 +0000 (08:14 +0800)]
doxygen use sections

7 years agoRecheck slot when an FD gets closed and make formatting consistent
Mike Messina [Mon, 11 Jul 2016 13:17:48 +0000 (21:17 +0800)]
Recheck slot when an FD gets closed and make formatting consistent

7 years agoUse one event for all sockets to avoid 64 limit and fix the single dispatch issue
mmessina [Mon, 11 Jul 2016 13:17:21 +0000 (21:17 +0800)]
Use one event for all sockets to avoid 64 limit and fix the single dispatch issue

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

7 years agoah change default header len to 4096 and pool size 4
Andy Green [Sun, 10 Jul 2016 23:48:53 +0000 (07:48 +0800)]
ah change default header len to 4096 and pool size 4

Users are starting to appear with clients sending more than the default max header
content buffer of 1024... with the advent of the ah pool the old reasons for keeping this
modest no longer apply, so up it to 4096 and reduce the default pool size to 4 from 16 to
keep the overall memory usage the same.

7 years agoEXTPOLL export LWS_POLLXXX and document .events must be .revents
Andy Green [Sun, 10 Jul 2016 23:28:23 +0000 (07:28 +0800)]
EXTPOLL export LWS_POLLXXX and document .events must be .revents

7 years agoclient ssl add flag to control server cert hostname check
Andy Green [Thu, 7 Jul 2016 00:14:26 +0000 (08:14 +0800)]
client ssl add flag to control server cert hostname check