src: Use static_cast instead of reinterpret_cast if possible
This commit is contained in:
parent
660e1ec44d
commit
dfbea797bd
|
@ -80,7 +80,7 @@ void start_element_func
|
|||
const xmlChar *name,
|
||||
const xmlChar **attrs)
|
||||
{
|
||||
auto parser_data = reinterpret_cast<ParserData*>(user_data);
|
||||
auto parser_data = static_cast<ParserData*>(user_data);
|
||||
if(util::strieq(reinterpret_cast<const char*>(name), "link")) {
|
||||
auto rel_attr = get_attr(attrs, "rel");
|
||||
auto href_attr = get_attr(attrs, "href");
|
||||
|
|
|
@ -216,7 +216,7 @@ namespace {
|
|||
void readcb(bufferevent *bev, void *ptr)
|
||||
{
|
||||
int rv;
|
||||
auto handler = reinterpret_cast<Http2Handler*>(ptr);
|
||||
auto handler = static_cast<Http2Handler*>(ptr);
|
||||
rv = handler->on_read();
|
||||
if(rv != 0) {
|
||||
delete_handler(handler);
|
||||
|
@ -231,7 +231,7 @@ void writecb(bufferevent *bev, void *ptr)
|
|||
return;
|
||||
}
|
||||
int rv;
|
||||
auto handler = reinterpret_cast<Http2Handler*>(ptr);
|
||||
auto handler = static_cast<Http2Handler*>(ptr);
|
||||
rv = handler->on_write();
|
||||
if(rv != 0) {
|
||||
delete_handler(handler);
|
||||
|
@ -242,7 +242,7 @@ void writecb(bufferevent *bev, void *ptr)
|
|||
namespace {
|
||||
void eventcb(bufferevent *bev, short events, void *ptr)
|
||||
{
|
||||
auto handler = reinterpret_cast<Http2Handler*>(ptr);
|
||||
auto handler = static_cast<Http2Handler*>(ptr);
|
||||
if(events & BEV_EVENT_CONNECTED) {
|
||||
// SSL/TLS handshake completed
|
||||
if(handler->verify_npn_result() != 0) {
|
||||
|
@ -267,7 +267,7 @@ namespace {
|
|||
void connhd_readcb(bufferevent *bev, void *ptr)
|
||||
{
|
||||
uint8_t data[24];
|
||||
auto handler = reinterpret_cast<Http2Handler*>(ptr);
|
||||
auto handler = static_cast<Http2Handler*>(ptr);
|
||||
size_t leftlen = handler->get_left_connhd_len();
|
||||
auto input = bufferevent_get_input(bev);
|
||||
int readlen = evbuffer_remove(input, data, leftlen);
|
||||
|
@ -353,7 +353,7 @@ int Http2Handler::on_write()
|
|||
namespace {
|
||||
void settings_timeout_cb(evutil_socket_t fd, short what, void *arg)
|
||||
{
|
||||
auto hd = reinterpret_cast<Http2Handler*>(arg);
|
||||
auto hd = static_cast<Http2Handler*>(arg);
|
||||
hd->terminate_session(NGHTTP2_SETTINGS_TIMEOUT);
|
||||
hd->on_write();
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ ssize_t hd_send_callback(nghttp2_session *session,
|
|||
const uint8_t *data, size_t len, int flags,
|
||||
void *user_data)
|
||||
{
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
return hd->sendcb(data, len);
|
||||
}
|
||||
} // namespace
|
||||
|
@ -615,7 +615,7 @@ namespace {
|
|||
ssize_t hd_recv_callback(nghttp2_session *session,
|
||||
uint8_t *data, size_t len, int flags, void *user_data)
|
||||
{
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
return hd->recvcb(data, len);
|
||||
}
|
||||
} // namespace
|
||||
|
@ -778,7 +778,7 @@ int on_header_callback(nghttp2_session *session,
|
|||
const uint8_t *value, size_t valuelen,
|
||||
void *user_data)
|
||||
{
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
if(hd->get_config()->verbose) {
|
||||
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
|
||||
user_data);
|
||||
|
@ -812,7 +812,7 @@ int on_end_headers_callback(nghttp2_session *session,
|
|||
frame->headers.cat != NGHTTP2_HCAT_REQUEST) {
|
||||
return 0;
|
||||
}
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
auto stream = hd->get_stream(frame->hd.stream_id);
|
||||
if(!stream) {
|
||||
return 0;
|
||||
|
@ -847,7 +847,7 @@ namespace {
|
|||
int hd_on_frame_recv_callback
|
||||
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||
{
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
if(hd->get_config()->verbose) {
|
||||
print_session_id(hd->session_id());
|
||||
verbose_on_frame_recv_callback(session, frame, user_data);
|
||||
|
@ -884,7 +884,7 @@ int hd_on_frame_recv_callback
|
|||
int htdocs_on_request_recv_callback
|
||||
(nghttp2_session *session, int32_t stream_id, void *user_data)
|
||||
{
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
auto stream = hd->get_stream(stream_id);
|
||||
if(stream) {
|
||||
prepare_response(stream, hd);
|
||||
|
@ -896,7 +896,7 @@ namespace {
|
|||
int hd_before_frame_send_callback
|
||||
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||
{
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
if(frame->hd.type == NGHTTP2_PUSH_PROMISE) {
|
||||
auto stream_id = frame->push_promise.promised_stream_id;
|
||||
auto req = util::make_unique<Request>(stream_id);
|
||||
|
@ -914,7 +914,7 @@ int hd_on_frame_send_callback
|
|||
(nghttp2_session *session, const nghttp2_frame *frame,
|
||||
void *user_data)
|
||||
{
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
if(frame->hd.type == NGHTTP2_PUSH_PROMISE) {
|
||||
auto stream = hd->get_stream(frame->push_promise.promised_stream_id);
|
||||
if(stream) {
|
||||
|
@ -945,7 +945,7 @@ int hd_on_data_recv_callback
|
|||
void *user_data)
|
||||
{
|
||||
// TODO Handle POST
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
if(hd->get_config()->verbose) {
|
||||
print_session_id(hd->session_id());
|
||||
verbose_on_data_recv_callback(session, length, flags, stream_id,
|
||||
|
@ -960,7 +960,7 @@ int hd_on_data_send_callback
|
|||
(nghttp2_session *session, uint16_t length, uint8_t flags, int32_t stream_id,
|
||||
void *user_data)
|
||||
{
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
if(hd->get_config()->verbose) {
|
||||
print_session_id(hd->session_id());
|
||||
verbose_on_data_send_callback(session, length, flags, stream_id,
|
||||
|
@ -975,7 +975,7 @@ int on_stream_close_callback
|
|||
(nghttp2_session *session, int32_t stream_id, nghttp2_error_code error_code,
|
||||
void *user_data)
|
||||
{
|
||||
auto hd = reinterpret_cast<Http2Handler*>(user_data);
|
||||
auto hd = static_cast<Http2Handler*>(user_data);
|
||||
hd->remove_stream(stream_id);
|
||||
if(hd->get_config()->verbose) {
|
||||
print_session_id(hd->session_id());
|
||||
|
@ -1061,8 +1061,7 @@ namespace {
|
|||
int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len,
|
||||
void *arg)
|
||||
{
|
||||
auto next_proto =
|
||||
reinterpret_cast<std::pair<unsigned char*, size_t>* >(arg);
|
||||
auto next_proto = static_cast<std::pair<unsigned char*, size_t>* >(arg);
|
||||
*data = next_proto->first;
|
||||
*len = next_proto->second;
|
||||
return SSL_TLSEXT_ERR_OK;
|
||||
|
@ -1082,7 +1081,7 @@ namespace {
|
|||
void evlistener_acceptcb(evconnlistener *listener, int fd,
|
||||
sockaddr *addr, int addrlen, void *arg)
|
||||
{
|
||||
auto handler = reinterpret_cast<ListenEventHandler*>(arg);
|
||||
auto handler = static_cast<ListenEventHandler*>(arg);
|
||||
handler->accept_connection(fd, addr, addrlen);
|
||||
}
|
||||
} // namespace
|
||||
|
@ -1170,7 +1169,7 @@ int alpn_select_proto_cb(SSL* ssl,
|
|||
const unsigned char *in, unsigned int inlen,
|
||||
void *arg)
|
||||
{
|
||||
auto config = reinterpret_cast<HttpServer*>(arg)->get_config();
|
||||
auto config = static_cast<HttpServer*>(arg)->get_config();
|
||||
if(config->verbose) {
|
||||
std::cout << "[ALPN] client offers:" << std::endl;
|
||||
}
|
||||
|
|
|
@ -888,7 +888,7 @@ int htp_msg_begincb(http_parser *htp)
|
|||
namespace {
|
||||
int htp_status_completecb(http_parser *htp)
|
||||
{
|
||||
auto client = reinterpret_cast<HttpClient*>(htp->data);
|
||||
auto client = static_cast<HttpClient*>(htp->data);
|
||||
client->upgrade_response_status_code = htp->status_code;
|
||||
return 0;
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ int htp_status_completecb(http_parser *htp)
|
|||
namespace {
|
||||
int htp_msg_completecb(http_parser *htp)
|
||||
{
|
||||
auto client = reinterpret_cast<HttpClient*>(htp->data);
|
||||
auto client = static_cast<HttpClient*>(htp->data);
|
||||
client->upgrade_response_complete = true;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1026,7 +1026,7 @@ void update_html_parser(HttpClient *client, Request *req,
|
|||
namespace {
|
||||
HttpClient* get_session(void *user_data)
|
||||
{
|
||||
return reinterpret_cast<HttpClient*>(user_data);
|
||||
return static_cast<HttpClient*>(user_data);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -1302,7 +1302,7 @@ namespace {
|
|||
void upgrade_readcb(bufferevent *bev, void *ptr)
|
||||
{
|
||||
int rv;
|
||||
auto client = reinterpret_cast<HttpClient*>(ptr);
|
||||
auto client = static_cast<HttpClient*>(ptr);
|
||||
rv = client->on_upgrade_read();
|
||||
if(rv != 0) {
|
||||
client->disconnect();
|
||||
|
@ -1314,7 +1314,7 @@ namespace {
|
|||
void readcb(bufferevent *bev, void *ptr)
|
||||
{
|
||||
int rv;
|
||||
auto client = reinterpret_cast<HttpClient*>(ptr);
|
||||
auto client = static_cast<HttpClient*>(ptr);
|
||||
rv = client->on_read();
|
||||
if(rv != 0) {
|
||||
client->disconnect();
|
||||
|
@ -1329,7 +1329,7 @@ void writecb(bufferevent *bev, void *ptr)
|
|||
return;
|
||||
}
|
||||
int rv;
|
||||
auto client = reinterpret_cast<HttpClient*>(ptr);
|
||||
auto client = static_cast<HttpClient*>(ptr);
|
||||
rv = client->on_write();
|
||||
if(rv != 0) {
|
||||
client->disconnect();
|
||||
|
@ -1341,7 +1341,7 @@ namespace {
|
|||
void eventcb(bufferevent *bev, short events, void *ptr)
|
||||
{
|
||||
int rv;
|
||||
auto client = reinterpret_cast<HttpClient*>(ptr);
|
||||
auto client = static_cast<HttpClient*>(ptr);
|
||||
if(events & BEV_EVENT_CONNECTED) {
|
||||
client->state = STATE_CONNECTED;
|
||||
int fd = bufferevent_getfd(bev);
|
||||
|
@ -1420,7 +1420,7 @@ ssize_t client_send_callback(nghttp2_session *session,
|
|||
const uint8_t *data, size_t len, int flags,
|
||||
void *user_data)
|
||||
{
|
||||
auto client = reinterpret_cast<HttpClient*>(user_data);
|
||||
auto client = static_cast<HttpClient*>(user_data);
|
||||
return client->sendcb(data, len);
|
||||
}
|
||||
} // namespace
|
||||
|
@ -1430,7 +1430,7 @@ ssize_t client_recv_callback(nghttp2_session *session,
|
|||
uint8_t *buf, size_t len, int flags,
|
||||
void *user_data)
|
||||
{
|
||||
auto client = reinterpret_cast<HttpClient*>(user_data);
|
||||
auto client = static_cast<HttpClient*>(user_data);
|
||||
return client->recvcb(buf, len);
|
||||
}
|
||||
} // namespace
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace {
|
|||
void ssl_acceptcb(evconnlistener *listener, int fd,
|
||||
sockaddr *addr, int addrlen, void *arg)
|
||||
{
|
||||
auto handler = reinterpret_cast<ListenHandler*>(arg);
|
||||
auto handler = static_cast<ListenHandler*>(arg);
|
||||
handler->accept_connection(fd, addr, addrlen);
|
||||
}
|
||||
} // namespace
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace shrpx {
|
|||
namespace {
|
||||
void upstream_readcb(bufferevent *bev, void *arg)
|
||||
{
|
||||
auto handler = reinterpret_cast<ClientHandler*>(arg);
|
||||
auto handler = static_cast<ClientHandler*>(arg);
|
||||
int rv = handler->on_read();
|
||||
if(rv != 0) {
|
||||
delete handler;
|
||||
|
@ -58,7 +58,7 @@ void upstream_readcb(bufferevent *bev, void *arg)
|
|||
namespace {
|
||||
void upstream_writecb(bufferevent *bev, void *arg)
|
||||
{
|
||||
auto handler = reinterpret_cast<ClientHandler*>(arg);
|
||||
auto handler = static_cast<ClientHandler*>(arg);
|
||||
// We actually depend on write low-warter mark == 0.
|
||||
if(handler->get_outbuf_length() > 0) {
|
||||
// Possibly because of deferred callback, we may get this callback
|
||||
|
@ -80,7 +80,7 @@ void upstream_writecb(bufferevent *bev, void *arg)
|
|||
namespace {
|
||||
void upstream_eventcb(bufferevent *bev, short events, void *arg)
|
||||
{
|
||||
auto handler = reinterpret_cast<ClientHandler*>(arg);
|
||||
auto handler = static_cast<ClientHandler*>(arg);
|
||||
bool finish = false;
|
||||
if(events & BEV_EVENT_EOF) {
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
|
@ -136,7 +136,7 @@ void upstream_http2_connhd_readcb(bufferevent *bev, void *arg)
|
|||
{
|
||||
// This callback assumes upstream is Http2Upstream.
|
||||
uint8_t data[NGHTTP2_CLIENT_CONNECTION_HEADER_LEN];
|
||||
auto handler = reinterpret_cast<ClientHandler*>(arg);
|
||||
auto handler = static_cast<ClientHandler*>(arg);
|
||||
auto leftlen = handler->get_left_connhd_len();
|
||||
auto input = bufferevent_get_input(bev);
|
||||
auto readlen = evbuffer_remove(input, data, leftlen);
|
||||
|
@ -173,7 +173,7 @@ void upstream_http1_connhd_readcb(bufferevent *bev, void *arg)
|
|||
{
|
||||
// This callback assumes upstream is HttpsUpstream.
|
||||
uint8_t data[NGHTTP2_CLIENT_CONNECTION_HEADER_LEN];
|
||||
auto handler = reinterpret_cast<ClientHandler*>(arg);
|
||||
auto handler = static_cast<ClientHandler*>(arg);
|
||||
auto leftlen = handler->get_left_connhd_len();
|
||||
auto input = bufferevent_get_input(bev);
|
||||
auto readlen = evbuffer_copyout(input, data, leftlen);
|
||||
|
|
|
@ -158,12 +158,12 @@ ssize_t http2_data_read_callback(nghttp2_session *session,
|
|||
nghttp2_data_source *source,
|
||||
void *user_data)
|
||||
{
|
||||
auto sd = reinterpret_cast<StreamData*>
|
||||
auto sd = static_cast<StreamData*>
|
||||
(nghttp2_session_get_stream_user_data(session, stream_id));
|
||||
if(!sd || !sd->dconn) {
|
||||
return NGHTTP2_ERR_DEFERRED;
|
||||
}
|
||||
auto dconn = reinterpret_cast<Http2DownstreamConnection*>(source->ptr);
|
||||
auto dconn = static_cast<Http2DownstreamConnection*>(source->ptr);
|
||||
auto downstream = dconn->get_downstream();
|
||||
if(!downstream) {
|
||||
// In this case, RST_STREAM should have been issued. But depending
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace {
|
|||
void notify_readcb(bufferevent *bev, void *arg)
|
||||
{
|
||||
int rv;
|
||||
auto http2session = reinterpret_cast<Http2Session*>(arg);
|
||||
auto http2session = static_cast<Http2Session*>(arg);
|
||||
http2session->clear_notify();
|
||||
switch(http2session->get_state()) {
|
||||
case Http2Session::DISCONNECTED:
|
||||
|
@ -172,7 +172,7 @@ void notify_readcb(bufferevent *bev, void *arg)
|
|||
namespace {
|
||||
void notify_eventcb(bufferevent *bev, short events, void *arg)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(arg);
|
||||
auto http2session = static_cast<Http2Session*>(arg);
|
||||
// TODO should DIE()?
|
||||
if(events & BEV_EVENT_EOF) {
|
||||
SSLOG(ERROR, http2session) << "Notification connection lost: EOF";
|
||||
|
@ -222,7 +222,7 @@ namespace {
|
|||
void readcb(bufferevent *bev, void *ptr)
|
||||
{
|
||||
int rv;
|
||||
auto http2session = reinterpret_cast<Http2Session*>(ptr);
|
||||
auto http2session = static_cast<Http2Session*>(ptr);
|
||||
rv = http2session->on_read();
|
||||
if(rv != 0) {
|
||||
http2session->disconnect();
|
||||
|
@ -237,7 +237,7 @@ void writecb(bufferevent *bev, void *ptr)
|
|||
return;
|
||||
}
|
||||
int rv;
|
||||
auto http2session = reinterpret_cast<Http2Session*>(ptr);
|
||||
auto http2session = static_cast<Http2Session*>(ptr);
|
||||
rv = http2session->on_write();
|
||||
if(rv != 0) {
|
||||
http2session->disconnect();
|
||||
|
@ -248,7 +248,7 @@ void writecb(bufferevent *bev, void *ptr)
|
|||
namespace {
|
||||
void eventcb(bufferevent *bev, short events, void *ptr)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(ptr);
|
||||
auto http2session = static_cast<Http2Session*>(ptr);
|
||||
if(events & BEV_EVENT_CONNECTED) {
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
SSLOG(INFO, http2session) << "Connection established";
|
||||
|
@ -288,7 +288,7 @@ void eventcb(bufferevent *bev, short events, void *ptr)
|
|||
namespace {
|
||||
void proxy_readcb(bufferevent *bev, void *ptr)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(ptr);
|
||||
auto http2session = static_cast<Http2Session*>(ptr);
|
||||
if(http2session->on_read_proxy() == 0) {
|
||||
switch(http2session->get_state()) {
|
||||
case Http2Session::PROXY_CONNECTED:
|
||||
|
@ -313,7 +313,7 @@ void proxy_readcb(bufferevent *bev, void *ptr)
|
|||
namespace {
|
||||
void proxy_eventcb(bufferevent *bev, short events, void *ptr)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(ptr);
|
||||
auto http2session = static_cast<Http2Session*>(ptr);
|
||||
if(events & BEV_EVENT_CONNECTED) {
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
SSLOG(INFO, http2session) << "Connected to the proxy";
|
||||
|
@ -498,7 +498,7 @@ void Http2Session::unwrap_free_bev()
|
|||
namespace {
|
||||
int htp_hdrs_completecb(http_parser *htp)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(htp->data);
|
||||
auto http2session = static_cast<Http2Session*>(htp->data);
|
||||
// We just check status code here
|
||||
if(htp->status_code == 200) {
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
|
@ -693,7 +693,7 @@ ssize_t send_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
int rv;
|
||||
auto http2session = reinterpret_cast<Http2Session*>(user_data);
|
||||
auto http2session = static_cast<Http2Session*>(user_data);
|
||||
auto bev = http2session->get_bev();
|
||||
auto output = bufferevent_get_output(bev);
|
||||
// Check buffer length and return WOULDBLOCK if it is large enough.
|
||||
|
@ -717,12 +717,12 @@ int on_stream_close_callback
|
|||
void *user_data)
|
||||
{
|
||||
int rv;
|
||||
auto http2session = reinterpret_cast<Http2Session*>(user_data);
|
||||
auto http2session = static_cast<Http2Session*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
SSLOG(INFO, http2session) << "Stream stream_id=" << stream_id
|
||||
<< " is being closed";
|
||||
}
|
||||
auto sd = reinterpret_cast<StreamData*>
|
||||
auto sd = static_cast<StreamData*>
|
||||
(nghttp2_session_get_stream_user_data(session, stream_id));
|
||||
if(sd == 0) {
|
||||
// We might get this close callback when pushed streams are
|
||||
|
@ -756,7 +756,7 @@ int on_stream_close_callback
|
|||
namespace {
|
||||
void settings_timeout_cb(evutil_socket_t fd, short what, void *arg)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(arg);
|
||||
auto http2session = static_cast<Http2Session*>(arg);
|
||||
SSLOG(INFO, http2session) << "SETTINGS timeout";
|
||||
if(http2session->terminate_session(NGHTTP2_SETTINGS_TIMEOUT) != 0) {
|
||||
http2session->disconnect();
|
||||
|
@ -808,7 +808,7 @@ int on_header_callback(nghttp2_session *session,
|
|||
frame->headers.cat != NGHTTP2_HCAT_RESPONSE) {
|
||||
return 0;
|
||||
}
|
||||
auto sd = reinterpret_cast<StreamData*>
|
||||
auto sd = static_cast<StreamData*>
|
||||
(nghttp2_session_get_stream_user_data(session, frame->hd.stream_id));
|
||||
if(!sd || !sd->dconn) {
|
||||
return 0;
|
||||
|
@ -839,8 +839,8 @@ int on_end_headers_callback(nghttp2_session *session,
|
|||
return 0;
|
||||
}
|
||||
int rv;
|
||||
auto http2session = reinterpret_cast<Http2Session*>(user_data);
|
||||
auto sd = reinterpret_cast<StreamData*>
|
||||
auto http2session = static_cast<Http2Session*>(user_data);
|
||||
auto sd = static_cast<StreamData*>
|
||||
(nghttp2_session_get_stream_user_data(session, frame->hd.stream_id));
|
||||
if(!sd || !sd->dconn) {
|
||||
return 0;
|
||||
|
@ -943,7 +943,7 @@ namespace {
|
|||
int on_frame_recv_callback
|
||||
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(user_data);
|
||||
auto http2session = static_cast<Http2Session*>(user_data);
|
||||
switch(frame->hd.type) {
|
||||
case NGHTTP2_HEADERS: {
|
||||
if(frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
|
||||
|
@ -955,7 +955,7 @@ int on_frame_recv_callback
|
|||
if(frame->headers.cat != NGHTTP2_HCAT_RESPONSE) {
|
||||
break;
|
||||
}
|
||||
auto sd = reinterpret_cast<StreamData*>
|
||||
auto sd = static_cast<StreamData*>
|
||||
(nghttp2_session_get_stream_user_data(session, frame->hd.stream_id));
|
||||
if(!sd || !sd->dconn) {
|
||||
http2session->submit_rst_stream(frame->hd.stream_id,
|
||||
|
@ -972,7 +972,7 @@ int on_frame_recv_callback
|
|||
break;
|
||||
}
|
||||
case NGHTTP2_RST_STREAM: {
|
||||
auto sd = reinterpret_cast<StreamData*>
|
||||
auto sd = static_cast<StreamData*>
|
||||
(nghttp2_session_get_stream_user_data(session, frame->hd.stream_id));
|
||||
if(sd && sd->dconn) {
|
||||
auto downstream = sd->dconn->get_downstream();
|
||||
|
@ -1032,8 +1032,8 @@ int on_data_chunk_recv_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
int rv;
|
||||
auto http2session = reinterpret_cast<Http2Session*>(user_data);
|
||||
auto sd = reinterpret_cast<StreamData*>
|
||||
auto http2session = static_cast<Http2Session*>(user_data);
|
||||
auto sd = static_cast<StreamData*>
|
||||
(nghttp2_session_get_stream_user_data(session, stream_id));
|
||||
if(!sd || !sd->dconn) {
|
||||
http2session->submit_rst_stream(stream_id, NGHTTP2_INTERNAL_ERROR);
|
||||
|
@ -1061,10 +1061,10 @@ int before_frame_send_callback(nghttp2_session *session,
|
|||
const nghttp2_frame *frame,
|
||||
void *user_data)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(user_data);
|
||||
auto http2session = static_cast<Http2Session*>(user_data);
|
||||
if(frame->hd.type == NGHTTP2_HEADERS &&
|
||||
frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
|
||||
auto sd = reinterpret_cast<StreamData*>
|
||||
auto sd = static_cast<StreamData*>
|
||||
(nghttp2_session_get_stream_user_data(session, frame->hd.stream_id));
|
||||
if(!sd || !sd->dconn) {
|
||||
http2session->submit_rst_stream(frame->hd.stream_id, NGHTTP2_CANCEL);
|
||||
|
@ -1085,7 +1085,7 @@ namespace {
|
|||
int on_frame_send_callback(nghttp2_session* session,
|
||||
const nghttp2_frame *frame, void *user_data)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(user_data);
|
||||
auto http2session = static_cast<Http2Session*>(user_data);
|
||||
if(frame->hd.type == NGHTTP2_SETTINGS &&
|
||||
(frame->hd.flags & NGHTTP2_FLAG_ACK) == 0) {
|
||||
if(http2session->start_settings_timer() != 0) {
|
||||
|
@ -1101,7 +1101,7 @@ int on_frame_not_send_callback(nghttp2_session *session,
|
|||
const nghttp2_frame *frame,
|
||||
int lib_error_code, void *user_data)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(user_data);
|
||||
auto http2session = static_cast<Http2Session*>(user_data);
|
||||
SSLOG(WARNING, http2session) << "Failed to send control frame type="
|
||||
<< frame->hd.type << ", "
|
||||
<< "lib_error_code=" << lib_error_code << ":"
|
||||
|
@ -1110,7 +1110,7 @@ int on_frame_not_send_callback(nghttp2_session *session,
|
|||
frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
|
||||
// To avoid stream hanging around, flag Downstream::MSG_RESET and
|
||||
// terminate the upstream and downstream connections.
|
||||
auto sd = reinterpret_cast<StreamData*>
|
||||
auto sd = static_cast<StreamData*>
|
||||
(nghttp2_session_get_stream_user_data(session, frame->hd.stream_id));
|
||||
if(!sd) {
|
||||
return 0;
|
||||
|
@ -1138,7 +1138,7 @@ int on_frame_recv_parse_error_callback(nghttp2_session *session,
|
|||
size_t payloadlen, int lib_error_code,
|
||||
void *user_data)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(user_data);
|
||||
auto http2session = static_cast<Http2Session*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
SSLOG(INFO, http2session)
|
||||
<< "Failed to parse received control frame. type="
|
||||
|
@ -1156,7 +1156,7 @@ int on_unknown_frame_recv_callback(nghttp2_session *session,
|
|||
const uint8_t *payload, size_t payloadlen,
|
||||
void *user_data)
|
||||
{
|
||||
auto http2session = reinterpret_cast<Http2Session*>(user_data);
|
||||
auto http2session = static_cast<Http2Session*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
SSLOG(INFO, http2session) << "Received unknown control frame";
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ ssize_t send_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
int rv;
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
auto handler = upstream->get_client_handler();
|
||||
auto bev = handler->get_bev();
|
||||
auto output = bufferevent_get_output(bev);
|
||||
|
@ -78,7 +78,7 @@ int on_stream_close_callback
|
|||
(nghttp2_session *session, int32_t stream_id, nghttp2_error_code error_code,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "Stream stream_id=" << stream_id
|
||||
<< " is being closed";
|
||||
|
@ -156,7 +156,7 @@ int Http2Upstream::upgrade_upstream(HttpsUpstream *http)
|
|||
namespace {
|
||||
void settings_timeout_cb(evutil_socket_t fd, short what, void *arg)
|
||||
{
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(arg);
|
||||
auto upstream = static_cast<Http2Upstream*>(arg);
|
||||
ULOG(INFO, upstream) << "SETTINGS timeout";
|
||||
if(upstream->terminate_session(NGHTTP2_SETTINGS_TIMEOUT) != 0) {
|
||||
delete upstream->get_client_handler();
|
||||
|
@ -209,7 +209,7 @@ int on_header_callback(nghttp2_session *session,
|
|||
frame->headers.cat != NGHTTP2_HCAT_REQUEST) {
|
||||
return 0;
|
||||
}
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
auto downstream = upstream->find_downstream(frame->hd.stream_id);
|
||||
if(!downstream) {
|
||||
return 0;
|
||||
|
@ -236,7 +236,7 @@ int on_end_headers_callback(nghttp2_session *session,
|
|||
return 0;
|
||||
}
|
||||
int rv;
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
auto downstream = upstream->find_downstream(frame->hd.stream_id);
|
||||
if(!downstream) {
|
||||
return 0;
|
||||
|
@ -337,7 +337,7 @@ int on_frame_recv_callback
|
|||
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||
{
|
||||
int rv;
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
switch(frame->hd.type) {
|
||||
case NGHTTP2_HEADERS: {
|
||||
if(frame->headers.cat != NGHTTP2_HCAT_REQUEST) {
|
||||
|
@ -392,7 +392,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session,
|
|||
const uint8_t *data, size_t len,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
auto downstream = upstream->find_downstream(stream_id);
|
||||
if(downstream) {
|
||||
if(downstream->push_upload_data_chunk(data, len) != 0) {
|
||||
|
@ -409,7 +409,7 @@ int on_data_recv_callback(nghttp2_session *session,
|
|||
uint16_t length, uint8_t flags, int32_t stream_id,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
auto downstream = upstream->find_downstream(stream_id);
|
||||
if(downstream && (flags & NGHTTP2_FLAG_END_STREAM)) {
|
||||
downstream->end_upload_data();
|
||||
|
@ -423,7 +423,7 @@ namespace {
|
|||
int on_frame_send_callback(nghttp2_session* session,
|
||||
const nghttp2_frame *frame, void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
if(frame->hd.type == NGHTTP2_SETTINGS &&
|
||||
(frame->hd.flags & NGHTTP2_FLAG_ACK) == 0) {
|
||||
if(upstream->start_settings_timer() != 0) {
|
||||
|
@ -439,7 +439,7 @@ int on_frame_not_send_callback(nghttp2_session *session,
|
|||
const nghttp2_frame *frame,
|
||||
int lib_error_code, void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
ULOG(WARNING, upstream) << "Failed to send control frame type="
|
||||
<< static_cast<uint32_t>(frame->hd.type)
|
||||
<< ", lib_error_code=" << lib_error_code << ":"
|
||||
|
@ -464,7 +464,7 @@ int on_frame_recv_parse_error_callback(nghttp2_session *session,
|
|||
size_t payloadlen, int lib_error_code,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "Failed to parse received control frame. type="
|
||||
<< type
|
||||
|
@ -481,7 +481,7 @@ int on_unknown_frame_recv_callback(nghttp2_session *session,
|
|||
const uint8_t *payload, size_t payloadlen,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(user_data);
|
||||
auto upstream = static_cast<Http2Upstream*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "Received unknown control frame.";
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ ClientHandler* Http2Upstream::get_client_handler() const
|
|||
namespace {
|
||||
void downstream_readcb(bufferevent *bev, void *ptr)
|
||||
{
|
||||
auto dconn = reinterpret_cast<DownstreamConnection*>(ptr);
|
||||
auto dconn = static_cast<DownstreamConnection*>(ptr);
|
||||
auto downstream = dconn->get_downstream();
|
||||
auto upstream = static_cast<Http2Upstream*>(downstream->get_upstream());
|
||||
if(downstream->get_request_state() == Downstream::STREAM_CLOSED) {
|
||||
|
@ -701,7 +701,7 @@ void downstream_writecb(bufferevent *bev, void *ptr)
|
|||
if(evbuffer_get_length(bufferevent_get_output(bev)) > 0) {
|
||||
return;
|
||||
}
|
||||
auto dconn = reinterpret_cast<DownstreamConnection*>(ptr);
|
||||
auto dconn = static_cast<DownstreamConnection*>(ptr);
|
||||
auto downstream = dconn->get_downstream();
|
||||
auto upstream = static_cast<Http2Upstream*>(downstream->get_upstream());
|
||||
upstream->resume_read(SHRPX_NO_BUFFER, downstream);
|
||||
|
@ -711,7 +711,7 @@ void downstream_writecb(bufferevent *bev, void *ptr)
|
|||
namespace {
|
||||
void downstream_eventcb(bufferevent *bev, short events, void *ptr)
|
||||
{
|
||||
auto dconn = reinterpret_cast<DownstreamConnection*>(ptr);
|
||||
auto dconn = static_cast<DownstreamConnection*>(ptr);
|
||||
auto downstream = dconn->get_downstream();
|
||||
auto upstream = static_cast<Http2Upstream*>(downstream->get_upstream());
|
||||
if(events & BEV_EVENT_CONNECTED) {
|
||||
|
@ -879,8 +879,8 @@ ssize_t downstream_data_read_callback(nghttp2_session *session,
|
|||
nghttp2_data_source *source,
|
||||
void *user_data)
|
||||
{
|
||||
auto downstream = reinterpret_cast<Downstream*>(source->ptr);
|
||||
auto upstream = reinterpret_cast<Http2Upstream*>(downstream->get_upstream());
|
||||
auto downstream = static_cast<Downstream*>(source->ptr);
|
||||
auto upstream = static_cast<Http2Upstream*>(downstream->get_upstream());
|
||||
auto handler = upstream->get_client_handler();
|
||||
auto body = downstream->get_response_body_buf();
|
||||
assert(body);
|
||||
|
|
|
@ -305,7 +305,7 @@ namespace {
|
|||
// Gets called when DownstreamConnection is pooled in ClientHandler.
|
||||
void idle_eventcb(bufferevent *bev, short events, void *arg)
|
||||
{
|
||||
auto dconn = reinterpret_cast<HttpDownstreamConnection*>(arg);
|
||||
auto dconn = static_cast<HttpDownstreamConnection*>(arg);
|
||||
if(events & BEV_EVENT_CONNECTED) {
|
||||
// Downstream was detached before connection established?
|
||||
// This may be safe to be left.
|
||||
|
@ -381,7 +381,7 @@ bool HttpDownstreamConnection::get_output_buffer_full()
|
|||
namespace {
|
||||
int htp_hdrs_completecb(http_parser *htp)
|
||||
{
|
||||
auto downstream = reinterpret_cast<Downstream*>(htp->data);
|
||||
auto downstream = static_cast<Downstream*>(htp->data);
|
||||
downstream->set_response_http_status(htp->status_code);
|
||||
downstream->set_response_major(htp->http_major);
|
||||
downstream->set_response_minor(htp->http_minor);
|
||||
|
@ -425,7 +425,7 @@ int htp_hdrs_completecb(http_parser *htp)
|
|||
namespace {
|
||||
int htp_hdr_keycb(http_parser *htp, const char *data, size_t len)
|
||||
{
|
||||
auto downstream = reinterpret_cast<Downstream*>(htp->data);
|
||||
auto downstream = static_cast<Downstream*>(htp->data);
|
||||
if(downstream->get_response_header_key_prev()) {
|
||||
downstream->append_last_response_header_key(data, len);
|
||||
} else {
|
||||
|
@ -438,7 +438,7 @@ int htp_hdr_keycb(http_parser *htp, const char *data, size_t len)
|
|||
namespace {
|
||||
int htp_hdr_valcb(http_parser *htp, const char *data, size_t len)
|
||||
{
|
||||
auto downstream = reinterpret_cast<Downstream*>(htp->data);
|
||||
auto downstream = static_cast<Downstream*>(htp->data);
|
||||
if(downstream->get_response_header_key_prev()) {
|
||||
downstream->set_last_response_header_value(std::string(data, len));
|
||||
} else {
|
||||
|
@ -451,7 +451,7 @@ int htp_hdr_valcb(http_parser *htp, const char *data, size_t len)
|
|||
namespace {
|
||||
int htp_bodycb(http_parser *htp, const char *data, size_t len)
|
||||
{
|
||||
auto downstream = reinterpret_cast<Downstream*>(htp->data);
|
||||
auto downstream = static_cast<Downstream*>(htp->data);
|
||||
return downstream->get_upstream()->on_downstream_body
|
||||
(downstream, reinterpret_cast<const uint8_t*>(data), len);
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ int htp_bodycb(http_parser *htp, const char *data, size_t len)
|
|||
namespace {
|
||||
int htp_msg_completecb(http_parser *htp)
|
||||
{
|
||||
auto downstream = reinterpret_cast<Downstream*>(htp->data);
|
||||
auto downstream = static_cast<Downstream*>(htp->data);
|
||||
downstream->set_response_state(Downstream::MSG_COMPLETE);
|
||||
// Block reading another response message from (broken?)
|
||||
// server. This callback is not called if the connection is
|
||||
|
|
|
@ -71,7 +71,7 @@ void HttpsUpstream::reset_current_header_length()
|
|||
namespace {
|
||||
int htp_msg_begin(http_parser *htp)
|
||||
{
|
||||
auto upstream = reinterpret_cast<HttpsUpstream*>(htp->data);
|
||||
auto upstream = static_cast<HttpsUpstream*>(htp->data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "HTTP request started";
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ int htp_msg_begin(http_parser *htp)
|
|||
namespace {
|
||||
int htp_uricb(http_parser *htp, const char *data, size_t len)
|
||||
{
|
||||
auto upstream = reinterpret_cast<HttpsUpstream*>(htp->data);
|
||||
auto upstream = static_cast<HttpsUpstream*>(htp->data);
|
||||
auto downstream = upstream->get_downstream();
|
||||
downstream->append_request_path(data, len);
|
||||
return 0;
|
||||
|
@ -95,7 +95,7 @@ int htp_uricb(http_parser *htp, const char *data, size_t len)
|
|||
namespace {
|
||||
int htp_hdr_keycb(http_parser *htp, const char *data, size_t len)
|
||||
{
|
||||
auto upstream = reinterpret_cast<HttpsUpstream*>(htp->data);
|
||||
auto upstream = static_cast<HttpsUpstream*>(htp->data);
|
||||
auto downstream = upstream->get_downstream();
|
||||
if(downstream->get_request_header_key_prev()) {
|
||||
downstream->append_last_request_header_key(data, len);
|
||||
|
@ -109,7 +109,7 @@ int htp_hdr_keycb(http_parser *htp, const char *data, size_t len)
|
|||
namespace {
|
||||
int htp_hdr_valcb(http_parser *htp, const char *data, size_t len)
|
||||
{
|
||||
auto upstream = reinterpret_cast<HttpsUpstream*>(htp->data);
|
||||
auto upstream = static_cast<HttpsUpstream*>(htp->data);
|
||||
auto downstream = upstream->get_downstream();
|
||||
if(downstream->get_request_header_key_prev()) {
|
||||
downstream->set_last_request_header_value(std::string(data, len));
|
||||
|
@ -124,7 +124,7 @@ namespace {
|
|||
int htp_hdrs_completecb(http_parser *htp)
|
||||
{
|
||||
int rv;
|
||||
auto upstream = reinterpret_cast<HttpsUpstream*>(htp->data);
|
||||
auto upstream = static_cast<HttpsUpstream*>(htp->data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "HTTP request headers completed";
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ namespace {
|
|||
int htp_bodycb(http_parser *htp, const char *data, size_t len)
|
||||
{
|
||||
int rv;
|
||||
auto upstream = reinterpret_cast<HttpsUpstream*>(htp->data);
|
||||
auto upstream = static_cast<HttpsUpstream*>(htp->data);
|
||||
auto downstream = upstream->get_downstream();
|
||||
rv = downstream->push_upload_data_chunk
|
||||
(reinterpret_cast<const uint8_t*>(data), len);
|
||||
|
@ -214,7 +214,7 @@ namespace {
|
|||
int htp_msg_completecb(http_parser *htp)
|
||||
{
|
||||
int rv;
|
||||
auto upstream = reinterpret_cast<HttpsUpstream*>(htp->data);
|
||||
auto upstream = static_cast<HttpsUpstream*>(htp->data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "HTTP request completed";
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ int HttpsUpstream::resume_read(IOCtrlReason reason, Downstream *downstream)
|
|||
namespace {
|
||||
void https_downstream_readcb(bufferevent *bev, void *ptr)
|
||||
{
|
||||
auto dconn = reinterpret_cast<DownstreamConnection*>(ptr);
|
||||
auto dconn = static_cast<DownstreamConnection*>(ptr);
|
||||
auto downstream = dconn->get_downstream();
|
||||
auto upstream = static_cast<HttpsUpstream*>(downstream->get_upstream());
|
||||
int rv;
|
||||
|
@ -481,7 +481,7 @@ void https_downstream_writecb(bufferevent *bev, void *ptr)
|
|||
if(evbuffer_get_length(bufferevent_get_output(bev)) > 0) {
|
||||
return;
|
||||
}
|
||||
auto dconn = reinterpret_cast<DownstreamConnection*>(ptr);
|
||||
auto dconn = static_cast<DownstreamConnection*>(ptr);
|
||||
auto downstream = dconn->get_downstream();
|
||||
auto upstream = static_cast<HttpsUpstream*>(downstream->get_upstream());
|
||||
// May return -1
|
||||
|
@ -492,7 +492,7 @@ void https_downstream_writecb(bufferevent *bev, void *ptr)
|
|||
namespace {
|
||||
void https_downstream_eventcb(bufferevent *bev, short events, void *ptr)
|
||||
{
|
||||
auto dconn = reinterpret_cast<DownstreamConnection*>(ptr);
|
||||
auto dconn = static_cast<DownstreamConnection*>(ptr);
|
||||
auto downstream = dconn->get_downstream();
|
||||
auto upstream = static_cast<HttpsUpstream*>(downstream->get_upstream());
|
||||
if(events & BEV_EVENT_CONNECTED) {
|
||||
|
|
|
@ -54,7 +54,7 @@ ssize_t send_callback(spdylay_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
int rv;
|
||||
auto upstream = reinterpret_cast<SpdyUpstream*>(user_data);
|
||||
auto upstream = static_cast<SpdyUpstream*>(user_data);
|
||||
auto handler = upstream->get_client_handler();
|
||||
auto bev = handler->get_bev();
|
||||
auto output = bufferevent_get_output(bev);
|
||||
|
@ -77,7 +77,7 @@ namespace {
|
|||
ssize_t recv_callback(spdylay_session *session,
|
||||
uint8_t *data, size_t len, int flags, void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<SpdyUpstream*>(user_data);
|
||||
auto upstream = static_cast<SpdyUpstream*>(user_data);
|
||||
auto handler = upstream->get_client_handler();
|
||||
auto bev = handler->get_bev();
|
||||
auto input = bufferevent_get_input(bev);
|
||||
|
@ -97,7 +97,7 @@ void on_stream_close_callback
|
|||
(spdylay_session *session, int32_t stream_id, spdylay_status_code status_code,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<SpdyUpstream*>(user_data);
|
||||
auto upstream = static_cast<SpdyUpstream*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "Stream stream_id=" << stream_id
|
||||
<< " is being closed";
|
||||
|
@ -142,7 +142,7 @@ void on_ctrl_recv_callback
|
|||
(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<SpdyUpstream*>(user_data);
|
||||
auto upstream = static_cast<SpdyUpstream*>(user_data);
|
||||
switch(type) {
|
||||
case SPDYLAY_SYN_STREAM: {
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
|
@ -243,7 +243,7 @@ void on_data_chunk_recv_callback(spdylay_session *session,
|
|||
const uint8_t *data, size_t len,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<SpdyUpstream*>(user_data);
|
||||
auto upstream = static_cast<SpdyUpstream*>(user_data);
|
||||
auto downstream = upstream->find_downstream(stream_id);
|
||||
if(downstream) {
|
||||
if(downstream->push_upload_data_chunk(data, len) != 0) {
|
||||
|
@ -290,7 +290,7 @@ namespace {
|
|||
void on_data_recv_callback(spdylay_session *session, uint8_t flags,
|
||||
int32_t stream_id, int32_t length, void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<SpdyUpstream*>(user_data);
|
||||
auto upstream = static_cast<SpdyUpstream*>(user_data);
|
||||
auto downstream = upstream->find_downstream(stream_id);
|
||||
if(downstream && (flags & SPDYLAY_DATA_FLAG_FIN)) {
|
||||
downstream->end_upload_data();
|
||||
|
@ -305,7 +305,7 @@ void on_ctrl_not_send_callback(spdylay_session *session,
|
|||
spdylay_frame *frame,
|
||||
int error_code, void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<SpdyUpstream*>(user_data);
|
||||
auto upstream = static_cast<SpdyUpstream*>(user_data);
|
||||
ULOG(WARNING, upstream) << "Failed to send control frame type=" << type
|
||||
<< ", error_code=" << error_code << ":"
|
||||
<< spdylay_strerror(error_code);
|
||||
|
@ -328,7 +328,7 @@ void on_ctrl_recv_parse_error_callback(spdylay_session *session,
|
|||
size_t payloadlen, int error_code,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<SpdyUpstream*>(user_data);
|
||||
auto upstream = static_cast<SpdyUpstream*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "Failed to parse received control frame. type="
|
||||
<< type
|
||||
|
@ -344,7 +344,7 @@ void on_unknown_ctrl_recv_callback(spdylay_session *session,
|
|||
const uint8_t *payload, size_t payloadlen,
|
||||
void *user_data)
|
||||
{
|
||||
auto upstream = reinterpret_cast<SpdyUpstream*>(user_data);
|
||||
auto upstream = static_cast<SpdyUpstream*>(user_data);
|
||||
if(LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "Received unknown control frame.";
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ ClientHandler* SpdyUpstream::get_client_handler() const
|
|||
namespace {
|
||||
void spdy_downstream_readcb(bufferevent *bev, void *ptr)
|
||||
{
|
||||
auto dconn = reinterpret_cast<DownstreamConnection*>(ptr);
|
||||
auto dconn = static_cast<DownstreamConnection*>(ptr);
|
||||
auto downstream = dconn->get_downstream();
|
||||
auto upstream = static_cast<SpdyUpstream*>(downstream->get_upstream());
|
||||
if(downstream->get_request_state() == Downstream::STREAM_CLOSED) {
|
||||
|
@ -559,7 +559,7 @@ void spdy_downstream_writecb(bufferevent *bev, void *ptr)
|
|||
if(evbuffer_get_length(bufferevent_get_output(bev)) > 0) {
|
||||
return;
|
||||
}
|
||||
auto dconn = reinterpret_cast<DownstreamConnection*>(ptr);
|
||||
auto dconn = static_cast<DownstreamConnection*>(ptr);
|
||||
auto downstream = dconn->get_downstream();
|
||||
auto upstream = static_cast<SpdyUpstream*>(downstream->get_upstream());
|
||||
upstream->resume_read(SHRPX_NO_BUFFER, downstream);
|
||||
|
@ -569,7 +569,7 @@ void spdy_downstream_writecb(bufferevent *bev, void *ptr)
|
|||
namespace {
|
||||
void spdy_downstream_eventcb(bufferevent *bev, short events, void *ptr)
|
||||
{
|
||||
auto dconn = reinterpret_cast<DownstreamConnection*>(ptr);
|
||||
auto dconn = static_cast<DownstreamConnection*>(ptr);
|
||||
auto downstream = dconn->get_downstream();
|
||||
auto upstream = static_cast<SpdyUpstream*>(downstream->get_upstream());
|
||||
if(events & BEV_EVENT_CONNECTED) {
|
||||
|
@ -723,8 +723,8 @@ ssize_t spdy_data_read_callback(spdylay_session *session,
|
|||
spdylay_data_source *source,
|
||||
void *user_data)
|
||||
{
|
||||
auto downstream = reinterpret_cast<Downstream*>(source->ptr);
|
||||
auto upstream = reinterpret_cast<SpdyUpstream*>(downstream->get_upstream());
|
||||
auto downstream = static_cast<Downstream*>(source->ptr);
|
||||
auto upstream = static_cast<SpdyUpstream*>(downstream->get_upstream());
|
||||
auto handler = upstream->get_client_handler();
|
||||
auto body = downstream->get_response_body_buf();
|
||||
assert(body);
|
||||
|
|
|
@ -62,8 +62,7 @@ namespace {
|
|||
int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len,
|
||||
void *arg)
|
||||
{
|
||||
auto next_proto =
|
||||
reinterpret_cast<std::pair<unsigned char*, size_t>*>(arg);
|
||||
auto next_proto = static_cast<std::pair<unsigned char*, size_t>*>(arg);
|
||||
*data = next_proto->first;
|
||||
*len = next_proto->second;
|
||||
return SSL_TLSEXT_ERR_OK;
|
||||
|
@ -103,7 +102,7 @@ size_t set_npn_prefs(unsigned char *out, char **protos, size_t len)
|
|||
namespace {
|
||||
int ssl_pem_passwd_cb(char *buf, int size, int rwflag, void *user_data)
|
||||
{
|
||||
auto config = reinterpret_cast<Config*>(user_data);
|
||||
auto config = static_cast<Config*>(user_data);
|
||||
int len = (int)strlen(config->private_key_passwd);
|
||||
if (size < len + 1) {
|
||||
LOG(ERROR) << "ssl_pem_passwd_cb: buf is too small " << size;
|
||||
|
@ -579,8 +578,8 @@ void get_altnames(X509 *cert,
|
|||
std::vector<std::string>& ip_addrs,
|
||||
std::string& common_name)
|
||||
{
|
||||
GENERAL_NAMES* altnames;
|
||||
altnames = reinterpret_cast<GENERAL_NAMES*>
|
||||
GENERAL_NAMES *altnames =
|
||||
static_cast<GENERAL_NAMES*>
|
||||
(X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr));
|
||||
if(altnames) {
|
||||
util::auto_delete<GENERAL_NAMES*> altnames_deleter(altnames,
|
||||
|
|
|
@ -57,7 +57,7 @@ Worker::~Worker()
|
|||
namespace {
|
||||
void readcb(bufferevent *bev, void *arg)
|
||||
{
|
||||
auto receiver = reinterpret_cast<ThreadEventReceiver*>(arg);
|
||||
auto receiver = static_cast<ThreadEventReceiver*>(arg);
|
||||
receiver->on_read(bev);
|
||||
}
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in New Issue