platform/upstream/libwebsockets.git
8 years agoclient accept connection request even if no free ah
Andy Green [Mon, 29 Feb 2016 06:19:16 +0000 (14:19 +0800)]
client accept connection request even if no free ah

It can join the free ah list and pick up client connect processing
later when the ah becomes available; this simplifies the code
doing the request since he won't have to deal with unexpected
failures / retries based on dynamic ah availability.

To do this though we have to handle that the connect_info members
may not have scope that lets them still exist after we return from
the first connect call, we stash them in a malloc'd buffer so the
connect processing can have them much later even so.

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agorelease checklist ab
Andy Green [Mon, 29 Feb 2016 03:26:13 +0000 (11:26 +0800)]
release checklist ab

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoadopt readbuf do service
Andy Green [Sat, 27 Feb 2016 03:42:22 +0000 (11:42 +0800)]
adopt readbuf do service

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolibuv when in use skip shutdown close phase
Andy Green [Mon, 29 Feb 2016 02:34:29 +0000 (10:34 +0800)]
libuv when in use skip shutdown close phase

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agowindows listen for pollhup
Andy Green [Mon, 29 Feb 2016 02:10:42 +0000 (10:10 +0800)]
windows listen for pollhup

After Ondraco

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

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoah move more_rx_waiting to wsi scope
Andy Green [Sun, 28 Feb 2016 02:55:31 +0000 (10:55 +0800)]
ah move more_rx_waiting to wsi scope

Originally this was alright in wsi->u.hdr, because ah implied header
processing.  But since we allowed ah to be held across http
keep-alive transactions if we saw we had more header data, it means
we were trying to read this union member out of scope after it had
transitioned.

Moving the more_rx_waiting member to be a 1-bit bifield in the wsi
solves it and lets us check the state any time later at http
transaction completion.

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

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotest server libuv support status protocol
Andy Green [Sat, 27 Feb 2016 05:17:26 +0000 (13:17 +0800)]
test server libuv support status protocol

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolibuv create 1Hz background timeout check
Andy Green [Sat, 27 Feb 2016 03:03:27 +0000 (11:03 +0800)]
libuv create 1Hz background timeout check

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoDon't include <sys/cdefs.h> for NetBSD
Kamil Rytarowski [Sat, 27 Feb 2016 02:18:43 +0000 (03:18 +0100)]
Don't include <sys/cdefs.h> for NetBSD

We needed it for the BSD symbol to be defined, while __NetBSD__ is defined
with a compiler.

Thanks Andy Green for the initial fix.

Signed-off-by: Kamil Rytarowski <n54@gmx.com>
8 years agonetbsd netinet include
Andy Green [Sat, 27 Feb 2016 01:34:28 +0000 (09:34 +0800)]
netbsd netinet include

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoforce service properly when unconsumed rxbuf in ah
Andy Green [Fri, 26 Feb 2016 02:48:51 +0000 (10:48 +0800)]
force service properly when unconsumed rxbuf in ah

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoadopt readbuf fix no ah path
Andy Green [Fri, 26 Feb 2016 01:22:29 +0000 (09:22 +0800)]
adopt readbuf fix no ah path

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoclose wsi must do detatch ah flow even if no ah
Andy Green [Thu, 25 Feb 2016 13:50:49 +0000 (21:50 +0800)]
close wsi must do detatch ah flow even if no ah

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoimprove timeout and ah list comments
Andy Green [Thu, 25 Feb 2016 13:39:01 +0000 (21:39 +0800)]
improve timeout and ah list comments

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoremove ah scan
Andy Green [Thu, 25 Feb 2016 13:43:09 +0000 (21:43 +0800)]
remove ah scan

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agofix missing callback return check
Andy Green [Thu, 25 Feb 2016 12:27:10 +0000 (20:27 +0800)]
fix missing callback return check

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agounix privs change group before user
Andy Green [Thu, 25 Feb 2016 07:12:16 +0000 (15:12 +0800)]
unix privs change group before user

Otherwise we no longer have privs to change the group after doing the user

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotest server log LWS_CALLBACK_HTTP
Andy Green [Thu, 25 Feb 2016 07:06:37 +0000 (15:06 +0800)]
test server log LWS_CALLBACK_HTTP

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agologging timestamp creation expose as api
Andy Green [Thu, 25 Feb 2016 07:01:55 +0000 (15:01 +0800)]
logging timestamp creation expose as api

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agocgi
Andy Green [Sun, 21 Feb 2016 13:25:48 +0000 (21:25 +0800)]
cgi

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agouser code must explicitly complete http transaction
Andy Green [Wed, 24 Feb 2016 12:58:19 +0000 (20:58 +0800)]
user code must explicitly complete http transaction

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agodefeat POLLOUT if socket in shutdown wait
Andy Green [Wed, 24 Feb 2016 13:27:46 +0000 (21:27 +0800)]
defeat POLLOUT if socket in shutdown wait

After andrejs.hanins@ubnt.com

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoadopt variant with preamble rx
Andy Green [Wed, 24 Feb 2016 03:05:56 +0000 (11:05 +0800)]
adopt variant with preamble rx

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agows union member must have actual struct at start not pointer
Andy Green [Wed, 24 Feb 2016 04:40:21 +0000 (12:40 +0800)]
ws union member must have actual struct at start not pointer

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoclient callback closed if not upgraded also for server connection
Andrejs Hanins [Wed, 24 Feb 2016 10:54:37 +0000 (12:54 +0200)]
client callback closed if not upgraded also for server connection

https://github.com/warmcat/libwebsockets/issues/437
https://github.com/warmcat/libwebsockets/pull/440

8 years agoclient connect must init position_in_fds_table
Andrejs Hanins [Mon, 22 Feb 2016 15:32:52 +0000 (23:32 +0800)]
client connect must init position_in_fds_table

8 years agowindows doesnt have localtime_r
Andy Green [Sun, 21 Feb 2016 13:36:48 +0000 (21:36 +0800)]
windows doesnt have localtime_r

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotest server status no ssl include time header
Andy Green [Sun, 21 Feb 2016 07:13:15 +0000 (15:13 +0800)]
test server status no ssl include time header

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotest server add lws_status
Andy Green [Sat, 20 Feb 2016 06:05:55 +0000 (14:05 +0800)]
test server add lws_status

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoLWS_BUILD_HASH improve
Andy Green [Sat, 20 Feb 2016 06:07:09 +0000 (14:07 +0800)]
LWS_BUILD_HASH improve

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotest html add tabs
Andy Green [Fri, 19 Feb 2016 23:52:35 +0000 (07:52 +0800)]
test html add tabs

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolibwebsockets.org url updates
Andy Green [Sun, 21 Feb 2016 02:42:46 +0000 (10:42 +0800)]
libwebsockets.org url updates

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolwsl stderr sink use formatted time
Sebastian Reimer [Sat, 20 Feb 2016 23:42:49 +0000 (07:42 +0800)]
lwsl stderr sink use formatted time

AG change to use localtime_r for threadsafety and leave old method as fallback

8 years agossl get rid of build_cert_chain
Andy Green [Sat, 20 Feb 2016 23:08:28 +0000 (07:08 +0800)]
ssl get rid of build_cert_chain

It's not supported on major distro SSL (Fedora is 1.1) and
libressl (on 2.x) doesn't have it either.

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

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoStop uv loop in default signal handler, clean-ups
Alex Hultman [Sat, 20 Feb 2016 15:01:12 +0000 (16:01 +0100)]
Stop uv loop in default signal handler, clean-ups

8 years agoMake sure every handle is closed before destroying the uv loop
Alex Hultman [Sat, 20 Feb 2016 14:32:57 +0000 (15:32 +0100)]
Make sure every handle is closed before destroying the uv loop

8 years agoDon't destroy ev/uv loops if they haven't been created yet
Alex Hultman [Sat, 20 Feb 2016 10:58:49 +0000 (11:58 +0100)]
Don't destroy ev/uv loops if they haven't been created yet

