mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00

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....
120 lines
3.2 KiB
C
120 lines
3.2 KiB
C
/* lws_config.h Generated from lws_config.h.in */
|
|
|
|
#ifndef NDEBUG
|
|
#ifndef _DEBUG
|
|
#define _DEBUG
|
|
#endif
|
|
#endif
|
|
|
|
#define LWS_INSTALL_DATADIR "${CMAKE_INSTALL_PREFIX}/share"
|
|
|
|
/* Define to 1 to use wolfSSL/CyaSSL as a replacement for OpenSSL.
|
|
* LWS_OPENSSL_SUPPORT needs to be set also for this to work. */
|
|
#cmakedefine USE_WOLFSSL
|
|
|
|
/* Also define to 1 (in addition to USE_WOLFSSL) when using the
|
|
(older) CyaSSL library */
|
|
#cmakedefine USE_OLD_CYASSL
|
|
|
|
#cmakedefine LWS_USE_MBEDTLS
|
|
#cmakedefine LWS_USE_POLARSSL
|
|
#cmakedefine LWS_WITH_ESP8266
|
|
|
|
#cmakedefine LWS_WITH_PLUGINS
|
|
#cmakedefine LWS_WITH_NO_LOGS
|
|
|
|
/* The Libwebsocket version */
|
|
#cmakedefine LWS_LIBRARY_VERSION "${LWS_LIBRARY_VERSION}"
|
|
|
|
#define LWS_LIBRARY_VERSION_MAJOR ${LWS_LIBRARY_VERSION_MAJOR}
|
|
#define LWS_LIBRARY_VERSION_MINOR ${LWS_LIBRARY_VERSION_MINOR}
|
|
#define LWS_LIBRARY_VERSION_PATCH ${LWS_LIBRARY_VERSION_PATCH}
|
|
/* LWS_LIBRARY_VERSION_NUMBER looks like 1005001 for e.g. version 1.5.1 */
|
|
#define LWS_LIBRARY_VERSION_NUMBER (LWS_LIBRARY_VERSION_MAJOR*1000000)+(LWS_LIBRARY_VERSION_MINOR*1000)+LWS_LIBRARY_VERSION_PATCH
|
|
|
|
/* The current git commit hash that we're building from */
|
|
#cmakedefine LWS_BUILD_HASH "${LWS_BUILD_HASH}"
|
|
|
|
/* Build with OpenSSL support */
|
|
#cmakedefine LWS_OPENSSL_SUPPORT
|
|
|
|
/* The client should load and trust CA root certs it finds in the OS */
|
|
#cmakedefine LWS_SSL_CLIENT_USE_OS_CA_CERTS
|
|
|
|
/* Sets the path where the client certs should be installed. */
|
|
#cmakedefine LWS_OPENSSL_CLIENT_CERTS "${LWS_OPENSSL_CLIENT_CERTS}"
|
|
|
|
/* Turn off websocket extensions */
|
|
#cmakedefine LWS_NO_EXTENSIONS
|
|
|
|
/* Enable libev io loop */
|
|
#cmakedefine LWS_USE_LIBEV
|
|
|
|
/* Enable libuv io loop */
|
|
#cmakedefine LWS_USE_LIBUV
|
|
|
|
/* Build with support for ipv6 */
|
|
#cmakedefine LWS_USE_IPV6
|
|
|
|
/* Build with support for UNIX domain socket */
|
|
#cmakedefine LWS_USE_UNIX_SOCK
|
|
|
|
/* Build with support for HTTP2 */
|
|
#cmakedefine LWS_USE_HTTP2
|
|
|
|
/* Turn on latency measuring code */
|
|
#cmakedefine LWS_LATENCY
|
|
|
|
/* Don't build the daemonizeation api */
|
|
#cmakedefine LWS_NO_DAEMONIZE
|
|
|
|
/* Build without server support */
|
|
#cmakedefine LWS_NO_SERVER
|
|
|
|
/* Build without client support */
|
|
#cmakedefine LWS_NO_CLIENT
|
|
|
|
/* If we should compile with MinGW support */
|
|
#cmakedefine LWS_MINGW_SUPPORT
|
|
|
|
/* Use the BSD getifaddrs that comes with libwebsocket, for uclibc support */
|
|
#cmakedefine LWS_BUILTIN_GETIFADDRS
|
|
|
|
/* use SHA1() not internal libwebsockets_SHA1 */
|
|
#cmakedefine LWS_SHA1_USE_OPENSSL_NAME
|
|
|
|
/* SSL server using ECDH certificate */
|
|
#cmakedefine LWS_SSL_SERVER_WITH_ECDH_CERT
|
|
#cmakedefine LWS_HAVE_SSL_CTX_set1_param
|
|
#cmakedefine LWS_HAVE_X509_VERIFY_PARAM_set1_host
|
|
|
|
#cmakedefine LWS_HAVE_UV_VERSION_H
|
|
|
|
/* CGI apis */
|
|
#cmakedefine LWS_WITH_CGI
|
|
|
|
/* whether the Openssl is recent enough, and / or built with, ecdh */
|
|
#cmakedefine LWS_HAVE_OPENSSL_ECDH_H
|
|
|
|
/* HTTP Proxy support */
|
|
#cmakedefine LWS_WITH_HTTP_PROXY
|
|
|
|
/* HTTP Ranges support */
|
|
#cmakedefine LWS_WITH_RANGES
|
|
|
|
/* Http access log support */
|
|
#cmakedefine LWS_WITH_ACCESS_LOG
|
|
#cmakedefine LWS_WITH_SERVER_STATUS
|
|
|
|
#cmakedefine LWS_WITH_STATEFUL_URLDECODE
|
|
|
|
/* Maximum supported service threads */
|
|
#define LWS_MAX_SMP ${LWS_MAX_SMP}
|
|
|
|
/* Lightweight JSON Parser */
|
|
#cmakedefine LWS_WITH_LEJP
|
|
|
|
/* SMTP */
|
|
#cmakedefine LWS_WITH_SMTP
|
|
|
|
${LWS_SIZEOFPTR_CODE}
|