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
8afd75ca
Commit
8afd75ca
authored
Mar 04, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make request, response const
parent
0676535c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
35 deletions
+44
-35
examples/asio-cl.cc
examples/asio-cl.cc
+3
-3
src/asio_client_request.cc
src/asio_client_request.cc
+6
-4
src/asio_client_response.cc
src/asio_client_response.cc
+1
-1
src/asio_client_session.cc
src/asio_client_session.cc
+11
-9
src/asio_client_session_impl.cc
src/asio_client_session_impl.cc
+4
-3
src/asio_client_session_impl.h
src/asio_client_session_impl.h
+3
-2
src/includes/nghttp2/asio_http2.h
src/includes/nghttp2/asio_http2.h
+16
-13
No files found.
examples/asio-cl.cc
View file @
8afd75ca
...
@@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
...
@@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
return
;
return
;
}
}
req
->
on_response
([
&
sess
,
req
](
response
&
res
)
{
req
->
on_response
([
&
sess
,
req
](
const
response
&
res
)
{
std
::
cerr
<<
"response header was received"
<<
std
::
endl
;
std
::
cerr
<<
"response header was received"
<<
std
::
endl
;
print_header
(
res
);
print_header
(
res
);
...
@@ -87,12 +87,12 @@ int main(int argc, char *argv[]) {
...
@@ -87,12 +87,12 @@ int main(int argc, char *argv[]) {
std
::
cerr
<<
"request done with error_code="
<<
error_code
<<
std
::
endl
;
std
::
cerr
<<
"request done with error_code="
<<
error_code
<<
std
::
endl
;
});
});
req
->
on_push
([](
request
&
push_req
)
{
req
->
on_push
([](
const
request
&
push_req
)
{
std
::
cerr
<<
"push request was received"
<<
std
::
endl
;
std
::
cerr
<<
"push request was received"
<<
std
::
endl
;
print_header
(
push_req
);
print_header
(
push_req
);
push_req
.
on_response
([](
response
&
res
)
{
push_req
.
on_response
([](
const
response
&
res
)
{
std
::
cerr
<<
"push response header was received"
<<
std
::
endl
;
std
::
cerr
<<
"push response header was received"
<<
std
::
endl
;
res
.
on_data
([](
const
uint8_t
*
data
,
std
::
size_t
len
)
{
res
.
on_data
([](
const
uint8_t
*
data
,
std
::
size_t
len
)
{
...
...
src/asio_client_request.cc
View file @
8afd75ca
...
@@ -36,13 +36,15 @@ request::request() : impl_(make_unique<request_impl>()) {}
...
@@ -36,13 +36,15 @@ request::request() : impl_(make_unique<request_impl>()) {}
request
::~
request
()
{}
request
::~
request
()
{}
void
request
::
cancel
()
{
impl_
->
cancel
();
}
void
request
::
cancel
()
const
{
impl_
->
cancel
();
}
void
request
::
on_response
(
response_cb
cb
)
{
impl_
->
on_response
(
std
::
move
(
cb
));
}
void
request
::
on_response
(
response_cb
cb
)
const
{
impl_
->
on_response
(
std
::
move
(
cb
));
}
void
request
::
on_push
(
request_cb
cb
)
{
impl_
->
on_push
(
std
::
move
(
cb
));
}
void
request
::
on_push
(
request_cb
cb
)
const
{
impl_
->
on_push
(
std
::
move
(
cb
));
}
void
request
::
on_close
(
close_cb
cb
)
{
impl_
->
on_close
(
std
::
move
(
cb
));
}
void
request
::
on_close
(
close_cb
cb
)
const
{
impl_
->
on_close
(
std
::
move
(
cb
));
}
const
std
::
string
&
request
::
method
()
const
{
return
impl_
->
method
();
}
const
std
::
string
&
request
::
method
()
const
{
return
impl_
->
method
();
}
...
...
src/asio_client_response.cc
View file @
8afd75ca
...
@@ -36,7 +36,7 @@ response::response() : impl_(make_unique<response_impl>()) {}
...
@@ -36,7 +36,7 @@ response::response() : impl_(make_unique<response_impl>()) {}
response
::~
response
()
{}
response
::~
response
()
{}
void
response
::
on_data
(
data_cb
cb
)
{
impl_
->
on_data
(
std
::
move
(
cb
));
}
void
response
::
on_data
(
data_cb
cb
)
const
{
impl_
->
on_data
(
std
::
move
(
cb
));
}
int
response
::
status_code
()
const
{
return
impl_
->
status_code
();
}
int
response
::
status_code
()
const
{
return
impl_
->
status_code
();
}
...
...
src/asio_client_session.cc
View file @
8afd75ca
...
@@ -57,22 +57,24 @@ void session::shutdown() { impl_->shutdown(); }
...
@@ -57,22 +57,24 @@ void session::shutdown() { impl_->shutdown(); }
boost
::
asio
::
io_service
&
session
::
io_service
()
{
return
impl_
->
io_service
();
}
boost
::
asio
::
io_service
&
session
::
io_service
()
{
return
impl_
->
io_service
();
}
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
const
std
::
string
&
method
,
header_map
h
)
{
const
std
::
string
&
uri
,
header_map
h
)
{
return
impl_
->
submit
(
ec
,
method
,
uri
,
read_cb
(),
std
::
move
(
h
));
return
impl_
->
submit
(
ec
,
method
,
uri
,
read_cb
(),
std
::
move
(
h
));
}
}
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
const
std
::
string
&
method
,
std
::
string
data
,
header_map
h
)
{
const
std
::
string
&
uri
,
std
::
string
data
,
header_map
h
)
{
return
impl_
->
submit
(
ec
,
method
,
uri
,
string_reader
(
std
::
move
(
data
)),
return
impl_
->
submit
(
ec
,
method
,
uri
,
string_reader
(
std
::
move
(
data
)),
std
::
move
(
h
));
std
::
move
(
h
));
}
}
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
const
std
::
string
&
method
,
read_cb
cb
,
header_map
h
)
{
const
std
::
string
&
uri
,
read_cb
cb
,
header_map
h
)
{
return
impl_
->
submit
(
ec
,
method
,
uri
,
std
::
move
(
cb
),
std
::
move
(
h
));
return
impl_
->
submit
(
ec
,
method
,
uri
,
std
::
move
(
cb
),
std
::
move
(
h
));
}
}
...
...
src/asio_client_session_impl.cc
View file @
8afd75ca
...
@@ -358,9 +358,10 @@ std::unique_ptr<stream> session_impl::create_stream() {
...
@@ -358,9 +358,10 @@ std::unique_ptr<stream> session_impl::create_stream() {
return
strm
;
return
strm
;
}
}
request
*
session_impl
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
session_impl
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
const
std
::
string
&
method
,
read_cb
cb
,
header_map
h
)
{
const
std
::
string
&
uri
,
read_cb
cb
,
header_map
h
)
{
ec
.
clear
();
ec
.
clear
();
auto
nva
=
std
::
vector
<
nghttp2_nv
>
();
auto
nva
=
std
::
vector
<
nghttp2_nv
>
();
...
...
src/asio_client_session_impl.h
View file @
8afd75ca
...
@@ -66,8 +66,9 @@ public:
...
@@ -66,8 +66,9 @@ public:
stream
*
create_push_stream
(
int32_t
stream_id
);
stream
*
create_push_stream
(
int32_t
stream_id
);
stream
*
find_stream
(
int32_t
stream_id
);
stream
*
find_stream
(
int32_t
stream_id
);
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
uri
,
read_cb
cb
,
header_map
h
);
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
read_cb
cb
,
header_map
h
);
virtual
void
start_connect
(
tcp
::
resolver
::
iterator
endpoint_it
)
=
0
;
virtual
void
start_connect
(
tcp
::
resolver
::
iterator
endpoint_it
)
=
0
;
virtual
tcp
::
socket
&
socket
()
=
0
;
virtual
tcp
::
socket
&
socket
()
=
0
;
...
...
src/includes/nghttp2/asio_http2.h
View file @
8afd75ca
...
@@ -287,7 +287,7 @@ public:
...
@@ -287,7 +287,7 @@ public:
response
();
response
();
~
response
();
~
response
();
void
on_data
(
data_cb
cb
);
void
on_data
(
data_cb
cb
)
const
;
int
status_code
()
const
;
int
status_code
()
const
;
...
@@ -303,8 +303,8 @@ private:
...
@@ -303,8 +303,8 @@ private:
class
request
;
class
request
;
using
response_cb
=
std
::
function
<
void
(
response
&
)
>
;
using
response_cb
=
std
::
function
<
void
(
const
response
&
)
>
;
using
request_cb
=
std
::
function
<
void
(
request
&
)
>
;
using
request_cb
=
std
::
function
<
void
(
const
request
&
)
>
;
class
request_impl
;
class
request_impl
;
...
@@ -313,11 +313,11 @@ public:
...
@@ -313,11 +313,11 @@ public:
request
();
request
();
~
request
();
~
request
();
void
on_response
(
response_cb
cb
);
void
on_response
(
response_cb
cb
)
const
;
void
on_push
(
request_cb
cb
);
void
on_push
(
request_cb
cb
)
const
;
void
on_close
(
close_cb
cb
);
void
on_close
(
close_cb
cb
)
const
;
void
cancel
();
void
cancel
()
const
;
const
std
::
string
&
method
()
const
;
const
std
::
string
&
method
()
const
;
const
std
::
string
&
scheme
()
const
;
const
std
::
string
&
scheme
()
const
;
...
@@ -351,12 +351,15 @@ public:
...
@@ -351,12 +351,15 @@ public:
boost
::
asio
::
io_service
&
io_service
();
boost
::
asio
::
io_service
&
io_service
();
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
uri
,
header_map
h
=
{});
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
header_map
h
=
{});
const
std
::
string
&
uri
,
std
::
string
data
,
header_map
h
=
{});
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
const
std
::
string
&
uri
,
read_cb
cb
,
header_map
h
=
{});
std
::
string
data
,
header_map
h
=
{});
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
read_cb
cb
,
header_map
h
=
{});
private:
private:
std
::
unique_ptr
<
session_impl
>
impl_
;
std
::
unique_ptr
<
session_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