Code cleanup
This commit is contained in:
parent
49b8d1d88c
commit
7d282cd0bd
|
@ -999,7 +999,7 @@ static int deflate_nv(nghttp2_hd_deflater *deflater,
|
|||
{
|
||||
int rv;
|
||||
search_result res;
|
||||
ssize_t idx = -1;
|
||||
ssize_t idx;
|
||||
int incidx = 0;
|
||||
uint32_t name_hash = hash(nv->name, nv->namelen);
|
||||
uint32_t value_hash = hash(nv->value, nv->valuelen);
|
||||
|
|
|
@ -1511,7 +1511,7 @@ static int session_headers_add_pad(nghttp2_session *session,
|
|||
padlen = padded_payloadlen - frame->hd.length;
|
||||
|
||||
DEBUGF(fprintf(stderr,
|
||||
"send: padding selected: payloadlen=%zu, padlen=%zu\n",
|
||||
"send: padding selected: payloadlen=%zd, padlen=%zu\n",
|
||||
padded_payloadlen, padlen));
|
||||
|
||||
rv = nghttp2_frame_add_pad(framebufs, &frame->hd, padlen);
|
||||
|
@ -1784,9 +1784,9 @@ static int session_prep_frame(nghttp2_session *session,
|
|||
|
||||
rv = nghttp2_session_predicate_data_send(session, frame->hd.stream_id);
|
||||
if(rv != 0) {
|
||||
int rv2;
|
||||
|
||||
if(stream) {
|
||||
int rv2;
|
||||
|
||||
rv2 = nghttp2_stream_detach_data(stream, &session->ob_da_pq,
|
||||
session->last_cycle);
|
||||
|
||||
|
@ -5389,7 +5389,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
|
|||
}
|
||||
}
|
||||
|
||||
DEBUGF(fprintf(stderr, "recv: data_readlen=%zu\n", data_readlen));
|
||||
DEBUGF(fprintf(stderr, "recv: data_readlen=%zd\n", data_readlen));
|
||||
|
||||
if(stream && data_readlen > 0 &&
|
||||
session->callbacks.on_data_chunk_recv_callback) {
|
||||
|
@ -5815,7 +5815,7 @@ int nghttp2_session_pack_data(nghttp2_session *session,
|
|||
use safe limit. */
|
||||
payloadlen = datamax;
|
||||
|
||||
DEBUGF(fprintf(stderr, "send: use safe limit payloadlen=%zu",
|
||||
DEBUGF(fprintf(stderr, "send: use safe limit payloadlen=%zd",
|
||||
payloadlen));
|
||||
} else {
|
||||
assert(&session->aob.framebufs == bufs);
|
||||
|
|
|
@ -674,7 +674,6 @@ int Http2Handler::submit_non_final_response(const std::string& status,
|
|||
int Http2Handler::submit_push_promise(Stream *stream,
|
||||
const std::string& push_path)
|
||||
{
|
||||
std::string authority;
|
||||
auto itr = std::lower_bound(std::begin(stream->headers),
|
||||
std::end(stream->headers),
|
||||
Header(":authority", ""));
|
||||
|
|
|
@ -79,7 +79,7 @@ static void to_hex(char *dest, const uint8_t *src, size_t len)
|
|||
|
||||
static void output_to_json(nghttp2_hd_deflater *deflater,
|
||||
nghttp2_bufs *bufs, size_t inputlen,
|
||||
const std::vector<nghttp2_nv> nva,
|
||||
const std::vector<nghttp2_nv>& nva,
|
||||
int seq)
|
||||
{
|
||||
auto len = nghttp2_bufs_len(bufs);
|
||||
|
|
|
@ -1122,8 +1122,8 @@ int on_data_chunk_recv_callback
|
|||
const uint8_t *data, size_t len, void *user_data)
|
||||
{
|
||||
auto client = get_session(user_data);
|
||||
auto req =
|
||||
(Request*)nghttp2_session_get_stream_user_data(session, stream_id);
|
||||
auto req = static_cast<Request*>
|
||||
(nghttp2_session_get_stream_user_data(session, stream_id));
|
||||
|
||||
if(!req) {
|
||||
return 0;
|
||||
|
@ -1301,8 +1301,8 @@ int on_header_callback(nghttp2_session *session,
|
|||
|
||||
switch(frame->hd.type) {
|
||||
case NGHTTP2_HEADERS: {
|
||||
auto req = (Request*)nghttp2_session_get_stream_user_data
|
||||
(session, frame->hd.stream_id);
|
||||
auto req = static_cast<Request*>
|
||||
(nghttp2_session_get_stream_user_data(session, frame->hd.stream_id));
|
||||
|
||||
if(!req) {
|
||||
break;
|
||||
|
@ -1330,8 +1330,9 @@ int on_header_callback(nghttp2_session *session,
|
|||
break;
|
||||
}
|
||||
case NGHTTP2_PUSH_PROMISE: {
|
||||
auto req = (Request*)nghttp2_session_get_stream_user_data
|
||||
(session, frame->push_promise.promised_stream_id);
|
||||
auto req = static_cast<Request*>
|
||||
(nghttp2_session_get_stream_user_data
|
||||
(session, frame->push_promise.promised_stream_id));
|
||||
|
||||
if(!req) {
|
||||
break;
|
||||
|
@ -1369,8 +1370,8 @@ int on_frame_recv_callback2
|
|||
auto client = get_session(user_data);
|
||||
switch(frame->hd.type) {
|
||||
case NGHTTP2_HEADERS: {
|
||||
auto req = (Request*)nghttp2_session_get_stream_user_data
|
||||
(session, frame->hd.stream_id);
|
||||
auto req = static_cast<Request*>
|
||||
(nghttp2_session_get_stream_user_data(session, frame->hd.stream_id));
|
||||
// If this is the HTTP Upgrade with OPTIONS method to avoid POST,
|
||||
// req is nullptr.
|
||||
if(!req) {
|
||||
|
@ -1414,8 +1415,9 @@ int on_frame_recv_callback2
|
|||
}
|
||||
break;
|
||||
case NGHTTP2_PUSH_PROMISE: {
|
||||
auto req = (Request*)nghttp2_session_get_stream_user_data
|
||||
(session, frame->push_promise.promised_stream_id);
|
||||
auto req = static_cast<Request*>
|
||||
(nghttp2_session_get_stream_user_data
|
||||
(session, frame->push_promise.promised_stream_id));
|
||||
if(!req) {
|
||||
break;
|
||||
}
|
||||
|
@ -1472,8 +1474,8 @@ int on_stream_close_callback
|
|||
void *user_data)
|
||||
{
|
||||
auto client = get_session(user_data);
|
||||
auto req =
|
||||
(Request*)nghttp2_session_get_stream_user_data(session, stream_id);
|
||||
auto req = static_cast<Request*>
|
||||
(nghttp2_session_get_stream_user_data(session, stream_id));
|
||||
|
||||
if(!req) {
|
||||
return 0;
|
||||
|
@ -1798,8 +1800,8 @@ ssize_t file_read_callback
|
|||
uint8_t *buf, size_t length, uint32_t *data_flags,
|
||||
nghttp2_data_source *source, void *user_data)
|
||||
{
|
||||
auto req = (Request*)nghttp2_session_get_stream_user_data
|
||||
(session, stream_id);
|
||||
auto req = static_cast<Request*>
|
||||
(nghttp2_session_get_stream_user_data(session, stream_id));
|
||||
assert(req);
|
||||
int fd = source->fd;
|
||||
ssize_t nread;
|
||||
|
|
Loading…
Reference in New Issue