8 years agochangelog sync
Andy Green [Sat, 20 Feb 2016 01:12:52 +0000 (09:12 +0800)]
changelog sync

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoattack.sh add check for nonexistant file processing
Andy Green [Sat, 20 Feb 2016 00:12:31 +0000 (08:12 +0800)]
attack.sh add check for nonexistant file processing

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolws_return_http_status send content length
Andy Green [Fri, 19 Feb 2016 23:53:24 +0000 (07:53 +0800)]
lws_return_http_status send content length

If we're sending content, we must do so with a
content-length on http/1.1

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotest server example systemd service file
Andy Green [Fri, 19 Feb 2016 04:46:36 +0000 (12:46 +0800)]
test server example systemd service file

Make sure you have daemonization enabled to use this

make .. -DLWS_WITHOUT_DAEMONIZE=0

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agodaemonize work under systemd
Andy Green [Fri, 19 Feb 2016 04:44:59 +0000 (12:44 +0800)]
daemonize work under systemd

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoah pool lifetime use dynamic rxpos
Andy Green [Fri, 19 Feb 2016 03:47:52 +0000 (11:47 +0800)]
ah pool lifetime use dynamic rxpos

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotest server allow set uid gid from cmdline
Andy Green [Fri, 19 Feb 2016 03:15:10 +0000 (11:15 +0800)]
test server allow set uid gid from cmdline

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agowindows plat correct assert test in lws_poll_listen_fd
Andy Green [Thu, 18 Feb 2016 13:01:27 +0000 (21:01 +0800)]
windows plat correct assert test in lws_poll_listen_fd

After https://github.com/warmcat/libwebsockets/issues/430

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agocontext creation info add ecdh_curve
Andy Green [Thu, 18 Feb 2016 12:36:55 +0000 (20:36 +0800)]
context creation info add ecdh_curve

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotest server SSL STS header delivery example
Andy Green [Thu, 18 Feb 2016 12:36:40 +0000 (20:36 +0800)]
test server SSL STS header delivery example

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotest server allow only best quality ciphers
Andy Green [Thu, 18 Feb 2016 12:36:23 +0000 (20:36 +0800)]
test server allow only best quality ciphers

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agossl add server ecdh curve init
Andy Green [Thu, 18 Feb 2016 12:36:09 +0000 (20:36 +0800)]
ssl add server ecdh curve init

Using "real" SSL certs requires some init for openssl ECDH
curve.  Add a default curve "prime256v1" and allow overriding it
at context creation time.

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotest server allow external certs
Andy Green [Wed, 17 Feb 2016 03:58:51 +0000 (11:58 +0800)]
test server allow external certs

Allow the test server to use external certs for testing

libwebsockets-test-server --ssl -C libwebsockets.org.crt -K libwebsockets.org.key -A libwebsockets.org.cer

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agossl ecdh check errors properly
Andy Green [Wed, 17 Feb 2016 03:09:58 +0000 (11:09 +0800)]
ssl ecdh check errors properly

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agomore documentation typos
Andy Green [Tue, 16 Feb 2016 23:46:27 +0000 (07:46 +0800)]
more documentation typos

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoFix some typos.
Peter Pentchev [Tue, 16 Feb 2016 13:19:36 +0000 (15:19 +0200)]
Fix some typos.

8 years agodebug reduce noise
Andy Green [Tue, 16 Feb 2016 10:47:24 +0000 (18:47 +0800)]
debug reduce noise

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agov1.7.0
Andy Green [Tue, 16 Feb 2016 04:32:18 +0000 (12:32 +0800)]
v1.7.0

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoappveyor update openssl url
Andy Green [Tue, 16 Feb 2016 05:20:30 +0000 (13:20 +0800)]
appveyor update openssl url

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agocoverity 158147 test ping sprintf bounds
Andy Green [Mon, 15 Feb 2016 13:08:18 +0000 (21:08 +0800)]
coverity 158147 test ping sprintf bounds

Well, just in the test app arg processing, but yes...

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agocoverity 158146 test fraggle sprintf bounds
Andy Green [Mon, 15 Feb 2016 13:07:09 +0000 (21:07 +0800)]
coverity 158146 test fraggle sprintf bounds

