Commit graph

2143 commits

Author SHA1 Message Date
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
Fabian Kurz
d3c33936b5 lwsl_timestamp month off by one 2016-06-01 08:32:18 +08:00
Alexander Bruines
d6fba75433 Adroid test-server client 2016-05-28 19:51:33 +08:00
Andy Green
3358c53445 lwsws conf.c migrate to lib
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-26 21:12:11 +08:00
Andy Green
488e05a6b4 plugins add win modifiers before libwebsockets.h for dll export flag
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-26 07:52:20 +08:00
Andy Green
9de9d0dacd windows adapt plugin name format vs functions
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-25 21:44:30 +08:00
Andy Green
5c27334b39 windows call plugins init on win32 plat
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-25 19:43:02 +08:00
Andy Green
264786db4d lws_get_peer_simple move to user api
https://github.com/warmcat/libwebsockets/issues/537

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-25 08:08:11 +08:00
Andy Green
3a42fb545a update discard pre 2016 date if post 2016 date seen
Otherwise lwsws started at boot on a system without an RTC
may feel it was started in 1970, and when the clock is set
by ntpd a little later, has been up for 16,000 days...

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-24 17:44:35 +08:00
Andy Green
92b0d8a614 lwsws fix settable conf dir and error paths
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-22 07:01:35 +08:00
Andy Green
82e883f7ad clean correct file comment at top and remove pointless LWS_CALLBACK_HTTP
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-21 15:18:30 +08:00
Andy Green
7c2d5964f7 lws_ssl_client_connect2 remove duplicate close on error path
https://github.com/warmcat/libwebsockets/issues/532

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-19 17:27:15 +08:00
Andy Green
e7c1c757cd replace LWS_MAX_SOCKET_IO_BUF with context creation info pt_serv_buf_size
This makes it easy for user code to choose the size of the per-thread
buffer used by various things in lws, including file transfer chunking.

Previously it was 4096, if you leave info.pt_serv_buf_size as zero that
is still the default.

With some caveats, you can increase transfer efficiency by increasing it
to, eg, 128KiB, if that makes sense for your memory situation.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-19 12:34:35 +08:00
Andy Green
9b03cb9828 lwsws localhost example conf add testcgi
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-17 21:53:53 +08:00
Andy Green
7ad94de897 lejp string chunk 255
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-17 21:27:24 +08:00
Andy Green
cbd11f749e lejp check callback errors and use reject path
Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-17 21:22:06 +08:00
Andy Green
81a5a125f4 deprecate misnamed lws_vhost_get add lws_get_vhost
All the other simple accessors begin lws_get_...

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-17 13:47:44 +08:00