From c17b3b8517bcf0f1cc484949385283fb903b5d72 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 31 Mar 2016 20:06:14 +0900 Subject: [PATCH] clang-format --- src/nghttp.cc | 31 ++++++++++++------------------- src/ssl.cc | 21 +++++++++++---------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/src/nghttp.cc b/src/nghttp.cc index c9f219ac..e3647b17 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -324,23 +324,16 @@ void continue_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { } } // namespace -ContinueTimer::ContinueTimer(struct ev_loop *loop, Request *req) - : loop(loop) { +ContinueTimer::ContinueTimer(struct ev_loop *loop, Request *req) : loop(loop) { ev_timer_init(&timer, continue_timeout_cb, 1., 0.); timer.data = req; } -ContinueTimer::~ContinueTimer() { - stop(); -} +ContinueTimer::~ContinueTimer() { stop(); } -void ContinueTimer::start() { - ev_timer_start(loop, &timer); -} +void ContinueTimer::start() { ev_timer_start(loop, &timer); } -void ContinueTimer::stop() { - ev_timer_stop(loop, &timer); -} +void ContinueTimer::stop() { ev_timer_stop(loop, &timer); } void ContinueTimer::dispatch_continue() { // Only dispatch the timeout callback if it hasn't already been called. @@ -412,7 +405,8 @@ int submit_request(HttpClient *client, const Headers &headers, Request *req) { if (req->data_prd) { if (!config.no_content_length) { - build_headers.emplace_back("content-length", util::utos(req->data_length)); + build_headers.emplace_back("content-length", + util::utos(req->data_length)); } if (config.expect_continue) { expect_continue = true; @@ -461,7 +455,7 @@ int submit_request(HttpClient *client, const Headers &headers, Request *req) { if (expect_continue) { stream_id = nghttp2_submit_headers(client->session, 0, -1, &req->pri_spec, - nva.data(), nva.size(), req); + nva.data(), nva.size(), req); } else { stream_id = nghttp2_submit_request(client->session, &req->pri_spec, nva.data(), @@ -471,8 +465,8 @@ int submit_request(HttpClient *client, const Headers &headers, Request *req) { if (stream_id < 0) { std::cerr << "[ERROR] nghttp2_submit_" << (expect_continue ? "headers" : "request") - << "() returned error: " - << nghttp2_strerror(stream_id) << std::endl; + << "() returned error: " << nghttp2_strerror(stream_id) + << std::endl; return -1; } @@ -1982,8 +1976,7 @@ int before_frame_send_callback(nghttp2_session *session, } // namespace namespace { -int on_frame_send_callback(nghttp2_session *session, - const nghttp2_frame *frame, +int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, void *user_data) { if (config.verbose) { verbose_on_frame_send_callback(session, frame, user_data); @@ -2392,8 +2385,8 @@ int run(char **uris, int n) { nghttp2_session_callbacks_set_before_frame_send_callback( callbacks, before_frame_send_callback); - nghttp2_session_callbacks_set_on_frame_send_callback( - callbacks, on_frame_send_callback); + nghttp2_session_callbacks_set_on_frame_send_callback(callbacks, + on_frame_send_callback); nghttp2_session_callbacks_set_on_frame_not_send_callback( callbacks, on_frame_not_send_callback); diff --git a/src/ssl.cc b/src/ssl.cc index f144fa94..8d8cd782 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -123,16 +123,17 @@ TLSSessionInfo *get_tls_session_info(TLSSessionInfo *tls_info, SSL *ssl) { the black listed cipher suites for HTTP/2 described in RFC 7540. https://github.com/jay/http2_blacklisted_ciphers */ -#define IS_CIPHER_BANNED_METHOD2(id) ( \ - (0x0000 <= id && id <= 0x00FF && \ - "\xFF\xFF\xFF\xCF\xFF\xFF\xFF\xFF\x7F\x00\x00\x00\x80\x3F\x00\x00" \ - "\xF0\xFF\xFF\x3F\xF3\xF3\xFF\xFF\x3F\x00\x00\x00\x00\x00\x00\x80" \ - [(id & 0xFF) / 8] & (1 << (id % 8))) || \ - (0xC000 <= id && id <= 0xC0FF && \ - "\xFE\xFF\xFF\xFF\xFF\x67\xFE\xFF\xFF\xFF\x33\xCF\xFC\xCF\xFF\xCF" \ - "\x3C\xF3\xFC\x3F\x33\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" \ - [(id & 0xFF) / 8] & (1 << (id % 8))) \ -) +#define IS_CIPHER_BANNED_METHOD2(id) \ + ((0x0000 <= id && id <= 0x00FF && \ + "\xFF\xFF\xFF\xCF\xFF\xFF\xFF\xFF\x7F\x00\x00\x00\x80\x3F\x00\x00" \ + "\xF0\xFF\xFF\x3F\xF3\xF3\xFF\xFF\x3F\x00\x00\x00\x00\x00\x00\x80" \ + [(id & 0xFF) / 8] & \ + (1 << (id % 8))) || \ + (0xC000 <= id && id <= 0xC0FF && \ + "\xFE\xFF\xFF\xFF\xFF\x67\xFE\xFF\xFF\xFF\x33\xCF\xFC\xCF\xFF\xCF" \ + "\x3C\xF3\xFC\x3F\x33\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" \ + [(id & 0xFF) / 8] & \ + (1 << (id % 8)))) bool check_http2_cipher_black_list(SSL *ssl) { int id = SSL_CIPHER_get_id(SSL_get_current_cipher(ssl)) & 0xFFFFFF;