Well, just in the test app arg processing, but yes...

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agocoverity 158145 lws_header_table_detatch must handle no ah attached
Andy Green [Mon, 15 Feb 2016 13:00:39 +0000 (21:00 +0800)]
coverity 158145 lws_header_table_detatch must handle no ah attached

callers should protect it so this doesn't make a problem.  But
Coverity is correct the code is confused about it.

Make it okay if we close a connection before the ah got attached.

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agorelease checklist coverity
Andy Green [Mon, 15 Feb 2016 12:55:29 +0000 (20:55 +0800)]
release checklist coverity

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoapi doc update pre 1.7
Andy Green [Mon, 15 Feb 2016 12:48:00 +0000 (20:48 +0800)]
api doc update pre 1.7

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agotimeout settable from info
Andy Green [Mon, 15 Feb 2016 12:36:02 +0000 (20:36 +0800)]
timeout settable from info

This adds an info member that allows the user code to
set the library's network action timeout in seconds.

If left at the default 0, the build-time default
AWAITING_TIMEOUT continues to be used.

As suggested

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

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agorelease checklist api updates
Andy Green [Mon, 15 Feb 2016 12:38:59 +0000 (20:38 +0800)]
release checklist api updates

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agohttp_transaction_completed handle two completions in detach reset order
Andy Green [Mon, 15 Feb 2016 11:05:43 +0000 (19:05 +0800)]
http_transaction_completed handle two completions in detach reset order

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoah owns rxbuf
Andy Green [Mon, 15 Feb 2016 04:37:04 +0000 (12:37 +0800)]
ah owns rxbuf

This is intended to solve a longstanding problem with the
relationship between http/1.1 keep-alive and the service
loop.

Ah now contain an rx buffer which is used during header
processing, and the ah may not be detached from the wsi
until the rx buffer is exhausted.

Having the rx buffer in the ah means we can delay using the
rx until a later service loop.

Ah which have pending rx force POLLIN service on the wsi
they are attached to automatically, so we can interleave
general service / connections with draining each ah rx
buffer.

The possible http/1.1 situations and their dispositions are:

 1) exactly one set of http headers come.  After processing,
    the ah is detached since no pending rx left.  If more
    headers come later, a fresh ah is aqcuired when available
    and the rx flow control blocks the read until then.

 2) more that one whole set of headers come and we remain in
    http mode (no upgrade).  The ah is left attached and
    returns to the service loop after the first set of headers.
    We will get forced service due to the ah having pending
    content (respecting flowcontrol) and process the pending
    rx in the ah.  If we use it all up, we will detach the
    ah.

 3) one set of http headers come with ws traffic appended.
    We service the headers, do the upgrade, and keep the ah
    until the remaining ws content is used.  When we
    exhausted the ws traffix in the ah rx buffer, we
    detach the ah.

Since there can be any amount of http/1.1 pipelining on a
connection, and each may be expensive to service, it's now
enforced there is a return to the service loop after each
header set is serviced on a connection.

When I added the forced service for ah with pending buffering,
I added support for it to the windows plat code.  However this
is untested.

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoautobahn wait for all fork completion
Andy Green [Mon, 15 Feb 2016 06:44:18 +0000 (14:44 +0800)]
autobahn wait for all fork completion

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoautobahn put back 2.10 2.11
Andy Green [Mon, 15 Feb 2016 06:23:41 +0000 (14:23 +0800)]
autobahn put back 2.10 2.11

The test ordering breaks if we try to skip them, just
leave them in.

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoattack.sh add http1.1 pipelining check
Andy Green [Mon, 15 Feb 2016 06:01:06 +0000 (14:01 +0800)]
attack.sh add http1.1 pipelining check

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agorelease checklist qa
Andy Green [Mon, 15 Feb 2016 04:37:23 +0000 (12:37 +0800)]
release checklist qa

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolibuv integration
Andy Green [Sun, 14 Feb 2016 01:27:41 +0000 (09:27 +0800)]
libuv integration

This gets the libuv stuff plumbed in and working.

Currently it's only workable for some service thread, and there
is an isolated valgrind problem left

