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
fb7d22fc
Commit
fb7d22fc
authored
Aug 29, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add int return value to nghttp2_on_invalid_frame_recv_callback
parent
a59cd3be
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
14 deletions
+27
-14
lib/includes/nghttp2/nghttp2.h
lib/includes/nghttp2/nghttp2.h
+7
-2
lib/nghttp2_session.c
lib/nghttp2_session.c
+12
-6
src/app_helper.cc
src/app_helper.cc
+2
-1
src/app_helper.h
src/app_helper.h
+1
-1
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+5
-4
No files found.
lib/includes/nghttp2/nghttp2.h
View file @
fb7d22fc
...
@@ -783,7 +783,7 @@ typedef ssize_t (*nghttp2_recv_callback)
...
@@ -783,7 +783,7 @@ typedef ssize_t (*nghttp2_recv_callback)
* The implementation of this function must return 0 if it
* The implementation of this function must return 0 if it
* succeeds. If nonzero is returned, it is treated as fatal error and
* succeeds. If nonzero is returned, it is treated as fatal error and
* `nghttp2_session_recv()` and `nghttp2_session_send()` functions
* `nghttp2_session_recv()` and `nghttp2_session_send()` functions
* return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
*
immediately
return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
*/
*/
typedef
int
(
*
nghttp2_on_frame_recv_callback
)
typedef
int
(
*
nghttp2_on_frame_recv_callback
)
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
void
*
user_data
);
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
void
*
user_data
);
...
@@ -796,8 +796,13 @@ typedef int (*nghttp2_on_frame_recv_callback)
...
@@ -796,8 +796,13 @@ typedef int (*nghttp2_on_frame_recv_callback)
* :enum:`nghttp2_error_code` and indicates the error. When this
* :enum:`nghttp2_error_code` and indicates the error. When this
* callback function is invoked, the library automatically submits
* callback function is invoked, the library automatically submits
* either RST_STREAM or GOAWAY frame.
* either RST_STREAM or GOAWAY frame.
*
* 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`.
*/
*/
typedef
void
(
*
nghttp2_on_invalid_frame_recv_callback
)
typedef
int
(
*
nghttp2_on_invalid_frame_recv_callback
)
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
nghttp2_error_code
error_code
,
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
nghttp2_error_code
error_code
,
void
*
user_data
);
void
*
user_data
);
...
...
lib/nghttp2_session.c
View file @
fb7d22fc
...
@@ -1649,8 +1649,10 @@ static int nghttp2_session_handle_invalid_stream
...
@@ -1649,8 +1649,10 @@ static int nghttp2_session_handle_invalid_stream
return
r
;
return
r
;
}
}
if
(
session
->
callbacks
.
on_invalid_frame_recv_callback
)
{
if
(
session
->
callbacks
.
on_invalid_frame_recv_callback
)
{
session
->
callbacks
.
on_invalid_frame_recv_callback
if
(
session
->
callbacks
.
on_invalid_frame_recv_callback
(
session
,
frame
,
error_code
,
session
->
user_data
);
(
session
,
frame
,
error_code
,
session
->
user_data
)
!=
0
)
{
return
NGHTTP2_ERR_CALLBACK_FAILURE
;
}
}
}
return
0
;
return
0
;
}
}
...
@@ -1664,8 +1666,10 @@ static int nghttp2_session_handle_invalid_connection
...
@@ -1664,8 +1666,10 @@ static int nghttp2_session_handle_invalid_connection
nghttp2_error_code
error_code
)
nghttp2_error_code
error_code
)
{
{
if
(
session
->
callbacks
.
on_invalid_frame_recv_callback
)
{
if
(
session
->
callbacks
.
on_invalid_frame_recv_callback
)
{
session
->
callbacks
.
on_invalid_frame_recv_callback
if
(
session
->
callbacks
.
on_invalid_frame_recv_callback
(
session
,
frame
,
error_code
,
session
->
user_data
);
(
session
,
frame
,
error_code
,
session
->
user_data
)
!=
0
)
{
return
NGHTTP2_ERR_CALLBACK_FAILURE
;
}
}
}
return
nghttp2_session_fail_session
(
session
,
error_code
);
return
nghttp2_session_fail_session
(
session
,
error_code
);
}
}
...
@@ -2254,8 +2258,10 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session,
...
@@ -2254,8 +2258,10 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session,
}
}
}
else
{
}
else
{
if
(
session
->
callbacks
.
on_invalid_frame_recv_callback
)
{
if
(
session
->
callbacks
.
on_invalid_frame_recv_callback
)
{
session
->
callbacks
.
on_invalid_frame_recv_callback
if
(
session
->
callbacks
.
on_invalid_frame_recv_callback
(
session
,
frame
,
NGHTTP2_PROTOCOL_ERROR
,
session
->
user_data
);
(
session
,
frame
,
NGHTTP2_PROTOCOL_ERROR
,
session
->
user_data
)
!=
0
)
{
return
NGHTTP2_ERR_CALLBACK_FAILURE
;
}
}
}
return
nghttp2_session_add_rst_stream
return
nghttp2_session_add_rst_stream
(
session
,
(
session
,
...
...
src/app_helper.cc
View file @
fb7d22fc
...
@@ -333,7 +333,7 @@ int on_frame_recv_callback
...
@@ -333,7 +333,7 @@ int on_frame_recv_callback
return
0
;
return
0
;
}
}
void
on_invalid_frame_recv_callback
int
on_invalid_frame_recv_callback
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
nghttp2_error_code
error_code
,
void
*
user_data
)
nghttp2_error_code
error_code
,
void
*
user_data
)
{
{
...
@@ -341,6 +341,7 @@ void on_invalid_frame_recv_callback
...
@@ -341,6 +341,7 @@ void on_invalid_frame_recv_callback
printf
(
" [INVALID; status=%s] recv "
,
strstatus
(
error_code
));
printf
(
" [INVALID; status=%s] recv "
,
strstatus
(
error_code
));
print_frame
(
PRINT_RECV
,
frame
);
print_frame
(
PRINT_RECV
,
frame
);
fflush
(
stdout
);
fflush
(
stdout
);
return
0
;
}
}
namespace
{
namespace
{
...
...
src/app_helper.h
View file @
fb7d22fc
...
@@ -42,7 +42,7 @@ void print_nv(char **nv);
...
@@ -42,7 +42,7 @@ void print_nv(char **nv);
int
on_frame_recv_callback
int
on_frame_recv_callback
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
void
*
user_data
);
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
void
*
user_data
);
void
on_invalid_frame_recv_callback
int
on_invalid_frame_recv_callback
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
nghttp2_error_code
error_code
,
void
*
user_data
);
nghttp2_error_code
error_code
,
void
*
user_data
);
...
...
tests/nghttp2_session_test.c
View file @
fb7d22fc
...
@@ -135,13 +135,14 @@ static int on_frame_recv_callback(nghttp2_session *session,
...
@@ -135,13 +135,14 @@ static int on_frame_recv_callback(nghttp2_session *session,
return
0
;
return
0
;
}
}
static
void
on_invalid_frame_recv_callback
(
nghttp2_session
*
session
,
static
int
on_invalid_frame_recv_callback
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
nghttp2_frame
*
frame
,
nghttp2_error_code
error_code
,
nghttp2_error_code
error_code
,
void
*
user_data
)
void
*
user_data
)
{
{
my_user_data
*
ud
=
(
my_user_data
*
)
user_data
;
my_user_data
*
ud
=
(
my_user_data
*
)
user_data
;
++
ud
->
invalid_frame_recv_cb_called
;
++
ud
->
invalid_frame_recv_cb_called
;
return
0
;
}
}
static
void
on_frame_send_callback
(
nghttp2_session
*
session
,
static
void
on_frame_send_callback
(
nghttp2_session
*
session
,
...
...
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