Commit graph

1643 commits

Author SHA1 Message Date
Andy Green
debb7aa043 LWS_WITH_ACCESS_LOG: add referrer to log format and quotes around user agent
This also forces any double-quotes in the UA or referrer to be single-quotes.

This aligns to log to the "combined log format" described here

https://httpd.apache.org/docs/1.3/logs.html#combined
2017-08-27 20:18:48 +08:00
Petar Paradzik
a2943ca41d cgi: fix killing cgi before draining its output
CGI's which don't have content-length nor they are explicitly chunked
are killed immediately after being reaped even if their output has not
being drained. This is fixed by deferring from killing them like those
which are explicitly chunked.

Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>
2017-08-26 12:16:33 +08:00
Petar Paradzik
04134742f9 cgi: fix overriding 'PATH' environment variable
Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>
2017-08-26 12:15:51 +08:00
Andy Green
2e5110e731 cgi: provide constants for reason_bf 2017-08-26 12:15:40 +08:00
Petar Paradzik
afc9c0ac26 cgi: add support for manual chunking of CGI output
In cases when CGI output doesn't contain content-length nor it is
explicitly chunked, do manual chunking of CGI output.

Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>
2017-08-26 12:04:15 +08:00
Petar Paradzik
5b23b8c99f cgi: remove and kill CGI after closing its STDOUT handler
Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>
2017-08-26 12:00:16 +08:00
Petar Paradzik
b66e8e1898 cgi: fix not getting POLLHUP on fd associated to CGI STDOUT
Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>
2017-08-26 11:59:58 +08:00
Mike Messina
0bb3646256 win32: skip delay in WSAWaitForMultipleEvents if POLLOUT expected
https://github.com/warmcat/libwebsockets/issues/994
2017-08-22 21:32:47 +08:00
Andy Green
c60b2413a4 ah: double-check timeouts on all active ah independent of wsi and dump info 2017-08-21 08:55:13 +08:00
Andy Green
58195fbc1e esp-idf v3: account for optional SHA256 when walking segments 2017-08-19 13:14:34 +08:00
Cory McWilliams
4b24369d64 Subject: Mismatched lws_zalloc / free 2017-08-17 07:30:23 +08:00
Andy Green
872e8d7e9d docs: swap _all_protocol_vhost cut and paste
https://github.com/warmcat/libwebsockets/issues/989
2017-08-16 15:21:22 +08:00
Andy Green
5da9ce2f06 ah: reuse at end of transaction has no timeout
If we complete a transaction but end up keeping the ah, we must force
a timeout on it.  Otherwise a bad bot could keep the socket open and
exhaust the ah pool.
2017-08-15 07:58:53 +08:00
lnmx
b93c057472 send content-type when LWS_WITH_RANGES=OFF
https://github.com/warmcat/libwebsockets/pull/987

With the RANGES feature disabled, lws_serve_http_file would
not add the content-type header to the response.
2017-08-12 20:50:25 +08:00
Andy Green
5a38d88fdd handle same vh protocol reinsert 2017-08-12 20:50:21 +08:00
Andy Green
219a367a4c esp32: allow return of default vhost at init time 2017-08-06 06:53:38 +08:00
Andy Green
93a5b586a3 lws_callback_all_protocol_vhost_args 2017-08-05 10:38:59 +08:00
Andy Green
16ef37ef5d close path: make sure a second time timeout and ssl buffered lists are scrubbed
lws_meta children can have a different close path
2017-08-04 13:27:34 +08:00
Andy Green
c6233ce403 coverity 182068: 155650: unnecessary check against illegal NULL 2017-07-28 14:19:24 +08:00
Andy Green
7849c5a8ad pmd: autobahn fixes 2017-07-28 13:12:03 +08:00
Andy Green
855f7e8712 log: downgrade logging for ah wait 2017-07-28 07:04:47 +08:00
Andy Green
9f31e94e09 correct status payload size 2017-07-28 07:03:57 +08:00
Andy Green
d86641ed3a libevent: update to use static plugins and work with new libevent2
Plus fix broken indent style
2017-07-27 07:57:59 +08:00
Andy Green
d766c99861 dummy handler: LWS_CALLBACK_HTTP_FILE_COMPLETION 2017-07-27 07:26:00 +08:00
Andy Green
ba45f7cf9f ah: allow configurable ah hold timeout 2017-07-26 11:49:41 +08:00
namowen
61e58885f4 client: ipv6 reject when lws_getaddrinfo46 failed
https://github.com/warmcat/libwebsockets/issues/978
2017-07-25 17:14:37 +08:00
Andy Green
3562e441e3 client-fix-header-stash-leak-on-close-before-success 2017-07-21 21:49:24 +08:00
Andy Green
003bd7dcee client: fix hdr stash leak 2017-07-21 21:34:46 +08:00
Andy Green
75bbb3b2c0 client: always set port even if sockfd already created 2017-07-21 21:34:46 +08:00
Andy Green
8ccc64679f client: fix redirect ssl to ssl 2017-07-21 20:25:32 +08:00
Andy Green
6c09952065 url cleaning: leave // after http[s]: alone 2017-07-21 20:04:02 +08:00
Andy Green
09f3947b4c lws_intptr_t: fix ordering
https://github.com/warmcat/libwebsockets/issues/973
2017-07-21 19:25:41 +08:00
Andy Green
ad15082563 coverity-181580: supposedly dead code 2017-07-19 14:47:30 +08:00
Andy Green
2d313bdc02 coverity 181577: lejp_conf loop on calling uv_loop_close to keep coverity happy 2017-07-19 14:37:04 +08:00
Andy Green
3526fde154 coverity 181573: false positive since lws_is_ssl returns a bool 2017-07-19 14:37:04 +08:00
Andy Green
bd1dd7efd4 coverity 181576: remove dead code to keep coverity happy 2017-07-19 14:37:04 +08:00
Andy Green
1690581cd2 coverity 181574: confirm uri_ptr non-null before deref 2017-07-19 14:19:03 +08:00
Andy Green
3c360d5192 coverity 181579: check result of malloc as intended 2017-07-19 14:17:39 +08:00
Andy Green
8a4881a142 coverity 181575: check vhost iface non-null if using via bind_iface 2017-07-19 14:16:32 +08:00
Andy Green
6f11c1361a lws-meta 2017-07-19 08:59:42 +08:00
Andy Green
3b0066cb3f close: make close notification go through writable
Until now we took the approach if just writing the close notification
broke something, we didn't care because we were closing the connection
anyway.