==28425== 128 bytes in 1 blocks are definitely lost in loss record 3 of 3
==28425==    at 0x4C28C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28425==    by 0x4C2AB1E: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28425==    by 0x58BBB27: maybe_resize (core.c:748)
==28425==    by 0x58BBB27: uv__io_start (core.c:787)
==28425==    by 0x58C1B80: uv__signal_loop_once_init (signal.c:225)
==28425==    by 0x58C1B80: uv_signal_init (signal.c:260)
==28425==    by 0x58BF7A6: uv_loop_init (loop.c:66)
==28425==    by 0x4157F5: lws_uv_initloop (libuv.c:89)
==28425==    by 0x405536: main (test-server-libuv.c:284)

libuv wants to sign off on all libuv 'handles' that will close, and
callback to do the close confirmation asynchronously.  The wsi close function
is adapted when libuv is in use to work with libuv accordingly and exit the uv
loop the number of remaining wsi is zero.

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoport test-server-libuv.c from libev to libuv
Alex Hultman [Thu, 4 Feb 2016 11:40:42 +0000 (19:40 +0800)]
port test-server-libuv.c from libev to libuv

8 years agolibuv initial replace libev version
Alex Hultman [Mon, 1 Feb 2016 00:31:54 +0000 (08:31 +0800)]
libuv initial replace libev version

8 years agorelease-checklist
Andy Green [Sat, 13 Feb 2016 04:02:26 +0000 (12:02 +0800)]
release-checklist

8 years agoAsk sysconf for Android's getdtablesize.
Dan Albert [Fri, 12 Feb 2016 00:13:27 +0000 (16:13 -0800)]
Ask sysconf for Android's getdtablesize.

8 years agofixed LWS_PRE description
Steffen Vogel [Tue, 9 Feb 2016 06:19:15 +0000 (07:19 +0100)]
fixed LWS_PRE description

8 years agospecfile add fuzxy
Andy Green [Tue, 9 Feb 2016 01:37:11 +0000 (09:37 +0800)]
specfile add fuzxy

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

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolws_reset_header_table dont reset NULL
Andy Green [Tue, 9 Feb 2016 01:15:02 +0000 (09:15 +0800)]
lws_reset_header_table dont reset NULL

This is only a temporary, fragile solution.

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

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolicense clarification and test apps CC zero
Andy Green [Mon, 8 Feb 2016 00:44:21 +0000 (08:44 +0800)]
license clarification and test apps CC zero

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolws_parse_uri fix test client use and add more docs
Andy Green [Sat, 6 Feb 2016 23:28:21 +0000 (07:28 +0800)]
lws_parse_uri fix test client use and add more docs

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

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoah pool take care about freeing headers after parsing
Andy Green [Sat, 6 Feb 2016 00:44:34 +0000 (08:44 +0800)]
ah pool take care about freeing headers after parsing

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agodebug spew remove ah reset logging
Andy Green [Tue, 2 Feb 2016 23:06:52 +0000 (07:06 +0800)]
debug spew remove ah reset logging

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoLWS_WARN_DEPRECATED and fixup older test apps
Andy Green [Tue, 2 Feb 2016 01:02:24 +0000 (09:02 +0800)]
LWS_WARN_DEPRECATED and fixup older test apps

Enforce no more internal use of deprecated apis (esp in the test apps)

Also signal clearly to users what is on the way out.

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoautobahn add test script
Andy Green [Mon, 1 Feb 2016 09:38:15 +0000 (17:38 +0800)]
autobahn add test script

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoattack.sh exit 0 on success
Andy Green [Sun, 31 Jan 2016 03:53:49 +0000 (11:53 +0800)]
attack.sh exit 0 on success

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoah http1.1 deal with pipelined headers properly
Andy Green [Sat, 30 Jan 2016 03:43:10 +0000 (11:43 +0800)]
ah http1.1 deal with pipelined headers properly

Connections must hold an ah for the whole time they are
processing one header set, even if eg, the headers are
fragmented and it involves network roundtrip times.

However on http1.1 / keepalive, it must drop the ah when
there are no more header sets to deal with, and reacquire
the ah later when more data appears.  It's because the
time between header sets / http1.1 requests is unbounded
and the ah would be tied up forever.

