Add flags parameter to nghttp2_on_header_callback
This commit is contained in:
parent
e5b0303481
commit
c9f90924a9
|
@ -216,6 +216,7 @@ static int on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
http2_session_data *session_data = (http2_session_data*)user_data;
|
http2_session_data *session_data = (http2_session_data*)user_data;
|
||||||
|
|
|
@ -400,6 +400,7 @@ static int on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
http2_stream_data *stream_data;
|
http2_stream_data *stream_data;
|
||||||
|
|
|
@ -1338,12 +1338,15 @@ typedef int (*nghttp2_on_begin_headers_callback)
|
||||||
* @functypedef
|
* @functypedef
|
||||||
*
|
*
|
||||||
* Callback function invoked when a header name/value pair is received
|
* Callback function invoked when a header name/value pair is received
|
||||||
* for the |frame|. When this callback is invoked, ``frame->hd.type``
|
* for the |frame|. The |name| of length |namelen| is header name.
|
||||||
* is either :enum:`NGHTTP2_HEADERS` or :enum:`NGHTTP2_PUSH_PROMISE`.
|
* The |value| of length |valuelen| is header value. The |flags| is
|
||||||
* After all header name/value pairs are processed with this callback,
|
* bitwise OR of one or more of :type:`nghttp2_nv_flag`.
|
||||||
* and no error has been detected,
|
*
|
||||||
* :type:`nghttp2_on_frame_recv_callback` will be invoked. If there
|
* When this callback is invoked, ``frame->hd.type`` is either
|
||||||
* is an error in decompression,
|
* :enum:`NGHTTP2_HEADERS` or :enum:`NGHTTP2_PUSH_PROMISE`. After all
|
||||||
|
* header name/value pairs are processed with this callback, and no
|
||||||
|
* error has been detected, :type:`nghttp2_on_frame_recv_callback`
|
||||||
|
* will be invoked. If there is an error in decompression,
|
||||||
* :type:`nghttp2_on_frame_recv_callback` for the |frame| will not be
|
* :type:`nghttp2_on_frame_recv_callback` for the |frame| will not be
|
||||||
* invoked.
|
* invoked.
|
||||||
*
|
*
|
||||||
|
@ -1393,6 +1396,7 @@ typedef int (*nghttp2_on_header_callback)
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2420,6 +2420,7 @@ static int session_call_on_header(nghttp2_session *session,
|
||||||
rv = session->callbacks.on_header_callback(session, frame,
|
rv = session->callbacks.on_header_callback(session, frame,
|
||||||
nv->name, nv->namelen,
|
nv->name, nv->namelen,
|
||||||
nv->value, nv->valuelen,
|
nv->value, nv->valuelen,
|
||||||
|
nv->flags,
|
||||||
session->user_data);
|
session->user_data);
|
||||||
if(rv == NGHTTP2_ERR_PAUSE ||
|
if(rv == NGHTTP2_ERR_PAUSE ||
|
||||||
rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) {
|
rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) {
|
||||||
|
|
|
@ -1094,13 +1094,14 @@ int on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
auto hd = static_cast<Http2Handler*>(user_data);
|
auto hd = static_cast<Http2Handler*>(user_data);
|
||||||
if(hd->get_config()->verbose) {
|
if(hd->get_config()->verbose) {
|
||||||
print_session_id(hd->session_id());
|
print_session_id(hd->session_id());
|
||||||
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
|
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
|
||||||
user_data);
|
flags, user_data);
|
||||||
}
|
}
|
||||||
if(frame->hd.type != NGHTTP2_HEADERS ||
|
if(frame->hd.type != NGHTTP2_HEADERS ||
|
||||||
frame->headers.cat != NGHTTP2_HCAT_REQUEST) {
|
frame->headers.cat != NGHTTP2_HCAT_REQUEST) {
|
||||||
|
|
|
@ -469,6 +469,7 @@ int verbose_on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
nghttp2_nv nv = {
|
nghttp2_nv nv = {
|
||||||
|
@ -476,7 +477,8 @@ int verbose_on_header_callback(nghttp2_session *session,
|
||||||
static_cast<uint16_t>(namelen), static_cast<uint16_t>(valuelen)
|
static_cast<uint16_t>(namelen), static_cast<uint16_t>(valuelen)
|
||||||
};
|
};
|
||||||
print_timer();
|
print_timer();
|
||||||
fprintf(outfile, " (stream_id=%d) ", frame->hd.stream_id);
|
fprintf(outfile, " (stream_id=%d, noind=%d) ", frame->hd.stream_id,
|
||||||
|
(flags & NGHTTP2_NV_FLAG_NO_INDEX) != 0);
|
||||||
print_nv(&nv, 1, false /* no indent */);
|
print_nv(&nv, 1, false /* no indent */);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ int verbose_on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
int verbose_on_frame_recv_callback
|
int verbose_on_frame_recv_callback
|
||||||
|
|
|
@ -59,6 +59,7 @@ int on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
auto client = static_cast<Client*>(user_data);
|
auto client = static_cast<Client*>(user_data);
|
||||||
|
|
|
@ -1210,11 +1210,12 @@ int on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
if(config.verbose) {
|
if(config.verbose) {
|
||||||
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
|
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
|
||||||
user_data);
|
flags, user_data);
|
||||||
}
|
}
|
||||||
switch(frame->hd.type) {
|
switch(frame->hd.type) {
|
||||||
case NGHTTP2_HEADERS: {
|
case NGHTTP2_HEADERS: {
|
||||||
|
|
|
@ -788,6 +788,7 @@ int on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
if(frame->hd.type != NGHTTP2_HEADERS ||
|
if(frame->hd.type != NGHTTP2_HEADERS ||
|
||||||
|
|
|
@ -179,11 +179,12 @@ int on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
if(get_config()->upstream_frame_debug) {
|
if(get_config()->upstream_frame_debug) {
|
||||||
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
|
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
|
||||||
user_data);
|
flags, user_data);
|
||||||
}
|
}
|
||||||
if(frame->hd.type != NGHTTP2_HEADERS ||
|
if(frame->hd.type != NGHTTP2_HEADERS ||
|
||||||
frame->headers.cat != NGHTTP2_HCAT_REQUEST) {
|
frame->headers.cat != NGHTTP2_HCAT_REQUEST) {
|
||||||
|
|
|
@ -295,6 +295,7 @@ static int on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -312,9 +313,10 @@ static int pause_on_header_callback(nghttp2_session *session,
|
||||||
const nghttp2_frame *frame,
|
const nghttp2_frame *frame,
|
||||||
const uint8_t *name, size_t namelen,
|
const uint8_t *name, size_t namelen,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
|
uint8_t flags,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
on_header_callback(session, frame, name, namelen, value, valuelen,
|
on_header_callback(session, frame, name, namelen, value, valuelen, flags,
|
||||||
user_data);
|
user_data);
|
||||||
return NGHTTP2_ERR_PAUSE;
|
return NGHTTP2_ERR_PAUSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue