This commit deprecates all APIs, including structs and callback
functions, that use ssize_t. New APIs that use nghttp2_ssize are
added as a replacement. The usage of ssize_t is problematic for
several reasons. Some platforms do not define ssize_t. The minimum
value of ssize_t that POSIX requires is -1 which makes nghttp2 error
code out of range. nghttp2_ssize is an alias of ptrdiff_t that is in
C standard and covers our error code range.
New code should use new nghttp2_ssize APIs. The existing applications
should consider migrating to new APIs.
The deprecated ssize_t APIs continue to work for backward
compatibility.
Here is the summary of the deprecated APIs and their replacements:
Callback functions:
- nghttp2_data_source_read_callback => nghttp2_data_source_read_callback2
- nghttp2_data_source_read_length_callback => nghttp2_data_source_read_length_callback2
- nghttp2_pack_extension_callback => nghttp2_pack_extension_callback2
- nghttp2_recv_callback => nghttp2_recv_callback2
- nghttp2_select_padding_callback => nghttp2_select_padding_callback2
- nghttp2_send_callback => nghttp2_send_callback2
Structs:
- nghttp2_data_provider => nghttp2_data_provider2
Functions:
- nghttp2_hd_deflate_hd => nghttp2_hd_deflate_hd2
- nghttp2_hd_deflate_hd_vec => nghttp2_hd_deflate_hd_vec2
- nghttp2_hd_inflate_hd2 => nghttp2_hd_inflate_hd3
- nghttp2_pack_settings_payload => nghttp2_pack_settings_payload2
- nghttp2_session_callbacks_set_data_source_read_length_callback =>
nghttp2_session_callbacks_set_data_source_read_length_callback2
- nghttp2_session_callbacks_set_pack_extension_callback =>
nghttp2_session_callbacks_set_pack_extension_callback2
- nghttp2_session_callbacks_set_recv_callback =>
nghttp2_session_callbacks_set_recv_callback2
- nghttp2_session_callbacks_set_select_padding_callback =>
nghttp2_session_callbacks_set_select_padding_callback2
- nghttp2_session_callbacks_set_send_callback =>
nghttp2_session_callbacks_set_send_callback2
- nghttp2_session_mem_recv => nghttp2_session_mem_recv2
- nghttp2_session_mem_send => nghttp2_session_mem_send2
- nghttp2_submit_data => nghttp2_submit_data2
- nghttp2_submit_request => nghttp2_submit_request2
- nghttp2_submit_response => nghttp2_submit_response2
For those applications that do not want to see ssize_t in nghttp2.h
header file, define NGHTTP2_NO_SSIZE_T macro before including
nghttp2.h. It hides all ssize_t APIs.
llhttp does not include URL parser. We extracted URL parser code from
http-parser and put it under third-party/url-parser.
llhttp bd3d224eb8cdc92c6fc8f508d7bbe0ba266e8e92
NPN has been superseeded by ALPN. OpenSSL provides a configure
option to disable npn (no-npn) which results in an OpenSSL
installation that defines OPENSSL_NO_NEXTPROTONEG in opensslconf.h
The #ifdef's look safe here (as the next_proto is initialized as
nullptr). Alteratively, macros could be defined for the used npn
methods that return a 0 for next_proto.
Signed-off-by: Bernard Spil <brnrd@FreeBSD.org>
This commit adds ALPN support to tutorial client/server. It also adds
a code to check h2 was negotiated, if not, drop connection.
For tutorial server, now it sends connection preface just after TLS
handshake was made without waiting for the client connection preface.
The COMPILE_LANGUAGE generator expression is only supported since CMake
3.3. Moreover, it does not work with all generators (works with Makefile
and Ninja, but not with Visual Studio).
target_compile_options would only work if a target does not mix C and
C++ sources, since the flags are intended to be set for a specific
language, use set_source_files_properties instead. This approach is also
less repetitive.
Drop the idea of using lists and COMPILE_OPTIONS,
set_source_files_properties only understands COMPILE_FLAGS (a single
string, not a list).
Fixes the following two warnings:
examples/client.c:292:0: error: macro "MAX_OUTLEN" is not used [-Werror=unused-macros]
examples/tiny-nghttpd.c:298:13: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
Caught using cmake as the autoconf check fails due to unused macros
(HAVE_xxx in conftest.c) and a main function without parameters
respectively.
Compile with BoringSSL except for neverbleed and libnghttp2_asio. The
former uses ENGINE and RSA_METHOD, and they are quite different
between OpenSSL and BoringSSL. The latter uses boost::asio, which
calls OpenSSL functions deleted in BoringSSL.