Commit 53ee21ca authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Remove nghttp2_on_unknown_frame_recv_callback

It is not used by library for a while.  It could be used to pass
unsupported extension frames to application, but its interface
requires library to buffer entire frame, which we'd like to avoid.
For unsupported extension frames, we will add new callbacks which does
not require buffering if they are required.
parent 31528b62
......@@ -1321,33 +1321,6 @@ typedef int (*nghttp2_on_stream_close_callback)
(nghttp2_session *session, int32_t stream_id, uint32_t error_code,
void *user_data);
/**
* @functypedef
*
* Callback function invoked when the received frame type is unknown.
* The |head| is the pointer to the header of the received frame. The
* |headlen| is the length of the |head|. According to the spec, the
* |headlen| is always 8. In other words, the |head| is the first 8
* bytes of the received frame. The |payload| is the pointer to the
* data portion of the received frame. The |payloadlen| is the length
* of the |payload|. This is the data after the length field. The
* |user_data| pointer is the third argument passed in to the call to
* `nghttp2_session_client_new()` or `nghttp2_session_server_new()`.
*
* The implementation of this function must return 0 if it succeeds.
* If nonzero is returned, it is treated as fatal error and
* `nghttp2_session_recv()` and `nghttp2_session_send()` functions
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
*
* To set this callback to :type:`nghttp2_session_callbacks`, use
* `nghttp2_session_callbacks_set_on_unknown_frame_recv_callback()`.
*/
typedef int (*nghttp2_on_unknown_frame_recv_callback)
(nghttp2_session *session,
const uint8_t *head, size_t headlen,
const uint8_t *payload, size_t payloadlen,
void *user_data);
/**
* @functypedef
*
......@@ -1594,16 +1567,6 @@ void nghttp2_session_callbacks_set_on_stream_close_callback
(nghttp2_session_callbacks *cbs,
nghttp2_on_stream_close_callback on_stream_close_callback);
/**
* @function
*
* Sets callback function invoked when the received frame type is
* unknown.
*/
void nghttp2_session_callbacks_set_on_unknown_frame_recv_callback
(nghttp2_session_callbacks *cbs,
nghttp2_on_unknown_frame_recv_callback on_unknown_frame_recv_callback);
/**
* @function
*
......
......@@ -103,13 +103,6 @@ void nghttp2_session_callbacks_set_on_stream_close_callback
cbs->on_stream_close_callback = on_stream_close_callback;
}
void nghttp2_session_callbacks_set_on_unknown_frame_recv_callback
(nghttp2_session_callbacks *cbs,
nghttp2_on_unknown_frame_recv_callback on_unknown_frame_recv_callback)
{
cbs->on_unknown_frame_recv_callback = on_unknown_frame_recv_callback;
}
void nghttp2_session_callbacks_set_on_begin_headers_callback
(nghttp2_session_callbacks *cbs,
nghttp2_on_begin_headers_callback on_begin_headers_callback)
......
......@@ -81,11 +81,6 @@ struct nghttp2_session_callbacks {
* Callback function invoked when the stream is closed.
*/
nghttp2_on_stream_close_callback on_stream_close_callback;
/**
* Callback function invoked when the received frame type is
* unknown.
*/
nghttp2_on_unknown_frame_recv_callback on_unknown_frame_recv_callback;
/**
* Callback function invoked when the reception of header block in
* HEADERS or PUSH_PROMISE is started.
......
......@@ -1459,9 +1459,6 @@ void fill_callback(nghttp2_session_callbacks *callbacks, const Config *config)
if(config->verbose) {
nghttp2_session_callbacks_set_on_invalid_frame_recv_callback
(callbacks, verbose_on_invalid_frame_recv_callback);
nghttp2_session_callbacks_set_on_unknown_frame_recv_callback
(callbacks, verbose_on_unknown_frame_recv_callback);
}
nghttp2_session_callbacks_set_on_data_chunk_recv_callback
......
......@@ -473,33 +473,6 @@ int verbose_on_invalid_frame_recv_callback
return 0;
}
namespace {
void dump_header(const uint8_t *head, size_t headlen)
{
size_t i;
print_frame_attr_indent();
fprintf(outfile, "Header dump: ");
for(i = 0; i < headlen; ++i) {
fprintf(outfile, "%02X ", head[i]);
}
fprintf(outfile, "\n");
}
} // namespace
int verbose_on_unknown_frame_recv_callback(nghttp2_session *session,
const uint8_t *head,
size_t headlen,
const uint8_t *payload,
size_t payloadlen,
void *user_data)
{
print_timer();
fprintf(outfile, " recv unknown frame\n");
dump_header(head, headlen);
fflush(outfile);
return 0;
}
int verbose_on_frame_send_callback
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
{
......
......@@ -53,13 +53,6 @@ int verbose_on_invalid_frame_recv_callback
(nghttp2_session *session, const nghttp2_frame *frame,
uint32_t error_code, void *user_data);
int verbose_on_unknown_frame_recv_callback(nghttp2_session *session,
const uint8_t *head,
size_t headlen,
const uint8_t *payload,
size_t payloadlen,
void *user_data);
int verbose_on_frame_send_callback
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data);
......
......@@ -1847,9 +1847,6 @@ int run(char **uris, int n)
nghttp2_session_callbacks_set_on_invalid_frame_recv_callback
(callbacks, verbose_on_invalid_frame_recv_callback);
nghttp2_session_callbacks_set_on_unknown_frame_recv_callback
(callbacks, verbose_on_unknown_frame_recv_callback);
}
nghttp2_session_callbacks_set_on_data_chunk_recv_callback
......
......@@ -1345,20 +1345,6 @@ int on_frame_not_send_callback(nghttp2_session *session,
}
} // namespace
namespace {
int on_unknown_frame_recv_callback(nghttp2_session *session,
const uint8_t *head, size_t headlen,
const uint8_t *payload, size_t payloadlen,
void *user_data)
{
auto http2session = static_cast<Http2Session*>(user_data);
if(LOG_ENABLED(INFO)) {
SSLOG(INFO, http2session) << "Received unknown control frame";
}
return 0;
}
} // namespace
int Http2Session::on_connect()
{
int rv;
......@@ -1414,9 +1400,6 @@ int Http2Session::on_connect()
nghttp2_session_callbacks_set_on_frame_not_send_callback
(callbacks, on_frame_not_send_callback);
nghttp2_session_callbacks_set_on_unknown_frame_recv_callback
(callbacks, on_unknown_frame_recv_callback);
nghttp2_session_callbacks_set_on_header_callback
(callbacks, on_header_callback);
......
......@@ -607,20 +607,6 @@ int on_frame_not_send_callback(nghttp2_session *session,
}
} // namespace
namespace {
int on_unknown_frame_recv_callback(nghttp2_session *session,
const uint8_t *head, size_t headlen,
const uint8_t *payload, size_t payloadlen,
void *user_data)
{
auto upstream = static_cast<Http2Upstream*>(user_data);
if(LOG_ENABLED(INFO)) {
ULOG(INFO, upstream) << "Received unknown control frame.";
}
return 0;
}
} // namespace
namespace {
uint32_t infer_upstream_rst_stream_error_code(uint32_t downstream_error_code)
{
......@@ -669,9 +655,6 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
nghttp2_session_callbacks_set_on_frame_not_send_callback
(callbacks, on_frame_not_send_callback);
nghttp2_session_callbacks_set_on_unknown_frame_recv_callback
(callbacks, on_unknown_frame_recv_callback);
nghttp2_session_callbacks_set_on_header_callback
(callbacks, on_header_callback);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment