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
292f2199
Commit
292f2199
authored
Dec 24, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpd: Avoid sending last 0-sized DATA
parent
55e550f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
src/HttpServer.cc
src/HttpServer.cc
+6
-3
src/HttpServer.h
src/HttpServer.h
+1
-0
No files found.
src/HttpServer.cc
View file @
292f2199
...
@@ -110,8 +110,8 @@ Config::Config()
...
@@ -110,8 +110,8 @@ Config::Config()
Config
::~
Config
()
{
nghttp2_option_del
(
session_option
);
}
Config
::~
Config
()
{
nghttp2_option_del
(
session_option
);
}
Stream
::
Stream
(
Http2Handler
*
handler
,
int32_t
stream_id
)
Stream
::
Stream
(
Http2Handler
*
handler
,
int32_t
stream_id
)
:
handler
(
handler
),
rtimer
(
nullptr
),
wtimer
(
nullptr
),
stream_id
(
stream_id
),
:
handler
(
handler
),
rtimer
(
nullptr
),
wtimer
(
nullptr
),
body_left
(
0
),
file
(
-
1
)
{}
stream_id
(
stream_id
),
file
(
-
1
)
{}
Stream
::~
Stream
()
{
Stream
::~
Stream
()
{
if
(
file
!=
-
1
)
{
if
(
file
!=
-
1
)
{
...
@@ -692,7 +692,8 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id,
...
@@ -692,7 +692,8 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id,
return
NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
;
return
NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
;
}
}
if
(
nread
==
0
)
{
stream
->
body_left
-=
nread
;
if
(
nread
==
0
||
stream
->
body_left
<=
0
)
{
*
data_flags
|=
NGHTTP2_DATA_FLAG_EOF
;
*
data_flags
|=
NGHTTP2_DATA_FLAG_EOF
;
if
(
nghttp2_session_get_stream_remote_close
(
session
,
stream_id
)
==
0
)
{
if
(
nghttp2_session_get_stream_remote_close
(
session
,
stream_id
)
==
0
)
{
...
@@ -747,6 +748,7 @@ void prepare_status_response(Stream *stream, Http2Handler *hd,
...
@@ -747,6 +748,7 @@ void prepare_status_response(Stream *stream, Http2Handler *hd,
close
(
pipefd
[
1
]);
close
(
pipefd
[
1
]);
stream
->
file
=
pipefd
[
0
];
stream
->
file
=
pipefd
[
0
];
stream
->
body_left
=
body
.
size
();
nghttp2_data_provider
data_prd
;
nghttp2_data_provider
data_prd
;
data_prd
.
source
.
fd
=
pipefd
[
0
];
data_prd
.
source
.
fd
=
pipefd
[
0
];
data_prd
.
read_callback
=
file_read_callback
;
data_prd
.
read_callback
=
file_read_callback
;
...
@@ -856,6 +858,7 @@ void prepare_response(Stream *stream, Http2Handler *hd,
...
@@ -856,6 +858,7 @@ void prepare_response(Stream *stream, Http2Handler *hd,
}
}
stream
->
file
=
file
;
stream
->
file
=
file
;
stream
->
body_left
=
buf
.
st_size
;
nghttp2_data_provider
data_prd
;
nghttp2_data_provider
data_prd
;
...
...
src/HttpServer.h
View file @
292f2199
...
@@ -90,6 +90,7 @@ struct Stream {
...
@@ -90,6 +90,7 @@ struct Stream {
Http2Handler
*
handler
;
Http2Handler
*
handler
;
event
*
rtimer
;
event
*
rtimer
;
event
*
wtimer
;
event
*
wtimer
;
int64_t
body_left
;
int32_t
stream_id
;
int32_t
stream_id
;
int
file
;
int
file
;
Stream
(
Http2Handler
*
handler
,
int32_t
stream_id
);
Stream
(
Http2Handler
*
handler
,
int32_t
stream_id
);
...
...
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