clang-format-3.9

This commit is contained in:
Tatsuhiro Tsujikawa 2016-10-15 18:36:04 +09:00
parent e9d562f987
commit 0cf6848646
48 changed files with 4760 additions and 4825 deletions

View File

@ -66,13 +66,13 @@ enum { IO_NONE, WANT_READ, WANT_WRITE };
#define MAKE_NV(NAME, VALUE) \
{ \
(uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
(uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
NGHTTP2_NV_FLAG_NONE \
}
#define MAKE_NV_CS(NAME, VALUE) \
{ \
(uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, strlen(VALUE), \
(uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, strlen(VALUE), \
NGHTTP2_NV_FLAG_NONE \
}
@ -457,9 +457,10 @@ static void ctl_poll(struct pollfd *pollfd, struct Connection *connection) {
static void submit_request(struct Connection *connection, struct Request *req) {
int32_t stream_id;
/* Make sure that the last item is NULL */
const nghttp2_nv nva[] = {
MAKE_NV(":method", "GET"), MAKE_NV_CS(":path", req->path),
MAKE_NV(":scheme", "https"), MAKE_NV_CS(":authority", req->hostport),
const nghttp2_nv nva[] = {MAKE_NV(":method", "GET"),
MAKE_NV_CS(":path", req->path),
MAKE_NV(":scheme", "https"),
MAKE_NV_CS(":authority", req->hostport),
MAKE_NV("accept", "*/*"),
MAKE_NV("user-agent", "nghttp2/" NGHTTP2_VERSION)};

View File

@ -33,7 +33,7 @@
#define MAKE_NV(K, V) \
{ \
(uint8_t *) K, (uint8_t *)V, sizeof(K) - 1, sizeof(V) - 1, \
(uint8_t *)K, (uint8_t *)V, sizeof(K) - 1, sizeof(V) - 1, \
NGHTTP2_NV_FLAG_NONE \
}

View File

@ -383,13 +383,13 @@ static void send_client_connection_header(http2_session_data *session_data) {
#define MAKE_NV(NAME, VALUE, VALUELEN) \
{ \
(uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, VALUELEN, \
(uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, VALUELEN, \
NGHTTP2_NV_FLAG_NONE \
}
#define MAKE_NV2(NAME, VALUE) \
{ \
(uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
(uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
NGHTTP2_NV_FLAG_NONE \
}

View File

@ -79,7 +79,7 @@
#define MAKE_NV(NAME, VALUE) \
{ \
(uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
(uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
NGHTTP2_NV_FLAG_NONE \
}

View File

@ -2802,8 +2802,8 @@ NGHTTP2_EXTERN int nghttp2_session_send(nghttp2_session *session);
* buffer up small chunks of data as necessary to avoid this
* situation.
*/
NGHTTP2_EXTERN ssize_t
nghttp2_session_mem_send(nghttp2_session *session, const uint8_t **data_ptr);
NGHTTP2_EXTERN ssize_t nghttp2_session_mem_send(nghttp2_session *session,
const uint8_t **data_ptr);
/**
* @function
@ -3018,9 +3018,8 @@ nghttp2_session_get_outbound_queue_size(nghttp2_session *session);
*
* This function returns -1 if it fails.
*/
NGHTTP2_EXTERN int32_t
nghttp2_session_get_stream_effective_recv_data_length(nghttp2_session *session,
int32_t stream_id);
NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_effective_recv_data_length(
nghttp2_session *session, int32_t stream_id);
/**
* @function
@ -3039,9 +3038,8 @@ nghttp2_session_get_stream_effective_recv_data_length(nghttp2_session *session,
*
* This function returns -1 if it fails.
*/
NGHTTP2_EXTERN int32_t
nghttp2_session_get_stream_effective_local_window_size(nghttp2_session *session,
int32_t stream_id);
NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_effective_local_window_size(
nghttp2_session *session, int32_t stream_id);
/**
* @function
@ -3055,9 +3053,8 @@ nghttp2_session_get_stream_effective_local_window_size(nghttp2_session *session,
*
* This function returns -1 if it fails.
*/
NGHTTP2_EXTERN int32_t
nghttp2_session_get_stream_local_window_size(nghttp2_session *session,
int32_t stream_id);
NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_local_window_size(
nghttp2_session *session, int32_t stream_id);
/**
* @function
@ -3124,9 +3121,8 @@ nghttp2_session_get_local_window_size(nghttp2_session *session);
*
* This function returns -1 if it fails.
*/
NGHTTP2_EXTERN int32_t
nghttp2_session_get_stream_remote_window_size(nghttp2_session *session,
int32_t stream_id);
NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_remote_window_size(
nghttp2_session *session, int32_t stream_id);
/**
* @function
@ -3279,9 +3275,8 @@ NGHTTP2_EXTERN int nghttp2_submit_shutdown_notice(nghttp2_session *session);
* The |id| must be one of values defined in
* :enum:`nghttp2_settings_id`.
*/
NGHTTP2_EXTERN uint32_t
nghttp2_session_get_remote_settings(nghttp2_session *session,
nghttp2_settings_id id);
NGHTTP2_EXTERN uint32_t nghttp2_session_get_remote_settings(
nghttp2_session *session, nghttp2_settings_id id);
/**
* @function
@ -3290,9 +3285,8 @@ nghttp2_session_get_remote_settings(nghttp2_session *session,
* by the remote endpoint. The |id| must be one of the values defined
* in :enum:`nghttp2_settings_id`.
*/
NGHTTP2_EXTERN uint32_t
nghttp2_session_get_local_settings(nghttp2_session *session,
nghttp2_settings_id id);
NGHTTP2_EXTERN uint32_t nghttp2_session_get_local_settings(
nghttp2_session *session, nghttp2_settings_id id);
/**
* @function
@ -3587,9 +3581,8 @@ NGHTTP2_EXTERN int nghttp2_session_upgrade2(nghttp2_session *session,
* :enum:`NGHTTP2_ERR_INSUFF_BUFSIZE`
* The provided |buflen| size is too small to hold the output.
*/
NGHTTP2_EXTERN ssize_t
nghttp2_pack_settings_payload(uint8_t *buf, size_t buflen,
const nghttp2_settings_entry *iv, size_t niv);
NGHTTP2_EXTERN ssize_t nghttp2_pack_settings_payload(
uint8_t *buf, size_t buflen, const nghttp2_settings_entry *iv, size_t niv);
/**
* @function
@ -3714,11 +3707,9 @@ nghttp2_priority_spec_check_default(const nghttp2_priority_spec *pri_spec);
* frame.
*
*/
NGHTTP2_EXTERN int32_t
nghttp2_submit_request(nghttp2_session *session,
const nghttp2_priority_spec *pri_spec,
const nghttp2_nv *nva, size_t nvlen,
const nghttp2_data_provider *data_prd,
NGHTTP2_EXTERN int32_t nghttp2_submit_request(
nghttp2_session *session, const nghttp2_priority_spec *pri_spec,
const nghttp2_nv *nva, size_t nvlen, const nghttp2_data_provider *data_prd,
void *stream_user_data);
/**
@ -3934,10 +3925,9 @@ NGHTTP2_EXTERN int nghttp2_submit_trailer(nghttp2_session *session,
* frame.
*
*/
NGHTTP2_EXTERN int32_t
nghttp2_submit_headers(nghttp2_session *session, uint8_t flags,
int32_t stream_id, const nghttp2_priority_spec *pri_spec,
const nghttp2_nv *nva, size_t nvlen,
NGHTTP2_EXTERN int32_t nghttp2_submit_headers(
nghttp2_session *session, uint8_t flags, int32_t stream_id,
const nghttp2_priority_spec *pri_spec, const nghttp2_nv *nva, size_t nvlen,
void *stream_user_data);
/**
@ -4146,10 +4136,9 @@ NGHTTP2_EXTERN int nghttp2_submit_settings(nghttp2_session *session,
* is called for this frame.
*
*/
NGHTTP2_EXTERN int32_t
nghttp2_submit_push_promise(nghttp2_session *session, uint8_t flags,
int32_t stream_id, const nghttp2_nv *nva,
size_t nvlen, void *promised_stream_user_data);
NGHTTP2_EXTERN int32_t nghttp2_submit_push_promise(
nghttp2_session *session, uint8_t flags, int32_t stream_id,
const nghttp2_nv *nva, size_t nvlen, void *promised_stream_user_data);
/**
* @function
@ -4693,9 +4682,10 @@ nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater,
* :enum:`NGHTTP2_ERR_INSUFF_BUFSIZE`
* The provided |buflen| size is too small to hold the output.
*/
NGHTTP2_EXTERN ssize_t
nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, uint8_t *buf,
size_t buflen, const nghttp2_nv *nva, size_t nvlen);
NGHTTP2_EXTERN ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater,
uint8_t *buf, size_t buflen,
const nghttp2_nv *nva,
size_t nvlen);
/**
* @function
@ -4724,9 +4714,11 @@ nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, uint8_t *buf,
* :enum:`NGHTTP2_ERR_INSUFF_BUFSIZE`
* The provided |buflen| size is too small to hold the output.
*/
NGHTTP2_EXTERN ssize_t
nghttp2_hd_deflate_hd_vec(nghttp2_hd_deflater *deflater, const nghttp2_vec *vec,
size_t veclen, const nghttp2_nv *nva, size_t nvlen);
NGHTTP2_EXTERN ssize_t nghttp2_hd_deflate_hd_vec(nghttp2_hd_deflater *deflater,
const nghttp2_vec *vec,
size_t veclen,
const nghttp2_nv *nva,
size_t nvlen);
/**
* @function
@ -5046,9 +5038,10 @@ NGHTTP2_EXTERN ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater,
* }
*
*/
NGHTTP2_EXTERN ssize_t
nghttp2_hd_inflate_hd2(nghttp2_hd_inflater *inflater, nghttp2_nv *nv_out,
int *inflate_flags, const uint8_t *in, size_t inlen,
NGHTTP2_EXTERN ssize_t nghttp2_hd_inflate_hd2(nghttp2_hd_inflater *inflater,
nghttp2_nv *nv_out,
int *inflate_flags,
const uint8_t *in, size_t inlen,
int in_final);
/**

View File

@ -35,8 +35,8 @@
/* Make scalar initialization form of nghttp2_hd_entry */
#define MAKE_STATIC_ENT(N, V, T, H) \
{ \
{ NULL, NULL, (uint8_t *)(N), sizeof((N)) - 1, -1 } \
, {NULL, NULL, (uint8_t *)(V), sizeof((V)) - 1, -1}, \
{NULL, NULL, (uint8_t *)(N), sizeof((N)) - 1, -1}, \
{NULL, NULL, (uint8_t *)(V), sizeof((V)) - 1, -1}, \
{(uint8_t *)(N), (uint8_t *)(V), sizeof((N)) - 1, sizeof((V)) - 1, 0}, \
T, H \
}
@ -1296,7 +1296,8 @@ static const nghttp2_nv *nghttp2_hd_table_get2(nghttp2_hd_context *context,
assert(INDEX_RANGE_VALID(context, idx));
if (idx >= NGHTTP2_STATIC_TABLE_LENGTH) {
return &hd_ringbuf_get(&context->hd_table,
idx - NGHTTP2_STATIC_TABLE_LENGTH)->cnv;
idx - NGHTTP2_STATIC_TABLE_LENGTH)
->cnv;
}
return &static_table[idx].cnv;

View File

@ -26,262 +26,71 @@
/* Generated by mkhufftbl.py */
const nghttp2_huff_sym huff_sym_table[] = {{13, 0x1ff8u},
{23, 0x7fffd8u},
{28, 0xfffffe2u},
{28, 0xfffffe3u},
{28, 0xfffffe4u},
{28, 0xfffffe5u},
{28, 0xfffffe6u},
{28, 0xfffffe7u},
{28, 0xfffffe8u},
{24, 0xffffeau},
{30, 0x3ffffffcu},
{28, 0xfffffe9u},
{28, 0xfffffeau},
{30, 0x3ffffffdu},
{28, 0xfffffebu},
{28, 0xfffffecu},
{28, 0xfffffedu},
{28, 0xfffffeeu},
{28, 0xfffffefu},
{28, 0xffffff0u},
{28, 0xffffff1u},
{28, 0xffffff2u},
{30, 0x3ffffffeu},
{28, 0xffffff3u},
{28, 0xffffff4u},
{28, 0xffffff5u},
{28, 0xffffff6u},
{28, 0xffffff7u},
{28, 0xffffff8u},
{28, 0xffffff9u},
{28, 0xffffffau},
{28, 0xffffffbu},
{6, 0x14u},
{10, 0x3f8u},
{10, 0x3f9u},
{12, 0xffau},
{13, 0x1ff9u},
{6, 0x15u},
{8, 0xf8u},
{11, 0x7fau},
{10, 0x3fau},
{10, 0x3fbu},
{8, 0xf9u},
{11, 0x7fbu},
{8, 0xfau},
{6, 0x16u},
{6, 0x17u},
{6, 0x18u},
{5, 0x0u},
{5, 0x1u},
{5, 0x2u},
{6, 0x19u},
{6, 0x1au},
{6, 0x1bu},
{6, 0x1cu},
{6, 0x1du},
{6, 0x1eu},
{6, 0x1fu},
{7, 0x5cu},
{8, 0xfbu},
{15, 0x7ffcu},
{6, 0x20u},
{12, 0xffbu},
{10, 0x3fcu},
{13, 0x1ffau},
{6, 0x21u},
{7, 0x5du},
{7, 0x5eu},
{7, 0x5fu},
{7, 0x60u},
{7, 0x61u},
{7, 0x62u},
{7, 0x63u},
{7, 0x64u},
{7, 0x65u},
{7, 0x66u},
{7, 0x67u},
{7, 0x68u},
{7, 0x69u},
{7, 0x6au},
{7, 0x6bu},
{7, 0x6cu},
{7, 0x6du},
{7, 0x6eu},
{7, 0x6fu},
{7, 0x70u},
{7, 0x71u},
{7, 0x72u},
{8, 0xfcu},
{7, 0x73u},
{8, 0xfdu},
{13, 0x1ffbu},
{19, 0x7fff0u},
{13, 0x1ffcu},
{14, 0x3ffcu},
{6, 0x22u},
{15, 0x7ffdu},
{5, 0x3u},
{6, 0x23u},
{5, 0x4u},
{6, 0x24u},
{5, 0x5u},
{6, 0x25u},
{6, 0x26u},
{6, 0x27u},
{5, 0x6u},
{7, 0x74u},
{7, 0x75u},
{6, 0x28u},
{6, 0x29u},
{6, 0x2au},
{5, 0x7u},
{6, 0x2bu},
{7, 0x76u},
{6, 0x2cu},
{5, 0x8u},
{5, 0x9u},
{6, 0x2du},
{7, 0x77u},
{7, 0x78u},
{7, 0x79u},
{7, 0x7au},
{7, 0x7bu},
{15, 0x7ffeu},
{11, 0x7fcu},
{14, 0x3ffdu},
{13, 0x1ffdu},
{28, 0xffffffcu},
{20, 0xfffe6u},
{22, 0x3fffd2u},
{20, 0xfffe7u},
{20, 0xfffe8u},
{22, 0x3fffd3u},
{22, 0x3fffd4u},
{22, 0x3fffd5u},
{23, 0x7fffd9u},
{22, 0x3fffd6u},
{23, 0x7fffdau},
{23, 0x7fffdbu},
{23, 0x7fffdcu},
{23, 0x7fffddu},
{23, 0x7fffdeu},
{24, 0xffffebu},
{23, 0x7fffdfu},
{24, 0xffffecu},
{24, 0xffffedu},
{22, 0x3fffd7u},
{23, 0x7fffe0u},
{24, 0xffffeeu},
{23, 0x7fffe1u},
{23, 0x7fffe2u},
{23, 0x7fffe3u},
{23, 0x7fffe4u},
{21, 0x1fffdcu},
{22, 0x3fffd8u},
{23, 0x7fffe5u},
{22, 0x3fffd9u},
{23, 0x7fffe6u},
{23, 0x7fffe7u},
{24, 0xffffefu},
{22, 0x3fffdau},
{21, 0x1fffddu},
{20, 0xfffe9u},
{22, 0x3fffdbu},
{22, 0x3fffdcu},
{23, 0x7fffe8u},
{23, 0x7fffe9u},
{21, 0x1fffdeu},
{23, 0x7fffeau},
{22, 0x3fffddu},
{22, 0x3fffdeu},
{24, 0xfffff0u},
{21, 0x1fffdfu},
{22, 0x3fffdfu},
{23, 0x7fffebu},
{23, 0x7fffecu},
{21, 0x1fffe0u},
{21, 0x1fffe1u},
{22, 0x3fffe0u},
{21, 0x1fffe2u},
{23, 0x7fffedu},
{22, 0x3fffe1u},
{23, 0x7fffeeu},
{23, 0x7fffefu},
{20, 0xfffeau},
{22, 0x3fffe2u},
{22, 0x3fffe3u},
{22, 0x3fffe4u},
{23, 0x7ffff0u},
{22, 0x3fffe5u},
{22, 0x3fffe6u},
{23, 0x7ffff1u},
{26, 0x3ffffe0u},
{26, 0x3ffffe1u},
{20, 0xfffebu},
{19, 0x7fff1u},
{22, 0x3fffe7u},
{23, 0x7ffff2u},
{22, 0x3fffe8u},
{25, 0x1ffffecu},
{26, 0x3ffffe2u},
{26, 0x3ffffe3u},
{26, 0x3ffffe4u},
{27, 0x7ffffdeu},
{27, 0x7ffffdfu},
{26, 0x3ffffe5u},
{24, 0xfffff1u},
{25, 0x1ffffedu},
{19, 0x7fff2u},
{21, 0x1fffe3u},
{26, 0x3ffffe6u},
{27, 0x7ffffe0u},
{27, 0x7ffffe1u},
{26, 0x3ffffe7u},
{27, 0x7ffffe2u},
{24, 0xfffff2u},
{21, 0x1fffe4u},
{21, 0x1fffe5u},
{26, 0x3ffffe8u},
{26, 0x3ffffe9u},
{28, 0xffffffdu},
{27, 0x7ffffe3u},
{27, 0x7ffffe4u},
{27, 0x7ffffe5u},
{20, 0xfffecu},
{24, 0xfffff3u},
{20, 0xfffedu},
{21, 0x1fffe6u},
{22, 0x3fffe9u},
{21, 0x1fffe7u},
{21, 0x1fffe8u},
{23, 0x7ffff3u},
{22, 0x3fffeau},
{22, 0x3fffebu},
{25, 0x1ffffeeu},
{25, 0x1ffffefu},
{24, 0xfffff4u},
{24, 0xfffff5u},
{26, 0x3ffffeau},
{23, 0x7ffff4u},
{26, 0x3ffffebu},
{27, 0x7ffffe6u},
{26, 0x3ffffecu},
{26, 0x3ffffedu},
{27, 0x7ffffe7u},
{27, 0x7ffffe8u},
{27, 0x7ffffe9u},
{27, 0x7ffffeau},
{27, 0x7ffffebu},
{28, 0xffffffeu},
{27, 0x7ffffecu},
{27, 0x7ffffedu},
{27, 0x7ffffeeu},
{27, 0x7ffffefu},
{27, 0x7fffff0u},
{26, 0x3ffffeeu},
const nghttp2_huff_sym huff_sym_table[] = {
{13, 0x1ff8u}, {23, 0x7fffd8u}, {28, 0xfffffe2u}, {28, 0xfffffe3u},
{28, 0xfffffe4u}, {28, 0xfffffe5u}, {28, 0xfffffe6u}, {28, 0xfffffe7u},
{28, 0xfffffe8u}, {24, 0xffffeau}, {30, 0x3ffffffcu}, {28, 0xfffffe9u},
{28, 0xfffffeau}, {30, 0x3ffffffdu}, {28, 0xfffffebu}, {28, 0xfffffecu},
{28, 0xfffffedu}, {28, 0xfffffeeu}, {28, 0xfffffefu}, {28, 0xffffff0u},
{28, 0xffffff1u}, {28, 0xffffff2u}, {30, 0x3ffffffeu}, {28, 0xffffff3u},
{28, 0xffffff4u}, {28, 0xffffff5u}, {28, 0xffffff6u}, {28, 0xffffff7u},
{28, 0xffffff8u}, {28, 0xffffff9u}, {28, 0xffffffau}, {28, 0xffffffbu},
{6, 0x14u}, {10, 0x3f8u}, {10, 0x3f9u}, {12, 0xffau},
{13, 0x1ff9u}, {6, 0x15u}, {8, 0xf8u}, {11, 0x7fau},
{10, 0x3fau}, {10, 0x3fbu}, {8, 0xf9u}, {11, 0x7fbu},
{8, 0xfau}, {6, 0x16u}, {6, 0x17u}, {6, 0x18u},
{5, 0x0u}, {5, 0x1u}, {5, 0x2u}, {6, 0x19u},
{6, 0x1au}, {6, 0x1bu}, {6, 0x1cu}, {6, 0x1du},
{6, 0x1eu}, {6, 0x1fu}, {7, 0x5cu}, {8, 0xfbu},
{15, 0x7ffcu}, {6, 0x20u}, {12, 0xffbu}, {10, 0x3fcu},
{13, 0x1ffau}, {6, 0x21u}, {7, 0x5du}, {7, 0x5eu},
{7, 0x5fu}, {7, 0x60u}, {7, 0x61u}, {7, 0x62u},
{7, 0x63u}, {7, 0x64u}, {7, 0x65u}, {7, 0x66u},
{7, 0x67u}, {7, 0x68u}, {7, 0x69u}, {7, 0x6au},
{7, 0x6bu}, {7, 0x6cu}, {7, 0x6du}, {7, 0x6eu},
{7, 0x6fu}, {7, 0x70u}, {7, 0x71u}, {7, 0x72u},
{8, 0xfcu}, {7, 0x73u}, {8, 0xfdu}, {13, 0x1ffbu},
{19, 0x7fff0u}, {13, 0x1ffcu}, {14, 0x3ffcu}, {6, 0x22u},
{15, 0x7ffdu}, {5, 0x3u}, {6, 0x23u}, {5, 0x4u},
{6, 0x24u}, {5, 0x5u}, {6, 0x25u}, {6, 0x26u},
{6, 0x27u}, {5, 0x6u}, {7, 0x74u}, {7, 0x75u},
{6, 0x28u}, {6, 0x29u}, {6, 0x2au}, {5, 0x7u},
{6, 0x2bu}, {7, 0x76u}, {6, 0x2cu}, {5, 0x8u},
{5, 0x9u}, {6, 0x2du}, {7, 0x77u}, {7, 0x78u},
{7, 0x79u}, {7, 0x7au}, {7, 0x7bu}, {15, 0x7ffeu},
{11, 0x7fcu}, {14, 0x3ffdu}, {13, 0x1ffdu}, {28, 0xffffffcu},
{20, 0xfffe6u}, {22, 0x3fffd2u}, {20, 0xfffe7u}, {20, 0xfffe8u},
{22, 0x3fffd3u}, {22, 0x3fffd4u}, {22, 0x3fffd5u}, {23, 0x7fffd9u},
{22, 0x3fffd6u}, {23, 0x7fffdau}, {23, 0x7fffdbu}, {23, 0x7fffdcu},
{23, 0x7fffddu}, {23, 0x7fffdeu}, {24, 0xffffebu}, {23, 0x7fffdfu},
{24, 0xffffecu}, {24, 0xffffedu}, {22, 0x3fffd7u}, {23, 0x7fffe0u},
{24, 0xffffeeu}, {23, 0x7fffe1u}, {23, 0x7fffe2u}, {23, 0x7fffe3u},
{23, 0x7fffe4u}, {21, 0x1fffdcu}, {22, 0x3fffd8u}, {23, 0x7fffe5u},
{22, 0x3fffd9u}, {23, 0x7fffe6u}, {23, 0x7fffe7u}, {24, 0xffffefu},
{22, 0x3fffdau}, {21, 0x1fffddu}, {20, 0xfffe9u}, {22, 0x3fffdbu},
{22, 0x3fffdcu}, {23, 0x7fffe8u}, {23, 0x7fffe9u}, {21, 0x1fffdeu},
{23, 0x7fffeau}, {22, 0x3fffddu}, {22, 0x3fffdeu}, {24, 0xfffff0u},
{21, 0x1fffdfu}, {22, 0x3fffdfu}, {23, 0x7fffebu}, {23, 0x7fffecu},
{21, 0x1fffe0u}, {21, 0x1fffe1u}, {22, 0x3fffe0u}, {21, 0x1fffe2u},
{23, 0x7fffedu}, {22, 0x3fffe1u}, {23, 0x7fffeeu}, {23, 0x7fffefu},
{20, 0xfffeau}, {22, 0x3fffe2u}, {22, 0x3fffe3u}, {22, 0x3fffe4u},
{23, 0x7ffff0u}, {22, 0x3fffe5u}, {22, 0x3fffe6u}, {23, 0x7ffff1u},
{26, 0x3ffffe0u}, {26, 0x3ffffe1u}, {20, 0xfffebu}, {19, 0x7fff1u},
{22, 0x3fffe7u}, {23, 0x7ffff2u}, {22, 0x3fffe8u}, {25, 0x1ffffecu},
{26, 0x3ffffe2u}, {26, 0x3ffffe3u}, {26, 0x3ffffe4u}, {27, 0x7ffffdeu},
{27, 0x7ffffdfu}, {26, 0x3ffffe5u}, {24, 0xfffff1u}, {25, 0x1ffffedu},
{19, 0x7fff2u}, {21, 0x1fffe3u}, {26, 0x3ffffe6u}, {27, 0x7ffffe0u},
{27, 0x7ffffe1u}, {26, 0x3ffffe7u}, {27, 0x7ffffe2u}, {24, 0xfffff2u},
{21, 0x1fffe4u}, {21, 0x1fffe5u}, {26, 0x3ffffe8u}, {26, 0x3ffffe9u},
{28, 0xffffffdu}, {27, 0x7ffffe3u}, {27, 0x7ffffe4u}, {27, 0x7ffffe5u},
{20, 0xfffecu}, {24, 0xfffff3u}, {20, 0xfffedu}, {21, 0x1fffe6u},
{22, 0x3fffe9u}, {21, 0x1fffe7u}, {21, 0x1fffe8u}, {23, 0x7ffff3u},
{22, 0x3fffeau}, {22, 0x3fffebu}, {25, 0x1ffffeeu}, {25, 0x1ffffefu},
{24, 0xfffff4u}, {24, 0xfffff5u}, {26, 0x3ffffeau}, {23, 0x7ffff4u},
{26, 0x3ffffebu}, {27, 0x7ffffe6u}, {26, 0x3ffffecu}, {26, 0x3ffffedu},
{27, 0x7ffffe7u}, {27, 0x7ffffe8u}, {27, 0x7ffffe9u}, {27, 0x7ffffeau},
{27, 0x7ffffebu}, {28, 0xffffffeu}, {27, 0x7ffffecu}, {27, 0x7ffffedu},
{27, 0x7ffffeeu}, {27, 0x7ffffefu}, {27, 0x7fffff0u}, {26, 0x3ffffeeu},
{30, 0x3fffffffu}};
const nghttp2_huff_decode huff_decode_table[][16] = {

View File

@ -338,58 +338,70 @@ const char *nghttp2_strerror(int error_code) {
/* Generated by gennmchartbl.py */
static int VALID_HD_NAME_CHARS[] = {
0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, 0 /* EOT */,
0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, 0 /* BS */, 0 /* HT */,
0 /* LF */, 0 /* VT */, 0 /* FF */, 0 /* CR */, 0 /* SO */,
0 /* SI */, 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */,
0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, 0 /* CAN */,
0 /* EM */, 0 /* SUB */, 0 /* ESC */, 0 /* FS */, 0 /* GS */,
0 /* RS */, 0 /* US */, 0 /* SPC */, 1 /* ! */, 0 /* " */,
1 /* # */, 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */,
0 /* ( */, 0 /* ) */, 1 /* * */, 1 /* + */, 0 /* , */,
1 /* - */, 1 /* . */, 0 /* / */, 1 /* 0 */, 1 /* 1 */,
1 /* 2 */, 1 /* 3 */, 1 /* 4 */, 1 /* 5 */, 1 /* 6 */,
1 /* 7 */, 1 /* 8 */, 1 /* 9 */, 0 /* : */, 0 /* ; */,
0 /* < */, 0 /* = */, 0 /* > */, 0 /* ? */, 0 /* @ */,
0 /* A */, 0 /* B */, 0 /* C */, 0 /* D */, 0 /* E */,
0 /* F */, 0 /* G */, 0 /* H */, 0 /* I */, 0 /* J */,
0 /* K */, 0 /* L */, 0 /* M */, 0 /* N */, 0 /* O */,
0 /* P */, 0 /* Q */, 0 /* R */, 0 /* S */, 0 /* T */,
0 /* U */, 0 /* V */, 0 /* W */, 0 /* X */, 0 /* Y */,
0 /* Z */, 0 /* [ */, 0 /* \ */, 0 /* ] */, 1 /* ^ */,
1 /* _ */, 1 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */,
1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, 1 /* h */,
1 /* i */, 1 /* j */, 1 /* k */, 1 /* l */, 1 /* m */,
1 /* n */, 1 /* o */, 1 /* p */, 1 /* q */, 1 /* r */,
1 /* s */, 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */,
1 /* x */, 1 /* y */, 1 /* z */, 0 /* { */, 1 /* | */,
0 /* } */, 1 /* ~ */, 0 /* DEL */, 0 /* 0x80 */, 0 /* 0x81 */,
0 /* 0x82 */, 0 /* 0x83 */, 0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */,
0 /* 0x87 */, 0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */,
0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */, 0 /* 0x90 */,
0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */, 0 /* 0x94 */, 0 /* 0x95 */,
0 /* 0x96 */, 0 /* 0x97 */, 0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */,
0 /* 0x9b */, 0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */,
0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */, 0 /* 0xa4 */,
0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */, 0 /* 0xa8 */, 0 /* 0xa9 */,
0 /* 0xaa */, 0 /* 0xab */, 0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */,
0 /* 0xaf */, 0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */,
0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */, 0 /* 0xb8 */,
0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */, 0 /* 0xbc */, 0 /* 0xbd */,
0 /* 0xbe */, 0 /* 0xbf */, 0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */,
0 /* 0xc3 */, 0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */,
0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */, 0 /* 0xcc */,
0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */, 0 /* 0xd0 */, 0 /* 0xd1 */,
0 /* 0xd2 */, 0 /* 0xd3 */, 0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */,
0 /* 0xd7 */, 0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */,
0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */, 0 /* 0xe0 */,
0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */, 0 /* 0xe4 */, 0 /* 0xe5 */,
0 /* 0xe6 */, 0 /* 0xe7 */, 0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */,
0 /* 0xeb */, 0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */,
0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */, 0 /* 0xf4 */,
0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */, 0 /* 0xf8 */, 0 /* 0xf9 */,
0 /* 0xfa */, 0 /* 0xfb */, 0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */,
0 /* 0xff */
0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */,
0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */,
0 /* BS */, 0 /* HT */, 0 /* LF */, 0 /* VT */,
0 /* FF */, 0 /* CR */, 0 /* SO */, 0 /* SI */,
0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */,
0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */,
0 /* CAN */, 0 /* EM */, 0 /* SUB */, 0 /* ESC */,
0 /* FS */, 0 /* GS */, 0 /* RS */, 0 /* US */,
0 /* SPC */, 1 /* ! */, 0 /* " */, 1 /* # */,
1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */,
0 /* ( */, 0 /* ) */, 1 /* * */, 1 /* + */,
0 /* , */, 1 /* - */, 1 /* . */, 0 /* / */,
1 /* 0 */, 1 /* 1 */, 1 /* 2 */, 1 /* 3 */,
1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */,
1 /* 8 */, 1 /* 9 */, 0 /* : */, 0 /* ; */,
0 /* < */, 0 /* = */, 0 /* > */, 0 /* ? */,
0 /* @ */, 0 /* A */, 0 /* B */, 0 /* C */,
0 /* D */, 0 /* E */, 0 /* F */, 0 /* G */,
0 /* H */, 0 /* I */, 0 /* J */, 0 /* K */,
0 /* L */, 0 /* M */, 0 /* N */, 0 /* O */,
0 /* P */, 0 /* Q */, 0 /* R */, 0 /* S */,
0 /* T */, 0 /* U */, 0 /* V */, 0 /* W */,
0 /* X */, 0 /* Y */, 0 /* Z */, 0 /* [ */,
0 /* \ */, 0 /* ] */, 1 /* ^ */, 1 /* _ */,
1 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */,
1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */,
1 /* h */, 1 /* i */, 1 /* j */, 1 /* k */,
1 /* l */, 1 /* m */, 1 /* n */, 1 /* o */,
1 /* p */, 1 /* q */, 1 /* r */, 1 /* s */,
1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */,
1 /* x */, 1 /* y */, 1 /* z */, 0 /* { */,
1 /* | */, 0 /* } */, 1 /* ~ */, 0 /* DEL */,
0 /* 0x80 */, 0 /* 0x81 */, 0 /* 0x82 */, 0 /* 0x83 */,
0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, 0 /* 0x87 */,
0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */,
0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */,
0 /* 0x90 */, 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */,
0 /* 0x94 */, 0 /* 0x95 */, 0 /* 0x96 */, 0 /* 0x97 */,
0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, 0 /* 0x9b */,
0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */,
0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */,
0 /* 0xa4 */, 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */,
0 /* 0xa8 */, 0 /* 0xa9 */, 0 /* 0xaa */, 0 /* 0xab */,
0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, 0 /* 0xaf */,
0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */,
0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */,
0 /* 0xb8 */, 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */,
0 /* 0xbc */, 0 /* 0xbd */, 0 /* 0xbe */, 0 /* 0xbf */,
0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, 0 /* 0xc3 */,
0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */,
0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */,
0 /* 0xcc */, 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */,
0 /* 0xd0 */, 0 /* 0xd1 */, 0 /* 0xd2 */, 0 /* 0xd3 */,
0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, 0 /* 0xd7 */,
0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */,
0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */,
0 /* 0xe0 */, 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */,
0 /* 0xe4 */, 0 /* 0xe5 */, 0 /* 0xe6 */, 0 /* 0xe7 */,
0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, 0 /* 0xeb */,
0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */,
0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */,
0 /* 0xf4 */, 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */,
0 /* 0xf8 */, 0 /* 0xf9 */, 0 /* 0xfa */, 0 /* 0xfb */,
0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, 0 /* 0xff */
};
int nghttp2_check_header_name(const uint8_t *name, size_t len) {
@ -414,58 +426,70 @@ int nghttp2_check_header_name(const uint8_t *name, size_t len) {
/* Generated by genvchartbl.py */
static int VALID_HD_VALUE_CHARS[] = {
0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, 0 /* EOT */,
0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, 0 /* BS */, 1 /* HT */,
0 /* LF */, 0 /* VT */, 0 /* FF */, 0 /* CR */, 0 /* SO */,
0 /* SI */, 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */,
0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, 0 /* CAN */,
0 /* EM */, 0 /* SUB */, 0 /* ESC */, 0 /* FS */, 0 /* GS */,
0 /* RS */, 0 /* US */, 1 /* SPC */, 1 /* ! */, 1 /* " */,
1 /* # */, 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */,
1 /* ( */, 1 /* ) */, 1 /* * */, 1 /* + */, 1 /* , */,
1 /* - */, 1 /* . */, 1 /* / */, 1 /* 0 */, 1 /* 1 */,
1 /* 2 */, 1 /* 3 */, 1 /* 4 */, 1 /* 5 */, 1 /* 6 */,
1 /* 7 */, 1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */,
1 /* < */, 1 /* = */, 1 /* > */, 1 /* ? */, 1 /* @ */,
1 /* A */, 1 /* B */, 1 /* C */, 1 /* D */, 1 /* E */,
1 /* F */, 1 /* G */, 1 /* H */, 1 /* I */, 1 /* J */,
1 /* K */, 1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */,
1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */, 1 /* T */,
1 /* U */, 1 /* V */, 1 /* W */, 1 /* X */, 1 /* Y */,
1 /* Z */, 1 /* [ */, 1 /* \ */, 1 /* ] */, 1 /* ^ */,
1 /* _ */, 1 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */,
1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, 1 /* h */,
1 /* i */, 1 /* j */, 1 /* k */, 1 /* l */, 1 /* m */,
1 /* n */, 1 /* o */, 1 /* p */, 1 /* q */, 1 /* r */,
1 /* s */, 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */,
1 /* x */, 1 /* y */, 1 /* z */, 1 /* { */, 1 /* | */,
1 /* } */, 1 /* ~ */, 0 /* DEL */, 1 /* 0x80 */, 1 /* 0x81 */,
1 /* 0x82 */, 1 /* 0x83 */, 1 /* 0x84 */, 1 /* 0x85 */, 1 /* 0x86 */,
1 /* 0x87 */, 1 /* 0x88 */, 1 /* 0x89 */, 1 /* 0x8a */, 1 /* 0x8b */,
1 /* 0x8c */, 1 /* 0x8d */, 1 /* 0x8e */, 1 /* 0x8f */, 1 /* 0x90 */,
1 /* 0x91 */, 1 /* 0x92 */, 1 /* 0x93 */, 1 /* 0x94 */, 1 /* 0x95 */,
1 /* 0x96 */, 1 /* 0x97 */, 1 /* 0x98 */, 1 /* 0x99 */, 1 /* 0x9a */,
1 /* 0x9b */, 1 /* 0x9c */, 1 /* 0x9d */, 1 /* 0x9e */, 1 /* 0x9f */,
1 /* 0xa0 */, 1 /* 0xa1 */, 1 /* 0xa2 */, 1 /* 0xa3 */, 1 /* 0xa4 */,
1 /* 0xa5 */, 1 /* 0xa6 */, 1 /* 0xa7 */, 1 /* 0xa8 */, 1 /* 0xa9 */,
1 /* 0xaa */, 1 /* 0xab */, 1 /* 0xac */, 1 /* 0xad */, 1 /* 0xae */,
1 /* 0xaf */, 1 /* 0xb0 */, 1 /* 0xb1 */, 1 /* 0xb2 */, 1 /* 0xb3 */,
1 /* 0xb4 */, 1 /* 0xb5 */, 1 /* 0xb6 */, 1 /* 0xb7 */, 1 /* 0xb8 */,
1 /* 0xb9 */, 1 /* 0xba */, 1 /* 0xbb */, 1 /* 0xbc */, 1 /* 0xbd */,
1 /* 0xbe */, 1 /* 0xbf */, 1 /* 0xc0 */, 1 /* 0xc1 */, 1 /* 0xc2 */,
1 /* 0xc3 */, 1 /* 0xc4 */, 1 /* 0xc5 */, 1 /* 0xc6 */, 1 /* 0xc7 */,
1 /* 0xc8 */, 1 /* 0xc9 */, 1 /* 0xca */, 1 /* 0xcb */, 1 /* 0xcc */,
1 /* 0xcd */, 1 /* 0xce */, 1 /* 0xcf */, 1 /* 0xd0 */, 1 /* 0xd1 */,
1 /* 0xd2 */, 1 /* 0xd3 */, 1 /* 0xd4 */, 1 /* 0xd5 */, 1 /* 0xd6 */,
1 /* 0xd7 */, 1 /* 0xd8 */, 1 /* 0xd9 */, 1 /* 0xda */, 1 /* 0xdb */,
1 /* 0xdc */, 1 /* 0xdd */, 1 /* 0xde */, 1 /* 0xdf */, 1 /* 0xe0 */,
1 /* 0xe1 */, 1 /* 0xe2 */, 1 /* 0xe3 */, 1 /* 0xe4 */, 1 /* 0xe5 */,
1 /* 0xe6 */, 1 /* 0xe7 */, 1 /* 0xe8 */, 1 /* 0xe9 */, 1 /* 0xea */,
1 /* 0xeb */, 1 /* 0xec */, 1 /* 0xed */, 1 /* 0xee */, 1 /* 0xef */,
1 /* 0xf0 */, 1 /* 0xf1 */, 1 /* 0xf2 */, 1 /* 0xf3 */, 1 /* 0xf4 */,
1 /* 0xf5 */, 1 /* 0xf6 */, 1 /* 0xf7 */, 1 /* 0xf8 */, 1 /* 0xf9 */,
1 /* 0xfa */, 1 /* 0xfb */, 1 /* 0xfc */, 1 /* 0xfd */, 1 /* 0xfe */,
1 /* 0xff */
0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */,
0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */,
0 /* BS */, 1 /* HT */, 0 /* LF */, 0 /* VT */,
0 /* FF */, 0 /* CR */, 0 /* SO */, 0 /* SI */,
0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */,
0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */,
0 /* CAN */, 0 /* EM */, 0 /* SUB */, 0 /* ESC */,
0 /* FS */, 0 /* GS */, 0 /* RS */, 0 /* US */,
1 /* SPC */, 1 /* ! */, 1 /* " */, 1 /* # */,
1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */,
1 /* ( */, 1 /* ) */, 1 /* * */, 1 /* + */,
1 /* , */, 1 /* - */, 1 /* . */, 1 /* / */,
1 /* 0 */, 1 /* 1 */, 1 /* 2 */, 1 /* 3 */,
1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */,
1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */,
1 /* < */, 1 /* = */, 1 /* > */, 1 /* ? */,
1 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */,
1 /* D */, 1 /* E */, 1 /* F */, 1 /* G */,
1 /* H */, 1 /* I */, 1 /* J */, 1 /* K */,
1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */,
1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */,
1 /* T */, 1 /* U */, 1 /* V */, 1 /* W */,
1 /* X */, 1 /* Y */, 1 /* Z */, 1 /* [ */,
1 /* \ */, 1 /* ] */, 1 /* ^ */, 1 /* _ */,
1 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */,
1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */,
1 /* h */, 1 /* i */, 1 /* j */, 1 /* k */,
1 /* l */, 1 /* m */, 1 /* n */, 1 /* o */,
1 /* p */, 1 /* q */, 1 /* r */, 1 /* s */,
1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */,
1 /* x */, 1 /* y */, 1 /* z */, 1 /* { */,
1 /* | */, 1 /* } */, 1 /* ~ */, 0 /* DEL */,
1 /* 0x80 */, 1 /* 0x81 */, 1 /* 0x82 */, 1 /* 0x83 */,
1 /* 0x84 */, 1 /* 0x85 */, 1 /* 0x86 */, 1 /* 0x87 */,
1 /* 0x88 */, 1 /* 0x89 */, 1 /* 0x8a */, 1 /* 0x8b */,
1 /* 0x8c */, 1 /* 0x8d */, 1 /* 0x8e */, 1 /* 0x8f */,
1 /* 0x90 */, 1 /* 0x91 */, 1 /* 0x92 */, 1 /* 0x93 */,
1 /* 0x94 */, 1 /* 0x95 */, 1 /* 0x96 */, 1 /* 0x97 */,
1 /* 0x98 */, 1 /* 0x99 */, 1 /* 0x9a */, 1 /* 0x9b */,
1 /* 0x9c */, 1 /* 0x9d */, 1 /* 0x9e */, 1 /* 0x9f */,
1 /* 0xa0 */, 1 /* 0xa1 */, 1 /* 0xa2 */, 1 /* 0xa3 */,
1 /* 0xa4 */, 1 /* 0xa5 */, 1 /* 0xa6 */, 1 /* 0xa7 */,
1 /* 0xa8 */, 1 /* 0xa9 */, 1 /* 0xaa */, 1 /* 0xab */,
1 /* 0xac */, 1 /* 0xad */, 1 /* 0xae */, 1 /* 0xaf */,
1 /* 0xb0 */, 1 /* 0xb1 */, 1 /* 0xb2 */, 1 /* 0xb3 */,
1 /* 0xb4 */, 1 /* 0xb5 */, 1 /* 0xb6 */, 1 /* 0xb7 */,
1 /* 0xb8 */, 1 /* 0xb9 */, 1 /* 0xba */, 1 /* 0xbb */,
1 /* 0xbc */, 1 /* 0xbd */, 1 /* 0xbe */, 1 /* 0xbf */,
1 /* 0xc0 */, 1 /* 0xc1 */, 1 /* 0xc2 */, 1 /* 0xc3 */,
1 /* 0xc4 */, 1 /* 0xc5 */, 1 /* 0xc6 */, 1 /* 0xc7 */,
1 /* 0xc8 */, 1 /* 0xc9 */, 1 /* 0xca */, 1 /* 0xcb */,
1 /* 0xcc */, 1 /* 0xcd */, 1 /* 0xce */, 1 /* 0xcf */,
1 /* 0xd0 */, 1 /* 0xd1 */, 1 /* 0xd2 */, 1 /* 0xd3 */,
1 /* 0xd4 */, 1 /* 0xd5 */, 1 /* 0xd6 */, 1 /* 0xd7 */,
1 /* 0xd8 */, 1 /* 0xd9 */, 1 /* 0xda */, 1 /* 0xdb */,
1 /* 0xdc */, 1 /* 0xdd */, 1 /* 0xde */, 1 /* 0xdf */,
1 /* 0xe0 */, 1 /* 0xe1 */, 1 /* 0xe2 */, 1 /* 0xe3 */,
1 /* 0xe4 */, 1 /* 0xe5 */, 1 /* 0xe6 */, 1 /* 0xe7 */,
1 /* 0xe8 */, 1 /* 0xe9 */, 1 /* 0xea */, 1 /* 0xeb */,
1 /* 0xec */, 1 /* 0xed */, 1 /* 0xee */, 1 /* 0xef */,
1 /* 0xf0 */, 1 /* 0xf1 */, 1 /* 0xf2 */, 1 /* 0xf3 */,
1 /* 0xf4 */, 1 /* 0xf5 */, 1 /* 0xf6 */, 1 /* 0xf7 */,
1 /* 0xf8 */, 1 /* 0xf9 */, 1 /* 0xfa */, 1 /* 0xfb */,
1 /* 0xfc */, 1 /* 0xfd */, 1 /* 0xfe */, 1 /* 0xff */
};
int nghttp2_check_header_value(const uint8_t *value, size_t len) {

View File

@ -286,58 +286,70 @@ static int http_response_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv,
/* Generated by genauthroitychartbl.py */
static char VALID_AUTHORITY_CHARS[] = {
0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, 0 /* EOT */,
0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, 0 /* BS */, 0 /* HT */,
0 /* LF */, 0 /* VT */, 0 /* FF */, 0 /* CR */, 0 /* SO */,
0 /* SI */, 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */,
0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, 0 /* CAN */,
0 /* EM */, 0 /* SUB */, 0 /* ESC */, 0 /* FS */, 0 /* GS */,
0 /* RS */, 0 /* US */, 0 /* SPC */, 1 /* ! */, 0 /* " */,
0 /* # */, 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */,
1 /* ( */, 1 /* ) */, 1 /* * */, 1 /* + */, 1 /* , */,
1 /* - */, 1 /* . */, 0 /* / */, 1 /* 0 */, 1 /* 1 */,
1 /* 2 */, 1 /* 3 */, 1 /* 4 */, 1 /* 5 */, 1 /* 6 */,
1 /* 7 */, 1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */,
0 /* < */, 1 /* = */, 0 /* > */, 0 /* ? */, 1 /* @ */,
1 /* A */, 1 /* B */, 1 /* C */, 1 /* D */, 1 /* E */,
1 /* F */, 1 /* G */, 1 /* H */, 1 /* I */, 1 /* J */,
1 /* K */, 1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */,
1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */, 1 /* T */,
1 /* U */, 1 /* V */, 1 /* W */, 1 /* X */, 1 /* Y */,
1 /* Z */, 1 /* [ */, 0 /* \ */, 1 /* ] */, 0 /* ^ */,
1 /* _ */, 0 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */,
1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, 1 /* h */,
1 /* i */, 1 /* j */, 1 /* k */, 1 /* l */, 1 /* m */,
1 /* n */, 1 /* o */, 1 /* p */, 1 /* q */, 1 /* r */,
1 /* s */, 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */,
1 /* x */, 1 /* y */, 1 /* z */, 0 /* { */, 0 /* | */,
0 /* } */, 1 /* ~ */, 0 /* DEL */, 0 /* 0x80 */, 0 /* 0x81 */,
0 /* 0x82 */, 0 /* 0x83 */, 0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */,
0 /* 0x87 */, 0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */,
0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */, 0 /* 0x90 */,
0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */, 0 /* 0x94 */, 0 /* 0x95 */,
0 /* 0x96 */, 0 /* 0x97 */, 0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */,
0 /* 0x9b */, 0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */,
0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */, 0 /* 0xa4 */,
0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */, 0 /* 0xa8 */, 0 /* 0xa9 */,
0 /* 0xaa */, 0 /* 0xab */, 0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */,
0 /* 0xaf */, 0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */,
0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */, 0 /* 0xb8 */,
0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */, 0 /* 0xbc */, 0 /* 0xbd */,
0 /* 0xbe */, 0 /* 0xbf */, 0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */,
0 /* 0xc3 */, 0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */,
0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */, 0 /* 0xcc */,
0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */, 0 /* 0xd0 */, 0 /* 0xd1 */,
0 /* 0xd2 */, 0 /* 0xd3 */, 0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */,
0 /* 0xd7 */, 0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */,
0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */, 0 /* 0xe0 */,
0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */, 0 /* 0xe4 */, 0 /* 0xe5 */,
0 /* 0xe6 */, 0 /* 0xe7 */, 0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */,
0 /* 0xeb */, 0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */,
0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */, 0 /* 0xf4 */,
0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */, 0 /* 0xf8 */, 0 /* 0xf9 */,
0 /* 0xfa */, 0 /* 0xfb */, 0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */,
0 /* 0xff */
0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */,
0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */,
0 /* BS */, 0 /* HT */, 0 /* LF */, 0 /* VT */,
0 /* FF */, 0 /* CR */, 0 /* SO */, 0 /* SI */,
0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */,
0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */,
0 /* CAN */, 0 /* EM */, 0 /* SUB */, 0 /* ESC */,
0 /* FS */, 0 /* GS */, 0 /* RS */, 0 /* US */,
0 /* SPC */, 1 /* ! */, 0 /* " */, 0 /* # */,
1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */,
1 /* ( */, 1 /* ) */, 1 /* * */, 1 /* + */,
1 /* , */, 1 /* - */, 1 /* . */, 0 /* / */,
1 /* 0 */, 1 /* 1 */, 1 /* 2 */, 1 /* 3 */,
1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */,
1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */,
0 /* < */, 1 /* = */, 0 /* > */, 0 /* ? */,
1 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */,
1 /* D */, 1 /* E */, 1 /* F */, 1 /* G */,
1 /* H */, 1 /* I */, 1 /* J */, 1 /* K */,
1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */,
1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */,
1 /* T */, 1 /* U */, 1 /* V */, 1 /* W */,
1 /* X */, 1 /* Y */, 1 /* Z */, 1 /* [ */,
0 /* \ */, 1 /* ] */, 0 /* ^ */, 1 /* _ */,
0 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */,
1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */,
1 /* h */, 1 /* i */, 1 /* j */, 1 /* k */,
1 /* l */, 1 /* m */, 1 /* n */, 1 /* o */,
1 /* p */, 1 /* q */, 1 /* r */, 1 /* s */,
1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */,
1 /* x */, 1 /* y */, 1 /* z */, 0 /* { */,
0 /* | */, 0 /* } */, 1 /* ~ */, 0 /* DEL */,
0 /* 0x80 */, 0 /* 0x81 */, 0 /* 0x82 */, 0 /* 0x83 */,
0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, 0 /* 0x87 */,
0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */,
0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */,
0 /* 0x90 */, 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */,
0 /* 0x94 */, 0 /* 0x95 */, 0 /* 0x96 */, 0 /* 0x97 */,
0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, 0 /* 0x9b */,
0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */,
0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */,
0 /* 0xa4 */, 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */,
0 /* 0xa8 */, 0 /* 0xa9 */, 0 /* 0xaa */, 0 /* 0xab */,
0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, 0 /* 0xaf */,
0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */,
0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */,
0 /* 0xb8 */, 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */,
0 /* 0xbc */, 0 /* 0xbd */, 0 /* 0xbe */, 0 /* 0xbf */,
0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, 0 /* 0xc3 */,
0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */,
0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */,
0 /* 0xcc */, 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */,
0 /* 0xd0 */, 0 /* 0xd1 */, 0 /* 0xd2 */, 0 /* 0xd3 */,
0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, 0 /* 0xd7 */,
0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */,
0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */,
0 /* 0xe0 */, 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */,
0 /* 0xe4 */, 0 /* 0xe5 */, 0 /* 0xe6 */, 0 /* 0xe7 */,
0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, 0 /* 0xeb */,
0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */,
0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */,
0 /* 0xf4 */, 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */,
0 /* 0xf8 */, 0 /* 0xf9 */, 0 /* 0xfa */, 0 /* 0xfb */,
0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, 0 /* 0xff */
};
static int check_authority(const uint8_t *value, size_t len) {

View File

@ -30,7 +30,7 @@ static int select_next_protocol(unsigned char **out, unsigned char *outlen,
const unsigned char *in, unsigned int inlen,
const char *key, unsigned int keylen) {
unsigned int i;
for (i = 0; i + keylen <= inlen; i += (unsigned int)(in [i] + 1)) {
for (i = 0; i + keylen <= inlen; i += (unsigned int)(in[i] + 1)) {
if (memcmp(&in[i], key, keylen) == 0) {
*out = (unsigned char *)&in[i + 1];
*outlen = in[i];

View File

@ -2082,7 +2082,7 @@ int alpn_select_proto_cb(SSL *ssl, const unsigned char **out,
std::cout << "[ALPN] client offers:" << std::endl;
}
if (config->verbose) {
for (unsigned int i = 0; i < inlen; i += in [i] + 1) {
for (unsigned int i = 0; i < inlen; i += in[i] + 1) {
std::cout << " * ";
std::cout.write(reinterpret_cast<const char *>(&in[i + 1]), in[i]);
std::cout << std::endl;

View File

@ -334,7 +334,8 @@ void print_frame(print_type ptype, const nghttp2_frame *frame) {
frame->goaway.error_code,
static_cast<unsigned int>(frame->goaway.opaque_data_len),
util::ascii_dump(frame->goaway.opaque_data,
frame->goaway.opaque_data_len).c_str());
frame->goaway.opaque_data_len)
.c_str());
break;
case NGHTTP2_WINDOW_UPDATE:
print_frame_attr_indent();

View File

@ -521,9 +521,9 @@ const request *session_impl::submit(boost::system::error_code &ec,
if (cb) {
strm->request().impl().on_read(std::move(cb));
prd.source.ptr = strm.get();
prd.read_callback =
[](nghttp2_session *session, int32_t stream_id, uint8_t *buf,
size_t length, uint32_t *data_flags, nghttp2_data_source *source,
prd.read_callback = [](nghttp2_session *session, int32_t stream_id,
uint8_t *buf, size_t length, uint32_t *data_flags,
nghttp2_data_source *source,
void *user_data) -> ssize_t {
auto strm = static_cast<stream *>(source->ptr);
return strm->request().impl().call_on_read(buf, length, data_flags);

View File

@ -74,10 +74,12 @@ public:
virtual void start_connect(tcp::resolver::iterator endpoint_it) = 0;
virtual tcp::socket &socket() = 0;
virtual void read_socket(std::function<
void(const boost::system::error_code &ec, std::size_t n)> h) = 0;
virtual void write_socket(std::function<
void(const boost::system::error_code &ec, std::size_t n)> h) = 0;
virtual void read_socket(
std::function<void(const boost::system::error_code &ec, std::size_t n)>
h) = 0;
virtual void write_socket(
std::function<void(const boost::system::error_code &ec, std::size_t n)>
h) = 0;
virtual void shutdown_socket() = 0;
void shutdown();

View File

@ -44,10 +44,12 @@ public:
virtual void start_connect(tcp::resolver::iterator endpoint_it);
virtual tcp::socket &socket();
virtual void read_socket(std::function<
void(const boost::system::error_code &ec, std::size_t n)> h);
virtual void write_socket(std::function<
void(const boost::system::error_code &ec, std::size_t n)> h);
virtual void read_socket(
std::function<void(const boost::system::error_code &ec, std::size_t n)>
h);
virtual void write_socket(
std::function<void(const boost::system::error_code &ec, std::size_t n)>
h);
virtual void shutdown_socket();
private:

View File

@ -47,10 +47,12 @@ public:
virtual void start_connect(tcp::resolver::iterator endpoint_it);
virtual tcp::socket &socket();
virtual void read_socket(std::function<
void(const boost::system::error_code &ec, std::size_t n)> h);
virtual void write_socket(std::function<
void(const boost::system::error_code &ec, std::size_t n)> h);
virtual void read_socket(
std::function<void(const boost::system::error_code &ec, std::size_t n)>
h);
virtual void write_socket(
std::function<void(const boost::system::error_code &ec, std::size_t n)>
h);
virtual void shutdown_socket();
private:

View File

@ -113,8 +113,8 @@ generator_cb file_generator(const std::string &path) {
generator_cb file_generator_from_fd(int fd) {
auto d = defer_shared(close, fd);
return [fd, d](uint8_t *buf, size_t len, uint32_t *data_flags)
-> generator_cb::result_type {
return [fd, d](uint8_t *buf, size_t len,
uint32_t *data_flags) -> generator_cb::result_type {
ssize_t n;
while ((n = read(fd, buf, len)) == -1 && errno == EINTR)
;

View File

@ -58,7 +58,7 @@ void io_service_pool::run(bool asynchronous) {
// Create a pool of threads to run all of the io_services.
for (std::size_t i = 0; i < io_services_.size(); ++i) {
futures_.push_back(std::async(std::launch::async,
(size_t (boost::asio::io_service::*)(void)) &
(size_t(boost::asio::io_service::*)(void)) &
boost::asio::io_service::run,
io_services_[i]));
}

View File

@ -130,8 +130,8 @@ void server::start_accept(boost::asio::ssl::context &tls_context,
acceptor.async_accept(
new_connection->socket().lowest_layer(),
[this, &tls_context, &acceptor, &mux, new_connection](
const boost::system::error_code &e) {
[this, &tls_context, &acceptor, &mux,
new_connection](const boost::system::error_code &e) {
if (!e) {
new_connection->socket().lowest_layer().set_option(
tcp::no_delay(true));

View File

@ -345,9 +345,9 @@ int http2_handler::start_response(stream &strm) {
auto &req = strm.request().impl();
if (::nghttp2::http2::expect_response_body(req.method(), res.status_code())) {
prd.source.ptr = &strm;
prd.read_callback =
[](nghttp2_session *session, int32_t stream_id, uint8_t *buf,
size_t length, uint32_t *data_flags, nghttp2_data_source *source,
prd.read_callback = [](nghttp2_session *session, int32_t stream_id,
uint8_t *buf, size_t length, uint32_t *data_flags,
nghttp2_data_source *source,
void *user_data) -> ssize_t {
auto &strm = *static_cast<stream *>(source->ptr);
return strm.response().impl().call_read(buf, length, data_flags);

View File

@ -369,7 +369,8 @@ OPTIONS:
buffer.
Default: 4096
-d, --dump-header-table
Output dynamic header table.)" << std::endl;
Output dynamic header table.)"
<< std::endl;
}
static struct option long_options[] = {

View File

@ -1339,7 +1339,8 @@ process_time_stats(const std::vector<std::unique_ptr<Worker>> &workers) {
}
request_times.push_back(
std::chrono::duration_cast<std::chrono::duration<double>>(
req_stat.stream_close_time - req_stat.request_time).count());
req_stat.stream_close_time - req_stat.request_time)
.count());
}
const auto &stat = w->stats;
@ -1348,7 +1349,8 @@ process_time_stats(const std::vector<std::unique_ptr<Worker>> &workers) {
if (recorded(cstat.client_start_time) &&
recorded(cstat.client_end_time)) {
auto t = std::chrono::duration_cast<std::chrono::duration<double>>(
cstat.client_end_time - cstat.client_start_time).count();
cstat.client_end_time - cstat.client_start_time)
.count();
if (t > 1e-9) {
rps_values.push_back(cstat.req_success / t);
}
@ -1362,7 +1364,8 @@ process_time_stats(const std::vector<std::unique_ptr<Worker>> &workers) {
connect_times.push_back(
std::chrono::duration_cast<std::chrono::duration<double>>(
cstat.connect_time - cstat.connect_start_time).count());
cstat.connect_time - cstat.connect_start_time)
.count());
if (!recorded(cstat.ttfb)) {
continue;
@ -1370,7 +1373,8 @@ process_time_stats(const std::vector<std::unique_ptr<Worker>> &workers) {
ttfb_times.push_back(
std::chrono::duration_cast<std::chrono::duration<double>>(
cstat.ttfb - cstat.connect_start_time).count());
cstat.ttfb - cstat.connect_start_time)
.count());
}
}
@ -1617,7 +1621,8 @@ void print_version(std::ostream &out) {
namespace {
void print_usage(std::ostream &out) {
out << R"(Usage: h2load [OPTIONS]... [URI]...
benchmarking tool for HTTP/2 and SPDY server)" << std::endl;
benchmarking tool for HTTP/2 and SPDY server)"
<< std::endl;
}
} // namespace
@ -1649,14 +1654,17 @@ Options:
with --timing-script-file option, this option specifies
the number of requests each client performs rather than
the number of requests across all clients.
Default: )" << config.nreqs << R"(
Default: )"
<< config.nreqs << R"(
-c, --clients=<N>
Number of concurrent clients. With -r option, this
specifies the maximum number of connections to be made.
Default: )" << config.nclients << R"(
Default: )"
<< config.nclients << R"(
-t, --threads=<N>
Number of native threads.
Default: )" << config.nthreads << R"(
Default: )"
<< config.nthreads << R"(
-i, --input-file=<PATH>
Path of a file with multiple URIs are separated by EOLs.
This option will disable URIs getting from command-line.
@ -1675,13 +1683,15 @@ Options:
-w, --window-bits=<N>
Sets the stream level initial window size to (2**<N>)-1.
For SPDY, 2**<N> is used instead.
Default: )" << config.window_bits << R"(
Default: )"
<< config.window_bits << R"(
-W, --connection-window-bits=<N>
Sets the connection level initial window size to
(2**<N>)-1. For SPDY, if <N> is strictly less than 16,
this option is ignored. Otherwise 2**<N> is used for
SPDY.
Default: )" << config.connection_window_bits << R"(
Default: )"
<< config.connection_window_bits << R"(
-H, --header=<HEADER>
Add/Override a header to the requests.
--ciphers=<SUITE>
@ -1699,8 +1709,10 @@ Options:
Available protocols: )";
#endif // !HAVE_SPDYLAY
out << NGHTTP2_CLEARTEXT_PROTO_VERSION_ID << R"( and
)" << NGHTTP2_H1_1 << R"(
Default: )" << NGHTTP2_CLEARTEXT_PROTO_VERSION_ID << R"(
)"
<< NGHTTP2_H1_1 << R"(
Default: )"
<< NGHTTP2_CLEARTEXT_PROTO_VERSION_ID << R"(
-d, --data=<PATH>
Post FILE to server. The request method is changed to
POST. For http/1.1 connection, if -d is used, the
@ -1774,20 +1786,22 @@ Options:
NPN. The parameter must be delimited by a single comma
only and any white spaces are treated as a part of
protocol string.
Default: )" << DEFAULT_NPN_LIST << R"(
Default: )"
<< DEFAULT_NPN_LIST << R"(
--h1 Short hand for --npn-list=http/1.1
--no-tls-proto=http/1.1, which effectively force
http/1.1 for both http and https URI.
--header-table-size=<SIZE>
Specify decoder header table size.
Default: )" << util::utos_unit(config.header_table_size) << R"(
Default: )"
<< util::utos_unit(config.header_table_size) << R"(
--encoder-header-table-size=<SIZE>
Specify encoder header table size. The decoder (server)
specifies the maximum dynamic table size it accepts.
Then the negotiated dynamic table size is the minimum of
this option value and the value which server specified.
Default: )" << util::utos_unit(config.encoder_header_table_size)
<< R"(
Default: )"
<< util::utos_unit(config.encoder_header_table_size) << R"(
-v, --verbose
Output debug information.
--version Display version information and exit.
@ -1801,7 +1815,8 @@ Options:
The <DURATION> argument is an integer and an optional unit (e.g., 1s
is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
(hours, minutes, seconds and milliseconds, respectively). If a unit
is omitted, a second is used as unit.)" << std::endl;
is omitted, a second is used as unit.)"
<< std::endl;
}
} // namespace
@ -2122,7 +2137,8 @@ int main(int argc, char **argv) {
if (config.nreqs > uris.size()) {
std::cerr << "-n: the number of requests must be less than or equal "
"to the number of timing script entries. Setting number "
"of requests to " << uris.size() << std::endl;
"of requests to "
<< uris.size() << std::endl;
config.nreqs = uris.size();
}
@ -2172,7 +2188,8 @@ int main(int argc, char **argv) {
if (config.nclients < config.nthreads) {
std::cerr << "-c, -t: the number of clients must be greater than or equal "
"to the number of threads." << std::endl;
"to the number of threads."
<< std::endl;
exit(EXIT_FAILURE);
}
@ -2185,7 +2202,8 @@ int main(int argc, char **argv) {
if (config.rate > config.nclients) {
std::cerr << "-r, -c: the connection rate must be smaller than or equal "
"to the number of clients." << std::endl;
"to the number of clients."
<< std::endl;
exit(EXIT_FAILURE);
}
}
@ -2532,26 +2550,29 @@ int main(int argc, char **argv) {
}
std::cout << std::fixed << std::setprecision(2) << R"(
finished in )" << util::format_duration(duration) << ", " << rps << " req/s, "
finished in )"
<< util::format_duration(duration) << ", " << rps << " req/s, "
<< util::utos_funit(bps) << R"(B/s
requests: )" << stats.req_todo << " total, " << stats.req_started
<< " started, " << stats.req_done << " done, "
<< stats.req_status_success << " succeeded, " << stats.req_failed
<< " failed, " << stats.req_error << " errored, "
<< stats.req_timedout << R"( timeout
status codes: )" << stats.status[2] << " 2xx, " << stats.status[3] << " 3xx, "
requests: )" << stats.req_todo
<< " total, " << stats.req_started << " started, " << stats.req_done
<< " done, " << stats.req_status_success << " succeeded, "
<< stats.req_failed << " failed, " << stats.req_error
<< " errored, " << stats.req_timedout << R"( timeout
status codes: )"
<< stats.status[2] << " 2xx, " << stats.status[3] << " 3xx, "
<< stats.status[4] << " 4xx, " << stats.status[5] << R"( 5xx
traffic: )" << util::utos_funit(stats.bytes_total) << "B (" << stats.bytes_total
<< ") total, " << util::utos_funit(stats.bytes_head) << "B ("
<< stats.bytes_head << ") headers (space savings "
<< header_space_savings * 100 << "%), "
<< util::utos_funit(stats.bytes_body) << "B (" << stats.bytes_body
<< R"() data
traffic: )" << util::utos_funit(stats.bytes_total)
<< "B (" << stats.bytes_total << ") total, "
<< util::utos_funit(stats.bytes_head) << "B (" << stats.bytes_head
<< ") headers (space savings " << header_space_savings * 100
<< "%), " << util::utos_funit(stats.bytes_body) << "B ("
<< stats.bytes_body << R"() data
min max mean sd +/- sd
time for request: )" << std::setw(10) << util::format_duration(ts.request.min)
<< " " << std::setw(10) << util::format_duration(ts.request.max)
<< " " << std::setw(10) << util::format_duration(ts.request.mean)
<< " " << std::setw(10) << util::format_duration(ts.request.sd)
time for request: )"
<< std::setw(10) << util::format_duration(ts.request.min) << " "
<< std::setw(10) << util::format_duration(ts.request.max) << " "
<< std::setw(10) << util::format_duration(ts.request.mean) << " "
<< std::setw(10) << util::format_duration(ts.request.sd)
<< std::setw(9) << util::dtos(ts.request.within_sd) << "%"
<< "\ntime for connect: " << std::setw(10)
<< util::format_duration(ts.connect.min) << " " << std::setw(10)

View File

@ -149,20 +149,20 @@ nghttp2_nv make_nv_nocopy(const StringRef &name, const StringRef &value,
// Create nghttp2_nv from string literal |name| and |value|.
template <size_t N, size_t M>
constexpr nghttp2_nv make_nv_ll(const char(&name)[N], const char(&value)[M]) {
constexpr nghttp2_nv make_nv_ll(const char (&name)[N], const char (&value)[M]) {
return {(uint8_t *)name, (uint8_t *)value, N - 1, M - 1,
NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE};
}
// Create nghttp2_nv from string literal |name| and c-string |value|.
template <size_t N>
nghttp2_nv make_nv_lc(const char(&name)[N], const char *value) {
nghttp2_nv make_nv_lc(const char (&name)[N], const char *value) {
return {(uint8_t *)name, (uint8_t *)value, N - 1, strlen(value),
NGHTTP2_NV_FLAG_NO_COPY_NAME};
}
template <size_t N>
nghttp2_nv make_nv_lc_nocopy(const char(&name)[N], const char *value) {
nghttp2_nv make_nv_lc_nocopy(const char (&name)[N], const char *value) {
return {(uint8_t *)name, (uint8_t *)value, N - 1, strlen(value),
NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE};
}
@ -170,19 +170,19 @@ nghttp2_nv make_nv_lc_nocopy(const char(&name)[N], const char *value) {
// Create nghttp2_nv from string literal |name| and std::string
// |value|.
template <size_t N>
nghttp2_nv make_nv_ls(const char(&name)[N], const std::string &value) {
nghttp2_nv make_nv_ls(const char (&name)[N], const std::string &value) {
return {(uint8_t *)name, (uint8_t *)value.c_str(), N - 1, value.size(),
NGHTTP2_NV_FLAG_NO_COPY_NAME};
}
template <size_t N>
nghttp2_nv make_nv_ls_nocopy(const char(&name)[N], const std::string &value) {
nghttp2_nv make_nv_ls_nocopy(const char (&name)[N], const std::string &value) {
return {(uint8_t *)name, (uint8_t *)value.c_str(), N - 1, value.size(),
NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE};
}
template <size_t N>
nghttp2_nv make_nv_ls_nocopy(const char(&name)[N], const StringRef &value) {
nghttp2_nv make_nv_ls_nocopy(const char (&name)[N], const StringRef &value) {
return {(uint8_t *)name, (uint8_t *)value.c_str(), N - 1, value.size(),
NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE};
}

View File

@ -39,7 +39,7 @@ using namespace nghttp2;
#define MAKE_NV(K, V) \
{ \
(uint8_t *) K, (uint8_t *)V, sizeof(K) - 1, sizeof(V) - 1, \
(uint8_t *)K, (uint8_t *)V, sizeof(K) - 1, sizeof(V) - 1, \
NGHTTP2_NV_FLAG_NONE \
}
@ -107,12 +107,8 @@ void test_http2_add_header(void) {
}
void test_http2_get_header(void) {
auto nva = Headers{{"alpha", "1"},
{"bravo", "2"},
{"bravo", "3"},
{"charlie", "4"},
{"delta", "5"},
{"echo", "6"},
auto nva = Headers{{"alpha", "1"}, {"bravo", "2"}, {"bravo", "3"},
{"charlie", "4"}, {"delta", "5"}, {"echo", "6"},
{"content-length", "7"}};
const Headers::value_type *rv;
rv = http2::get_header(nva, "delta");

View File

@ -90,7 +90,8 @@ typedef std::function<void(uint32_t)> close_cb;
// of the error and request/response must be closed, return
// NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE.
typedef std::function<ssize_t(uint8_t *buf, std::size_t len,
uint32_t *data_flags)> generator_cb;
uint32_t *data_flags)>
generator_cb;
// Convenient function to create function to read file denoted by
// |path|. This can be passed to response::end().

View File

@ -246,7 +246,8 @@ The output of this program can be used as input for deflatehd.
OPTIONS:
-d, --dump-header-table
Output dynamic header table.)" << std::endl;
Output dynamic header table.)"
<< std::endl;
;
}

View File

@ -99,10 +99,8 @@ template <typename Memchunk> struct Memchunks {
Memchunks(Pool<Memchunk> *pool)
: pool(pool), head(nullptr), tail(nullptr), len(0) {}
Memchunks(const Memchunks &) = delete;
Memchunks(Memchunks &&other) noexcept : pool(other.pool),
head(other.head),
tail(other.tail),
len(other.len) {
Memchunks(Memchunks &&other) noexcept
: pool(other.pool), head(other.head), tail(other.tail), len(other.len) {
// keep other.pool
other.head = other.tail = nullptr;
other.len = 0;
@ -173,7 +171,7 @@ template <typename Memchunk> struct Memchunks {
return count;
}
template <size_t N> size_t append(const char(&s)[N]) {
template <size_t N> size_t append(const char (&s)[N]) {
return append(s, N - 1);
}
size_t append(const std::string &s) { return append(s.c_str(), s.size()); }

View File

@ -225,8 +225,9 @@ void test_peek_memchunks_append(void) {
PeekMemchunks16 pchunks(&pool);
std::array<uint8_t, 32> b{{
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4',
'5', '6', '7', '8', '9', '0', '1', }},
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1',
}},
d;
pchunks.append(b.data(), b.size());
@ -259,8 +260,9 @@ void test_peek_memchunks_disable_peek_drain(void) {
PeekMemchunks16 pchunks(&pool);
std::array<uint8_t, 32> b{{
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4',
'5', '6', '7', '8', '9', '0', '1', }},
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1',
}},
d;
pchunks.append(b.data(), b.size());
@ -286,8 +288,9 @@ void test_peek_memchunks_disable_peek_no_drain(void) {
PeekMemchunks16 pchunks(&pool);
std::array<uint8_t, 32> b{{
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4',
'5', '6', '7', '8', '9', '0', '1', }},
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1',
}},
d;
pchunks.append(b.data(), b.size());
@ -313,8 +316,9 @@ void test_peek_memchunks_reset(void) {
PeekMemchunks16 pchunks(&pool);
std::array<uint8_t, 32> b{{
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4',
'5', '6', '7', '8', '9', '0', '1', }},
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1',
}},
d;
pchunks.append(b.data(), b.size());

View File

@ -89,7 +89,8 @@ enum {
namespace {
constexpr auto anchors = std::array<Anchor, 5>{{
{3, 0, 201}, {5, 0, 101}, {7, 0, 1}, {9, 7, 1}, {11, 3, 1}, }};
{3, 0, 201}, {5, 0, 101}, {7, 0, 1}, {9, 7, 1}, {11, 3, 1},
}};
} // namespace
Config::Config()
@ -1441,13 +1442,14 @@ void HttpClient::output_har(FILE *outfile) {
auto entries = json_array();
json_object_set_new(log, "entries", entries);
auto dns_delta =
std::chrono::duration_cast<std::chrono::microseconds>(
timing.domain_lookup_end_time - timing.start_time).count() /
auto dns_delta = std::chrono::duration_cast<std::chrono::microseconds>(
timing.domain_lookup_end_time - timing.start_time)
.count() /
1000.0;
auto connect_delta =
std::chrono::duration_cast<std::chrono::microseconds>(
timing.connect_end_time - timing.domain_lookup_end_time).count() /
timing.connect_end_time - timing.domain_lookup_end_time)
.count() /
1000.0;
for (size_t i = 0; i < reqvec.size(); ++i) {
@ -1468,20 +1470,23 @@ void HttpClient::output_har(FILE *outfile) {
std::chrono::system_clock::duration>(
req_timing.request_start_time - timing.start_time);
auto wait_delta = std::chrono::duration_cast<std::chrono::microseconds>(
req_timing.response_start_time -
req_timing.request_start_time).count() /
auto wait_delta =
std::chrono::duration_cast<std::chrono::microseconds>(
req_timing.response_start_time - req_timing.request_start_time)
.count() /
1000.0;
auto receive_delta = std::chrono::duration_cast<std::chrono::microseconds>(
req_timing.response_end_time -
req_timing.response_start_time).count() /
auto receive_delta =
std::chrono::duration_cast<std::chrono::microseconds>(
req_timing.response_end_time - req_timing.response_start_time)
.count() /
1000.0;
auto time_sum =
std::chrono::duration_cast<std::chrono::microseconds>(
(i == 0) ? (req_timing.response_end_time - timing.start_time)
: (req_timing.response_end_time -
req_timing.request_start_time)).count() /
req_timing.request_start_time))
.count() /
1000.0;
json_object_set_new(
@ -2114,7 +2119,8 @@ see http://www.w3.org/TR/resource-timing/#processing-model
sorted by 'complete'
id responseEnd requestStart process code size request path)" << std::endl;
id responseEnd requestStart process code size request path)"
<< std::endl;
const auto &base = client.timing.connect_end_time;
for (const auto &req : reqs) {
@ -2146,7 +2152,7 @@ int client_select_next_proto_cb(SSL *ssl, unsigned char **out,
print_timer();
std::cout << "[NPN] server offers:" << std::endl;
}
for (unsigned int i = 0; i < inlen; i += in [i] + 1) {
for (unsigned int i = 0; i < inlen; i += in[i] + 1) {
if (config.verbose) {
std::cout << " * ";
std::cout.write(reinterpret_cast<const char *>(&in[i + 1]), in[i]);
@ -2181,10 +2187,11 @@ const char *const CIPHER_LIST =
} // namespace
namespace {
int communicate(const std::string &scheme, const std::string &host,
uint16_t port,
std::vector<std::tuple<std::string, nghttp2_data_provider *,
int64_t, int32_t>> requests,
int communicate(
const std::string &scheme, const std::string &host, uint16_t port,
std::vector<
std::tuple<std::string, nghttp2_data_provider *, int64_t, int32_t>>
requests,
const nghttp2_session_callbacks *callbacks) {
int result = 0;
auto loop = EV_DEFAULT;
@ -2482,8 +2489,9 @@ int run(char **uris, int n) {
data_prd.source.fd = data_fd;
data_prd.read_callback = file_read_callback;
}
std::vector<std::tuple<std::string, nghttp2_data_provider *, int64_t,
int32_t>> requests;
std::vector<
std::tuple<std::string, nghttp2_data_provider *, int64_t, int32_t>>
requests;
size_t next_weight_idx = 0;
@ -2540,7 +2548,8 @@ void print_version(std::ostream &out) {
namespace {
void print_usage(std::ostream &out) {
out << R"(Usage: nghttp [OPTIONS]... <URI>...
HTTP/2 client)" << std::endl;
HTTP/2 client)"
<< std::endl;
}
} // namespace
@ -2607,8 +2616,8 @@ Options:
less than the number of URI, the last -p option value is
repeated. If there is no -p option, default weight, 16,
is assumed. The valid value range is
[)" << NGHTTP2_MIN_WEIGHT << ", " << NGHTTP2_MAX_WEIGHT
<< R"(], inclusive.
[)"
<< NGHTTP2_MIN_WEIGHT << ", " << NGHTTP2_MAX_WEIGHT << R"(], inclusive.
-M, --peer-max-concurrent-streams=<N>
Use <N> as SETTINGS_MAX_CONCURRENT_STREAMS value of
remote endpoint as if it is received in SETTINGS frame.
@ -2660,7 +2669,8 @@ Options:
The <DURATION> argument is an integer and an optional unit (e.g., 1s
is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
(hours, minutes, seconds and milliseconds, respectively). If a unit
is omitted, a second is used as unit.)" << std::endl;
is omitted, a second is used as unit.)"
<< std::endl;
}
} // namespace

View File

@ -142,7 +142,8 @@ Options:
-m, --max-concurrent-streams=<N>
Set the maximum number of the concurrent streams in one
HTTP/2 session.
Default: )" << config.max_concurrent_streams << R"(
Default: )"
<< config.max_concurrent_streams << R"(
-n, --workers=<N>
Set the number of worker threads.
Default: 1
@ -173,7 +174,8 @@ Options:
--mime-types-file=<PATH>
Path to file that contains MIME media types and the
extensions that represent them.
Default: )" << config.mime_types_file << R"(
Default: )"
<< config.mime_types_file << R"(
--no-content-length
Don't send content-length header field.
--version Display version information and exit.
@ -182,7 +184,8 @@ Options:
--
The <SIZE> argument is an integer and an optional unit (e.g., 10K is
10 * 1024). Units are K, M and G (powers of 1024).)" << std::endl;
10 * 1024). Units are K, M and G (powers of 1024).)"
<< std::endl;
}
} // namespace

View File

@ -1467,7 +1467,8 @@ void print_version(std::ostream &out) {
namespace {
void print_usage(std::ostream &out) {
out << R"(Usage: nghttpx [OPTIONS]... [<PRIVATE_KEY> <CERT>]
A reverse proxy for HTTP/2, HTTP/1 and SPDY.)" << std::endl;
A reverse proxy for HTTP/2, HTTP/1 and SPDY.)"
<< std::endl;
}
} // namespace
@ -1613,8 +1614,8 @@ Connections:
not contain these characters. Since ";" has special
meaning in shell, the option value must be quoted.
Default: )" << DEFAULT_DOWNSTREAM_HOST << ","
<< DEFAULT_DOWNSTREAM_PORT << R"(
Default: )"
<< DEFAULT_DOWNSTREAM_HOST << "," << DEFAULT_DOWNSTREAM_PORT << R"(
-f, --frontend=(<HOST>,<PORT>|unix:<PATH>)[[;<PARAM>]...]
Set frontend host and port. If <HOST> is '*', it
assumes all addresses including both IPv4 and IPv6.
@ -1645,7 +1646,8 @@ Connections:
Default: *,3000
--backlog=<N>
Set listen backlog size.
Default: )" << config->conn.listener.backlog << R"(
Default: )"
<< config->conn.listener.backlog << R"(
--backend-address-family=(auto|IPv4|IPv6)
Specify address family of backend connections. If
"auto" is given, both IPv4 and IPv6 are considered. If
@ -1671,25 +1673,30 @@ Connections:
Performance:
-n, --workers=<N>
Set the number of worker threads.
Default: )" << config->num_worker << R"(
Default: )"
<< config->num_worker << R"(
--read-rate=<SIZE>
Set maximum average read rate on frontend connection.
Setting 0 to this option means read rate is unlimited.
Default: )" << config->conn.upstream.ratelimit.read.rate << R"(
Default: )"
<< config->conn.upstream.ratelimit.read.rate << R"(
--read-burst=<SIZE>
Set maximum read burst size on frontend connection.
Setting 0 to this option means read burst size is
unlimited.
Default: )" << config->conn.upstream.ratelimit.read.burst << R"(
Default: )"
<< config->conn.upstream.ratelimit.read.burst << R"(
--write-rate=<SIZE>
Set maximum average write rate on frontend connection.
Setting 0 to this option means write rate is unlimited.
Default: )" << config->conn.upstream.ratelimit.write.rate << R"(
Default: )"
<< config->conn.upstream.ratelimit.write.rate << R"(
--write-burst=<SIZE>
Set maximum write burst size on frontend connection.
Setting 0 to this option means write burst size is
unlimited.
Default: )" << config->conn.upstream.ratelimit.write.burst << R"(
Default: )"
<< config->conn.upstream.ratelimit.write.burst << R"(
--worker-read-rate=<SIZE>
Set maximum average read rate on frontend connection per
worker. Setting 0 to this option means read rate is
@ -1713,7 +1720,8 @@ Performance:
--worker-frontend-connections=<N>
Set maximum number of simultaneous connections frontend
accepts. Setting 0 means unlimited.
Default: )" << config->conn.upstream.worker_connections << R"(
Default: )"
<< config->conn.upstream.worker_connections << R"(
--backend-connections-per-host=<N>
Set maximum number of backend concurrent connections
(and/or streams in case of HTTP/2) per origin host.
@ -1723,8 +1731,8 @@ Performance:
HTTP/2). To limit the number of connections per
frontend for default mode, use
--backend-connections-per-frontend.
Default: )" << config->conn.downstream->connections_per_host
<< R"(
Default: )"
<< config->conn.downstream->connections_per_host << R"(
--backend-connections-per-frontend=<N>
Set maximum number of backend concurrent connections
(and/or streams in case of HTTP/2) per frontend. This
@ -1732,12 +1740,13 @@ Performance:
unlimited. To limit the number of connections per host
with --http2-proxy option, use
--backend-connections-per-host.
Default: )" << config->conn.downstream->connections_per_frontend
<< R"(
Default: )"
<< config->conn.downstream->connections_per_frontend << R"(
--rlimit-nofile=<N>
Set maximum number of open files (RLIMIT_NOFILE) to <N>.
If 0 is given, nghttpx does not set the limit.
Default: )" << config->rlimit_nofile << R"(
Default: )"
<< config->rlimit_nofile << R"(
--backend-request-buffer=<SIZE>
Set buffer size used to store backend request.
Default: )"
@ -1751,7 +1760,8 @@ Performance:
limits the maximum length for the queue of connections
that have not yet completed the three-way handshake. If
value is 0 then fast open is disabled.
Default: )" << config->conn.listener.fastopen << R"(
Default: )"
<< config->conn.listener.fastopen << R"(
--no-kqueue Don't use kqueue. This option is only applicable for
the platforms which have kqueue. For other platforms,
this option will be simply ignored.
@ -1835,7 +1845,8 @@ SSL/TLS:
in the preference order. The supported curves depend on
the linked OpenSSL library. This function requires
OpenSSL >= 1.0.2.
Default: )" << config->tls.ecdh_curves << R"(
Default: )"
<< config->tls.ecdh_curves << R"(
-k, --insecure
Don't verify backend server's certificate if TLS is
enabled for backend connections.
@ -1875,7 +1886,8 @@ SSL/TLS:
NPN. The parameter must be delimited by a single comma
only and any white spaces are treated as a part of
protocol string.
Default: )" << DEFAULT_NPN_LIST << R"(
Default: )"
<< DEFAULT_NPN_LIST << R"(
--verify-client
Require and verify client certificate.
--verify-client-cacert=<PATH>
@ -1898,7 +1910,8 @@ SSL/TLS:
protocol list advertised by client does not overlap this
list, you will receive the error message "unknown
protocol".
Default: )" << DEFAULT_TLS_PROTO_LIST << R"(
Default: )"
<< DEFAULT_TLS_PROTO_LIST << R"(
--tls-ticket-key-file=<PATH>
Path to file that contains random data to construct TLS
session ticket parameters. If aes-128-cbc is given in
@ -1952,11 +1965,13 @@ SSL/TLS:
"failure" count is incremented by 1, which contributed
to the value controlled
--tls-ticket-key-memcached-max-fail option.
Default: )" << config->tls.ticket.memcached.max_retry << R"(
Default: )"
<< config->tls.ticket.memcached.max_retry << R"(
--tls-ticket-key-memcached-max-fail=<N>
Set maximum number of consecutive failure before
disabling TLS ticket until next scheduled key retrieval.
Default: )" << config->tls.ticket.memcached.max_fail << R"(
Default: )"
<< config->tls.ticket.memcached.max_fail << R"(
--tls-ticket-key-cipher=<CIPHER>
Specify cipher to encrypt TLS session ticket. Specify
either aes-128-cbc or aes-256-cbc. By default,
@ -1970,7 +1985,8 @@ SSL/TLS:
--fetch-ocsp-response-file=<PATH>
Path to fetch-ocsp-response script file. It should be
absolute path.
Default: )" << config->tls.ocsp.fetch_ocsp_response_file << R"(
Default: )"
<< config->tls.ocsp.fetch_ocsp_response_file << R"(
--ocsp-update-interval=<DURATION>
Set interval to update OCSP response cache.
Default: )"
@ -2033,34 +2049,36 @@ HTTP/2 and SPDY:
-c, --frontend-http2-max-concurrent-streams=<N>
Set the maximum number of the concurrent streams in one
frontend HTTP/2 and SPDY session.
Default: )" << config->http2.upstream.max_concurrent_streams
<< R"(
Default: )"
<< config->http2.upstream.max_concurrent_streams << R"(
--backend-http2-max-concurrent-streams=<N>
Set the maximum number of the concurrent streams in one
backend HTTP/2 session. This sets maximum number of
concurrent opened pushed streams. The maximum number of
concurrent requests are set by a remote server.
Default: )" << config->http2.downstream.max_concurrent_streams
<< R"(
Default: )"
<< config->http2.downstream.max_concurrent_streams << R"(
--frontend-http2-window-size=<SIZE>
Sets the per-stream initial window size of HTTP/2 and
SPDY frontend connection.
Default: )" << config->http2.upstream.window_size << R"(
Default: )"
<< config->http2.upstream.window_size << R"(
--frontend-http2-connection-window-size=<SIZE>
Sets the per-connection window size of HTTP/2 and SPDY
frontend connection. For SPDY connection, the value
less than 64KiB is rounded up to 64KiB.
Default: )" << config->http2.upstream.connection_window_size
<< R"(
Default: )"
<< config->http2.upstream.connection_window_size << R"(
--backend-http2-window-size=<SIZE>
Sets the initial window size of HTTP/2 backend
connection.
Default: )" << config->http2.downstream.window_size << R"(
Default: )"
<< config->http2.downstream.window_size << R"(
--backend-http2-connection-window-size=<SIZE>
Sets the per-connection window size of HTTP/2 backend
connection.
Default: )" << config->http2.downstream.connection_window_size
<< R"(
Default: )"
<< config->http2.downstream.connection_window_size << R"(
--http2-no-cookie-crumbling
Don't crumble cookie header field.
--padding=<N>
@ -2185,12 +2203,14 @@ Logging:
The variable can be enclosed by "{" and "}" for
disambiguation (e.g., ${remote_addr}).
Default: )" << DEFAULT_ACCESSLOG_FORMAT << R"(
Default: )"
<< DEFAULT_ACCESSLOG_FORMAT << R"(
--errorlog-file=<PATH>
Set path to write error log. To reopen file, send USR1
signal to nghttpx. stderr will be redirected to the
error log file unless --errorlog-syslog is used.
Default: )" << config->logging.error.file << R"(
Default: )"
<< config->logging.error.file << R"(
--errorlog-syslog
Send error log to syslog. If this option is used,
--errorlog-file option is ignored.
@ -2279,7 +2299,8 @@ HTTP:
Set maximum number of incoming HTTP request header
fields. If trailer fields exist, they are counted
towards this number.
Default: )" << config->http.max_request_header_fields << R"(
Default: )"
<< config->http.max_request_header_fields << R"(
--response-header-field-buffer=<SIZE>
Set maximum buffer size for incoming HTTP response
header field list. This is the sum of header name and
@ -2291,7 +2312,8 @@ HTTP:
Set maximum number of incoming HTTP response header
fields. If trailer fields exist, they are counted
towards this number.
Default: )" << config->http.max_response_header_fields << R"(
Default: )"
<< config->http.max_response_header_fields << R"(
--error-page=(<CODE>|*)=<PATH>
Set file path to custom error page served when nghttpx
originally generates HTTP error status code <CODE>.
@ -2301,7 +2323,8 @@ HTTP:
backend server, the custom error pages are not used.
--server-name=<NAME>
Change server response header field value to <NAME>.
Default: )" << config->http.server_name << R"(
Default: )"
<< config->http.server_name << R"(
--no-server-rewrite
Don't rewrite server header field in default mode. When
--http2-proxy is used, these headers will not be altered
@ -2310,8 +2333,8 @@ HTTP:
API:
--api-max-request-body=<SIZE>
Set the maximum size of request body for API request.
Default: )" << util::utos_unit(config->api.max_request_body)
<< R"(
Default: )"
<< util::utos_unit(config->api.max_request_body) << R"(
Debug:
--frontend-http2-dump-request-header=<PATH>
@ -2348,7 +2371,8 @@ Scripting:
Misc:
--conf=<PATH>
Load configuration from <PATH>.
Default: )" << config->conf_path << R"(
Default: )"
<< config->conf_path << R"(
--include=<PATH>
Load additional configurations from <PATH>. File <PATH>
is read when configuration parser encountered this
@ -2366,7 +2390,8 @@ Misc:
The <DURATION> argument is an integer and an optional unit (e.g., 1s
is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
(hours, minutes, seconds and milliseconds, respectively). If a unit
is omitted, a second is used as unit.)" << std::endl;
is omitted, a second is used as unit.)"
<< std::endl;
}
} // namespace