But in the case that we got pipelined http1.1 requests,
even partial already buffered, we must keep the ah,
resetting it instead of dropping it.  Because we store
the rx data conveniently in a per-tsi buffer since it only
does one thing at a time per thread, we cannot go back to
the event loop to await a new ah inside one service action.

But no problem since we definitely already have an ah,
let's just reuse it at http completion time if more rx is
already buffered.

NB: attack.sh makes request with echo | nc, this
accidentally sends a trailing '\n' from the echo showing
this problem.  With this patch attack.sh can complete well.

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoclean pre 1.7
Andy Green [Fri, 29 Jan 2016 13:18:54 +0000 (21:18 +0800)]
clean pre 1.7

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agocoverity 157401 dont test SHUTDOWN state in mode switch
Andy Green [Fri, 29 Jan 2016 07:41:13 +0000 (15:41 +0800)]
coverity 157401 dont test SHUTDOWN state in mode switch

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agocoverity 157402 explicitly disallow handling invalid sockfd
Andy Green [Fri, 29 Jan 2016 07:40:08 +0000 (15:40 +0800)]
coverity 157402 explicitly disallow handling invalid sockfd

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agocoverity 157403 fuzxy handle currently impossible error
Andy Green [Fri, 29 Jan 2016 07:35:01 +0000 (15:35 +0800)]
coverity 157403 fuzxy handle currently impossible error

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agocoverity 157404 get rid of needless NULL check
Andy Green [Fri, 29 Jan 2016 07:30:05 +0000 (15:30 +0800)]
coverity 157404 get rid of needless NULL check

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agocleanup test app startup messages
Andy Green [Fri, 29 Jan 2016 01:35:58 +0000 (09:35 +0800)]
cleanup test app startup messages

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agorestrict SO_REUSEPORT to multithreading only so no unexpected change otherwise
Andy Green [Fri, 29 Jan 2016 01:20:00 +0000 (09:20 +0800)]
restrict SO_REUSEPORT to multithreading only so no unexpected change otherwise

SO_REUSEPORT means you don't get any error any more if another
server instance is already running, this will be quite unexpected
for singlethreaded users.

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agohttp1.1 keepalive drop ah betweentimes
Andy Green [Fri, 29 Jan 2016 01:06:22 +0000 (09:06 +0800)]
http1.1 keepalive drop ah betweentimes

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

Tested with

wget -O- http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html http://localhost:7681/test.html

and confirm no connection processing during that on server side

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agowin dont redefine _WINSOCK_DEPRECATED_NO_WARNINGS
Andy Green [Thu, 28 Jan 2016 17:26:31 +0000 (01:26 +0800)]
win dont redefine _WINSOCK_DEPRECATED_NO_WARNINGS

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolextable add x-real-ip
Danomi Czaski [Thu, 28 Jan 2016 01:40:53 +0000 (09:40 +0800)]
lextable add x-real-ip

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agoreduce debug logging mark socket dead when pollert
Andy Green [Wed, 27 Jan 2016 00:50:31 +0000 (08:50 +0800)]
reduce debug logging mark socket dead when pollert

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agolws_adopt_socket
Andy Green [Tue, 26 Jan 2016 13:40:32 +0000 (21:40 +0800)]
lws_adopt_socket

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agomultithread stability
Andy Green [Tue, 26 Jan 2016 12:56:56 +0000 (20:56 +0800)]
multithread stability

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agombed simplify
Andy Green [Tue, 26 Jan 2016 12:45:10 +0000 (20:45 +0800)]
mbed simplify

Signed-off-by: Andy Green <andy.green@linaro.org>
8 years agopthreads only as needed
Andy Green [Mon, 25 Jan 2016 13:39:07 +0000 (21:39 +0800)]
pthreads only as needed

This just lets you build lws 1.6 without pthreads if your OS / toolchain
makes that possible, in the case you don't build the test apps
(libwebsockets-test-server-pthreads needs it)

Signed-off-by: Andy Green <andy.green@linaro.org>