libwebsockets/lib
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
..
.gitignore Ignoring linux build files 2013-01-09 15:46:11 +08:00
alloc.c esp8266 initial support 2016-08-10 21:20:23 +08:00
base64-decode.c base64 decode fix lengths 2016-08-10 21:20:23 +08:00
client-handshake.c client: protect againt losing ah by lws_client_connect_2 2016-12-16 22:08:13 +08:00
client-parser.c ws ping pong on idle connections 2016-08-10 21:20:23 +08:00
client.c client: add lws_http_client_http_response api 2016-12-16 22:08:13 +08:00
context.c clean: usused accidental global wsi 2016-12-20 14:37:07 +08:00
daemonize.c Revert changes in daemonize.c from commit 22d6f39e7f 2016-06-02 13:00:13 +08:00
extension-permessage-deflate.c replace LWS_MAX_SOCKET_IO_BUF with context creation info pt_serv_buf_size 2016-05-19 12:34:35 +08:00
extension-permessage-deflate.h extension permessage deflate 2016-01-11 11:34:01 +08:00
extension.c documentation convert to doxygen 2016-07-14 08:57:27 +08:00
getifaddrs.c whitespace trailing mass cleanout 2015-12-14 08:52:03 +08:00
getifaddrs.h esp8266 initial support 2016-08-10 21:20:23 +08:00
handshake.c cgi-retain-timeout-after-POST-send 2016-08-23 14:20:11 +08:00
header.c per-vhost headers and lwsws conf support 2016-08-27 17:07:06 +08:00
hpack.c http2 update integration 2016-04-13 11:53:40 +08:00
http2.c Subject: Fix some typographical and grammatical errors. 2016-10-03 21:31:27 +08:00
huftable.h http2 hpack basic decode ok including huff 2014-10-12 08:38:16 +08:00
lejp-conf.c basic-auth 2016-12-16 22:08:13 +08:00
lejp.c documentation convert to doxygen 2016-07-14 08:57:27 +08:00
lejp.h documentation convert to doxygen 2016-07-14 08:57:27 +08:00
lextable-strings.h token:x-forwarded-for 2016-12-20 14:37:07 +08:00
lextable.h token:x-forwarded-for 2016-12-20 14:37:07 +08:00
libev.c plugins 2016-04-07 09:38:08 +08:00
libuv.c vhost: allow adding vhosts after server init 2016-12-16 22:08:13 +08:00
libwebsockets.c lws_socket_bind: use lws_sockfd_type 2016-12-16 22:08:13 +08:00
libwebsockets.h RFC7233 HTTP Ranges support for server 2016-12-20 14:37:07 +08:00
lws-plat-esp8266.c alias lws_plat_service_tsi to lws_service_tsi in public api 2016-12-16 22:08:12 +08:00
lws-plat-mbed3.c documentation convert to doxygen 2016-07-14 08:57:27 +08:00
lws-plat-mbed3.cpp windows detect client connection error 2016-07-14 08:57:27 +08:00
lws-plat-unix.c alias lws_plat_service_tsi to lws_service_tsi in public api 2016-12-16 22:08:12 +08:00
lws-plat-win.c alias lws_plat_service_tsi to lws_service_tsi in public api 2016-12-16 22:08:12 +08:00
minihuf.c whitespace trailing mass cleanout 2015-12-14 08:52:03 +08:00
minilex.c whitespace trailing mass cleanout 2015-12-14 08:52:03 +08:00
output.c RFC7233 HTTP Ranges support for server 2016-12-20 14:37:07 +08:00
parsers.c client: add lws_http_client_http_response api 2016-12-16 22:08:13 +08:00
pollfd.c client fixups after esp8266 2016-08-10 21:23:01 +08:00
private-libwebsockets.h RFC7233 HTTP Ranges support for server 2016-12-20 14:37:07 +08:00
ranges.c RFC7233 HTTP Ranges support for server 2016-12-20 14:37:07 +08:00
rewrite.c check oom on lws_malloc 2016-05-12 21:04:33 +08:00
server-handshake.c ws-server: restrict returned Sec-Websocket-Protocol to the chosen name only 2016-12-16 22:08:13 +08:00
server.c RFC7233 HTTP Ranges support for server 2016-12-20 14:37:07 +08:00
service.c alias lws_plat_service_tsi to lws_service_tsi in public api 2016-12-16 22:08:12 +08:00
sha-1.c polarssl implementation 2016-04-18 20:05:43 +08:00
smtp.c documentation convert to doxygen 2016-07-14 08:57:27 +08:00
ssl-client.c Added flag to allow expired certificates. 2016-12-16 22:08:13 +08:00
ssl-http2.c http2 update integration 2016-04-13 11:53:40 +08:00
ssl-server.c openssl allow set clear of ssl options from info 2016-06-10 11:09:27 +08:00
ssl.c Remove the cleanup functions with OpenSSL 1.1. 2016-10-04 08:26:13 +08:00