clang-format
This commit is contained in:
parent
b26503f51c
commit
c17b3b8517
|
@ -324,23 +324,16 @@ void continue_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ContinueTimer::ContinueTimer(struct ev_loop *loop, Request *req)
|
ContinueTimer::ContinueTimer(struct ev_loop *loop, Request *req) : loop(loop) {
|
||||||
: loop(loop) {
|
|
||||||
ev_timer_init(&timer, continue_timeout_cb, 1., 0.);
|
ev_timer_init(&timer, continue_timeout_cb, 1., 0.);
|
||||||
timer.data = req;
|
timer.data = req;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContinueTimer::~ContinueTimer() {
|
ContinueTimer::~ContinueTimer() { stop(); }
|
||||||
stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContinueTimer::start() {
|
void ContinueTimer::start() { ev_timer_start(loop, &timer); }
|
||||||
ev_timer_start(loop, &timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContinueTimer::stop() {
|
void ContinueTimer::stop() { ev_timer_stop(loop, &timer); }
|
||||||
ev_timer_stop(loop, &timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContinueTimer::dispatch_continue() {
|
void ContinueTimer::dispatch_continue() {
|
||||||
// Only dispatch the timeout callback if it hasn't already been called.
|
// 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 (req->data_prd) {
|
||||||
if (!config.no_content_length) {
|
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) {
|
if (config.expect_continue) {
|
||||||
expect_continue = true;
|
expect_continue = true;
|
||||||
|
@ -461,7 +455,7 @@ int submit_request(HttpClient *client, const Headers &headers, Request *req) {
|
||||||
|
|
||||||
if (expect_continue) {
|
if (expect_continue) {
|
||||||
stream_id = nghttp2_submit_headers(client->session, 0, -1, &req->pri_spec,
|
stream_id = nghttp2_submit_headers(client->session, 0, -1, &req->pri_spec,
|
||||||
nva.data(), nva.size(), req);
|
nva.data(), nva.size(), req);
|
||||||
} else {
|
} else {
|
||||||
stream_id =
|
stream_id =
|
||||||
nghttp2_submit_request(client->session, &req->pri_spec, nva.data(),
|
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) {
|
if (stream_id < 0) {
|
||||||
std::cerr << "[ERROR] nghttp2_submit_"
|
std::cerr << "[ERROR] nghttp2_submit_"
|
||||||
<< (expect_continue ? "headers" : "request")
|
<< (expect_continue ? "headers" : "request")
|
||||||
<< "() returned error: "
|
<< "() returned error: " << nghttp2_strerror(stream_id)
|
||||||
<< nghttp2_strerror(stream_id) << std::endl;
|
<< std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1982,8 +1976,7 @@ int before_frame_send_callback(nghttp2_session *session,
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int on_frame_send_callback(nghttp2_session *session,
|
int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame,
|
||||||
const nghttp2_frame *frame,
|
|
||||||
void *user_data) {
|
void *user_data) {
|
||||||
if (config.verbose) {
|
if (config.verbose) {
|
||||||
verbose_on_frame_send_callback(session, frame, user_data);
|
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(
|
nghttp2_session_callbacks_set_before_frame_send_callback(
|
||||||
callbacks, before_frame_send_callback);
|
callbacks, before_frame_send_callback);
|
||||||
|
|
||||||
nghttp2_session_callbacks_set_on_frame_send_callback(
|
nghttp2_session_callbacks_set_on_frame_send_callback(callbacks,
|
||||||
callbacks, on_frame_send_callback);
|
on_frame_send_callback);
|
||||||
|
|
||||||
nghttp2_session_callbacks_set_on_frame_not_send_callback(
|
nghttp2_session_callbacks_set_on_frame_not_send_callback(
|
||||||
callbacks, on_frame_not_send_callback);
|
callbacks, on_frame_not_send_callback);
|
||||||
|
|
21
src/ssl.cc
21
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.
|
the black listed cipher suites for HTTP/2 described in RFC 7540.
|
||||||
https://github.com/jay/http2_blacklisted_ciphers
|
https://github.com/jay/http2_blacklisted_ciphers
|
||||||
*/
|
*/
|
||||||
#define IS_CIPHER_BANNED_METHOD2(id) ( \
|
#define IS_CIPHER_BANNED_METHOD2(id) \
|
||||||
(0x0000 <= id && id <= 0x00FF && \
|
((0x0000 <= id && id <= 0x00FF && \
|
||||||
"\xFF\xFF\xFF\xCF\xFF\xFF\xFF\xFF\x7F\x00\x00\x00\x80\x3F\x00\x00" \
|
"\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" \
|
"\xF0\xFF\xFF\x3F\xF3\xF3\xFF\xFF\x3F\x00\x00\x00\x00\x00\x00\x80" \
|
||||||
[(id & 0xFF) / 8] & (1 << (id % 8))) || \
|
[(id & 0xFF) / 8] & \
|
||||||
(0xC000 <= id && id <= 0xC0FF && \
|
(1 << (id % 8))) || \
|
||||||
"\xFE\xFF\xFF\xFF\xFF\x67\xFE\xFF\xFF\xFF\x33\xCF\xFC\xCF\xFF\xCF" \
|
(0xC000 <= id && id <= 0xC0FF && \
|
||||||
"\x3C\xF3\xFC\x3F\x33\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" \
|
"\xFE\xFF\xFF\xFF\xFF\x67\xFE\xFF\xFF\xFF\x33\xCF\xFC\xCF\xFF\xCF" \
|
||||||
[(id & 0xFF) / 8] & (1 << (id % 8))) \
|
"\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) {
|
bool check_http2_cipher_black_list(SSL *ssl) {
|
||||||
int id = SSL_CIPHER_get_id(SSL_get_current_cipher(ssl)) & 0xFFFFFF;
|
int id = SSL_CIPHER_get_id(SSL_get_current_cipher(ssl)) & 0xFFFFFF;
|
||||||
|
|
Loading…
Reference in New Issue