View File

@ -2285,12 +2285,14 @@ int parse_config(Config *config, int optid, const StringRef &opt,
return 0;
case SHRPX_OPTID_BACKEND_NO_TLS:
LOG(WARN) << opt << ": deprecated. backend connection is not encrypted by "
"default. See also " << SHRPX_OPT_BACKEND_TLS;
"default. See also "
<< SHRPX_OPT_BACKEND_TLS;
return 0;
case SHRPX_OPTID_BACKEND_TLS_SNI_FIELD:
LOG(WARN) << opt << ": deprecated. Use sni keyword in --backend option. "
"For now, all sni values of all backends are "
"overridden by the given value " << optarg;
"overridden by the given value "
<< optarg;
config->tls.backend_sni_name = make_string_ref(config->balloc, optarg);
return 0;

View File

@ -614,8 +614,8 @@ ssize_t Connection::write_tls(const void *data, size_t len) {
return 0;
case SSL_ERROR_SSL:
if (LOG_ENABLED(INFO)) {
LOG(INFO) << "SSL_write: " << ERR_error_string(ERR_get_error(),
nullptr);
LOG(INFO) << "SSL_write: "
<< ERR_error_string(ERR_get_error(), nullptr);
}
return SHRPX_ERR_NETWORK;
default:

View File

@ -1058,8 +1058,8 @@ int on_response_headers(Http2Session *http2session, Downstream *downstream,
}
downstream->set_request_state(Downstream::HEADER_COMPLETE);
if (LOG_ENABLED(INFO)) {
SSLOG(INFO, http2session)
<< "HTTP upgrade success. stream_id=" << frame->hd.stream_id;
SSLOG(INFO, http2session) << "HTTP upgrade success. stream_id="
<< frame->hd.stream_id;
}
} else {
auto content_length = resp.fs.header(http2::HD_CONTENT_LENGTH);

View File

@ -309,7 +309,8 @@ int Http2Upstream::on_request_headers(Downstream *downstream,
ss << TTY_HTTP_HD << nv.name << TTY_RST << ": " << nv.value << "\n";
}
ULOG(INFO, this) << "HTTP request headers. stream_id="
<< downstream->get_stream_id() << "\n" << ss.str();
<< downstream->get_stream_id() << "\n"
<< ss.str();
}
auto config = get_config();
@ -1814,7 +1815,8 @@ void Http2Upstream::log_response_headers(
<< StringRef{nv.value, nv.valuelen} << "\n";
}
ULOG(INFO, this) << "HTTP response headers. stream_id="
<< downstream->get_stream_id() << "\n" << ss.str();
<< downstream->get_stream_id() << "\n"
<< ss.str();
}
int Http2Upstream::on_timeout(Downstream *downstream) {
@ -2001,7 +2003,8 @@ int Http2Upstream::submit_push_promise(const StringRef &scheme,
<< StringRef{nv.value, nv.valuelen} << "\n";
}
ULOG(INFO, this) << "HTTP push request headers. promised_stream_id="
<< promised_stream_id << "\n" << ss.str();
<< promised_stream_id << "\n"
<< ss.str();
}
return 0;

