Commit graph

215 commits

Author SHA1 Message Date
Andy Green
4cca86926f v2.2.2 2017-07-19 01:05:49 +08:00
Leonardo Maccari Rufino
5a473e0dc3 Subject: Support to IPv6 on Windows 2017-06-01 06:57:59 +08:00
Sergey Kovalevich
2e8c0256c0 Subject: Fixed value of LIBWEBSOCKETS_LIBRARIES_STATIC 2017-05-30 09:02:48 +08:00
Sergey Kovalevich
a64bdff642 Subject: Fixed build in scope of a project (add_subdirectory) 2017-05-30 09:02:45 +08:00
Martin Milata
8d511c834f Subject: ssl: fix OpenSSL client method detection 2017-04-06 23:12:11 +08:00
Andy Green
8e2fe3f12b ssl: OpenSSL v1.1 deprecated TLSv1_2_client_method 2017-04-06 08:51:17 +08:00
Andy Green
839b1af4e4 esp32: move helper code into lws 2017-03-10 14:33:25 +08:00
Silas Parker
98eed1871a fops_zip: require libz 2017-03-09 20:26:26 +08:00
Andy Green
6be573f2c9 v2.2.0 2017-03-08 14:15:01 +08:00
Andy Green
3a09c3b7d6 esp32: align fops member name defines 2017-03-08 11:11:41 +08:00
Andy Green
19cc7acb24 fops-zip 2017-03-05 15:32:55 +08:00
Andy Green
753f1d642c junzip: style and migrate header into private-libwebsockets.h
Also introduce CMake LWS_WITH_ZIP_FOPS defaulting to ON that builds junzip.c and
make sure this is exported in lws_config.h (included by libwebsockets.h)

Improve lws handling of stdint.h import or simulate it.
2017-03-03 09:19:14 +08:00
Andy Green
be8d791b5e adoption: make union for socket and file fds
This lets lws support adopting raw file FDs and raw socket fds.

A test plugin creates a FIFO and prints data sent on it, using
the lws event loop.
2017-03-01 10:01:53 +08:00
Andy Green
4ca114fbcf cmake: create build/include 2017-02-28 07:51:56 +08:00
Andy Green
a5488f9c27 mbedtls: remove abortive attempt to avoid confusing people
Basically we support openssl api compatibles only.

If we ever try something different we need a shim making it openssl api or a proper abstraction layer added first.
2017-02-22 09:54:47 +08:00
Andy Green
0aed7a06d5 mbed3: sayonara
The port was technically worthwhile and laid the groundwork for ESP support.

