Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
bb70cdf6
Commit
bb70cdf6
authored
Dec 20, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Rename verbose callback functions
parent
9f7b231c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
63 deletions
+60
-63
src/HttpServer.cc
src/HttpServer.cc
+11
-7
src/app_helper.cc
src/app_helper.cc
+19
-18
src/app_helper.h
src/app_helper.h
+21
-20
src/nghttp.cc
src/nghttp.cc
+9
-18
No files found.
src/HttpServer.cc
View file @
bb70cdf6
...
...
@@ -764,7 +764,7 @@ int hd_on_frame_recv_callback
auto
hd
=
reinterpret_cast
<
Http2Handler
*>
(
user_data
);
if
(
hd
->
get_config
()
->
verbose
)
{
print_session_id
(
hd
->
session_id
());
on_frame_recv_callback
(
session
,
frame
,
user_data
);
verbose_
on_frame_recv_callback
(
session
,
frame
,
user_data
);
}
switch
(
frame
->
hd
.
type
)
{
case
NGHTTP2_HEADERS
:
...
...
@@ -856,7 +856,7 @@ int hd_on_frame_send_callback
}
if
(
hd
->
get_config
()
->
verbose
)
{
print_session_id
(
hd
->
session_id
());
on_frame_send_callback
(
session
,
frame
,
user_data
);
verbose_
on_frame_send_callback
(
session
,
frame
,
user_data
);
}
return
0
;
}
...
...
@@ -881,7 +881,8 @@ int hd_on_data_recv_callback
auto
hd
=
reinterpret_cast
<
Http2Handler
*>
(
user_data
);
if
(
hd
->
get_config
()
->
verbose
)
{
print_session_id
(
hd
->
session_id
());
on_data_recv_callback
(
session
,
length
,
flags
,
stream_id
,
user_data
);
verbose_on_data_recv_callback
(
session
,
length
,
flags
,
stream_id
,
user_data
);
}
return
0
;
}
...
...
@@ -895,7 +896,8 @@ int hd_on_data_send_callback
auto
hd
=
reinterpret_cast
<
Http2Handler
*>
(
user_data
);
if
(
hd
->
get_config
()
->
verbose
)
{
print_session_id
(
hd
->
session_id
());
on_data_send_callback
(
session
,
length
,
flags
,
stream_id
,
user_data
);
verbose_on_data_send_callback
(
session
,
length
,
flags
,
stream_id
,
user_data
);
}
return
0
;
}
...
...
@@ -931,10 +933,12 @@ void fill_callback(nghttp2_session_callbacks& callbacks, const Config *config)
callbacks
.
on_data_recv_callback
=
hd_on_data_recv_callback
;
callbacks
.
on_data_send_callback
=
hd_on_data_send_callback
;
if
(
config
->
verbose
)
{
callbacks
.
on_invalid_frame_recv_callback
=
on_invalid_frame_recv_callback
;
callbacks
.
on_invalid_frame_recv_callback
=
verbose_on_invalid_frame_recv_callback
;
callbacks
.
on_frame_recv_parse_error_callback
=
on_frame_recv_parse_error_callback
;
callbacks
.
on_unknown_frame_recv_callback
=
on_unknown_frame_recv_callback
;
verbose_on_frame_recv_parse_error_callback
;
callbacks
.
on_unknown_frame_recv_callback
=
verbose_on_unknown_frame_recv_callback
;
}
callbacks
.
on_data_chunk_recv_callback
=
on_data_chunk_recv_callback
;
callbacks
.
on_request_recv_callback
=
config
->
on_request_recv_callback
;
...
...
src/app_helper.cc
View file @
bb70cdf6
...
...
@@ -340,7 +340,7 @@ void print_frame(print_type ptype, const nghttp2_frame *frame)
}
}
// namespace
int
on_frame_recv_callback
int
verbose_
on_frame_recv_callback
(
nghttp2_session
*
session
,
const
nghttp2_frame
*
frame
,
void
*
user_data
)
{
print_timer
();
...
...
@@ -350,7 +350,7 @@ int on_frame_recv_callback
return
0
;
}
int
on_invalid_frame_recv_callback
int
verbose_
on_invalid_frame_recv_callback
(
nghttp2_session
*
session
,
const
nghttp2_frame
*
frame
,
nghttp2_error_code
error_code
,
void
*
user_data
)
{
...
...
@@ -374,13 +374,14 @@ void dump_header(const uint8_t *head, size_t headlen)
}
}
// namespace
int
on_frame_recv_parse_error_callback
(
nghttp2_session
*
session
,
nghttp2_frame_type
type
,
const
uint8_t
*
head
,
size_t
headlen
,
const
uint8_t
*
payload
,
size_t
payloadlen
,
int
error_code
,
void
*
user_data
)
int
verbose_on_frame_recv_parse_error_callback
(
nghttp2_session
*
session
,
nghttp2_frame_type
type
,
const
uint8_t
*
head
,
size_t
headlen
,
const
uint8_t
*
payload
,
size_t
payloadlen
,
int
error_code
,
void
*
user_data
)
{
print_timer
();
printf
(
" [PARSE_ERROR] recv %s%s%s frame
\n
"
,
...
...
@@ -394,12 +395,12 @@ int on_frame_recv_parse_error_callback(nghttp2_session *session,
return
0
;
}
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
)
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
();
printf
(
" recv unknown frame
\n
"
);
...
...
@@ -408,7 +409,7 @@ int on_unknown_frame_recv_callback(nghttp2_session *session,
return
0
;
}
int
on_frame_send_callback
int
verbose_
on_frame_send_callback
(
nghttp2_session
*
session
,
const
nghttp2_frame
*
frame
,
void
*
user_data
)
{
print_timer
();
...
...
@@ -433,7 +434,7 @@ void print_data_frame(print_type ptype, uint16_t length, uint8_t flags,
}
}
// namespace
int
on_data_recv_callback
int
verbose_
on_data_recv_callback
(
nghttp2_session
*
session
,
uint16_t
length
,
uint8_t
flags
,
int32_t
stream_id
,
void
*
user_data
)
{
...
...
@@ -444,7 +445,7 @@ int on_data_recv_callback
return
0
;
}
int
on_data_send_callback
int
verbose_
on_data_send_callback
(
nghttp2_session
*
session
,
uint16_t
length
,
uint8_t
flags
,
int32_t
stream_id
,
void
*
user_data
)
{
...
...
src/app_helper.h
View file @
bb70cdf6
...
...
@@ -41,36 +41,37 @@ namespace nghttp2 {
void
print_nv
(
char
**
nv
);
int
on_frame_recv_callback
int
verbose_
on_frame_recv_callback
(
nghttp2_session
*
session
,
const
nghttp2_frame
*
frame
,
void
*
user_data
);
int
on_invalid_frame_recv_callback
int
verbose_
on_invalid_frame_recv_callback
(
nghttp2_session
*
session
,
const
nghttp2_frame
*
frame
,
nghttp2_error_code
error_code
,
void
*
user_data
);
int
on_frame_recv_parse_error_callback
(
nghttp2_session
*
session
,
nghttp2_frame_type
type
,
const
uint8_t
*
head
,
size_t
headlen
,
const
uint8_t
*
payload
,
size_t
payloadlen
,
int
error_code
,
void
*
user_data
);
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
);
int
on_frame_send_callback
int
verbose_on_frame_recv_parse_error_callback
(
nghttp2_session
*
session
,
nghttp2_frame_type
type
,
const
uint8_t
*
head
,
size_t
headlen
,
const
uint8_t
*
payload
,
size_t
payloadlen
,
int
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
);
int
on_data_recv_callback
int
verbose_
on_data_recv_callback
(
nghttp2_session
*
session
,
uint16_t
length
,
uint8_t
flags
,
int32_t
stream_id
,
void
*
user_data
);
int
on_data_send_callback
int
verbose_
on_data_send_callback
(
nghttp2_session
*
session
,
uint16_t
length
,
uint8_t
flags
,
int32_t
stream_id
,
void
*
user_data
);
...
...
src/nghttp.cc
View file @
bb70cdf6
...
...
@@ -1096,17 +1096,6 @@ int before_frame_send_callback
}
}
// namespace
namespace
{
int
on_frame_send_callback2
(
nghttp2_session
*
session
,
const
nghttp2_frame
*
frame
,
void
*
user_data
)
{
if
(
config
.
verbose
)
{
on_frame_send_callback
(
session
,
frame
,
user_data
);
}
return
0
;
}
}
// namespace
namespace
{
void
check_response_header
(
nghttp2_session
*
session
,
const
nghttp2_frame
*
frame
,
void
*
user_data
)
...
...
@@ -1169,7 +1158,7 @@ int on_frame_recv_callback2
}
}
if
(
config
.
verbose
)
{
on_frame_recv_callback
(
session
,
frame
,
user_data
);
verbose_
on_frame_recv_callback
(
session
,
frame
,
user_data
);
}
return
0
;
}
...
...
@@ -1480,15 +1469,17 @@ int run(char **uris, int n)
callbacks
.
recv_callback
=
client_recv_callback
;
callbacks
.
on_stream_close_callback
=
on_stream_close_callback
;
callbacks
.
on_frame_recv_callback
=
on_frame_recv_callback2
;
callbacks
.
on_frame_send_callback
=
on_frame_send_callback2
;
callbacks
.
before_frame_send_callback
=
before_frame_send_callback
;
if
(
config
.
verbose
)
{
callbacks
.
on_data_recv_callback
=
on_data_recv_callback
;
callbacks
.
on_data_send_callback
=
on_data_send_callback
;
callbacks
.
on_invalid_frame_recv_callback
=
on_invalid_frame_recv_callback
;
callbacks
.
on_frame_send_callback
=
verbose_on_frame_send_callback
;
callbacks
.
on_data_recv_callback
=
verbose_on_data_recv_callback
;
callbacks
.
on_data_send_callback
=
verbose_on_data_send_callback
;
callbacks
.
on_invalid_frame_recv_callback
=
verbose_on_invalid_frame_recv_callback
;
callbacks
.
on_frame_recv_parse_error_callback
=
on_frame_recv_parse_error_callback
;
callbacks
.
on_unknown_frame_recv_callback
=
on_unknown_frame_recv_callback
;
verbose_on_frame_recv_parse_error_callback
;
callbacks
.
on_unknown_frame_recv_callback
=
verbose_on_unknown_frame_recv_callback
;
}
callbacks
.
on_data_chunk_recv_callback
=
on_data_chunk_recv_callback
;
std
::
string
prev_scheme
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment