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
a21c87d1
Commit
a21c87d1
authored
Feb 29, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nghttp2_http2_strerror() to return HTTP/2 error code string
parent
478fde5f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
39 deletions
+49
-39
doc/Makefile.am
doc/Makefile.am
+1
-0
lib/includes/nghttp2/nghttp2.h
lib/includes/nghttp2/nghttp2.h
+10
-0
lib/nghttp2_helper.c
lib/nghttp2_helper.c
+35
-0
src/app_helper.cc
src/app_helper.cc
+3
-39
No files found.
doc/Makefile.am
View file @
a21c87d1
...
...
@@ -49,6 +49,7 @@ APIDOCS= \
nghttp2_hd_inflate_hd.rst
\
nghttp2_hd_inflate_new.rst
\
nghttp2_hd_inflate_new2.rst
\
nghttp2_http2_strerror.rst
\
nghttp2_is_fatal.rst
\
nghttp2_nv_compare_name.rst
\
nghttp2_option_del.rst
\
...
...
lib/includes/nghttp2/nghttp2.h
View file @
a21c87d1
...
...
@@ -3224,6 +3224,16 @@ nghttp2_pack_settings_payload(uint8_t *buf, size_t buflen,
*/
NGHTTP2_EXTERN
const
char
*
nghttp2_strerror
(
int
lib_error_code
);
/**
* @function
*
* Returns string representation of HTTP/2 error code |error_code|
* (e.g., ``PROTOCOL_ERROR`` is returned if ``error_code ==
* NGHTTP2_PROTOCOL_ERROR``). If string representation is unknown for
* given |error_code|, this function returns string ``unknown``.
*/
NGHTTP2_EXTERN
const
char
*
nghttp2_http2_strerror
(
uint32_t
error_code
);
/**
* @function
*
...
...
lib/nghttp2_helper.c
View file @
a21c87d1
...
...
@@ -451,3 +451,38 @@ uint8_t *nghttp2_cpymem(uint8_t *dest, const void *src, size_t len) {
return
dest
+
len
;
}
const
char
*
nghttp2_http2_strerror
(
uint32_t
error_code
)
{
switch
(
error_code
)
{
case
NGHTTP2_NO_ERROR
:
return
"NO_ERROR"
;
case
NGHTTP2_PROTOCOL_ERROR
:
return
"PROTOCOL_ERROR"
;
case
NGHTTP2_INTERNAL_ERROR
:
return
"INTERNAL_ERROR"
;
case
NGHTTP2_FLOW_CONTROL_ERROR
:
return
"FLOW_CONTROL_ERROR"
;
case
NGHTTP2_SETTINGS_TIMEOUT
:
return
"SETTINGS_TIMEOUT"
;
case
NGHTTP2_STREAM_CLOSED
:
return
"STREAM_CLOSED"
;
case
NGHTTP2_FRAME_SIZE_ERROR
:
return
"FRAME_SIZE_ERROR"
;
case
NGHTTP2_REFUSED_STREAM
:
return
"REFUSED_STREAM"
;
case
NGHTTP2_CANCEL
:
return
"CANCEL"
;
case
NGHTTP2_COMPRESSION_ERROR
:
return
"COMPRESSION_ERROR"
;
case
NGHTTP2_CONNECT_ERROR
:
return
"CONNECT_ERROR"
;
case
NGHTTP2_ENHANCE_YOUR_CALM
:
return
"ENHANCE_YOUR_CALM"
;
case
NGHTTP2_INADEQUATE_SECURITY
:
return
"INADEQUATE_SECURITY"
;
case
NGHTTP2_HTTP_1_1_REQUIRED
:
return
"HTTP_1_1_REQUIRED"
;
default:
return
"unknown"
;
}
}
src/app_helper.cc
View file @
a21c87d1
...
...
@@ -62,43 +62,6 @@
namespace
nghttp2
{
namespace
{
const
char
*
strstatus
(
uint32_t
error_code
)
{
switch
(
error_code
)
{
case
NGHTTP2_NO_ERROR
:
return
"NO_ERROR"
;
case
NGHTTP2_PROTOCOL_ERROR
:
return
"PROTOCOL_ERROR"
;
case
NGHTTP2_INTERNAL_ERROR
:
return
"INTERNAL_ERROR"
;
case
NGHTTP2_FLOW_CONTROL_ERROR
:
return
"FLOW_CONTROL_ERROR"
;
case
NGHTTP2_SETTINGS_TIMEOUT
:
return
"SETTINGS_TIMEOUT"
;
case
NGHTTP2_STREAM_CLOSED
:
return
"STREAM_CLOSED"
;
case
NGHTTP2_FRAME_SIZE_ERROR
:
return
"FRAME_SIZE_ERROR"
;
case
NGHTTP2_REFUSED_STREAM
:
return
"REFUSED_STREAM"
;
case
NGHTTP2_CANCEL
:
return
"CANCEL"
;
case
NGHTTP2_COMPRESSION_ERROR
:
return
"COMPRESSION_ERROR"
;
case
NGHTTP2_CONNECT_ERROR
:
return
"CONNECT_ERROR"
;
case
NGHTTP2_ENHANCE_YOUR_CALM
:
return
"ENHANCE_YOUR_CALM"
;
case
NGHTTP2_INADEQUATE_SECURITY
:
return
"INADEQUATE_SECURITY"
;
case
NGHTTP2_HTTP_1_1_REQUIRED
:
return
"HTTP_1_1_REQUIRED"
;
default:
return
"UNKNOWN"
;
}
}
}
// namespace
namespace
{
const
char
*
strsettingsid
(
int32_t
id
)
{
switch
(
id
)
{
...
...
@@ -335,7 +298,7 @@ void print_frame(print_type ptype, const nghttp2_frame *frame) {
case
NGHTTP2_RST_STREAM
:
print_frame_attr_indent
();
fprintf
(
outfile
,
"(error_code=%s(0x%02x))
\n
"
,
strstatus
(
frame
->
rst_stream
.
error_code
),
nghttp2_http2_strerror
(
frame
->
rst_stream
.
error_code
),
frame
->
rst_stream
.
error_code
);
break
;
case
NGHTTP2_SETTINGS
:
...
...
@@ -364,7 +327,8 @@ void print_frame(print_type ptype, const nghttp2_frame *frame) {
print_frame_attr_indent
();
fprintf
(
outfile
,
"(last_stream_id=%d, error_code=%s(0x%02x), "
"opaque_data(%u)=[%s])
\n
"
,
frame
->
goaway
.
last_stream_id
,
strstatus
(
frame
->
goaway
.
error_code
),
frame
->
goaway
.
last_stream_id
,
nghttp2_http2_strerror
(
frame
->
goaway
.
error_code
),
frame
->
goaway
.
error_code
,
static_cast
<
unsigned
int
>
(
frame
->
goaway
.
opaque_data_len
),
util
::
ascii_dump
(
frame
->
goaway
.
opaque_data
,
...
...
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