Commit graph

2159 commits

Author SHA1 Message Date
Andy Green
5f73048d58 SNI-vhost-matching-fallback-to-wildcard 2016-07-14 08:57:28 +08:00
Andy Green
5ab523ec3f 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.
2016-07-14 08:57:28 +08:00
Andy Green
2b304a933f EXTPOLL export LWS_POLLXXX and document .events must be .revents 2016-07-14 08:57:28 +08:00
Andy Green
675c349cc5 client ssl add flag to control server cert hostname check 2016-07-14 08:57:28 +08:00
Andy Green
fee9f006f6 defer ESTABLISHED until after mode is WS_SERVING 2016-07-14 08:57:28 +08:00
Andy Green
0aa382f6fb lejp-conf: substitute _lws_ddir_ with install dir 2016-07-14 08:57:28 +08:00
Andy Green
cd6a70672b lejp_conf: pmo as alias for cgi-env
Since cgi-env only applies for cgi types, we can
re-use it for generic per-mount options (pmo)
2016-07-14 08:57:28 +08:00
Andy Green
ae0d8d74f9 win32-clean-and-use-do-while 2016-07-14 08:57:28 +08:00
Andy Green
906006e21e lws_get_mimetype 2016-07-14 08:57:27 +08:00
Andy Green
8860eddeb2 peer closes during partial buffered just hang up
https://github.com/warmcat/libwebsockets/issues/573
2016-07-14 08:57:27 +08:00
Andy Green
81c221ed35 CLIENT_CONNECTION_ERROR add strings
This clears up a couple of issues with client connect.

 - if CLIENT_CONNECTION_ERROR is coming, which of the many
   ways the rejection may have happened is documented in the
   in argument.  It's still possible if it just got hung up on
   in will be NULL, but now it has MANY more canned strings
   describing the issue available at the callback

	"getaddrinfo (ipv6) failed"
	"unknown address family"
	"getaddrinfo (ipv4) failed"
	"set socket opts failed"
	"insert wsi failed"
	"lws_ssl_client_connect1 failed"
	"lws_ssl_client_connect2 failed"
	"Peer hung up"
	"read failed"
	"HS: URI missing"
	"HS: Redirect code but no Location"
	"HS: URI did not parse"
	"HS: Redirect failed"
	"HS: Server did not return 200"
	"HS: OOM"
	"HS: disallowed by client filter"
	"HS: disallowed at ESTABLISHED"
	"HS: ACCEPT missing"
	"HS: ws upgrade response not 101"
	"HS: UPGRADE missing"
	"HS: Upgrade to something other than websocket"
	"HS: CONNECTION missing"
	"HS: UPGRADE malformed"
	"HS: PROTOCOL malformed"
	"HS: Cannot match protocol"
	"HS: EXT: list too big"
	"HS: EXT: failed setting defaults"
	"HS: EXT: failed parsing defaults"
	"HS: EXT: failed parsing options"
	"HS: EXT: Rejects server options"
	"HS: EXT: unknown ext"
	"HS: Accept hash wrong"
	"HS: Rejected by filter cb"
	"HS: OOM"
	"HS: SO_SNDBUF failed"
	"HS: Rejected at CLIENT_ESTABLISHED"

 - until now the user code did not get the new wsi that was created
    in the client connection action until it returned.  However the
    client connection action may provoke callbacks like
    CLIENT_CONNECTION_ERROR before then, if multiple client connections
    are initiated it makes it unknown to user code which one the callback
    applies to.  The wsi is provided in the callback but it has not yet
    returned from the client connect api to give that wsi to the user code.

    To solve that there is a new member added to client connect info struct,
    pwsi, which lets you pass a pointer to a struct wsi * in the user code
    that will get filled in with the new wsi.  That happens before any
    callbacks could be provoked, and it is updated to NULL if the connect
    action fails before returning from the client connect api.
2016-07-14 08:57:27 +08:00
Andy Green
e8439168dc remove polarssl mbedtls support
Just remove it from cmake
2016-07-14 08:57:27 +08:00
Andy Green
f25eefdd41 reduce log spew and document test-server variants 2016-07-14 08:57:27 +08:00
Robin Rowe
8fdff1053c fix __x86_64__ check
https://github.com/warmcat/libwebsockets/issues/574
2016-07-14 08:57:27 +08:00
Andy Green
9ec76d4b72 test-libev add server-status protocol 2016-07-14 08:57:27 +08:00
Andy Green
e7bf0aa1dc client confirm server hostname in cert
Openssl v1.0.2 and above have support for checking the hostname
the client side connected to against the hostname on the cert the
server presented.

This enables that feature if the necessary API is available in the
openssl version, meaning the connection will fail at ssl negotiation if the
cert isn't for the requested server

It's very easy to test, add a fake entry to /etc/hosts for the server IP with
a different name, using that will fail at ssl but using the correct dns name
matching the certificate will work.
2016-07-14 08:57:27 +08:00
Andy Piper
6ff571f854 windows detect client connection error 2016-07-14 08:57:27 +08:00
Andy Green
ca44730b36 dlfcn h only if plugins
Signed-off-by: None <andy@warmcat.com>
2016-07-14 08:57:27 +08:00
Andy Green
014481e912 documentation convert to doxygen
Signed-off-by: Andy Green <andy@warmcat.com>
2016-07-14 08:57:27 +08:00
Andy Green
4e75ae3b4e protocol-lws-messageboard
This is a simple messageboard built on top of lwsgs

Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-28 14:51:44 +08:00
Andy Green
7f92ee802c lws_bind_protocol
When using http/1.1+ keepalive and mounts, the relationship between
a connection and a protocol becomes dynamic.  The same connection might
visit different bits of the url space served by different mounts using
different protocols.

