From c6ef1c02b9c26bfb01e28c259c122ff55944f78e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 13 Nov 2015 00:53:29 +0900 Subject: [PATCH] Switch to clang-format-3.6 --- doc/sources/contribute.rst | 4 +- examples/client.c | 11 ++--- lib/includes/nghttp2/nghttp2.h | 71 +++++++++++++++-------------- lib/nghttp2_helper.h | 2 +- lib/nghttp2_session.c | 7 ++- src/asio_client_session_impl.cc | 18 ++++---- src/asio_client_session_tcp_impl.cc | 12 ++--- src/asio_client_session_tls_impl.cc | 42 ++++++++--------- src/asio_common.cc | 27 +++++------ src/asio_server.cc | 58 +++++++++++------------ src/asio_server_connection.h | 39 ++++++++-------- src/asio_server_http2_handler.cc | 6 +-- src/http2.h | 10 ++-- src/includes/nghttp2/asio_http2.h | 4 +- src/memchunk.h | 2 +- src/memchunk_test.cc | 12 ++--- src/nghttp.cc | 27 +++++------ src/shrpx_connection_handler.cc | 16 +++---- src/shrpx_downstream_test.cc | 8 ++-- src/shrpx_http2_session.cc | 4 +- src/shrpx_http2_upstream.cc | 9 ++-- src/shrpx_log.cc | 2 +- src/shrpx_log_config.cc | 4 +- src/shrpx_spdy_upstream.cc | 12 ++--- src/shrpx_ssl.cc | 4 +- src/shrpx_ssl_test.cc | 13 +++--- src/template.h | 8 ++-- src/util.cc | 36 +++++++-------- src/util.h | 10 ++-- tests/nghttp2_hd_test.c | 39 ++++++---------- tests/nghttp2_pq_test.c | 4 +- tests/nghttp2_session_test.c | 8 ++-- 32 files changed, 255 insertions(+), 274 deletions(-) diff --git a/doc/sources/contribute.rst b/doc/sources/contribute.rst index 14a11e2e..4cbd341b 100644 --- a/doc/sources/contribute.rst +++ b/doc/sources/contribute.rst @@ -27,7 +27,7 @@ We use clang-format to format source code consistently. The clang-format configuration file .clang-format is located at the root directory. Since clang-format produces slightly different results between versions, we currently use clang-format which comes with -clang-3.5. +clang-3.6. To detect any violation to the coding style, we recommend to setup git pre-commit hook to check coding style of the changes you introduced. @@ -35,7 +35,7 @@ The pre-commit file is located at the root directory. Copy it under .git/hooks and make sure that it is executable. The pre-commit script uses clang-format-diff.py to detect any style errors. If it is not in your PATH or it exists under different name (e.g., -clang-format-diff-3.5 in debian), either add it to PATH variable or +clang-format-diff-3.6 in debian), either add it to PATH variable or add git option ``clangformatdiff.binary`` to point to the script. For emacs users, integrating clang-format to emacs is very easy. diff --git a/examples/client.c b/examples/client.c index 09bf7593..4280dd52 100644 --- a/examples/client.c +++ b/examples/client.c @@ -459,12 +459,11 @@ 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), - MAKE_NV("accept", "*/*"), - MAKE_NV("user-agent", "nghttp2/" NGHTTP2_VERSION)}; + 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)}; stream_id = nghttp2_submit_request(connection->session, NULL, nva, sizeof(nva) / sizeof(nva[0]), NULL, req); diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index 82749969..7515555c 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -2339,8 +2339,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 @@ -2538,7 +2538,7 @@ nghttp2_session_set_stream_user_data(nghttp2_session *session, * include the deferred DATA frames. */ NGHTTP2_EXTERN size_t - nghttp2_session_get_outbound_queue_size(nghttp2_session *session); +nghttp2_session_get_outbound_queue_size(nghttp2_session *session); /** * @function @@ -2554,8 +2554,9 @@ NGHTTP2_EXTERN size_t * * 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 @@ -2567,8 +2568,9 @@ NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_effective_recv_data_length( * * 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 @@ -2585,7 +2587,7 @@ NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_effective_local_window_size( * This function returns -1 if it fails. */ NGHTTP2_EXTERN int32_t - nghttp2_session_get_effective_recv_data_length(nghttp2_session *session); +nghttp2_session_get_effective_recv_data_length(nghttp2_session *session); /** * @function @@ -2598,7 +2600,7 @@ NGHTTP2_EXTERN int32_t * This function returns -1 if it fails. */ NGHTTP2_EXTERN int32_t - nghttp2_session_get_effective_local_window_size(nghttp2_session *session); +nghttp2_session_get_effective_local_window_size(nghttp2_session *session); /** * @function @@ -2615,8 +2617,8 @@ NGHTTP2_EXTERN int32_t * 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_session_get_stream_remote_window_size(nghttp2_session *session, + int32_t stream_id); /** * @function @@ -2626,7 +2628,7 @@ NGHTTP2_EXTERN int32_t * This function always succeeds. */ NGHTTP2_EXTERN int32_t - nghttp2_session_get_remote_window_size(nghttp2_session *session); +nghttp2_session_get_remote_window_size(nghttp2_session *session); /** * @function @@ -2752,8 +2754,8 @@ NGHTTP2_EXTERN int nghttp2_submit_shutdown_notice(nghttp2_session *session); * :enum:`nghttp2_settings_id`. */ NGHTTP2_EXTERN uint32_t - nghttp2_session_get_remote_settings(nghttp2_session *session, - nghttp2_settings_id id); +nghttp2_session_get_remote_settings(nghttp2_session *session, + nghttp2_settings_id id); /** * @function @@ -2782,7 +2784,7 @@ NGHTTP2_EXTERN int nghttp2_session_set_next_stream_id(nghttp2_session *session, * function returns 1 << 31. */ NGHTTP2_EXTERN uint32_t - nghttp2_session_get_next_stream_id(nghttp2_session *session); +nghttp2_session_get_next_stream_id(nghttp2_session *session); /** * @function @@ -2970,8 +2972,8 @@ NGHTTP2_EXTERN int nghttp2_session_upgrade2(nghttp2_session *session, * 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_pack_settings_payload(uint8_t *buf, size_t buflen, + const nghttp2_settings_entry *iv, size_t niv); /** * @function @@ -3082,11 +3084,11 @@ nghttp2_priority_spec_check_default(const nghttp2_priority_spec *pri_spec); * */ 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); +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); /** * @function @@ -3297,11 +3299,10 @@ NGHTTP2_EXTERN int nghttp2_submit_trailer(nghttp2_session *session, * */ 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); +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); /** * @function @@ -3504,9 +3505,9 @@ NGHTTP2_EXTERN int nghttp2_submit_settings(nghttp2_session *session, * */ 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_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 @@ -3595,7 +3596,7 @@ NGHTTP2_EXTERN int nghttp2_submit_goaway(nghttp2_session *session, * This function always succeeds. */ NGHTTP2_EXTERN int32_t - nghttp2_session_get_last_proc_stream_id(nghttp2_session *session); +nghttp2_session_get_last_proc_stream_id(nghttp2_session *session); /** * @function @@ -3880,8 +3881,8 @@ nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater, * 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_hd_deflate_hd(nghttp2_hd_deflater *deflater, uint8_t *buf, + size_t buflen, const nghttp2_nv *nva, size_t nvlen); /** * @function @@ -4239,7 +4240,7 @@ typedef enum { * :enum:`NGHTTP2_STREAM_STATE_IDLE`. */ NGHTTP2_EXTERN nghttp2_stream_proto_state - nghttp2_stream_get_state(nghttp2_stream *stream); +nghttp2_stream_get_state(nghttp2_stream *stream); /** * @function @@ -4302,7 +4303,7 @@ NGHTTP2_EXTERN int32_t nghttp2_stream_get_weight(nghttp2_stream *stream); * Returns the sum of the weight for |stream|'s children. */ NGHTTP2_EXTERN int32_t - nghttp2_stream_get_sum_dependency_weight(nghttp2_stream *stream); +nghttp2_stream_get_sum_dependency_weight(nghttp2_stream *stream); #ifdef __cplusplus } diff --git a/lib/nghttp2_helper.h b/lib/nghttp2_helper.h index 9e2a71d3..1fff65c0 100644 --- a/lib/nghttp2_helper.h +++ b/lib/nghttp2_helper.h @@ -41,7 +41,7 @@ #define lstreq(A, B, N) ((sizeof((A)) - 1) == (N) && memcmp((A), (B), (N)) == 0) #define nghttp2_struct_of(ptr, type, member) \ - ((type *)(void *)((char *)(ptr) - offsetof(type, member))) + ((type *)(void *)((char *)(ptr)-offsetof(type, member))) /* * Copies 2 byte unsigned integer |n| in host byte order to |buf| in diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index dfb29a0d..b84b6d1a 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -610,10 +610,9 @@ void nghttp2_session_del(nghttp2_session *session) { nghttp2_mem_free(mem, session); } -int -nghttp2_session_reprioritize_stream(nghttp2_session *session, - nghttp2_stream *stream, - const nghttp2_priority_spec *pri_spec_in) { +int nghttp2_session_reprioritize_stream( + nghttp2_session *session, nghttp2_stream *stream, + const nghttp2_priority_spec *pri_spec_in) { int rv; nghttp2_stream *dep_stream = NULL; nghttp2_priority_spec pri_spec_default; diff --git a/src/asio_client_session_impl.cc b/src/asio_client_session_impl.cc index 7baa385e..d3a57a1e 100644 --- a/src/asio_client_session_impl.cc +++ b/src/asio_client_session_impl.cc @@ -59,13 +59,13 @@ void session_impl::start_resolve(const std::string &host, resolver_.async_resolve({host, service}, [this](const boost::system::error_code &ec, tcp::resolver::iterator endpoint_it) { - if (ec) { - not_connected(ec); - return; - } + if (ec) { + not_connected(ec); + return; + } - start_connect(endpoint_it); - }); + start_connect(endpoint_it); + }); } void session_impl::connected(tcp::resolver::iterator endpoint_it) { @@ -462,9 +462,9 @@ const request *session_impl::submit(boost::system::error_code &ec, [](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(source->ptr); - return strm->request().impl().call_on_read(buf, length, data_flags); - }; + auto strm = static_cast(source->ptr); + return strm->request().impl().call_on_read(buf, length, data_flags); + }; prdptr = &prd; } diff --git a/src/asio_client_session_tcp_impl.cc b/src/asio_client_session_tcp_impl.cc index 41195bad..c20a2303 100644 --- a/src/asio_client_session_tcp_impl.cc +++ b/src/asio_client_session_tcp_impl.cc @@ -41,13 +41,13 @@ void session_tcp_impl::start_connect(tcp::resolver::iterator endpoint_it) { boost::asio::async_connect(socket_, endpoint_it, [this](const boost::system::error_code &ec, tcp::resolver::iterator endpoint_it) { - if (ec) { - not_connected(ec); - return; - } + if (ec) { + not_connected(ec); + return; + } - connected(endpoint_it); - }); + connected(endpoint_it); + }); } tcp::socket &session_tcp_impl::socket() { return socket_; } diff --git a/src/asio_client_session_tls_impl.cc b/src/asio_client_session_tls_impl.cc index 8db75c17..8dc32d57 100644 --- a/src/asio_client_session_tls_impl.cc +++ b/src/asio_client_session_tls_impl.cc @@ -45,31 +45,31 @@ session_tls_impl::session_tls_impl(boost::asio::io_service &io_service, session_tls_impl::~session_tls_impl() {} void session_tls_impl::start_connect(tcp::resolver::iterator endpoint_it) { - boost::asio::async_connect(socket(), endpoint_it, - [this](const boost::system::error_code &ec, + boost::asio::async_connect( + socket(), endpoint_it, [this](const boost::system::error_code &ec, tcp::resolver::iterator endpoint_it) { - if (ec) { - not_connected(ec); - return; - } + if (ec) { + not_connected(ec); + return; + } - socket_.async_handshake( - boost::asio::ssl::stream_base::client, - [this, endpoint_it](const boost::system::error_code &ec) { - if (ec) { - not_connected(ec); - return; - } + socket_.async_handshake( + boost::asio::ssl::stream_base::client, + [this, endpoint_it](const boost::system::error_code &ec) { + if (ec) { + not_connected(ec); + return; + } - if (!tls_h2_negotiated(socket_)) { - not_connected( - make_error_code(NGHTTP2_ASIO_ERR_TLS_NO_APP_PROTO_NEGOTIATED)); - return; - } + if (!tls_h2_negotiated(socket_)) { + not_connected(make_error_code( + NGHTTP2_ASIO_ERR_TLS_NO_APP_PROTO_NEGOTIATED)); + return; + } - connected(endpoint_it); - }); - }); + connected(endpoint_it); + }); + }); } tcp::socket &session_tls_impl::socket() { return socket_.next_layer(); } diff --git a/src/asio_common.cc b/src/asio_common.cc index f8567a5f..0319169e 100644 --- a/src/asio_common.cc +++ b/src/asio_common.cc @@ -90,8 +90,9 @@ generator_cb string_generator(std::string data) { } generator_cb deferred_generator() { - return [](uint8_t *buf, size_t len, - uint32_t *data_flags) { return NGHTTP2_ERR_DEFERRED; }; + return [](uint8_t *buf, size_t len, uint32_t *data_flags) { + return NGHTTP2_ERR_DEFERRED; + }; } template @@ -114,20 +115,20 @@ generator_cb file_generator_from_fd(int fd) { 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) - ; + ssize_t n; + while ((n = read(fd, buf, len)) == -1 && errno == EINTR) + ; - if (n == -1) { - return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; - } + if (n == -1) { + return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; + } - if (n == 0) { - *data_flags |= NGHTTP2_DATA_FLAG_EOF; - } + if (n == 0) { + *data_flags |= NGHTTP2_DATA_FLAG_EOF; + } - return n; - }; + return n; + }; } bool check_path(const std::string &path) { return util::check_path(path); } diff --git a/src/asio_server.cc b/src/asio_server.cc index 11c6c31d..531677f3 100644 --- a/src/asio_server.cc +++ b/src/asio_server.cc @@ -123,44 +123,46 @@ void server::start_accept(boost::asio::ssl::context &tls_context, auto new_connection = std::make_shared>( mux, io_service_pool_.get_io_service(), tls_context); - acceptor.async_accept(new_connection->socket().lowest_layer(), - [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)); - new_connection->socket().async_handshake( - boost::asio::ssl::stream_base::server, - [new_connection](const boost::system::error_code &e) { - if (e) { - return; - } + acceptor.async_accept( + new_connection->socket().lowest_layer(), + [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)); + new_connection->socket().async_handshake( + boost::asio::ssl::stream_base::server, + [new_connection](const boost::system::error_code &e) { + if (e) { + return; + } - if (!tls_h2_negotiated(new_connection->socket())) { - return; - } + if (!tls_h2_negotiated(new_connection->socket())) { + return; + } - new_connection->start(); - }); - } + new_connection->start(); + }); + } - start_accept(tls_context, acceptor, mux); - }); + start_accept(tls_context, acceptor, mux); + }); } void server::start_accept(tcp::acceptor &acceptor, serve_mux &mux) { auto new_connection = std::make_shared>( mux, io_service_pool_.get_io_service()); - acceptor.async_accept(new_connection->socket(), - [this, &acceptor, &mux, new_connection]( - const boost::system::error_code &e) { - if (!e) { - new_connection->socket().set_option(tcp::no_delay(true)); - new_connection->start(); - } + acceptor.async_accept( + new_connection->socket(), [this, &acceptor, &mux, new_connection]( + const boost::system::error_code &e) { + if (!e) { + new_connection->socket().set_option(tcp::no_delay(true)); + new_connection->start(); + } - start_accept(acceptor, mux); - }); + start_accept(acceptor, mux); + }); } void server::stop() { io_service_pool_.stop(); } diff --git a/src/asio_server_connection.h b/src/asio_server_connection.h index 0d58b882..3aba7336 100644 --- a/src/asio_server_connection.h +++ b/src/asio_server_connection.h @@ -83,29 +83,30 @@ public: void do_read() { auto self = this->shared_from_this(); - socket_.async_read_some(boost::asio::buffer(buffer_), - [this, self](const boost::system::error_code &e, - std::size_t bytes_transferred) { - if (!e) { - if (handler_->on_read(buffer_, bytes_transferred) != 0) { - return; - } + socket_.async_read_some( + boost::asio::buffer(buffer_), + [this, self](const boost::system::error_code &e, + std::size_t bytes_transferred) { + if (!e) { + if (handler_->on_read(buffer_, bytes_transferred) != 0) { + return; + } - do_write(); + do_write(); - if (!writing_ && handler_->should_stop()) { - return; - } + if (!writing_ && handler_->should_stop()) { + return; + } - do_read(); - } + do_read(); + } - // If an error occurs then no new asynchronous operations are - // started. This means that all shared_ptr references to the - // connection object will disappear and the object will be - // destroyed automatically after this handler returns. The - // connection class's destructor closes the socket. - }); + // If an error occurs then no new asynchronous operations are + // started. This means that all shared_ptr references to the + // connection object will disappear and the object will be + // destroyed automatically after this handler returns. The + // connection class's destructor closes the socket. + }); } void do_write() { diff --git a/src/asio_server_http2_handler.cc b/src/asio_server_http2_handler.cc index c55cb329..47cd18c5 100644 --- a/src/asio_server_http2_handler.cc +++ b/src/asio_server_http2_handler.cc @@ -332,9 +332,9 @@ int http2_handler::start_response(stream &strm) { [](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(source->ptr); - return strm.response().impl().call_read(buf, length, data_flags); - }; + auto &strm = *static_cast(source->ptr); + return strm.response().impl().call_read(buf, length, data_flags); + }; prd_ptr = &prd; } rv = nghttp2_submit_response(session_, strm.get_stream_id(), nva.data(), diff --git a/src/http2.h b/src/http2.h index 2669dd49..dedee285 100644 --- a/src/http2.h +++ b/src/http2.h @@ -119,20 +119,20 @@ nghttp2_nv make_nv_nocopy(const std::string &name, const std::string &value, // Create nghttp2_nv from string literal |name| and |value|. template -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 -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 -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}; } @@ -140,13 +140,13 @@ 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 -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 -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}; } diff --git a/src/includes/nghttp2/asio_http2.h b/src/includes/nghttp2/asio_http2.h index a95d7b95..0a4044aa 100644 --- a/src/includes/nghttp2/asio_http2.h +++ b/src/includes/nghttp2/asio_http2.h @@ -89,8 +89,8 @@ typedef std::function close_cb; // are not available right now, return NGHTTP2_ERR_DEFERRED. In case // 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; +typedef std::function generator_cb; // Convenient function to create function to read file denoted by // |path|. This can be passed to response::end(). diff --git a/src/memchunk.h b/src/memchunk.h index 4b29bc29..6245f61f 100644 --- a/src/memchunk.h +++ b/src/memchunk.h @@ -161,7 +161,7 @@ template struct Memchunks { return count; } - template size_t append(const char (&s)[N]) { + template 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()); } diff --git a/src/memchunk_test.cc b/src/memchunk_test.cc index c206d153..071fbbb1 100644 --- a/src/memchunk_test.cc +++ b/src/memchunk_test.cc @@ -226,8 +226,7 @@ void test_peek_memchunks_append(void) { std::array b{{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', - '5', '6', '7', '8', '9', '0', '1', - }}, + '5', '6', '7', '8', '9', '0', '1', }}, d; pchunks.append(b.data(), b.size()); @@ -261,8 +260,7 @@ void test_peek_memchunks_disable_peek_drain(void) { std::array b{{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', - '5', '6', '7', '8', '9', '0', '1', - }}, + '5', '6', '7', '8', '9', '0', '1', }}, d; pchunks.append(b.data(), b.size()); @@ -289,8 +287,7 @@ void test_peek_memchunks_disable_peek_no_drain(void) { std::array b{{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', - '5', '6', '7', '8', '9', '0', '1', - }}, + '5', '6', '7', '8', '9', '0', '1', }}, d; pchunks.append(b.data(), b.size()); @@ -317,8 +314,7 @@ void test_peek_memchunks_reset(void) { std::array b{{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', - '5', '6', '7', '8', '9', '0', '1', - }}, + '5', '6', '7', '8', '9', '0', '1', }}, d; pchunks.append(b.data(), b.size()); diff --git a/src/nghttp.cc b/src/nghttp.cc index 625f0905..e48d6592 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -89,8 +89,7 @@ enum { namespace { constexpr auto anchors = std::array{{ - {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() @@ -554,10 +553,11 @@ int HttpClient::initiate_connection() { // If the user overrode the :authority or host header, use that // value for the SNI extension const char *host_string = nullptr; - auto i = std::find_if(std::begin(config.headers), - std::end(config.headers), [](const Header &nv) { - return ":authority" == nv.name || "host" == nv.name; - }); + auto i = + std::find_if(std::begin(config.headers), std::end(config.headers), + [](const Header &nv) { + return ":authority" == nv.name || "host" == nv.name; + }); if (i != std::end(config.headers)) { host_string = (*i).value.c_str(); } else { @@ -1933,12 +1933,12 @@ void print_stats(const HttpClient &client) { std::sort(std::begin(reqs), std::end(reqs), [](const Request *lhs, const Request *rhs) { - const auto <iming = lhs->timing; - const auto &rtiming = rhs->timing; - return ltiming.response_end_time < rtiming.response_end_time || - (ltiming.response_end_time == rtiming.response_end_time && - ltiming.request_start_time < rtiming.request_start_time); - }); + const auto <iming = lhs->timing; + const auto &rtiming = rhs->timing; + return ltiming.response_end_time < rtiming.response_end_time || + (ltiming.response_end_time == rtiming.response_end_time && + ltiming.request_start_time < rtiming.request_start_time); + }); std::cout << R"( Request timing: @@ -2027,7 +2027,8 @@ namespace { int communicate( const std::string &scheme, const std::string &host, uint16_t port, std::vector> - requests, const nghttp2_session_callbacks *callbacks) { + requests, + const nghttp2_session_callbacks *callbacks) { int result = 0; auto loop = EV_DEFAULT; SSL_CTX *ssl_ctx = nullptr; diff --git a/src/shrpx_connection_handler.cc b/src/shrpx_connection_handler.cc index 76e1edc6..536b3e16 100644 --- a/src/shrpx_connection_handler.cc +++ b/src/shrpx_connection_handler.cc @@ -175,12 +175,12 @@ int ConnectionHandler::create_single_worker() { , nb_.get() #endif // HAVE_NEVERBLEED - ); + ); auto cl_ssl_ctx = ssl::setup_client_ssl_context( #ifdef HAVE_NEVERBLEED nb_.get() #endif // HAVE_NEVERBLEED - ); + ); if (cl_ssl_ctx) { all_ssl_ctx_.push_back(cl_ssl_ctx); @@ -207,12 +207,12 @@ int ConnectionHandler::create_worker_thread(size_t num) { , nb_.get() #endif // HAVE_NEVERBLEED - ); + ); auto cl_ssl_ctx = ssl::setup_client_ssl_context( #ifdef HAVE_NEVERBLEED nb_.get() #endif // HAVE_NEVERBLEED - ); + ); if (cl_ssl_ctx) { all_ssl_ctx_.push_back(cl_ssl_ctx); @@ -401,8 +401,8 @@ void ConnectionHandler::accept_pending_connection() { } } -void -ConnectionHandler::set_ticket_keys(std::shared_ptr ticket_keys) { +void ConnectionHandler::set_ticket_keys( + std::shared_ptr ticket_keys) { ticket_keys_ = std::move(ticket_keys); if (single_worker_) { single_worker_->set_ticket_keys(ticket_keys_); @@ -740,8 +740,8 @@ void ConnectionHandler::on_tls_ticket_key_get_success( set_ticket_keys_to_worker(ticket_keys); } -void -ConnectionHandler::schedule_next_tls_ticket_key_memcached_get(ev_timer *w) { +void ConnectionHandler::schedule_next_tls_ticket_key_memcached_get( + ev_timer *w) { ev_timer_set(w, get_config()->tls_ticket_key_memcached_interval, 0.); ev_timer_start(loop_, w); } diff --git a/src/shrpx_downstream_test.cc b/src/shrpx_downstream_test.cc index 871cac70..f74647ea 100644 --- a/src/shrpx_downstream_test.cc +++ b/src/shrpx_downstream_test.cc @@ -120,10 +120,10 @@ void test_downstream_crumble_request_cookie(void) { Headers cookies; std::transform(std::begin(nva), std::end(nva), std::back_inserter(cookies), [](const nghttp2_nv &nv) { - return Header(std::string(nv.name, nv.name + nv.namelen), - std::string(nv.value, nv.value + nv.valuelen), - nv.flags & NGHTTP2_NV_FLAG_NO_INDEX); - }); + return Header(std::string(nv.name, nv.name + nv.namelen), + std::string(nv.value, nv.value + nv.valuelen), + nv.flags & NGHTTP2_NV_FLAG_NO_INDEX); + }); Headers ans = {{"cookie", "alpha"}, {"cookie", "bravo"}, diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index 6f255cf9..2258903c 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -553,8 +553,8 @@ void Http2Session::add_downstream_connection(Http2DownstreamConnection *dconn) { dconns_.append(dconn); } -void -Http2Session::remove_downstream_connection(Http2DownstreamConnection *dconn) { +void Http2Session::remove_downstream_connection( + Http2DownstreamConnection *dconn) { dconns_.remove(dconn); dconn->detach_stream_data(); } diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index 05d0f70a..1c6af673 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -1391,8 +1391,8 @@ int Http2Upstream::error_reply(Downstream *downstream, return 0; } -void -Http2Upstream::add_pending_downstream(std::unique_ptr downstream) { +void Http2Upstream::add_pending_downstream( + std::unique_ptr downstream) { downstream_queue_.add_pending(std::move(downstream)); } @@ -1670,9 +1670,8 @@ int Http2Upstream::consume(int32_t stream_id, size_t len) { return 0; } -void -Http2Upstream::log_response_headers(Downstream *downstream, - const std::vector &nva) const { +void Http2Upstream::log_response_headers( + Downstream *downstream, const std::vector &nva) const { std::stringstream ss; for (auto &nv : nva) { ss << TTY_HTTP_HD << nv.name << TTY_RST << ": " << nv.value << "\n"; diff --git a/src/shrpx_log.cc b/src/shrpx_log.cc index b1f435e6..59095b51 100644 --- a/src/shrpx_log.cc +++ b/src/shrpx_log.cc @@ -184,7 +184,7 @@ std::pair copy(const std::string &src, size_t avail, namespace { template -std::pair copy_l(const char (&src)[N], size_t avail, +std::pair copy_l(const char(&src)[N], size_t avail, OutputIterator oitr) { return copy(src, N - 1, avail, oitr); } diff --git a/src/shrpx_log_config.cc b/src/shrpx_log_config.cc index 3d77673d..2222425c 100644 --- a/src/shrpx_log_config.cc +++ b/src/shrpx_log_config.cc @@ -52,8 +52,8 @@ static LogConfig *config = new LogConfig(); LogConfig *log_config(void) { return config; } #endif // NOTHREADS -void -LogConfig::update_tstamp(const std::chrono::system_clock::time_point &now) { +void LogConfig::update_tstamp( + const std::chrono::system_clock::time_point &now) { auto t0 = std::chrono::system_clock::to_time_t(time_str_updated_); auto t1 = std::chrono::system_clock::to_time_t(now); if (t0 == t1) { diff --git a/src/shrpx_spdy_upstream.cc b/src/shrpx_spdy_upstream.cc index 6b45a2e6..2ce0491c 100644 --- a/src/shrpx_spdy_upstream.cc +++ b/src/shrpx_spdy_upstream.cc @@ -888,13 +888,11 @@ int SpdyUpstream::error_reply(Downstream *downstream, std::string content_length = util::utos(html.size()); std::string status_string = http2::get_status_string(status_code); - const char *nv[] = {":status", status_string.c_str(), - ":version", "http/1.1", - "content-type", "text/html; charset=UTF-8", - "server", get_config()->server_name, - "content-length", content_length.c_str(), - "date", lgconf->time_http_str.c_str(), - nullptr}; + const char *nv[] = {":status", status_string.c_str(), ":version", "http/1.1", + "content-type", "text/html; charset=UTF-8", "server", + get_config()->server_name, "content-length", + content_length.c_str(), "date", + lgconf->time_http_str.c_str(), nullptr}; rv = spdylay_submit_response(session_, downstream->get_stream_id(), nv, &data_prd); diff --git a/src/shrpx_ssl.cc b/src/shrpx_ssl.cc index d204e2d6..8c4b4166 100644 --- a/src/shrpx_ssl.cc +++ b/src/shrpx_ssl.cc @@ -1145,7 +1145,7 @@ SSL_CTX *setup_server_ssl_context(std::vector &all_ssl_ctx, auto ssl_ctx = ssl::create_ssl_context(get_config()->private_key_file.get(), get_config()->cert_file.get() #ifdef HAVE_NEVERBLEED - , + , nb #endif // HAVE_NEVERBLEED ); @@ -1166,7 +1166,7 @@ SSL_CTX *setup_server_ssl_context(std::vector &all_ssl_ctx, auto ssl_ctx = ssl::create_ssl_context(keycert.first.c_str(), keycert.second.c_str() #ifdef HAVE_NEVERBLEED - , + , nb #endif // HAVE_NEVERBLEED ); diff --git a/src/shrpx_ssl_test.cc b/src/shrpx_ssl_test.cc index 22bac630..ff646b85 100644 --- a/src/shrpx_ssl_test.cc +++ b/src/shrpx_ssl_test.cc @@ -43,13 +43,12 @@ void test_shrpx_ssl_create_lookup_tree(void) { SSL_CTX_new(SSLv23_method()), SSL_CTX_new(SSLv23_method()), SSL_CTX_new(SSLv23_method()), SSL_CTX_new(SSLv23_method())}; - const char *hostnames[] = {"example.com", "www.example.org", - "*www.example.org", "x*.host.domain", - "*yy.host.domain", "nghttp2.sourceforge.net", - "sourceforge.net", - "sourceforge.net", // duplicate - "*.foo.bar", // oo.bar is suffix of *.foo.bar - "oo.bar"}; + const char *hostnames[] = { + "example.com", "www.example.org", "*www.example.org", "x*.host.domain", + "*yy.host.domain", "nghttp2.sourceforge.net", "sourceforge.net", + "sourceforge.net", // duplicate + "*.foo.bar", // oo.bar is suffix of *.foo.bar + "oo.bar"}; int num = array_size(ctxs); for (int i = 0; i < num; ++i) { tree->add_cert(ctxs[i], hostnames[i], strlen(hostnames[i])); diff --git a/src/template.h b/src/template.h index 5300902e..3f92bfac 100644 --- a/src/template.h +++ b/src/template.h @@ -60,11 +60,11 @@ make_array(T &&... t) { sizeof...(T)>{{std::forward(t)...}}; } -template constexpr size_t array_size(T (&)[N]) { +template constexpr size_t array_size(T(&)[N]) { return N; } -template constexpr size_t str_size(T (&)[N]) { +template constexpr size_t str_size(T(&)[N]) { return N - 1; } @@ -76,8 +76,8 @@ template struct Defer { Defer(Defer &&o) : f(std::move(o.f)) {} ~Defer() { f(); } - using ResultType = typename std::result_of< - typename std::decay::type(typename std::decay::type...)>::type; + using ResultType = typename std::result_of::type( + typename std::decay::type...)>::type; std::function f; }; diff --git a/src/util.cc b/src/util.cc index 0870b20e..1a040cf5 100644 --- a/src/util.cc +++ b/src/util.cc @@ -433,15 +433,15 @@ std::string format_hex(const unsigned char *s, size_t len) { void to_token68(std::string &base64str) { std::transform(std::begin(base64str), std::end(base64str), std::begin(base64str), [](char c) { - switch (c) { - case '+': - return '-'; - case '/': - return '_'; - default: - return c; - } - }); + switch (c) { + case '+': + return '-'; + case '/': + return '_'; + default: + return c; + } + }); base64str.erase(std::find(std::begin(base64str), std::end(base64str), '='), std::end(base64str)); } @@ -449,15 +449,15 @@ void to_token68(std::string &base64str) { void to_base64(std::string &token68str) { std::transform(std::begin(token68str), std::end(token68str), std::begin(token68str), [](char c) { - switch (c) { - case '-': - return '+'; - case '_': - return '/'; - default: - return c; - } - }); + switch (c) { + case '-': + return '+'; + case '_': + return '/'; + default: + return c; + } + }); if (token68str.size() & 0x3) { token68str.append(4 - (token68str.size() & 0x3), '='); } diff --git a/src/util.h b/src/util.h index 3a835e75..8eb88cdd 100644 --- a/src/util.h +++ b/src/util.h @@ -220,7 +220,7 @@ std::string quote_string(const std::string &target); std::string format_hex(const unsigned char *s, size_t len); -template std::string format_hex(const unsigned char (&s)[N]) { +template std::string format_hex(const unsigned char(&s)[N]) { return format_hex(s, N); } @@ -366,11 +366,11 @@ inline bool strieq(const char *a, const std::string &b) { } template -bool strieq_l(const char (&a)[N], InputIt b, size_t blen) { +bool strieq_l(const char(&a)[N], InputIt b, size_t blen) { return strieq(a, N - 1, b, blen); } -template bool strieq_l(const char (&a)[N], const std::string &b) { +template bool strieq_l(const char(&a)[N], const std::string &b) { return strieq(a, N - 1, std::begin(b), b.size()); } @@ -400,11 +400,11 @@ inline bool streq(const char *a, const char *b) { } template -bool streq_l(const char (&a)[N], InputIt b, size_t blen) { +bool streq_l(const char(&a)[N], InputIt b, size_t blen) { return streq(a, N - 1, b, blen); } -template bool streq_l(const char (&a)[N], const std::string &b) { +template bool streq_l(const char(&a)[N], const std::string &b) { return streq(a, N - 1, std::begin(b), b.size()); } diff --git a/tests/nghttp2_hd_test.c b/tests/nghttp2_hd_test.c index c71117ce..5a4d7c5f 100644 --- a/tests/nghttp2_hd_test.c +++ b/tests/nghttp2_hd_test.c @@ -1007,25 +1007,20 @@ 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"), @@ -1036,8 +1031,7 @@ 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"), @@ -1049,8 +1043,7 @@ 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"), @@ -1062,8 +1055,7 @@ 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"), @@ -1075,8 +1067,7 @@ 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"), @@ -1088,8 +1079,7 @@ 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"), @@ -1101,8 +1091,7 @@ 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"), @@ -1114,8 +1103,7 @@ 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"), @@ -1127,8 +1115,7 @@ 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"), diff --git a/tests/nghttp2_pq_test.c b/tests/nghttp2_pq_test.c index c37b156a..b0e694de 100644 --- a/tests/nghttp2_pq_test.c +++ b/tests/nghttp2_pq_test.c @@ -45,9 +45,7 @@ static string_entry *string_entry_new(const char *s) { return ent; } -static void string_entry_del(string_entry *ent) { - free(ent); -} +static void string_entry_del(string_entry *ent) { free(ent); } static int pq_less(const void *lhs, const void *rhs) { return strcmp(((string_entry *)lhs)->s, ((string_entry *)rhs)->s) < 0; diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index 758ada16..e990e611 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -8401,9 +8401,9 @@ void test_nghttp2_http_mandatory_headers(void) { MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), MAKE_NV("content-length", "-1")}; const nghttp2_nv dupcl_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":method", "POST"), + MAKE_NV(":scheme", "https"), MAKE_NV(":method", "POST"), MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), - MAKE_NV("content-length", "0"), MAKE_NV("content-length", "0")}; + MAKE_NV("content-length", "0"), MAKE_NV("content-length", "0")}; const nghttp2_nv badhd_reqnv[] = { MAKE_NV(":scheme", "https"), MAKE_NV(":method", "GET"), MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), @@ -8996,8 +8996,8 @@ void test_nghttp2_http_ignore_regular_header(void) { 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(":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"),