View File

@ -523,7 +523,8 @@ int HttpDownstreamConnection::push_request_headers() {
nhdrs = http::colorizeHeaders(nhdrs.c_str());
}
DCLOG(INFO, this) << "HTTP request headers. stream_id="
<< downstream_->get_stream_id() << "\n" << nhdrs;
<< downstream_->get_stream_id() << "\n"
<< nhdrs;
}
// Don't call signal_write() if we anticipate request body. We call
@ -791,8 +792,8 @@ int ensure_max_header_fields(const Downstream *downstream,
if (resp.fs.num_fields() >= httpconf.max_response_header_fields) {
if (LOG_ENABLED(INFO)) {
DLOG(INFO, downstream)
<< "Too many header field num=" << resp.fs.num_fields() + 1;
DLOG(INFO, downstream) << "Too many header field num="
<< resp.fs.num_fields() + 1;
}
return -1;
}

View File

@ -140,8 +140,8 @@ int htp_hdr_keycb(http_parser *htp, const char *data, size_t len) {
} else {
if (req.fs.num_fields() >= httpconf.max_request_header_fields) {
if (LOG_ENABLED(INFO)) {
ULOG(INFO, upstream)
<< "Too many header field num=" << req.fs.num_fields() + 1;
ULOG(INFO, upstream) << "Too many header field num="
<< req.fs.num_fields() + 1;
}
downstream->set_request_state(
Downstream::HTTP1_REQUEST_HEADER_TOO_LARGE);
@ -156,8 +156,8 @@ int htp_hdr_keycb(http_parser *htp, const char *data, size_t len) {
} else {
if (req.fs.num_fields() >= httpconf.max_request_header_fields) {
if (LOG_ENABLED(INFO)) {
ULOG(INFO, upstream)
<< "Too many header field num=" << req.fs.num_fields() + 1;
ULOG(INFO, upstream) << "Too many header field num="
<< req.fs.num_fields() + 1;
}
return -1;
}

View File

@ -209,7 +209,7 @@ std::pair<OutputIterator, size_t> copy(const ImmutableString &src, size_t avail,
namespace {
template <size_t N, typename OutputIterator>
std::pair<OutputIterator, size_t> copy_l(const char(&src)[N], size_t avail,
std::pair<OutputIterator, size_t> copy_l(const char (&src)[N], size_t avail,
OutputIterator oitr) {
return copy(src, N - 1, avail, oitr);
}
@ -320,7 +320,8 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
break;
case SHRPX_LOGF_REQUEST_TIME: {
auto t = std::chrono::duration_cast<std::chrono::milliseconds>(
lgsp.request_end_time - lgsp.request_start_time).count();
lgsp.request_end_time - lgsp.request_start_time)
.count();
auto frac = util::utos(t % 1000);
auto sec = util::utos(t / 1000);

View File

@ -552,8 +552,8 @@ int MemcachedConnection::parse_packet() {
if (LOG_ENABLED(INFO)) {
if (parse_state_.status_code) {
MCLOG(INFO, this)
<< "response returned error status: " << parse_state_.status_code;
MCLOG(INFO, this) << "response returned error status: "
<< parse_state_.status_code;
}
}

View File

@ -191,7 +191,8 @@ void on_ctrl_recv_callback(spdylay_session *session, spdylay_frame_type type,
ss << TTY_HTTP_HD << nv[i] << TTY_RST << ": " << nv[i + 1] << "\n";
}
ULOG(INFO, upstream) << "HTTP request headers. stream_id="
<< downstream->get_stream_id() << "\n" << ss.str();
<< downstream->get_stream_id() << "\n"
<< ss.str();
}
size_t num_headers = 0;
@ -872,8 +873,8 @@ ssize_t spdy_data_read_callback(spdylay_session *session, int32_t stream_id,
} else {
// For tunneling, issue RST_STREAM to finish the stream.
if (LOG_ENABLED(INFO)) {
ULOG(INFO, upstream)
<< "RST_STREAM to tunneled stream stream_id=" << stream_id;
ULOG(INFO, upstream) << "RST_STREAM to tunneled stream stream_id="
<< stream_id;
}
upstream->rst_stream(
downstream, infer_upstream_rst_stream_status_code(
@ -1000,10 +1001,12 @@ int SpdyUpstream::error_reply(Downstream *downstream,
auto content_length = util::make_string_ref_uint(balloc, html.size());
auto status_string = http2::get_status_string(balloc, status_code);
const char *nv[] = {":status", status_string.c_str(), ":version", "http/1.1",
"content-type", "text/html; charset=UTF-8", "server",
get_config()->http.server_name.c_str(), "content-length",
content_length.c_str(), "date", lgconf->time_http.c_str(),
const char *nv[] = {":status", status_string.c_str(),
":version", "http/1.1",
"content-type", "text/html; charset=UTF-8",
"server", get_config()->http.server_name.c_str(),
"content-length", content_length.c_str(),
"date", lgconf->time_http.c_str(),
nullptr};
rv = spdylay_submit_response(session_, downstream->get_stream_id(), nv,
@ -1166,7 +1169,8 @@ int SpdyUpstream::on_downstream_header_complete(Downstream *downstream) {
ss << TTY_HTTP_HD << nv[i] << TTY_RST << ": " << nv[i + 1] << "\n";
}
ULOG(INFO, this) << "HTTP response headers. stream_id="
<< downstream->get_stream_id() << "\n" << ss.str();
<< downstream->get_stream_id() << "\n"
<< ss.str();
}
spdylay_data_provider data_prd;
data_prd.source.ptr = downstream;

View File

@ -864,8 +864,8 @@ SSL_CTX *create_ssl_client_context(
if (neverbleed_load_private_key_file(nb, ssl_ctx, private_key_file.c_str(),
errbuf.data()) != 1) {
LOG(FATAL) << "neverbleed_load_private_key_file: could not load client "
"private key from " << private_key_file << ": "
<< errbuf.data();
"private key from "
<< private_key_file << ": " << errbuf.data();
DIE();
}
#endif // HAVE_NEVERBLEED
@ -881,8 +881,8 @@ SSL_CTX *create_ssl_client_context(
SSL *create_ssl(SSL_CTX *ssl_ctx) {
auto ssl = SSL_new(ssl_ctx);
if (!ssl) {
LOG(ERROR) << "SSL_new() failed: " << ERR_error_string(ERR_get_error(),
nullptr);
LOG(ERROR) << "SSL_new() failed: "
<< ERR_error_string(ERR_get_error(), nullptr);
return nullptr;
}

View File

@ -144,8 +144,8 @@ void test_shrpx_ssl_cert_lookup_tree_add_cert_from_x509(void) {
}
template <size_t N, size_t M>
bool tls_hostname_match_wrapper(const char(&pattern)[N],
const char(&hostname)[M]) {
bool tls_hostname_match_wrapper(const char (&pattern)[N],
const char (&hostname)[M]) {
return ssl::tls_hostname_match(StringRef{pattern, N}, StringRef{hostname, M});
}

View File

@ -219,7 +219,8 @@ void renew_ticket_key_cb(struct ev_loop *loop, ev_timer *w, int revents) {
auto max_tickets =
static_cast<size_t>(std::chrono::duration_cast<std::chrono::hours>(
get_config()->tls.session_timeout).count());
get_config()->tls.session_timeout)
.count());
new_keys.resize(std::min(max_tickets, old_keys.size() + 1));
std::copy_n(std::begin(old_keys), new_keys.size() - 1,

View File

@ -66,11 +66,11 @@ make_array(T &&... t) {
sizeof...(T)>{{std::forward<T>(t)...}};
}
template <typename T, size_t N> constexpr size_t array_size(T(&)[N]) {
template <typename T, size_t N> constexpr size_t array_size(T (&)[N]) {
return N;
}
template <typename T, size_t N> constexpr size_t str_size(T(&)[N]) {
template <typename T, size_t N> constexpr size_t str_size(T (&)[N]) {
return N - 1;
}
@ -264,8 +264,8 @@ public:
: len(std::distance(first, last)), base(copystr(first, last)) {}
ImmutableString(const ImmutableString &other)
: len(other.len), base(copystr(std::begin(other), std::end(other))) {}
ImmutableString(ImmutableString &&other) noexcept : len(other.len),
base(other.base) {
ImmutableString(ImmutableString &&other) noexcept
: len(other.len), base(other.base) {
other.len = 0;
other.base = "";
}
@ -300,7 +300,7 @@ public:
return *this;
}
template <size_t N> static ImmutableString from_lit(const char(&s)[N]) {
template <size_t N> static ImmutableString from_lit(const char (&s)[N]) {
return ImmutableString(s, N - 1);
}
@ -427,7 +427,7 @@ public:
: base(reinterpret_cast<const char *>(first)),
len(std::distance(first, last)) {}
template <typename CharT, size_t N>
constexpr static StringRef from_lit(const CharT(&s)[N]) {
constexpr static StringRef from_lit(const CharT (&s)[N]) {
return StringRef{s, N - 1};
}
static StringRef from_maybe_nullptr(const char *s) {

View File

@ -137,7 +137,7 @@ StringRef quote_string(BlockAllocator &balloc, const StringRef &target);
std::string format_hex(const unsigned char *s, size_t len);
template <size_t N> std::string format_hex(const unsigned char(&s)[N]) {
template <size_t N> std::string format_hex(const unsigned char (&s)[N]) {
return format_hex(s, N);
}
@ -232,7 +232,7 @@ template <typename S, typename T> bool istarts_with(const S &a, const T &b) {
}
template <typename T, typename CharT, size_t N>
bool istarts_with_l(const T &a, const CharT(&b)[N]) {
bool istarts_with_l(const T &a, const CharT (&b)[N]) {
return istarts_with(a.begin(), a.end(), b, b + N - 1);
}
@ -250,7 +250,7 @@ template <typename T, typename S> bool ends_with(const T &a, const S &b) {
}
template <typename T, typename CharT, size_t N>
bool ends_with_l(const T &a, const CharT(&b)[N]) {
bool ends_with_l(const T &a, const CharT (&b)[N]) {
return ends_with(a.begin(), a.end(), b, b + N - 1);
}
@ -268,7 +268,7 @@ template <typename T, typename S> bool iends_with(const T &a, const S &b) {
}
template <typename T, typename CharT, size_t N>
bool iends_with_l(const T &a, const CharT(&b)[N]) {
bool iends_with_l(const T &a, const CharT (&b)[N]) {
return iends_with(a.begin(), a.end(), b, b + N - 1);
}
@ -286,12 +286,12 @@ template <typename T, typename S> bool strieq(const T &a, const S &b) {
}
template <typename CharT, typename InputIt, size_t N>
bool strieq_l(const CharT(&a)[N], InputIt b, size_t blen) {
bool strieq_l(const CharT (&a)[N], InputIt b, size_t blen) {
return strieq(a, a + (N - 1), b, b + blen);
}
template <typename CharT, size_t N, typename T>
bool strieq_l(const CharT(&a)[N], const T &b) {
bool strieq_l(const CharT (&a)[N], const T &b) {
return strieq(a, a + (N - 1), b.begin(), b.end());
}
@ -308,12 +308,12 @@ template <typename T, typename S> bool streq(const T &a, const S &b) {
}
template <typename CharT, typename InputIt, size_t N>
bool streq_l(const CharT(&a)[N], InputIt b, size_t blen) {
bool streq_l(const CharT (&a)[N], InputIt b, size_t blen) {
return streq(a, a + (N - 1), b, b + blen);
}
template <typename CharT, size_t N, typename T>
bool streq_l(const CharT(&a)[N], const T &b) {
bool streq_l(const CharT (&a)[N], const T &b) {
return streq(a, a + (N - 1), b.begin(), b.end());
}
@ -728,7 +728,7 @@ OutputIt random_alpha_digit(OutputIt first, OutputIt last, Generator &gen) {
}
template <typename OutputIterator, typename CharT, size_t N>
OutputIterator copy_lit(OutputIterator it, CharT(&s)[N]) {
OutputIterator copy_lit(OutputIterator it, CharT (&s)[N]) {
return std::copy_n(s, N - 1, it);
}

View File

@ -209,8 +209,7 @@ static void run_nghttp2_session_send(void) {
fail:
nghttp2_session_del(session);
client_new_fail:
;
client_new_fail:;
}
void test_nghttp2_session_send(void) {

View File

@ -1001,20 +1001,25 @@ void test_nghttp2_hd_deflate_inflate(void) {
nghttp2_hd_deflater deflater;
nghttp2_hd_inflater inflater;
nghttp2_nv nv1[] = {
MAKE_NV(":status", "200 OK"), MAKE_NV("access-control-allow-origin", "*"),
MAKE_NV(":status", "200 OK"),
MAKE_NV("access-control-allow-origin", "*"),
MAKE_NV("cache-control", "private, max-age=0, must-revalidate"),
MAKE_NV("content-length", "76073"), MAKE_NV("content-type", "text/html"),
MAKE_NV("content-length", "76073"),
MAKE_NV("content-type", "text/html"),
MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
MAKE_NV("expires", "Sat, 27 Jul 2013 06:22:12 GMT"),
MAKE_NV("server", "Apache"), MAKE_NV("vary", "foobar"),
MAKE_NV("server", "Apache"),
MAKE_NV("vary", "foobar"),
MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"),
MAKE_NV("x-cache", "MISS from alphabravo"),
MAKE_NV("x-cache-action", "MISS"), MAKE_NV("x-cache-age", "0"),
MAKE_NV("x-cache-action", "MISS"),
MAKE_NV("x-cache-age", "0"),
MAKE_NV("x-cache-lookup", "MISS from alphabravo:3128"),
MAKE_NV("x-lb-nocache", "true"),
};
nghttp2_nv nv2[] = {
MAKE_NV(":status", "304 Not Modified"), MAKE_NV("age", "0"),
MAKE_NV(":status", "304 Not Modified"),
MAKE_NV("age", "0"),
MAKE_NV("cache-control", "max-age=56682045"),
MAKE_NV("content-type", "text/css"),
MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
@ -1025,7 +1030,8 @@ void test_nghttp2_hd_deflate_inflate(void) {
MAKE_NV("x-cache", "HIT from alphabravo"),
MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128")};
nghttp2_nv nv3[] = {
MAKE_NV(":status", "304 Not Modified"), MAKE_NV("age", "0"),
MAKE_NV(":status", "304 Not Modified"),
MAKE_NV("age", "0"),
MAKE_NV("cache-control", "max-age=56682072"),
MAKE_NV("content-type", "text/css"),
MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
@ -1037,7 +1043,8 @@ void test_nghttp2_hd_deflate_inflate(void) {
MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
};
nghttp2_nv nv4[] = {
MAKE_NV(":status", "304 Not Modified"), MAKE_NV("age", "0"),
MAKE_NV(":status", "304 Not Modified"),
MAKE_NV("age", "0"),
MAKE_NV("cache-control", "max-age=56682022"),
MAKE_NV("content-type", "text/css"),
MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
@ -1049,7 +1056,8 @@ void test_nghttp2_hd_deflate_inflate(void) {
MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
};
nghttp2_nv nv5[] = {
MAKE_NV(":status", "304 Not Modified"), MAKE_NV("age", "0"),
MAKE_NV(":status", "304 Not Modified"),
MAKE_NV("age", "0"),
MAKE_NV("cache-control", "max-age=4461139"),
MAKE_NV("content-type", "application/x-javascript"),
MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
@ -1061,7 +1069,8 @@ void test_nghttp2_hd_deflate_inflate(void) {
MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
};
nghttp2_nv nv6[] = {
MAKE_NV(":status", "304 Not Modified"), MAKE_NV("age", "0"),
MAKE_NV(":status", "304 Not Modified"),
MAKE_NV("age", "0"),
MAKE_NV("cache-control", "max-age=18645951"),
MAKE_NV("content-type", "application/x-javascript"),
MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
@ -1073,7 +1082,8 @@ void test_nghttp2_hd_deflate_inflate(void) {
MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
};
nghttp2_nv nv7[] = {
MAKE_NV(":status", "304 Not Modified"), MAKE_NV("age", "0"),
MAKE_NV(":status", "304 Not Modified"),
MAKE_NV("age", "0"),
MAKE_NV("cache-control", "max-age=31536000"),
MAKE_NV("content-type", "application/javascript"),
MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
@ -1085,7 +1095,8 @@ void test_nghttp2_hd_deflate_inflate(void) {
MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
};
nghttp2_nv nv8[] = {
MAKE_NV(":status", "304 Not Modified"), MAKE_NV("age", "0"),
MAKE_NV(":status", "304 Not Modified"),
MAKE_NV("age", "0"),
MAKE_NV("cache-control", "max-age=31536000"),
MAKE_NV("content-type", "application/javascript"),
MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
@ -1097,7 +1108,8 @@ void test_nghttp2_hd_deflate_inflate(void) {
MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
};
nghttp2_nv nv9[] = {
MAKE_NV(":status", "304 Not Modified"), MAKE_NV("age", "0"),
MAKE_NV(":status", "304 Not Modified"),
MAKE_NV("age", "0"),
MAKE_NV("cache-control", "max-age=31536000"),
MAKE_NV("content-type", "application/javascript"),
MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
@ -1109,7 +1121,8 @@ void test_nghttp2_hd_deflate_inflate(void) {
MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"),
};
nghttp2_nv nv10[] = {
MAKE_NV(":status", "304 Not Modified"), MAKE_NV("age", "0"),
MAKE_NV(":status", "304 Not Modified"),
MAKE_NV("age", "0"),
MAKE_NV("cache-control", "max-age=56682045"),
MAKE_NV("content-type", "text/css"),
MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"),
@ -1269,7 +1282,8 @@ void test_nghttp2_hd_deflate_hd_vec(void) {
nghttp2_hd_deflater *deflater;
nghttp2_hd_inflater *inflater;
nghttp2_nv nva[] = {
MAKE_NV(":method", "PUT"), MAKE_NV(":scheme", "https"),
MAKE_NV(":method", "PUT"),
MAKE_NV(":scheme", "https"),
MAKE_NV(":authority", "localhost:3000"),
MAKE_NV(":path", "/usr/foo/alpha/bravo"),
MAKE_NV("content-type", "image/png"),

View File

@ -10807,9 +10807,12 @@ void test_nghttp2_http_ignore_regular_header(void) {
ssize_t rv;
my_user_data ud;
const nghttp2_nv bad_reqnv[] = {
MAKE_NV(":authority", "localhost"), MAKE_NV(":scheme", "https"),
MAKE_NV(":path", "/"), MAKE_NV(":method", "GET"),
MAKE_NV("foo", "\x0zzz"), MAKE_NV("bar", "buzz"),
MAKE_NV(":authority", "localhost"),
MAKE_NV(":scheme", "https"),
MAKE_NV(":path", "/"),
MAKE_NV(":method", "GET"),
MAKE_NV("foo", "\x0zzz"),
MAKE_NV("bar", "buzz"),
};
const nghttp2_nv bad_ansnv[] = {
MAKE_NV(":authority", "localhost"), MAKE_NV(":scheme", "https"),