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
c4b487be
Commit
c4b487be
authored
Mar 07, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asio: Add client::request::write_trailer()
parent
c976a0fc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
0 deletions
+40
-0
src/asio_client_request.cc
src/asio_client_request.cc
+4
-0
src/asio_client_request_impl.cc
src/asio_client_request_impl.cc
+5
-0
src/asio_client_request_impl.h
src/asio_client_request_impl.h
+2
-0
src/asio_client_session_impl.cc
src/asio_client_session_impl.cc
+21
-0
src/asio_client_session_impl.h
src/asio_client_session_impl.h
+2
-0
src/includes/nghttp2/asio_http2_client.h
src/includes/nghttp2/asio_http2_client.h
+6
-0
No files found.
src/asio_client_request.cc
View file @
c4b487be
...
...
@@ -38,6 +38,10 @@ request::request() : impl_(make_unique<request_impl>()) {}
request
::~
request
()
{}
void
request
::
write_trailer
(
header_map
h
)
const
{
impl_
->
write_trailer
(
std
::
move
(
h
));
}
void
request
::
cancel
(
uint32_t
error_code
)
const
{
impl_
->
cancel
(
error_code
);
}
void
request
::
on_response
(
response_cb
cb
)
const
{
...
...
src/asio_client_request_impl.cc
View file @
c4b487be
...
...
@@ -34,6 +34,11 @@ namespace client {
request_impl
::
request_impl
()
:
strm_
(
nullptr
)
{}
void
request_impl
::
write_trailer
(
header_map
h
)
{
auto
sess
=
strm_
->
session
();
sess
->
write_trailer
(
*
strm_
,
std
::
move
(
h
));
}
void
request_impl
::
cancel
(
uint32_t
error_code
)
{
auto
sess
=
strm_
->
session
();
sess
->
cancel
(
*
strm_
,
error_code
);
...
...
src/asio_client_request_impl.h
View file @
c4b487be
...
...
@@ -43,6 +43,8 @@ public:
request_impl
(
const
request_impl
&
)
=
delete
;
request_impl
&
operator
=
(
const
request_impl
&
)
=
delete
;
void
write_trailer
(
header_map
h
);
void
cancel
(
uint32_t
error_code
);
void
on_response
(
response_cb
cb
);
...
...
src/asio_client_session_impl.cc
View file @
c4b487be
...
...
@@ -330,6 +330,27 @@ bool session_impl::setup_session() {
return
true
;
}
int
session_impl
::
write_trailer
(
stream
&
strm
,
header_map
h
)
{
int
rv
;
auto
nva
=
std
::
vector
<
nghttp2_nv
>
();
nva
.
reserve
(
h
.
size
());
for
(
auto
&
hd
:
h
)
{
nva
.
push_back
(
nghttp2
::
http2
::
make_nv
(
hd
.
first
,
hd
.
second
.
value
,
hd
.
second
.
sensitive
));
}
rv
=
nghttp2_submit_trailer
(
session_
,
strm
.
stream_id
(),
nva
.
data
(),
nva
.
size
());
if
(
rv
!=
0
)
{
return
-
1
;
}
signal_write
();
return
0
;
}
void
session_impl
::
cancel
(
stream
&
strm
,
uint32_t
error_code
)
{
nghttp2_submit_rst_stream
(
session_
,
NGHTTP2_FLAG_NONE
,
strm
.
stream_id
(),
error_code
);
...
...
src/asio_client_session_impl.h
View file @
c4b487be
...
...
@@ -55,6 +55,8 @@ public:
const
connect_cb
&
on_connect
()
const
;
const
error_cb
&
on_error
()
const
;
int
write_trailer
(
stream
&
strm
,
header_map
h
);
void
cancel
(
stream
&
strm
,
uint32_t
error_code
);
void
resume
(
stream
&
strm
);
...
...
src/includes/nghttp2/asio_http2_client.h
View file @
c4b487be
...
...
@@ -89,6 +89,12 @@ public:
// must not access request and response object.
void
on_close
(
close_cb
cb
)
const
;
// Write trailer part. This must be called after setting both
// NGHTTP2_DATA_FLAG_EOF and NGHTTP2_DATA_FLAG_NO_END_STREAM set in
// *data_flag parameter in generator_cb passed to session::submit()
// function.
void
write_trailer
(
header_map
h
)
const
;
// Cancels this request and response with given error code.
void
cancel
(
uint32_t
error_code
=
NGHTTP2_INTERNAL_ERROR
)
const
;
...
...
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