This patch ensures protocols can cleanly manage their per-connection
allocations by using the following callbacks when the protocol changes

 LWS_CALLBACK_HTTP_BIND_PROTOCOL
 LWS_CALLBACK_HTTP_DROP_PROTOCOL

For example if the pss wants to malloc stuff at runtime, it should do it
in LWS_CALLBACK_HTTP_BIND_PROTOCOL or later, and clean it up in
...DROP_PROTOCOL.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-18 09:36:27 +08:00
Andy Green
7a2fc442b6 protocol generic sessions
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-18 06:44:31 +08:00
Andy Green
920daf10a1 lws_json_escape
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-18 06:43:30 +08:00
Andy Green
4bd5b96735 lejp conf report human readable errors
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-18 06:42:13 +08:00
Andy Green
36f87b068f lws_now_secs
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-17 09:41:22 +08:00
OndraCo
f1bdb0fefe Modified the 64 connections "backup" so that there is no wait if any event
is already ready.
2016-06-16 13:02:31 +08:00
OndraCo
528adbde7f Added a back-up in case of more than 64 connections. 2016-06-16 13:02:20 +08:00
Andy Green
3f17a8e252 lws_callback_vhost_protocols
This gives protocols a way to talk to each other via per-vhost callbacks,
one per protocol (including the sender).

Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-15 10:46:58 +08:00
Andy Green
6cd27e8186 lws_process_html_args
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-14 12:35:23 +08:00
Andy Green
c55fd27d75 introduce urlencode decode and sql escape public apis
This adds

 - simple lws_urlencode()
 - simple lws_urldecode()
 - simple lws_sql_purify

Those expect the data to all be there and process it up until
the first '\0'.

There is also a larger opaque apis for handling POST_BODY urldecode.  To
enable these, you need to give cmake -DLWS_WITH_STATEFUL_URLDECODE=1 (or
arrange any larger feature that relies on it sets that in CMakeLists.txt)

 - stateful urldecode with parameter array

These have create / process / destroy semantics on a struct that maintains
decode state.

Stateful urldecode is capable of dealing with large POST data in multiple
POST_BODY callbacks cleanly, eg, file transfer by POST.

Stateful urldecode with parameter array wraps the above with a canned
callback that stores the urldecoded data and indexes them in a pointer
array matching an array of parameter names.

You may also pass it an optional callback when creating it, that will recieve
uploaded file content.

The test html is updated to support both urlencoded and multipart forms,
with some javascript to do clientside validation of an arbitrary 100KB
file size limit (there is no file size limit in the apis).

Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-14 12:04:38 +08:00
Gadkari Mugdha
70c60d81ab fix for https connection code 2016-06-14 12:04:34 +08:00
Andy Green
1ec8ba893a openssl allow set clear of ssl options from info 2016-06-10 11:09:27 +08:00
Karl Palsson
d13c1471c1 non-openssl: only check for openssl ecdh in openssl builds
See also
https://github.com/warmcat/libwebsockets/issues/559

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-06-07 19:50:26 +08:00
Andy Green
a0d21c3abd client CONNECTION_ERROR also allow in LWSS_CLIENT_UNCONNECTED
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-07 17:20:57 +08:00
Andy Green
d5466c97ae lws_write escalate pending truncated to make the
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-07 16:46:41 +08:00
Andy Green
602d884028 smtp
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-07 09:49:59 +08:00
Alexander Bruines
ed7c63e07d Android: update to use SDK Python script
The latest Android SDK updates deprecate the shell script
 used to create a standalone toolchain. This patch updates the Makefile for
 the Android test-client to use the new Python script to create the standalone
 toolchains.
2016-06-07 02:42:32 +08:00
Andy Green
57513b7d62 ARRAY_SIZE dont redefine
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-06 20:35:42 +08:00
Andy Green
7201057d28 avoid illegal sockfd on timeout
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-04 09:02:09 +08:00
Andy Green
011f915dd0 ipv6only add lejp conf and flag docs
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-04 09:01:28 +08:00
Denis Osvald
5780783c0c ipv6 don't ignore info.iface
Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
2016-06-04 08:37:50 +08:00
Denis Osvald
326c91b966 allow modifying ipv4 mapping option (IPV6_V6ONLY)
Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
2016-06-04 08:37:39 +08:00
Denis Osvald
33403a474e vhost creation print ipv6
Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
2016-06-04 08:37:31 +08:00
Denis Osvald
4507da486d fixup! ipv6 move disable to vhost option
client ipv6 check vhost not context
2016-06-04 08:37:19 +08:00
Denis Osvald
c16c6c8536 fixup! ipv6 move disable to vhost option
fix missing backslash in multiline macro
2016-06-04 08:37:08 +08:00
Andy Green
2dc7ddecfd ipv6 move disable to vhost option
Server ipv6 support disable is now controlled by vhost->options rather
than context->options, allowing it to be set per-vhost.



Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-03 21:19:40 +08:00
Andy Green
1dca916bec lws_get_urlarg_by_name
Adds a convenient way to directly get the value of a URL
argument like ...?x=y&v=1, regardless of position in the
parameter list.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-03 09:04:15 +08:00
Andy Green
4889566d5d add max_http_header_data2 and upgrade internal offsets from short to int
https://github.com/warmcat/libwebsockets/issues/550

Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-02 13:03:35 +08:00
Martin C Drohmann
eda447e74a Revert changes in daemonize.c from commit 22d6f39e7f 2016-06-02 13:00:13 +08:00
Young
261f23622c update document for lws_get_context 2016-06-01 08:34:32 +08:00