clang-format

This commit is contained in:
Tatsuhiro Tsujikawa 2016-03-31 20:06:14 +09:00
parent b26503f51c
commit c17b3b8517
2 changed files with 23 additions and 29 deletions

View File

@ -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);

View File

@ -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;