Add flags parameter to nghttp2_on_header_callback

This commit is contained in:
Tatsuhiro Tsujikawa 2014-04-02 02:10:35 +09:00
parent e5b0303481
commit c9f90924a9
12 changed files with 28 additions and 11 deletions

View File

@ -216,6 +216,7 @@ static int on_header_callback(nghttp2_session *session,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data)
{
http2_session_data *session_data = (http2_session_data*)user_data;

View File

@ -400,6 +400,7 @@ static int on_header_callback(nghttp2_session *session,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data)
{
http2_stream_data *stream_data;

View File

@ -1338,12 +1338,15 @@ typedef int (*nghttp2_on_begin_headers_callback)
* @functypedef
*
* Callback function invoked when a header name/value pair is received
* for the |frame|. When this callback is invoked, ``frame->hd.type``
* is either :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,
* for the |frame|. The |name| of length |namelen| is header name.
* The |value| of length |valuelen| is header value. The |flags| is
* bitwise OR of one or more of :type:`nghttp2_nv_flag`.
*
* When this callback is invoked, ``frame->hd.type`` is either
* :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
* invoked.
*
@ -1393,6 +1396,7 @@ typedef int (*nghttp2_on_header_callback)
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data);
/**

View File

@ -2420,6 +2420,7 @@ static int session_call_on_header(nghttp2_session *session,
rv = session->callbacks.on_header_callback(session, frame,
nv->name, nv->namelen,
nv->value, nv->valuelen,
nv->flags,
session->user_data);
if(rv == NGHTTP2_ERR_PAUSE ||
rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) {

View File

@ -1094,13 +1094,14 @@ int on_header_callback(nghttp2_session *session,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data)
{
auto hd = static_cast<Http2Handler*>(user_data);
if(hd->get_config()->verbose) {
print_session_id(hd->session_id());
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
user_data);
flags, user_data);
}
if(frame->hd.type != NGHTTP2_HEADERS ||
frame->headers.cat != NGHTTP2_HCAT_REQUEST) {

View File

@ -469,6 +469,7 @@ int verbose_on_header_callback(nghttp2_session *session,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data)
{
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)
};
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 */);
return 0;
}

View File

@ -43,6 +43,7 @@ int verbose_on_header_callback(nghttp2_session *session,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data);
int verbose_on_frame_recv_callback

View File

@ -59,6 +59,7 @@ int on_header_callback(nghttp2_session *session,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data)
{
auto client = static_cast<Client*>(user_data);

View File

@ -1210,11 +1210,12 @@ int on_header_callback(nghttp2_session *session,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data)
{
if(config.verbose) {
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
user_data);
flags, user_data);
}
switch(frame->hd.type) {
case NGHTTP2_HEADERS: {

View File

@ -788,6 +788,7 @@ int on_header_callback(nghttp2_session *session,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data)
{
if(frame->hd.type != NGHTTP2_HEADERS ||

View File

@ -179,11 +179,12 @@ int on_header_callback(nghttp2_session *session,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data)
{
if(get_config()->upstream_frame_debug) {
verbose_on_header_callback(session, frame, name, namelen, value, valuelen,
user_data);
flags, user_data);
}
if(frame->hd.type != NGHTTP2_HEADERS ||
frame->headers.cat != NGHTTP2_HCAT_REQUEST) {

View File

@ -295,6 +295,7 @@ static int on_header_callback(nghttp2_session *session,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *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 uint8_t *name, size_t namelen,
const uint8_t *value, size_t valuelen,
uint8_t flags,
void *user_data)
{
on_header_callback(session, frame, name, namelen, value, valuelen,
on_header_callback(session, frame, name, namelen, value, valuelen, flags,
user_data);
return NGHTTP2_ERR_PAUSE;
}