But now it is just useless cruft like mbed3 itself...
2017-02-22 09:50:11 +08:00
Andy Green
c7c4ae0aa4 ESP32 platform
This is enough for all the test app features to work on ESP32 without
SSL.
2017-02-18 17:27:22 +08:00
Yuchen Xie
936bf08a0f Fix typo 2017-02-18 17:27:22 +08:00
Joel Winarske
238766be6b windows: changes to build with VS2015 2017-02-18 17:27:22 +08:00
andSpace
7df395695b LWS_FALLBACK_GETHOSTBYNAME
Adapted by AG to not use-after-free and have LWS_FALLBACK_GETHOSTBYNAME
2017-02-05 22:30:27 +08:00
Andy Green
51c96d8c2a plat-optee and boringssl adaptations 2017-01-17 07:01:02 +08:00
Andy Green
d79d8b792d cmake: boringssl helper 2017-01-04 20:23:10 +08:00
Andy Green
ed4acef481 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....
2016-12-20 14:37:07 +08:00
Andy Green
ee94621b40 basic-auth 2016-12-16 22:08:13 +08:00
Bablooos
fded366ea0 Update CMakeLists.txt for BSD + libdl
Fixing build failure of libwebsockets-test-fraggle  on FreeBSD when LWS_WITH_PLUGINS.
Solution: FreeBSD has no libdl
2016-12-16 22:08:13 +08:00
Rainer Poisel
d2cef1515e Better support for MINW32 2016-12-16 22:08:13 +08:00
Yuchen Xie
63477ded0c Correct the library name of LIBHUBBUB_LIBRARIES
It should be `hubbub` in `find_library` to make the function work.
2016-10-10 20:10:34 +08:00
Andy Green
73557509bd v2.1.0
Bump soname to 9
2016-10-07 03:19:50 +08:00
Andy Green
4cfe81dfba ubuntu: fix uv detection for lwsws 2016-10-05 14:00:55 +08:00
Andy Green
53ec6b1789 fix cosmetic if end if name tag error 2016-10-05 10:15:16 +08:00
Peter Pentchev
fb71b790cd Subject: Fix some typographical and grammatical errors. 2016-10-03 21:31:27 +08:00
Brown, Matthew
b0ff623526 Added option to build the static library with PIC 2016-09-27 05:32:40 +08:00
Fredrik Skogman
9de43fc9d7 Check for sys/sockio.h. 2016-09-09 06:48:24 +08:00
Andy Green
7acf76cd3d esp8266 initial support 2016-08-10 21:20:23 +08:00
Andy Green
722cc4a366 plugin table dirlisting 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
e8439168dc remove polarssl mbedtls support
Just remove it from cmake
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 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
7a2fc442b6 protocol generic sessions
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-18 06:44:31 +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
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
602d884028 smtp
Signed-off-by: Andy Green <andy@warmcat.com>
2016-06-07 09:49:59 +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
d6be6776a8 win32 more build fixes
After alexgille

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

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-14 06:49:29 +08:00
Andy Green
2700d1c0c3 protocol_client_loopback_test
This is used to confirm that SSL client connections can coexist with
a vhost doing serving.

To set it up,

/*
 * This is a bit fiddly...
 *
 * 0) If you want the wss:// test to work, make sure the vhost is marked with
 *    enable-client-ssl if using lwsws, or call lws_init_vhost_client_ssl() on
 *    the vhost if you're doing it by hand.
 *
 * 1) enable the protocol on a vhost
 *
 *      "ws-protocols": [{
 *     "client-loopback-test": {
 *      "status": "ok"
 *     },  ...
 *
 *     the vhost should listen on 80 (ws://) or 443 (wss://)
 *
 * 2) mount the http part of the test one level down on the same vhost, eg
 *   {
 *      "mountpoint": "/c",
 *      "origin": "callback://client-loopback-test"
 *   }
 *
 * 3) Use a browser to visit the mountpoint with a URI attached for looping
 *    back, eg, if testing on localhost
 *
 *    http://localhost/c/ws://localhost
 *    https://localhost/c/wss://localhost
 *
 * 4) The HTTP part of this test protocol will try to do the requested
 *    ws client connection, to the same test protocol on the same
 *    server.
 */

Results should look like this

lwsws[29938]: client connection to localhost:443 with ssl: 1 started
lwsws[29938]: server part: LWS_CALLBACK_ESTABLISHED
lwsws[29938]: checking client ext permessage-deflate
lwsws[29938]: instantiating client ext permessage-deflate
lwsws[29938]: Client connection established
lwsws[29938]: Client connection received 7 from server 'Made it'

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-12 21:14:13 +08:00
Andy Green
0a4da2c71f lwsws remove all protocols use lws default http
Actually lwsws doesn't need his own protocol handler even for http
any more.  The default http handler in lws should do everything.

Move the cgi routing into lws default http protocol handler, and
delete lwsws one.  Remove all protocols from lwsws so the lws
default one gets used.

With this, and the earlier move of lejp into lws, lwsws itself
becomes 15.5KB of x86_64 (mainly conf parsing).

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-10 11:28:30 +08:00
Andy Green
5afc56770d lejp bring into lws
lejp is already in lws as part of lwsws.  However it's too generally useful
to just put directly in lwsws, it will lead to multiple copies of the source
in differet subprojects.

This moves it directly into lws, lwsws now gets it from there.

Like lwsws, by default at cmake it is disabled.  Selecting LWS_WITH_LWSWS now
selects LWS_WITH_LEJP and you can set that at cmake individually as well.

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