But with lws_meta, breaking stuff in the parent connection would be a
sticky problem outliving the closing child connection.

So this adds a new wsi state LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION
and makes the send go via the writable callback mechanism.
2017-07-19 08:55:57 +08:00
Andy Green
faa1526b39 lws-vhost-destroy
Adds a new api lws_vhost_destroy(struct lws_vhost *) which allows dynamic removal of vhosts.

The external api calls two parts of internal helpers that get reused for context destroy.

The second part is called deferred by 5s... this is to ensure that event library objects
composed into structs owned by the vhost all have a chance to complete their close
asynchronously.  That should happen immediately, but it requires us to return to the
event loop first.

The vhost being removed is deleted from the context vhost list by the first part, and does
not block further removals or creation during the delay for the deferred freeing of the
vhost memory.

Part 1:

 - if the vhost owned a listen socket needed by other vhosts listening on same iface + port, the listen
   socket is first handed off to another vhost so it stays alive

 - all wsi still open on the vhost are forcibly closed (including any listen socket still attached)

 - inform all active protocols on the vhost they should destroy themselves

 - remove vhost from context vhost list (can no longer be found by incoming connections)

 - add to a "being destroyed" context list and schedule the second part to be called in 5s

Part 2:

 - remove us from the being destroyed list

 - free all allocations owned by the vhost

 - zero down the vhost and free the vhost itself


In libwebsockets-test-server, you can send it a SIGUSR1 to have it toggle the creation and destruction of
a second vhost on port + 1.
2017-07-19 08:51:43 +08:00
Andy Green
632a0acc99 clean: fixes for appveyor warnings 2017-07-19 04:25:20 +08:00
Andy Green
dbd9262ac5 ah: enforce waiting list detach 2017-07-19 04:19:25 +08:00
Andy Green
d5f960f14b valgrind: avoid complaints from plugin loading 2017-07-19 04:18:11 +08:00
Andy Green
5106e9141f explicit vhosts: only check context for flag
Although the test apps reuse the context info directly and so inherit the
flag state there when creating vhosts, users might generate a fresh info
without the flag for vhost creation.  So just go by what was given at
context creation time.
2017-07-19 04:12:26 +08:00
Jesse Engle
61cc61817e Subject: Eliminated 'unused variable' compiler warning generated with -DLWS_WITH_NO_LOGS=ON.
The unused variable was only declared for use in a log macro that's
compiled out with the above compiler switch. I removed the declaration
and casted the variable at each use in the block.

AG: convert to void case reference irrespective of logging enabled.
AG: travis.yml: add -DLWS_WITH_NO_LOGS=ON that also enables lwsws + cgi code
2017-07-19 04:11:57 +08:00
Andy Green
3077b7776e valgrind: stop openssl still reachable complaints 2017-07-19 04:11:30 +08:00
Andy Green
81d5899c89 valgrind: fix leak in caps handling 2017-07-19 04:10:36 +08:00
Andy Green
a15007269e libuv: add helper for clean valgrind with foreign loop 2017-07-19 04:10:07 +08:00