Merge branch 'Wunused-parameter' of https://github.com/alagoutte/nghttp2 into alagoutte-Wunused-parameter
This commit is contained in:
commit
fe634e5326
15
configure.ac
15
configure.ac
|
@ -140,6 +140,20 @@ else
|
||||||
AC_SUBST([CYTHON])
|
AC_SUBST([CYTHON])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# If we're running GCC or clang define _U_ to be "__attribute__((unused))"
|
||||||
|
# so we can use _U_ to flag unused function parameters and not get warnings
|
||||||
|
# about them. Otherwise, define _U_ to be an empty string so that _U_ used
|
||||||
|
# to flag an unused function parameters will compile with other compilers.
|
||||||
|
#
|
||||||
|
# XXX - similar hints for other compilers?
|
||||||
|
#
|
||||||
|
if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
|
||||||
|
AC_DEFINE([_U_], [__attribute__((unused))], [Hint to the compiler that a function parameters is not used])
|
||||||
|
else
|
||||||
|
AC_DEFINE([_U_], , [Hint to the compiler that a function parameters is not used])
|
||||||
|
fi
|
||||||
|
|
||||||
AX_CXX_COMPILE_STDCXX_11([noext], [optional])
|
AX_CXX_COMPILE_STDCXX_11([noext], [optional])
|
||||||
|
|
||||||
AC_LANG_PUSH(C++)
|
AC_LANG_PUSH(C++)
|
||||||
|
@ -529,7 +543,6 @@ if test "x$werror" != "xno"; then
|
||||||
AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"])
|
AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"])
|
||||||
AX_CHECK_COMPILE_FLAG([-Wclobbered], [CFLAGS="$CFLAGS -Wclobbered"])
|
AX_CHECK_COMPILE_FLAG([-Wclobbered], [CFLAGS="$CFLAGS -Wclobbered"])
|
||||||
AX_CHECK_COMPILE_FLAG([-Wvla], [CFLAGS="$CFLAGS -Wvla"])
|
AX_CHECK_COMPILE_FLAG([-Wvla], [CFLAGS="$CFLAGS -Wvla"])
|
||||||
AX_CHECK_COMPILE_FLAG([-Wno-unused-parameter], [CFLAGS="$CFLAGS -Wno-unused-parameter"])
|
|
||||||
AX_CHECK_COMPILE_FLAG([-Wpragmas], [CFLAGS="$CFLAGS -Wpragmas"])
|
AX_CHECK_COMPILE_FLAG([-Wpragmas], [CFLAGS="$CFLAGS -Wpragmas"])
|
||||||
AX_CHECK_COMPILE_FLAG([-Wunreachable-code], [CFLAGS="$CFLAGS -Wunreachable-code"])
|
AX_CHECK_COMPILE_FLAG([-Wunreachable-code], [CFLAGS="$CFLAGS -Wunreachable-code"])
|
||||||
AX_CHECK_COMPILE_FLAG([-Waddress], [CFLAGS="$CFLAGS -Waddress"])
|
AX_CHECK_COMPILE_FLAG([-Waddress], [CFLAGS="$CFLAGS -Waddress"])
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
#include <nghttp2/nghttp2.h>
|
#include <nghttp2/nghttp2.h>
|
||||||
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
|
@ -144,8 +145,8 @@ static void diec(const char *func, int error_code)
|
||||||
* bytes actually written. See the documentation of
|
* bytes actually written. See the documentation of
|
||||||
* nghttp2_send_callback for the details.
|
* nghttp2_send_callback for the details.
|
||||||
*/
|
*/
|
||||||
static ssize_t send_callback(nghttp2_session *session,
|
static ssize_t send_callback(nghttp2_session *session _U_,
|
||||||
const uint8_t *data, size_t length, int flags,
|
const uint8_t *data, size_t length, int flags _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct Connection *connection;
|
struct Connection *connection;
|
||||||
|
@ -173,8 +174,8 @@ static ssize_t send_callback(nghttp2_session *session,
|
||||||
* |length| bytes. Returns the number of bytes stored in |buf|. See
|
* |length| bytes. Returns the number of bytes stored in |buf|. See
|
||||||
* the documentation of nghttp2_recv_callback for the details.
|
* the documentation of nghttp2_recv_callback for the details.
|
||||||
*/
|
*/
|
||||||
static ssize_t recv_callback(nghttp2_session *session,
|
static ssize_t recv_callback(nghttp2_session *session _U_,
|
||||||
uint8_t *buf, size_t length, int flags,
|
uint8_t *buf, size_t length, int flags _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct Connection *connection;
|
struct Connection *connection;
|
||||||
|
@ -199,7 +200,7 @@ static ssize_t recv_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_send_callback(nghttp2_session *session,
|
static int on_frame_send_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame, void *user_data)
|
const nghttp2_frame *frame, void *user_data _U_)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
switch(frame->hd.type) {
|
switch(frame->hd.type) {
|
||||||
|
@ -226,7 +227,7 @@ static int on_frame_send_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_recv_callback(nghttp2_session *session,
|
static int on_frame_recv_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame, void *user_data)
|
const nghttp2_frame *frame, void *user_data _U_)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
switch(frame->hd.type) {
|
switch(frame->hd.type) {
|
||||||
|
@ -264,8 +265,8 @@ static int on_frame_recv_callback(nghttp2_session *session,
|
||||||
*/
|
*/
|
||||||
static int on_stream_close_callback(nghttp2_session *session,
|
static int on_stream_close_callback(nghttp2_session *session,
|
||||||
int32_t stream_id,
|
int32_t stream_id,
|
||||||
nghttp2_error_code error_code,
|
uint32_t error_code _U_,
|
||||||
void *user_data)
|
void *user_data _U_)
|
||||||
{
|
{
|
||||||
struct Request *req;
|
struct Request *req;
|
||||||
req = nghttp2_session_get_stream_user_data(session, stream_id);
|
req = nghttp2_session_get_stream_user_data(session, stream_id);
|
||||||
|
@ -286,10 +287,10 @@ static int on_stream_close_callback(nghttp2_session *session,
|
||||||
* The implementation of nghttp2_on_data_chunk_recv_callback type. We
|
* The implementation of nghttp2_on_data_chunk_recv_callback type. We
|
||||||
* use this function to print the received response body.
|
* use this function to print the received response body.
|
||||||
*/
|
*/
|
||||||
static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags,
|
static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags _U_,
|
||||||
int32_t stream_id,
|
int32_t stream_id,
|
||||||
const uint8_t *data, size_t len,
|
const uint8_t *data, size_t len,
|
||||||
void *user_data)
|
void *user_data _U_)
|
||||||
{
|
{
|
||||||
struct Request *req;
|
struct Request *req;
|
||||||
req = nghttp2_session_get_stream_user_data(session, stream_id);
|
req = nghttp2_session_get_stream_user_data(session, stream_id);
|
||||||
|
@ -332,10 +333,10 @@ static void setup_nghttp2_callbacks(nghttp2_session_callbacks *callbacks)
|
||||||
* HTTP/2 protocol, if server does not offer HTTP/2 the nghttp2
|
* HTTP/2 protocol, if server does not offer HTTP/2 the nghttp2
|
||||||
* library supports, we terminate program.
|
* library supports, we terminate program.
|
||||||
*/
|
*/
|
||||||
static int select_next_proto_cb(SSL* ssl,
|
static int select_next_proto_cb(SSL* ssl _U_,
|
||||||
unsigned char **out, unsigned char *outlen,
|
unsigned char **out, unsigned char *outlen,
|
||||||
const unsigned char *in, unsigned int inlen,
|
const unsigned char *in, unsigned int inlen,
|
||||||
void *arg)
|
void *arg _U_)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
/* nghttp2_select_next_protocol() selects HTTP/2 protocol the
|
/* nghttp2_select_next_protocol() selects HTTP/2 protocol the
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ static void deflate(nghttp2_hd_deflater *deflater,
|
||||||
static int inflate_header_block(nghttp2_hd_inflater *inflater,
|
static int inflate_header_block(nghttp2_hd_inflater *inflater,
|
||||||
uint8_t *in, size_t inlen, int final);
|
uint8_t *in, size_t inlen, int final);
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc _U_, char **argv _U_)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
nghttp2_hd_deflater *deflater;
|
nghttp2_hd_deflater *deflater;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <config.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -179,9 +180,9 @@ static void print_headers(FILE *f, nghttp2_nv *nva, size_t nvlen)
|
||||||
/* nghttp2_send_callback. Here we transmit the |data|, |length| bytes,
|
/* nghttp2_send_callback. Here we transmit the |data|, |length| bytes,
|
||||||
to the network. Because we are using libevent bufferevent, we just
|
to the network. Because we are using libevent bufferevent, we just
|
||||||
write those bytes into bufferevent buffer. */
|
write those bytes into bufferevent buffer. */
|
||||||
static ssize_t send_callback(nghttp2_session *session,
|
static ssize_t send_callback(nghttp2_session *session _U_,
|
||||||
const uint8_t *data, size_t length,
|
const uint8_t *data, size_t length,
|
||||||
int flags, void *user_data)
|
int flags _U_, void *user_data)
|
||||||
{
|
{
|
||||||
http2_session_data *session_data = (http2_session_data*)user_data;
|
http2_session_data *session_data = (http2_session_data*)user_data;
|
||||||
struct bufferevent *bev = session_data->bev;
|
struct bufferevent *bev = session_data->bev;
|
||||||
|
@ -191,11 +192,11 @@ static ssize_t send_callback(nghttp2_session *session,
|
||||||
|
|
||||||
/* nghttp2_on_header_callback: Called when nghttp2 library emits
|
/* nghttp2_on_header_callback: Called when nghttp2 library emits
|
||||||
single header name/value pair. */
|
single header name/value pair. */
|
||||||
static int on_header_callback(nghttp2_session *session,
|
static int on_header_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
uint8_t flags,
|
uint8_t flags _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
http2_session_data *session_data = (http2_session_data*)user_data;
|
http2_session_data *session_data = (http2_session_data*)user_data;
|
||||||
|
@ -213,7 +214,7 @@ static int on_header_callback(nghttp2_session *session,
|
||||||
|
|
||||||
/* nghttp2_on_begin_headers_callback: Called when nghttp2 library gets
|
/* nghttp2_on_begin_headers_callback: Called when nghttp2 library gets
|
||||||
started to receive header block. */
|
started to receive header block. */
|
||||||
static int on_begin_headers_callback(nghttp2_session *session,
|
static int on_begin_headers_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -232,7 +233,7 @@ static int on_begin_headers_callback(nghttp2_session *session,
|
||||||
|
|
||||||
/* nghttp2_on_frame_recv_callback: Called when nghttp2 library
|
/* nghttp2_on_frame_recv_callback: Called when nghttp2 library
|
||||||
received a complete frame from the remote peer. */
|
received a complete frame from the remote peer. */
|
||||||
static int on_frame_recv_callback(nghttp2_session *session,
|
static int on_frame_recv_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame *frame, void *user_data)
|
const nghttp2_frame *frame, void *user_data)
|
||||||
{
|
{
|
||||||
http2_session_data *session_data = (http2_session_data*)user_data;
|
http2_session_data *session_data = (http2_session_data*)user_data;
|
||||||
|
@ -252,7 +253,7 @@ static int on_frame_recv_callback(nghttp2_session *session,
|
||||||
is meant to the stream we initiated, print the received data in
|
is meant to the stream we initiated, print the received data in
|
||||||
stdout, so that the user can redirect its output to the file
|
stdout, so that the user can redirect its output to the file
|
||||||
easily. */
|
easily. */
|
||||||
static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags,
|
static int on_data_chunk_recv_callback(nghttp2_session *session _U_, uint8_t flags _U_,
|
||||||
int32_t stream_id,
|
int32_t stream_id,
|
||||||
const uint8_t *data, size_t len,
|
const uint8_t *data, size_t len,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
|
@ -290,10 +291,10 @@ static int on_stream_close_callback(nghttp2_session *session,
|
||||||
/* NPN TLS extension client callback. We check that server advertised
|
/* NPN TLS extension client callback. We check that server advertised
|
||||||
the HTTP/2 protocol the nghttp2 library supports. If not, exit
|
the HTTP/2 protocol the nghttp2 library supports. If not, exit
|
||||||
the program. */
|
the program. */
|
||||||
static int select_next_proto_cb(SSL* ssl,
|
static int select_next_proto_cb(SSL* ssl _U_,
|
||||||
unsigned char **out, unsigned char *outlen,
|
unsigned char **out, unsigned char *outlen,
|
||||||
const unsigned char *in, unsigned int inlen,
|
const unsigned char *in, unsigned int inlen,
|
||||||
void *arg)
|
void *arg _U_)
|
||||||
{
|
{
|
||||||
if(nghttp2_select_next_protocol(out, outlen, in, inlen) <= 0) {
|
if(nghttp2_select_next_protocol(out, outlen, in, inlen) <= 0) {
|
||||||
errx(1, "Server did not advertise " NGHTTP2_PROTO_VERSION_ID);
|
errx(1, "Server did not advertise " NGHTTP2_PROTO_VERSION_ID);
|
||||||
|
@ -454,7 +455,7 @@ static void readcb(struct bufferevent *bev, void *ptr)
|
||||||
receiving GOAWAY, we check the some conditions on the nghttp2
|
receiving GOAWAY, we check the some conditions on the nghttp2
|
||||||
library and output buffer of bufferevent. If it indicates we have
|
library and output buffer of bufferevent. If it indicates we have
|
||||||
no business to this session, tear down the connection. */
|
no business to this session, tear down the connection. */
|
||||||
static void writecb(struct bufferevent *bev, void *ptr)
|
static void writecb(struct bufferevent *bev _U_, void *ptr)
|
||||||
{
|
{
|
||||||
http2_session_data *session_data = (http2_session_data*)ptr;
|
http2_session_data *session_data = (http2_session_data*)ptr;
|
||||||
if(nghttp2_session_want_read(session_data->session) == 0 &&
|
if(nghttp2_session_want_read(session_data->session) == 0 &&
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include <config.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
@ -79,8 +80,8 @@ struct app_context {
|
||||||
static unsigned char next_proto_list[256];
|
static unsigned char next_proto_list[256];
|
||||||
static size_t next_proto_list_len;
|
static size_t next_proto_list_len;
|
||||||
|
|
||||||
static int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len,
|
static int next_proto_cb(SSL *s _U_, const unsigned char **data, unsigned int *len,
|
||||||
void *arg)
|
void *arg _U_)
|
||||||
{
|
{
|
||||||
*data = next_proto_list;
|
*data = next_proto_list;
|
||||||
*len = (unsigned int)next_proto_list_len;
|
*len = (unsigned int)next_proto_list_len;
|
||||||
|
@ -140,7 +141,7 @@ static void add_stream(http2_session_data *session_data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remove_stream(http2_session_data *session_data,
|
static void remove_stream(http2_session_data *session_data _U_,
|
||||||
http2_stream_data *stream_data)
|
http2_stream_data *stream_data)
|
||||||
{
|
{
|
||||||
stream_data->prev->next = stream_data->next;
|
stream_data->prev->next = stream_data->next;
|
||||||
|
@ -259,9 +260,9 @@ static int session_recv(http2_session_data *session_data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t send_callback(nghttp2_session *session,
|
static ssize_t send_callback(nghttp2_session *session _U_,
|
||||||
const uint8_t *data, size_t length,
|
const uint8_t *data, size_t length,
|
||||||
int flags, void *user_data)
|
int flags _U_, void *user_data)
|
||||||
{
|
{
|
||||||
http2_session_data *session_data = (http2_session_data*)user_data;
|
http2_session_data *session_data = (http2_session_data*)user_data;
|
||||||
struct bufferevent *bev = session_data->bev;
|
struct bufferevent *bev = session_data->bev;
|
||||||
|
@ -330,9 +331,9 @@ static char* percent_decode(const uint8_t *value, size_t valuelen)
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t file_read_callback
|
static ssize_t file_read_callback
|
||||||
(nghttp2_session *session, int32_t stream_id,
|
(nghttp2_session *session _U_, int32_t stream_id _U_,
|
||||||
uint8_t *buf, size_t length, uint32_t *data_flags,
|
uint8_t *buf, size_t length, uint32_t *data_flags,
|
||||||
nghttp2_data_source *source, void *user_data)
|
nghttp2_data_source *source, void *user_data _U_)
|
||||||
{
|
{
|
||||||
int fd = source->fd;
|
int fd = source->fd;
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
|
@ -412,8 +413,8 @@ static int on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
uint8_t flags,
|
uint8_t flags _U_,
|
||||||
void *user_data)
|
void *user_data _U_)
|
||||||
{
|
{
|
||||||
http2_stream_data *stream_data;
|
http2_stream_data *stream_data;
|
||||||
const char PATH[] = ":path";
|
const char PATH[] = ":path";
|
||||||
|
@ -536,7 +537,7 @@ static int on_frame_recv_callback(nghttp2_session *session,
|
||||||
|
|
||||||
static int on_stream_close_callback(nghttp2_session *session,
|
static int on_stream_close_callback(nghttp2_session *session,
|
||||||
int32_t stream_id,
|
int32_t stream_id,
|
||||||
nghttp2_error_code error_code,
|
uint32_t error_code _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
http2_session_data *session_data = (http2_session_data*)user_data;
|
http2_session_data *session_data = (http2_session_data*)user_data;
|
||||||
|
@ -607,7 +608,7 @@ static int send_server_connection_header(http2_session_data *session_data)
|
||||||
|
|
||||||
/* readcb for bufferevent after client connection header was
|
/* readcb for bufferevent after client connection header was
|
||||||
checked. */
|
checked. */
|
||||||
static void readcb(struct bufferevent *bev, void *ptr)
|
static void readcb(struct bufferevent *bev _U_, void *ptr)
|
||||||
{
|
{
|
||||||
http2_session_data *session_data = (http2_session_data*)ptr;
|
http2_session_data *session_data = (http2_session_data*)ptr;
|
||||||
if(session_recv(session_data) != 0) {
|
if(session_recv(session_data) != 0) {
|
||||||
|
@ -642,7 +643,7 @@ static void writecb(struct bufferevent *bev, void *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eventcb for bufferevent */
|
/* eventcb for bufferevent */
|
||||||
static void eventcb(struct bufferevent *bev, short events, void *ptr)
|
static void eventcb(struct bufferevent *bev _U_, short events, void *ptr)
|
||||||
{
|
{
|
||||||
http2_session_data *session_data = (http2_session_data*)ptr;
|
http2_session_data *session_data = (http2_session_data*)ptr;
|
||||||
if(events & BEV_EVENT_CONNECTED) {
|
if(events & BEV_EVENT_CONNECTED) {
|
||||||
|
@ -668,7 +669,7 @@ static void eventcb(struct bufferevent *bev, short events, void *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* callback for evconnlistener */
|
/* callback for evconnlistener */
|
||||||
static void acceptcb(struct evconnlistener *listener, int fd,
|
static void acceptcb(struct evconnlistener *listener _U_, int fd,
|
||||||
struct sockaddr *addr, int addrlen, void *arg)
|
struct sockaddr *addr, int addrlen, void *arg)
|
||||||
{
|
{
|
||||||
app_context *app_ctx = (app_context*)arg;
|
app_context *app_ctx = (app_context*)arg;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
* overhead of underlying I/O library (e.g., libevent, Boost ASIO).
|
* overhead of underlying I/O library (e.g., libevent, Boost ASIO).
|
||||||
*/
|
*/
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
#include <config.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -532,7 +533,7 @@ static int io_loop_mod(io_loop *loop, int fd, uint32_t events, void *ptr)
|
||||||
return io_loop_ctl(loop, EPOLL_CTL_MOD, fd, events, ptr);
|
return io_loop_ctl(loop, EPOLL_CTL_MOD, fd, events, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int io_loop_run(io_loop *loop, server *serv)
|
static int io_loop_run(io_loop *loop, server *serv _U_)
|
||||||
{
|
{
|
||||||
#define NUM_EVENTS 1024
|
#define NUM_EVENTS 1024
|
||||||
struct epoll_event events[NUM_EVENTS];
|
struct epoll_event events[NUM_EVENTS];
|
||||||
|
@ -557,7 +558,7 @@ static int io_loop_run(io_loop *loop, server *serv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_timer(io_loop *loop, uint32_t events, void *ptr)
|
static int handle_timer(io_loop *loop _U_, uint32_t events _U_, void *ptr)
|
||||||
{
|
{
|
||||||
timer *tmr = ptr;
|
timer *tmr = ptr;
|
||||||
int64_t buf;
|
int64_t buf;
|
||||||
|
@ -572,7 +573,7 @@ static int handle_timer(io_loop *loop, uint32_t events, void *ptr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_accept(io_loop *loop, uint32_t events, void *ptr)
|
static int handle_accept(io_loop *loop, uint32_t events _U_, void *ptr)
|
||||||
{
|
{
|
||||||
int acfd;
|
int acfd;
|
||||||
server *serv = ptr;
|
server *serv = ptr;
|
||||||
|
@ -629,9 +630,9 @@ static void stream_error
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t fd_read_callback
|
static ssize_t fd_read_callback
|
||||||
(nghttp2_session *session, int32_t stream_id,
|
(nghttp2_session *session _U_, int32_t stream_id _U_,
|
||||||
uint8_t *buf, size_t length, uint32_t *data_flags,
|
uint8_t *buf, size_t length, uint32_t *data_flags,
|
||||||
nghttp2_data_source *source, void *user_data)
|
nghttp2_data_source *source, void *user_data _U_)
|
||||||
{
|
{
|
||||||
stream *strm = source->ptr;
|
stream *strm = source->ptr;
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
|
@ -651,9 +652,9 @@ static ssize_t fd_read_callback
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t resbuf_read_callback
|
static ssize_t resbuf_read_callback
|
||||||
(nghttp2_session *session, int32_t stream_id,
|
(nghttp2_session *session _U_, int32_t stream_id _U_,
|
||||||
uint8_t *buf, size_t length, uint32_t *data_flags,
|
uint8_t *buf, size_t length, uint32_t *data_flags,
|
||||||
nghttp2_data_source *source, void *user_data)
|
nghttp2_data_source *source, void *user_data _U_)
|
||||||
{
|
{
|
||||||
stream *strm = source->ptr;
|
stream *strm = source->ptr;
|
||||||
size_t left = strm->res_end - strm->res_begin;
|
size_t left = strm->res_end - strm->res_begin;
|
||||||
|
@ -715,7 +716,7 @@ static int check_path(const char *path, size_t len)
|
||||||
(len < 2 || memcmp(path + len - 2, "/.", 2) != 0);
|
(len < 2 || memcmp(path + len - 2, "/.", 2) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int make_path(io_buf *pathbuf, const char *req, size_t reqlen)
|
static int make_path(io_buf *pathbuf, const char *req, size_t reqlen _U_)
|
||||||
{
|
{
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
|
|
||||||
|
@ -953,7 +954,7 @@ static int on_begin_headers_callback
|
||||||
static int on_header_callback
|
static int on_header_callback
|
||||||
(nghttp2_session *session, const nghttp2_frame *frame,
|
(nghttp2_session *session, const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen, const uint8_t *value, size_t valuelen,
|
const uint8_t *name, size_t namelen, const uint8_t *value, size_t valuelen,
|
||||||
uint8_t flags, void *user_data)
|
uint8_t flags _U_, void *user_data)
|
||||||
{
|
{
|
||||||
connection *conn = user_data;
|
connection *conn = user_data;
|
||||||
stream *strm;
|
stream *strm;
|
||||||
|
@ -1079,8 +1080,8 @@ static int on_frame_recv_callback
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_stream_close_callback
|
static int on_stream_close_callback
|
||||||
(nghttp2_session *session, int32_t stream_id, uint32_t error_code,
|
(nghttp2_session *session, int32_t stream_id, uint32_t error_code _U_,
|
||||||
void *user_data)
|
void *user_data _U_)
|
||||||
{
|
{
|
||||||
stream *strm;
|
stream *strm;
|
||||||
|
|
||||||
|
@ -1096,7 +1097,7 @@ static int on_stream_close_callback
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_not_send_callback
|
static int on_frame_not_send_callback
|
||||||
(nghttp2_session *session, const nghttp2_frame *frame, int lib_error_code,
|
(nghttp2_session *session _U_, const nghttp2_frame *frame, int lib_error_code _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
connection *conn = user_data;
|
connection *conn = user_data;
|
||||||
|
|
|
@ -94,7 +94,7 @@ void nghttp2_frame_priority_init(nghttp2_priority *frame, int32_t stream_id,
|
||||||
frame->pri_spec = *pri_spec;
|
frame->pri_spec = *pri_spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nghttp2_frame_priority_free(nghttp2_priority *frame)
|
void nghttp2_frame_priority_free(nghttp2_priority *frame _U_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void nghttp2_frame_rst_stream_init(nghttp2_rst_stream *frame,
|
void nghttp2_frame_rst_stream_init(nghttp2_rst_stream *frame,
|
||||||
|
@ -106,7 +106,7 @@ void nghttp2_frame_rst_stream_init(nghttp2_rst_stream *frame,
|
||||||
frame->error_code = error_code;
|
frame->error_code = error_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nghttp2_frame_rst_stream_free(nghttp2_rst_stream *frame)
|
void nghttp2_frame_rst_stream_free(nghttp2_rst_stream *frame _U_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ void nghttp2_frame_ping_init(nghttp2_ping *frame, uint8_t flags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nghttp2_frame_ping_free(nghttp2_ping *frame)
|
void nghttp2_frame_ping_free(nghttp2_ping *frame _U_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void nghttp2_frame_goaway_init(nghttp2_goaway *frame, int32_t last_stream_id,
|
void nghttp2_frame_goaway_init(nghttp2_goaway *frame, int32_t last_stream_id,
|
||||||
|
@ -185,7 +185,7 @@ void nghttp2_frame_window_update_init(nghttp2_window_update *frame,
|
||||||
frame->reserved = 0;
|
frame->reserved = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nghttp2_frame_window_update_free(nghttp2_window_update *frame)
|
void nghttp2_frame_window_update_free(nghttp2_window_update *frame _U_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void nghttp2_frame_altsvc_init(nghttp2_extension *frame, int32_t stream_id,
|
void nghttp2_frame_altsvc_init(nghttp2_extension *frame, int32_t stream_id,
|
||||||
|
@ -242,7 +242,7 @@ void nghttp2_frame_data_init(nghttp2_data *frame, uint8_t flags,
|
||||||
frame->padlen = 0;
|
frame->padlen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nghttp2_frame_data_free(nghttp2_data *frame)
|
void nghttp2_frame_data_free(nghttp2_data *frame _U_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
size_t nghttp2_frame_priority_len(uint8_t flags)
|
size_t nghttp2_frame_priority_len(uint8_t flags)
|
||||||
|
@ -382,9 +382,9 @@ void nghttp2_frame_pack_priority_spec(uint8_t *buf,
|
||||||
}
|
}
|
||||||
|
|
||||||
void nghttp2_frame_unpack_priority_spec(nghttp2_priority_spec *pri_spec,
|
void nghttp2_frame_unpack_priority_spec(nghttp2_priority_spec *pri_spec,
|
||||||
uint8_t flags,
|
uint8_t flags _U_,
|
||||||
const uint8_t *payload,
|
const uint8_t *payload,
|
||||||
size_t payloadlen)
|
size_t payloadlen _U_)
|
||||||
{
|
{
|
||||||
int32_t dep_stream_id;
|
int32_t dep_stream_id;
|
||||||
uint8_t exclusive;
|
uint8_t exclusive;
|
||||||
|
@ -466,7 +466,7 @@ int nghttp2_frame_pack_rst_stream(nghttp2_bufs *bufs,
|
||||||
|
|
||||||
void nghttp2_frame_unpack_rst_stream_payload(nghttp2_rst_stream *frame,
|
void nghttp2_frame_unpack_rst_stream_payload(nghttp2_rst_stream *frame,
|
||||||
const uint8_t *payload,
|
const uint8_t *payload,
|
||||||
size_t payloadlen)
|
size_t payloadlen _U_)
|
||||||
{
|
{
|
||||||
frame->error_code = nghttp2_get_uint32(payload);
|
frame->error_code = nghttp2_get_uint32(payload);
|
||||||
}
|
}
|
||||||
|
@ -602,7 +602,7 @@ int nghttp2_frame_pack_push_promise(nghttp2_bufs *bufs,
|
||||||
|
|
||||||
int nghttp2_frame_unpack_push_promise_payload(nghttp2_push_promise *frame,
|
int nghttp2_frame_unpack_push_promise_payload(nghttp2_push_promise *frame,
|
||||||
const uint8_t *payload,
|
const uint8_t *payload,
|
||||||
size_t payloadlen)
|
size_t payloadlen _U_)
|
||||||
{
|
{
|
||||||
frame->promised_stream_id = nghttp2_get_uint32(payload) &
|
frame->promised_stream_id = nghttp2_get_uint32(payload) &
|
||||||
NGHTTP2_STREAM_ID_MASK;
|
NGHTTP2_STREAM_ID_MASK;
|
||||||
|
@ -633,7 +633,7 @@ int nghttp2_frame_pack_ping(nghttp2_bufs *bufs, nghttp2_ping *frame)
|
||||||
|
|
||||||
void nghttp2_frame_unpack_ping_payload(nghttp2_ping *frame,
|
void nghttp2_frame_unpack_ping_payload(nghttp2_ping *frame,
|
||||||
const uint8_t *payload,
|
const uint8_t *payload,
|
||||||
size_t payloadlen)
|
size_t payloadlen _U_)
|
||||||
{
|
{
|
||||||
memcpy(frame->opaque_data, payload, sizeof(frame->opaque_data));
|
memcpy(frame->opaque_data, payload, sizeof(frame->opaque_data));
|
||||||
}
|
}
|
||||||
|
@ -672,7 +672,7 @@ int nghttp2_frame_pack_goaway(nghttp2_bufs *bufs, nghttp2_goaway *frame)
|
||||||
|
|
||||||
void nghttp2_frame_unpack_goaway_payload(nghttp2_goaway *frame,
|
void nghttp2_frame_unpack_goaway_payload(nghttp2_goaway *frame,
|
||||||
const uint8_t *payload,
|
const uint8_t *payload,
|
||||||
size_t payloadlen,
|
size_t payloadlen _U_,
|
||||||
uint8_t *var_gift_payload,
|
uint8_t *var_gift_payload,
|
||||||
size_t var_gift_payloadlen)
|
size_t var_gift_payloadlen)
|
||||||
{
|
{
|
||||||
|
@ -739,7 +739,7 @@ int nghttp2_frame_pack_window_update(nghttp2_bufs *bufs,
|
||||||
|
|
||||||
void nghttp2_frame_unpack_window_update_payload(nghttp2_window_update *frame,
|
void nghttp2_frame_unpack_window_update_payload(nghttp2_window_update *frame,
|
||||||
const uint8_t *payload,
|
const uint8_t *payload,
|
||||||
size_t payloadlen)
|
size_t payloadlen _U_)
|
||||||
{
|
{
|
||||||
frame->window_size_increment = nghttp2_get_uint32(payload) &
|
frame->window_size_increment = nghttp2_get_uint32(payload) &
|
||||||
NGHTTP2_WINDOW_SIZE_INCREMENT_MASK;
|
NGHTTP2_WINDOW_SIZE_INCREMENT_MASK;
|
||||||
|
@ -803,7 +803,7 @@ int nghttp2_frame_pack_altsvc(nghttp2_bufs *bufs, nghttp2_extension *frame)
|
||||||
|
|
||||||
int nghttp2_frame_unpack_altsvc_payload(nghttp2_extension *frame,
|
int nghttp2_frame_unpack_altsvc_payload(nghttp2_extension *frame,
|
||||||
const uint8_t *payload,
|
const uint8_t *payload,
|
||||||
size_t payloadlen,
|
size_t payloadlen _U_,
|
||||||
uint8_t *var_gift_payload,
|
uint8_t *var_gift_payload,
|
||||||
size_t var_gift_payloadlen)
|
size_t var_gift_payloadlen)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1141,7 +1141,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater,
|
||||||
return (ssize_t)buflen;
|
return (ssize_t)buflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater,
|
size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater _U_,
|
||||||
const nghttp2_nv *nva, size_t nvlen)
|
const nghttp2_nv *nva, size_t nvlen)
|
||||||
{
|
{
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
|
|
|
@ -1233,7 +1233,7 @@ static int stream_predicate_for_send(nghttp2_stream *stream)
|
||||||
* received.
|
* received.
|
||||||
*/
|
*/
|
||||||
static int session_predicate_request_headers_send
|
static int session_predicate_request_headers_send
|
||||||
(nghttp2_session *session, nghttp2_headers *frame)
|
(nghttp2_session *session, nghttp2_headers *frame _U_)
|
||||||
{
|
{
|
||||||
if(session->goaway_flags) {
|
if(session->goaway_flags) {
|
||||||
/* When GOAWAY is sent or received, peer must not send new request
|
/* When GOAWAY is sent or received, peer must not send new request
|
||||||
|
@ -1302,7 +1302,7 @@ static int session_predicate_response_headers_send
|
||||||
* RST_STREAM was queued for this stream.
|
* RST_STREAM was queued for this stream.
|
||||||
*/
|
*/
|
||||||
static int session_predicate_push_response_headers_send
|
static int session_predicate_push_response_headers_send
|
||||||
(nghttp2_session *session, nghttp2_stream *stream)
|
(nghttp2_session *session _U_, nghttp2_stream *stream)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
/* TODO Should disallow HEADERS if GOAWAY has already been issued? */
|
/* TODO Should disallow HEADERS if GOAWAY has already been issued? */
|
||||||
|
@ -1506,8 +1506,8 @@ static int session_predicate_altsvc_send
|
||||||
*
|
*
|
||||||
* Currently this function always returns 0.
|
* Currently this function always returns 0.
|
||||||
*/
|
*/
|
||||||
static int nghttp2_session_predicate_settings_send(nghttp2_session *session,
|
static int nghttp2_session_predicate_settings_send(nghttp2_session *session _U_,
|
||||||
nghttp2_frame *frame)
|
nghttp2_frame *frame _U_)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2815,7 +2815,7 @@ static int session_call_on_header(nghttp2_session *session,
|
||||||
* Out of memory.
|
* Out of memory.
|
||||||
*/
|
*/
|
||||||
static int session_handle_frame_size_error(nghttp2_session *session,
|
static int session_handle_frame_size_error(nghttp2_session *session,
|
||||||
nghttp2_frame *frame)
|
nghttp2_frame *frame _U_)
|
||||||
{
|
{
|
||||||
/* TODO Currently no callback is called for this error, because we
|
/* TODO Currently no callback is called for this error, because we
|
||||||
call this callback before reading any payload */
|
call this callback before reading any payload */
|
||||||
|
@ -2998,7 +2998,7 @@ static int inflate_header_block(nghttp2_session *session,
|
||||||
* NGHTTP2_ERR_NOMEM
|
* NGHTTP2_ERR_NOMEM
|
||||||
* Out of memory.
|
* Out of memory.
|
||||||
*/
|
*/
|
||||||
int nghttp2_session_end_request_headers_received(nghttp2_session *session,
|
int nghttp2_session_end_request_headers_received(nghttp2_session *session _U_,
|
||||||
nghttp2_frame *frame,
|
nghttp2_frame *frame,
|
||||||
nghttp2_stream *stream)
|
nghttp2_stream *stream)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,7 +74,7 @@ void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id,
|
||||||
stream->root_next = NULL;
|
stream->root_next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nghttp2_stream_free(nghttp2_stream *stream)
|
void nghttp2_stream_free(nghttp2_stream *stream _U_)
|
||||||
{
|
{
|
||||||
/* We don't free stream->data_item. If it is assigned to aob, then
|
/* We don't free stream->data_item. If it is assigned to aob, then
|
||||||
active_outbound_item_reset() will delete it. If it is queued,
|
active_outbound_item_reset() will delete it. If it is queued,
|
||||||
|
@ -1060,7 +1060,7 @@ void nghttp2_stream_roots_init(nghttp2_stream_roots *roots)
|
||||||
roots->num_streams = 0;
|
roots->num_streams = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nghttp2_stream_roots_free(nghttp2_stream_roots *roots)
|
void nghttp2_stream_roots_free(nghttp2_stream_roots *roots _U_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void nghttp2_stream_roots_add(nghttp2_stream_roots *roots,
|
void nghttp2_stream_roots_add(nghttp2_stream_roots *roots,
|
||||||
|
|
|
@ -178,13 +178,13 @@ int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int nghttp2_submit_ping(nghttp2_session *session, uint8_t flags,
|
int nghttp2_submit_ping(nghttp2_session *session, uint8_t flags _U_,
|
||||||
const uint8_t *opaque_data)
|
const uint8_t *opaque_data)
|
||||||
{
|
{
|
||||||
return nghttp2_session_add_ping(session, NGHTTP2_FLAG_NONE, opaque_data);
|
return nghttp2_session_add_ping(session, NGHTTP2_FLAG_NONE, opaque_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags,
|
int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags _U_,
|
||||||
int32_t stream_id,
|
int32_t stream_id,
|
||||||
const nghttp2_priority_spec *pri_spec)
|
const nghttp2_priority_spec *pri_spec)
|
||||||
{
|
{
|
||||||
|
@ -229,7 +229,7 @@ int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_submit_rst_stream(nghttp2_session *session, uint8_t flags,
|
int nghttp2_submit_rst_stream(nghttp2_session *session, uint8_t flags _U_,
|
||||||
int32_t stream_id,
|
int32_t stream_id,
|
||||||
uint32_t error_code)
|
uint32_t error_code)
|
||||||
{
|
{
|
||||||
|
@ -240,7 +240,7 @@ int nghttp2_submit_rst_stream(nghttp2_session *session, uint8_t flags,
|
||||||
return nghttp2_session_add_rst_stream(session, stream_id, error_code);
|
return nghttp2_session_add_rst_stream(session, stream_id, error_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_submit_goaway(nghttp2_session *session, uint8_t flags,
|
int nghttp2_submit_goaway(nghttp2_session *session, uint8_t flags _U_,
|
||||||
int32_t last_stream_id,
|
int32_t last_stream_id,
|
||||||
uint32_t error_code,
|
uint32_t error_code,
|
||||||
const uint8_t *opaque_data, size_t opaque_data_len)
|
const uint8_t *opaque_data, size_t opaque_data_len)
|
||||||
|
@ -249,13 +249,13 @@ int nghttp2_submit_goaway(nghttp2_session *session, uint8_t flags,
|
||||||
error_code, opaque_data, opaque_data_len);
|
error_code, opaque_data, opaque_data_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_submit_settings(nghttp2_session *session, uint8_t flags,
|
int nghttp2_submit_settings(nghttp2_session *session, uint8_t flags _U_,
|
||||||
const nghttp2_settings_entry *iv, size_t niv)
|
const nghttp2_settings_entry *iv, size_t niv)
|
||||||
{
|
{
|
||||||
return nghttp2_session_add_settings(session, NGHTTP2_FLAG_NONE, iv, niv);
|
return nghttp2_session_add_settings(session, NGHTTP2_FLAG_NONE, iv, niv);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t nghttp2_submit_push_promise(nghttp2_session *session, uint8_t flags,
|
int32_t nghttp2_submit_push_promise(nghttp2_session *session, uint8_t flags _U_,
|
||||||
int32_t stream_id,
|
int32_t stream_id,
|
||||||
const nghttp2_nv *nva, size_t nvlen,
|
const nghttp2_nv *nva, size_t nvlen,
|
||||||
void *promised_stream_user_data)
|
void *promised_stream_user_data)
|
||||||
|
@ -366,7 +366,7 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags,
|
int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags _U_,
|
||||||
int32_t stream_id,
|
int32_t stream_id,
|
||||||
uint32_t max_age, uint16_t port,
|
uint32_t max_age, uint16_t port,
|
||||||
const uint8_t *protocol_id, size_t protocol_id_len,
|
const uint8_t *protocol_id, size_t protocol_id_len,
|
||||||
|
|
|
@ -54,7 +54,7 @@ static int clean_suite1(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc _U_, char* argv[] _U_)
|
||||||
{
|
{
|
||||||
CU_pSuite pSuite = NULL;
|
CU_pSuite pSuite = NULL;
|
||||||
unsigned int num_tests_failed;
|
unsigned int num_tests_failed;
|
||||||
|
|
|
@ -103,7 +103,7 @@ static void shuffle(int *a, int n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int eachfun(nghttp2_map_entry *entry, void *ptr)
|
static int eachfun(nghttp2_map_entry *entry _U_, void *ptr _U_)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ void test_nghttp2_map_functional(void)
|
||||||
nghttp2_map_free(&map);
|
nghttp2_map_free(&map);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int entry_free(nghttp2_map_entry *entry, void *ptr)
|
static int entry_free(nghttp2_map_entry *entry, void *ptr _U_)
|
||||||
{
|
{
|
||||||
free(entry);
|
free(entry);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -89,7 +89,7 @@ static int node_compar(const void *lhs, const void *rhs)
|
||||||
return ln->key - rn->key;
|
return ln->key - rn->key;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int node_update(void *item, void *arg)
|
static int node_update(void *item, void *arg _U_)
|
||||||
{
|
{
|
||||||
node *nd = (node*)item;
|
node *nd = (node*)item;
|
||||||
if((nd->key % 2) == 0) {
|
if((nd->key % 2) == 0) {
|
||||||
|
|
|
@ -101,31 +101,31 @@ static void scripted_data_feed_init2(scripted_data_feed *df,
|
||||||
df->feedseq[0] = len;
|
df->feedseq[0] = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t null_send_callback(nghttp2_session *session,
|
static ssize_t null_send_callback(nghttp2_session *session _U_,
|
||||||
const uint8_t* data, size_t len, int flags,
|
const uint8_t* data _U_, size_t len, int flags _U_,
|
||||||
void *user_data)
|
void *user_data _U_)
|
||||||
{
|
{
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t fail_send_callback(nghttp2_session *session,
|
static ssize_t fail_send_callback(nghttp2_session *session _U_,
|
||||||
const uint8_t *data, size_t len, int flags,
|
const uint8_t *data _U_, size_t len _U_, int flags _U_,
|
||||||
void *user_data)
|
void *user_data _U_)
|
||||||
{
|
{
|
||||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t fixed_bytes_send_callback(nghttp2_session *session,
|
static ssize_t fixed_bytes_send_callback(nghttp2_session *session _U_,
|
||||||
const uint8_t *data, size_t len,
|
const uint8_t *data _U_, size_t len,
|
||||||
int flags, void *user_data)
|
int flags _U_, void *user_data)
|
||||||
{
|
{
|
||||||
size_t fixed_sendlen = ((my_user_data*)user_data)->fixed_sendlen;
|
size_t fixed_sendlen = ((my_user_data*)user_data)->fixed_sendlen;
|
||||||
return fixed_sendlen < len ? fixed_sendlen : len;
|
return fixed_sendlen < len ? fixed_sendlen : len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t scripted_recv_callback(nghttp2_session *session,
|
static ssize_t scripted_recv_callback(nghttp2_session *session _U_,
|
||||||
uint8_t* data, size_t len, int flags,
|
uint8_t* data, size_t len, int flags _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
scripted_data_feed *df = ((my_user_data*)user_data)->df;
|
scripted_data_feed *df = ((my_user_data*)user_data)->df;
|
||||||
|
@ -139,16 +139,16 @@ static ssize_t scripted_recv_callback(nghttp2_session *session,
|
||||||
return wlen;
|
return wlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t eof_recv_callback(nghttp2_session *session,
|
static ssize_t eof_recv_callback(nghttp2_session *session _U_,
|
||||||
uint8_t* data, size_t len, int flags,
|
uint8_t* data _U_, size_t len _U_, int flags _U_,
|
||||||
void *user_data)
|
void *user_data _U_)
|
||||||
{
|
{
|
||||||
return NGHTTP2_ERR_EOF;
|
return NGHTTP2_ERR_EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t accumulator_send_callback(nghttp2_session *session,
|
static ssize_t accumulator_send_callback(nghttp2_session *session _U_,
|
||||||
const uint8_t *buf, size_t len,
|
const uint8_t *buf, size_t len,
|
||||||
int flags, void* user_data)
|
int flags _U_, void* user_data)
|
||||||
{
|
{
|
||||||
accumulator *acc = ((my_user_data*)user_data)->acc;
|
accumulator *acc = ((my_user_data*)user_data)->acc;
|
||||||
assert(acc->length+len < sizeof(acc->buf));
|
assert(acc->length+len < sizeof(acc->buf));
|
||||||
|
@ -157,8 +157,8 @@ static ssize_t accumulator_send_callback(nghttp2_session *session,
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_begin_frame_callback(nghttp2_session *session,
|
static int on_begin_frame_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame_hd *hd,
|
const nghttp2_frame_hd *hd _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -166,7 +166,7 @@ static int on_begin_frame_callback(nghttp2_session *session,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_recv_callback(nghttp2_session *session,
|
static int on_frame_recv_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -176,9 +176,9 @@ static int on_frame_recv_callback(nghttp2_session *session,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_invalid_frame_recv_callback(nghttp2_session *session,
|
static int on_invalid_frame_recv_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame _U_,
|
||||||
nghttp2_error_code error_code,
|
nghttp2_error_code error_code _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -186,7 +186,7 @@ static int on_invalid_frame_recv_callback(nghttp2_session *session,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_send_callback(nghttp2_session *session,
|
static int on_frame_send_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,7 @@ static int on_frame_send_callback(nghttp2_session *session,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_frame_not_send_callback(nghttp2_session *session,
|
static int on_frame_not_send_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
int lib_error,
|
int lib_error,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
|
@ -208,9 +208,9 @@ static int on_frame_not_send_callback(nghttp2_session *session,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_data_chunk_recv_callback(nghttp2_session *session,
|
static int on_data_chunk_recv_callback(nghttp2_session *session _U_,
|
||||||
uint8_t flags, int32_t stream_id,
|
uint8_t flags _U_, int32_t stream_id _U_,
|
||||||
const uint8_t *data, size_t len,
|
const uint8_t *data _U_, size_t len,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -219,9 +219,9 @@ static int on_data_chunk_recv_callback(nghttp2_session *session,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pause_on_data_chunk_recv_callback(nghttp2_session *session,
|
static int pause_on_data_chunk_recv_callback(nghttp2_session *session _U_,
|
||||||
uint8_t flags, int32_t stream_id,
|
uint8_t flags _U_, int32_t stream_id _U_,
|
||||||
const uint8_t *data, size_t len,
|
const uint8_t *data _U_, size_t len _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -229,7 +229,7 @@ static int pause_on_data_chunk_recv_callback(nghttp2_session *session,
|
||||||
return NGHTTP2_ERR_PAUSE;
|
return NGHTTP2_ERR_PAUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t select_padding_callback(nghttp2_session *session,
|
static ssize_t select_padding_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
size_t max_payloadlen,
|
size_t max_payloadlen,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
|
@ -239,23 +239,23 @@ static ssize_t select_padding_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t too_large_data_source_length_callback
|
static ssize_t too_large_data_source_length_callback
|
||||||
(nghttp2_session *session, uint8_t frame_type, int32_t stream_id,
|
(nghttp2_session *session _U_, uint8_t frame_type _U_, int32_t stream_id _U_,
|
||||||
int32_t session_remote_window_size, int32_t stream_remote_window_size,
|
int32_t session_remote_window_size _U_, int32_t stream_remote_window_size _U_,
|
||||||
uint32_t remote_max_frame_size, void *user_data) {
|
uint32_t remote_max_frame_size _U_, void *user_data _U_) {
|
||||||
return NGHTTP2_MAX_FRAME_SIZE_MAX + 1;
|
return NGHTTP2_MAX_FRAME_SIZE_MAX + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t smallest_length_data_source_length_callback
|
static ssize_t smallest_length_data_source_length_callback
|
||||||
(nghttp2_session *session, uint8_t frame_type, int32_t stream_id,
|
(nghttp2_session *session _U_, uint8_t frame_type _U_, int32_t stream_id _U_,
|
||||||
int32_t session_remote_window_size, int32_t stream_remote_window_size,
|
int32_t session_remote_window_size _U_, int32_t stream_remote_window_size _U_,
|
||||||
uint32_t remote_max_frame_size, void *user_data) {
|
uint32_t remote_max_frame_size _U_, void *user_data _U_) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t fixed_length_data_source_read_callback
|
static ssize_t fixed_length_data_source_read_callback
|
||||||
(nghttp2_session *session, int32_t stream_id,
|
(nghttp2_session *session _U_, int32_t stream_id _U_,
|
||||||
uint8_t *buf, size_t len, uint32_t *data_flags,
|
uint8_t *buf _U_, size_t len, uint32_t *data_flags,
|
||||||
nghttp2_data_source *source, void *user_data)
|
nghttp2_data_source *source _U_, void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
size_t wlen;
|
size_t wlen;
|
||||||
|
@ -272,17 +272,17 @@ static ssize_t fixed_length_data_source_read_callback
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t temporal_failure_data_source_read_callback
|
static ssize_t temporal_failure_data_source_read_callback
|
||||||
(nghttp2_session *session, int32_t stream_id,
|
(nghttp2_session *session _U_, int32_t stream_id _U_,
|
||||||
uint8_t *buf, size_t len, uint32_t *data_flags,
|
uint8_t *buf _U_, size_t len _U_, uint32_t *data_flags _U_,
|
||||||
nghttp2_data_source *source, void *user_data)
|
nghttp2_data_source *source _U_, void *user_data _U_)
|
||||||
{
|
{
|
||||||
return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
|
return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t fail_data_source_read_callback
|
static ssize_t fail_data_source_read_callback
|
||||||
(nghttp2_session *session, int32_t stream_id,
|
(nghttp2_session *session _U_, int32_t stream_id _U_,
|
||||||
uint8_t *buf, size_t len, uint32_t *data_flags,
|
uint8_t *buf _U_, size_t len _U_, uint32_t *data_flags _U_,
|
||||||
nghttp2_data_source *source, void *user_data)
|
nghttp2_data_source *source _U_, void *user_data _U_)
|
||||||
{
|
{
|
||||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -297,9 +297,9 @@ static ssize_t fail_data_source_read_callback
|
||||||
/* ++my_data->stream_close_cb_called; */
|
/* ++my_data->stream_close_cb_called; */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
static ssize_t block_count_send_callback(nghttp2_session* session,
|
static ssize_t block_count_send_callback(nghttp2_session* session _U_,
|
||||||
const uint8_t *data, size_t len,
|
const uint8_t *data _U_, size_t len,
|
||||||
int flags,
|
int flags _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -313,11 +313,11 @@ static ssize_t block_count_send_callback(nghttp2_session* session,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_header_callback(nghttp2_session *session,
|
static int on_header_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
uint8_t flags,
|
uint8_t flags _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -356,8 +356,8 @@ static int temporal_failure_on_header_callback
|
||||||
return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
|
return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_begin_headers_callback(nghttp2_session *session,
|
static int on_begin_headers_callback(nghttp2_session *session _U_,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -366,15 +366,15 @@ static int on_begin_headers_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t defer_data_source_read_callback
|
static ssize_t defer_data_source_read_callback
|
||||||
(nghttp2_session *session, int32_t stream_id,
|
(nghttp2_session *session _U_, int32_t stream_id _U_,
|
||||||
uint8_t *buf, size_t len, uint32_t *data_flags,
|
uint8_t *buf _U_, size_t len _U_, uint32_t *data_flags _U_,
|
||||||
nghttp2_data_source *source, void *user_data)
|
nghttp2_data_source *source _U_, void *user_data _U_)
|
||||||
{
|
{
|
||||||
return NGHTTP2_ERR_DEFERRED;
|
return NGHTTP2_ERR_DEFERRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stream_close_callback(nghttp2_session *session, int32_t stream_id,
|
static int stream_close_callback(nghttp2_session *session, int32_t stream_id,
|
||||||
nghttp2_error_code error_code,
|
nghttp2_error_code error_code _U_,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data* my_data = (my_user_data*)user_data;
|
my_user_data* my_data = (my_user_data*)user_data;
|
||||||
|
@ -3307,9 +3307,9 @@ void test_nghttp2_submit_data_read_length_smallest(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t submit_data_twice_data_source_read_callback
|
static ssize_t submit_data_twice_data_source_read_callback
|
||||||
(nghttp2_session *session, int32_t stream_id,
|
(nghttp2_session *session _U_, int32_t stream_id _U_,
|
||||||
uint8_t *buf, size_t len, uint32_t *data_flags,
|
uint8_t *buf _U_, size_t len, uint32_t *data_flags,
|
||||||
nghttp2_data_source *source, void *user_data)
|
nghttp2_data_source *source _U_, void *user_data _U_)
|
||||||
{
|
{
|
||||||
*data_flags |= NGHTTP2_DATA_FLAG_EOF;
|
*data_flags |= NGHTTP2_DATA_FLAG_EOF;
|
||||||
return nghttp2_min(len, 16);
|
return nghttp2_min(len, 16);
|
||||||
|
@ -3317,7 +3317,7 @@ static ssize_t submit_data_twice_data_source_read_callback
|
||||||
|
|
||||||
static int submit_data_twice_on_frame_send_callback(nghttp2_session *session,
|
static int submit_data_twice_on_frame_send_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
void *user_data)
|
void *user_data _U_)
|
||||||
{
|
{
|
||||||
static int called = 0;
|
static int called = 0;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
Loading…
Reference in New Issue