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
ff0eaf83
Commit
ff0eaf83
authored
Mar 04, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asio: Indicate EOF by passing 0 to the second parameter to data_cb
parent
7fb7575f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
18 deletions
+4
-18
src/asio_http2_handler.cc
src/asio_http2_handler.cc
+2
-12
src/asio_http2_handler.h
src/asio_http2_handler.h
+0
-3
src/includes/nghttp2/asio_http2.h
src/includes/nghttp2/asio_http2.h
+2
-0
src/includes/nghttp2/asio_http2_server.h
src/includes/nghttp2/asio_http2_server.h
+0
-3
No files found.
src/asio_http2_handler.cc
View file @
ff0eaf83
...
...
@@ -57,8 +57,6 @@ void request::on_data(data_cb cb) const {
return
impl_
->
on_data
(
std
::
move
(
cb
));
}
void
request
::
on_end
(
void_cb
cb
)
const
{
return
impl_
->
on_end
(
std
::
move
(
cb
));
}
request_impl
&
request
::
impl
()
const
{
return
*
impl_
;
}
response
::
response
()
:
impl_
(
make_unique
<
response_impl
>
())
{}
...
...
@@ -108,8 +106,6 @@ void request_impl::pushed(bool f) { pushed_ = f; }
void
request_impl
::
on_data
(
data_cb
cb
)
{
on_data_cb_
=
std
::
move
(
cb
);
}
void
request_impl
::
on_end
(
void_cb
cb
)
{
on_end_cb_
=
std
::
move
(
cb
);
}
void
request_impl
::
stream
(
http2_stream
*
s
)
{
stream_
=
s
;
}
void
request_impl
::
call_on_data
(
const
uint8_t
*
data
,
std
::
size_t
len
)
{
...
...
@@ -118,12 +114,6 @@ void request_impl::call_on_data(const uint8_t *data, std::size_t len) {
}
}
void
request_impl
::
call_on_end
()
{
if
(
on_end_cb_
)
{
on_end_cb_
();
}
}
response_impl
::
response_impl
()
:
stream_
(
nullptr
),
status_code_
(
200
),
started_
(
false
)
{}
...
...
@@ -288,7 +278,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame,
}
if
(
frame
->
hd
.
flags
&
NGHTTP2_FLAG_END_STREAM
)
{
stream
->
request
().
impl
().
call_on_
end
(
);
stream
->
request
().
impl
().
call_on_
data
(
nullptr
,
0
);
}
break
;
...
...
@@ -300,7 +290,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame,
handler
->
call_on_request
(
*
stream
);
if
(
frame
->
hd
.
flags
&
NGHTTP2_FLAG_END_STREAM
)
{
stream
->
request
().
impl
().
call_on_
end
(
);
stream
->
request
().
impl
().
call_on_
data
(
nullptr
,
0
);
}
break
;
...
...
src/asio_http2_handler.h
View file @
ff0eaf83
...
...
@@ -62,12 +62,10 @@ public:
bool
pushed
()
const
;
void
on_data
(
data_cb
cb
);
void
on_end
(
void_cb
cb
);
void
pushed
(
bool
f
);
void
stream
(
http2_stream
*
s
);
void
call_on_data
(
const
uint8_t
*
data
,
std
::
size_t
len
);
void
call_on_end
();
private:
http2_stream
*
stream_
;
...
...
@@ -75,7 +73,6 @@ private:
std
::
string
method_
;
uri_ref
uri_
;
data_cb
on_data_cb_
;
void_cb
on_end_cb_
;
bool
pushed_
;
};
...
...
src/includes/nghttp2/asio_http2.h
View file @
ff0eaf83
...
...
@@ -71,6 +71,8 @@ struct uri_ref {
std
::
string
fragment
;
};
// Callback function when data is arrived. EOF is indicated by
// passing 0 to the second parameter.
typedef
std
::
function
<
void
(
const
uint8_t
*
,
std
::
size_t
)
>
data_cb
;
typedef
std
::
function
<
void
(
void
)
>
void_cb
;
typedef
std
::
function
<
void
(
const
boost
::
system
::
error_code
&
ec
)
>
error_cb
;
...
...
src/includes/nghttp2/asio_http2_server.h
View file @
ff0eaf83
...
...
@@ -54,9 +54,6 @@ public:
// Sets callback when chunk of request body is received.
void
on_data
(
data_cb
cb
)
const
;
// Sets callback when request was completed.
void
on_end
(
void_cb
cb
)
const
;
// Pushes resource denoted by |path| using |method|. The additional
// headers can be given in |h|. request_cb will be called for
// pushed resource later on. This function returns true if it
...
...
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