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
c5ea2b4a
Commit
c5ea2b4a
authored
Dec 19, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'apohl79-master'
parents
5a2d7555
e71948d6
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
4 deletions
+37
-4
src/asio_server_connection.h
src/asio_server_connection.h
+3
-2
src/asio_server_http2_handler.cc
src/asio_server_http2_handler.cc
+9
-1
src/asio_server_http2_handler.h
src/asio_server_http2_handler.h
+5
-1
src/asio_server_request.cc
src/asio_server_request.cc
+4
-0
src/asio_server_request_impl.cc
src/asio_server_request_impl.cc
+8
-0
src/asio_server_request_impl.h
src/asio_server_request_impl.h
+5
-0
src/includes/nghttp2/asio_http2_server.h
src/includes/nghttp2/asio_http2_server.h
+3
-0
No files found.
src/asio_server_connection.h
View file @
c5ea2b4a
...
...
@@ -70,7 +70,8 @@ public:
/// Start the first asynchronous operation for the connection.
void
start
()
{
handler_
=
std
::
make_shared
<
http2_handler
>
(
socket_
.
get_io_service
(),
handler_
=
std
::
make_shared
<
http2_handler
>
(
socket_
.
get_io_service
(),
socket_
.
lowest_layer
().
remote_endpoint
(),
[
this
]()
{
do_write
();
},
mux_
);
if
(
handler_
->
start
()
!=
0
)
{
return
;
...
...
src/asio_server_http2_handler.cc
View file @
c5ea2b4a
...
...
@@ -136,6 +136,9 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame,
break
;
}
auto
&
req
=
strm
->
request
().
impl
();
req
.
remote_endpoint
(
handler
->
remote_endpoint
());
handler
->
call_on_request
(
*
strm
);
if
(
frame
->
hd
.
flags
&
NGHTTP2_FLAG_END_STREAM
)
{
...
...
@@ -225,8 +228,9 @@ int on_frame_not_send_callback(nghttp2_session *session,
}
// namespace
http2_handler
::
http2_handler
(
boost
::
asio
::
io_service
&
io_service
,
boost
::
asio
::
ip
::
tcp
::
endpoint
ep
,
connection_write
writefun
,
serve_mux
&
mux
)
:
writefun_
(
writefun
),
mux_
(
mux
),
io_service_
(
io_service
),
:
writefun_
(
writefun
),
mux_
(
mux
),
io_service_
(
io_service
),
remote_ep_
(
ep
),
session_
(
nullptr
),
buf_
(
nullptr
),
buflen_
(
0
),
inside_callback_
(
false
),
tstamp_cached_
(
time
(
nullptr
)),
formatted_date_
(
util
::
http_date
(
tstamp_cached_
))
{}
...
...
@@ -449,6 +453,10 @@ response *http2_handler::push_promise(boost::system::error_code &ec,
boost
::
asio
::
io_service
&
http2_handler
::
io_service
()
{
return
io_service_
;
}
const
boost
::
asio
::
ip
::
tcp
::
endpoint
&
http2_handler
::
remote_endpoint
()
{
return
remote_ep_
;
}
callback_guard
::
callback_guard
(
http2_handler
&
h
)
:
handler
(
h
)
{
handler
.
enter_callback
();
}
...
...
src/asio_server_http2_handler.h
View file @
c5ea2b4a
...
...
@@ -53,7 +53,8 @@ using connection_write = std::function<void(void)>;
class
http2_handler
:
public
std
::
enable_shared_from_this
<
http2_handler
>
{
public:
http2_handler
(
boost
::
asio
::
io_service
&
io_service
,
connection_write
writefun
,
http2_handler
(
boost
::
asio
::
io_service
&
io_service
,
boost
::
asio
::
ip
::
tcp
::
endpoint
ep
,
connection_write
writefun
,
serve_mux
&
mux
);
~
http2_handler
();
...
...
@@ -89,6 +90,8 @@ public:
boost
::
asio
::
io_service
&
io_service
();
const
boost
::
asio
::
ip
::
tcp
::
endpoint
&
remote_endpoint
();
const
std
::
string
&
http_date
();
template
<
size_t
N
>
...
...
@@ -152,6 +155,7 @@ private:
connection_write
writefun_
;
serve_mux
&
mux_
;
boost
::
asio
::
io_service
&
io_service_
;
boost
::
asio
::
ip
::
tcp
::
endpoint
remote_ep_
;
nghttp2_session
*
session_
;
const
uint8_t
*
buf_
;
std
::
size_t
buflen_
;
...
...
src/asio_server_request.cc
View file @
c5ea2b4a
...
...
@@ -50,6 +50,10 @@ void request::on_data(data_cb cb) const {
request_impl
&
request
::
impl
()
const
{
return
*
impl_
;
}
const
boost
::
asio
::
ip
::
tcp
::
endpoint
&
request
::
remote_endpoint
()
const
{
return
impl_
->
remote_endpoint
();
}
}
// namespace server
}
// namespace asio_http2
}
// namespace nghttp2
src/asio_server_request_impl.cc
View file @
c5ea2b4a
...
...
@@ -54,6 +54,14 @@ void request_impl::call_on_data(const uint8_t *data, std::size_t len) {
}
}
const
boost
::
asio
::
ip
::
tcp
::
endpoint
&
request_impl
::
remote_endpoint
()
const
{
return
remote_ep_
;
}
void
request_impl
::
remote_endpoint
(
boost
::
asio
::
ip
::
tcp
::
endpoint
ep
)
{
remote_ep_
=
ep
;
}
}
// namespace server
}
// namespace asio_http2
}
// namespace nghttp2
src/asio_server_request_impl.h
View file @
c5ea2b4a
...
...
@@ -28,6 +28,7 @@
#include "nghttp2_config.h"
#include <nghttp2/asio_http2_server.h>
#include <boost/asio/ip/tcp.hpp>
namespace
nghttp2
{
namespace
asio_http2
{
...
...
@@ -54,12 +55,16 @@ public:
void
stream
(
class
stream
*
s
);
void
call_on_data
(
const
uint8_t
*
data
,
std
::
size_t
len
);
const
boost
::
asio
::
ip
::
tcp
::
endpoint
&
remote_endpoint
()
const
;
void
remote_endpoint
(
boost
::
asio
::
ip
::
tcp
::
endpoint
ep
);
private:
class
stream
*
strm_
;
header_map
header_
;
std
::
string
method_
;
uri_ref
uri_
;
data_cb
on_data_cb_
;
boost
::
asio
::
ip
::
tcp
::
endpoint
remote_ep_
;
};
}
// namespace server
...
...
src/includes/nghttp2/asio_http2_server.h
View file @
c5ea2b4a
...
...
@@ -59,6 +59,9 @@ public:
// Application must not call this directly.
request_impl
&
impl
()
const
;
// Returns the remote endpoint of the request
const
boost
::
asio
::
ip
::
tcp
::
endpoint
&
remote_endpoint
()
const
;
private:
std
::
unique_ptr
<
request_impl
>
impl_
;
};
...
...
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