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
b2264ad5
Commit
b2264ad5
authored
Feb 04, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asio: server: Limit incoming request header field buffer size
parent
b0227d40
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
src/asio_server_http2_handler.cc
src/asio_server_http2_handler.cc
+7
-0
src/asio_server_request_impl.cc
src/asio_server_request_impl.cc
+7
-1
src/asio_server_request_impl.h
src/asio_server_request_impl.h
+4
-0
No files found.
src/asio_server_http2_handler.cc
View file @
b2264ad5
...
...
@@ -105,6 +105,13 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame,
}
// fall through
default:
if
(
req
.
header_buffer_size
()
+
namelen
+
valuelen
>
64
_k
)
{
nghttp2_submit_rst_stream
(
session
,
NGHTTP2_FLAG_NONE
,
frame
->
hd
.
stream_id
,
NGHTTP2_INTERNAL_ERROR
);
break
;
}
req
.
update_header_buffer_size
(
namelen
+
valuelen
);
req
.
header
().
emplace
(
std
::
string
(
name
,
name
+
namelen
),
header_value
{
std
::
string
(
value
,
value
+
valuelen
),
(
flags
&
NGHTTP2_NV_FLAG_NO_INDEX
)
!=
0
});
...
...
src/asio_server_request_impl.cc
View file @
b2264ad5
...
...
@@ -28,7 +28,7 @@ namespace nghttp2 {
namespace
asio_http2
{
namespace
server
{
request_impl
::
request_impl
()
:
strm_
(
nullptr
)
{}
request_impl
::
request_impl
()
:
strm_
(
nullptr
)
,
header_buffer_size_
(
0
)
{}
const
header_map
&
request_impl
::
header
()
const
{
return
header_
;
}
...
...
@@ -62,6 +62,12 @@ void request_impl::remote_endpoint(boost::asio::ip::tcp::endpoint ep) {
remote_ep_
=
std
::
move
(
ep
);
}
size_t
request_impl
::
header_buffer_size
()
const
{
return
header_buffer_size_
;
}
void
request_impl
::
update_header_buffer_size
(
size_t
len
)
{
header_buffer_size_
+=
len
;
}
}
// namespace server
}
// namespace asio_http2
}
// namespace nghttp2
src/asio_server_request_impl.h
View file @
b2264ad5
...
...
@@ -58,6 +58,9 @@ public:
const
boost
::
asio
::
ip
::
tcp
::
endpoint
&
remote_endpoint
()
const
;
void
remote_endpoint
(
boost
::
asio
::
ip
::
tcp
::
endpoint
ep
);
size_t
header_buffer_size
()
const
;
void
update_header_buffer_size
(
size_t
len
);
private:
class
stream
*
strm_
;
header_map
header_
;
...
...
@@ -65,6 +68,7 @@ private:
uri_ref
uri_
;
data_cb
on_data_cb_
;
boost
::
asio
::
ip
::
tcp
::
endpoint
remote_ep_
;
size_t
header_buffer_size_
;
};
}
// namespace server
...
...
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