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
d830e099
Commit
d830e099
authored
Feb 11, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shrpx: Send pending response data before RST_STREAM in tunnel connection
parent
98d18e64
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
12 deletions
+49
-12
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+14
-0
src/shrpx_spdy_session.cc
src/shrpx_spdy_session.cc
+16
-3
src/shrpx_spdy_upstream.cc
src/shrpx_spdy_upstream.cc
+19
-9
No files found.
src/shrpx_https_upstream.cc
View file @
d830e099
...
...
@@ -378,6 +378,20 @@ void https_downstream_readcb(bufferevent *bev, void *ptr)
delete
upstream
->
get_client_handler
();
}
else
if
(
rv
==
0
)
{
if
(
downstream
->
get_response_state
()
==
Downstream
::
MSG_COMPLETE
)
{
if
(
get_config
()
->
client_mode
&&
downstream
->
tunnel_established
())
{
// For tunneled connection, if there is no pending data,
// delete handler because on_write will not be called.
ClientHandler
*
handler
=
upstream
->
get_client_handler
();
if
(
handler
->
get_pending_write_length
()
==
0
)
{
delete
handler
;
}
else
{
if
(
LOG_ENABLED
(
INFO
))
{
DLOG
(
INFO
,
downstream
)
<<
"Tunneled connection has pending data"
;
}
handler
->
set_should_close_after_write
(
true
);
}
return
;
}
if
(
downstream
->
get_response_connection_close
())
{
// Connection close
downstream
->
set_downstream_connection
(
0
);
...
...
src/shrpx_spdy_session.cc
View file @
d830e099
...
...
@@ -697,9 +697,22 @@ void on_ctrl_recv_callback
if
(
downstream
&&
downstream
->
get_downstream_stream_id
()
==
frame
->
rst_stream
.
stream_id
)
{
// If we got RST_STREAM, just flag MSG_RESET to indicate
// upstream connection must be terminated.
downstream
->
set_response_state
(
Downstream
::
MSG_RESET
);
if
(
downstream
->
tunnel_established
()
&&
downstream
->
get_response_state
()
==
Downstream
::
HEADER_COMPLETE
)
{
// For tunneled connection, we has to submit RST_STREAM to
// upstream *after* whole response body is sent. We just set
// MSG_COMPLETE here. Upstream will take care of that.
if
(
LOG_ENABLED
(
INFO
))
{
SSLOG
(
INFO
,
spdy
)
<<
"RST_STREAM against tunneled stream "
<<
"stream_id="
<<
frame
->
rst_stream
.
stream_id
;
}
downstream
->
set_response_state
(
Downstream
::
MSG_COMPLETE
);
}
else
{
// If we got RST_STREAM, just flag MSG_RESET to indicate
// upstream connection must be terminated.
downstream
->
set_response_state
(
Downstream
::
MSG_RESET
);
}
call_downstream_readcb
(
spdy
,
downstream
);
}
}
...
...
src/shrpx_spdy_upstream.cc
View file @
d830e099
...
...
@@ -543,11 +543,12 @@ void spdy_downstream_eventcb(bufferevent *bev, short events, void *ptr)
ULOG
(
INFO
,
upstream
)
<<
"Downstream body was ended by EOF"
;
}
downstream
->
set_response_state
(
Downstream
::
MSG_COMPLETE
);
if
(
downstream
->
tunnel_established
())
{
upstream
->
rst_stream
(
downstream
,
SPDYLAY_INTERNAL_ERROR
);
}
else
{
upstream
->
on_downstream_body_complete
(
downstream
);
}
// For tunneled connection, MSG_COMPLETE signals
// spdy_data_read_callback to send RST_STREAM after pending
// response body is sent. This is needed to ensure that
// RST_STREAM is sent after all pending data are sent.
upstream
->
on_downstream_body_complete
(
downstream
);
}
else
if
(
downstream
->
get_response_state
()
==
Downstream
::
MSG_COMPLETE
)
{
// For SSL tunneling?
upstream
->
rst_stream
(
downstream
,
SPDYLAY_INTERNAL_ERROR
);
...
...
@@ -661,11 +662,20 @@ ssize_t spdy_data_read_callback(spdylay_session *session,
evbuffer
*
body
=
downstream
->
get_response_body_buf
();
assert
(
body
);
int
nread
=
evbuffer_remove
(
body
,
buf
,
length
);
// For tunneling, DATA stream is endless
if
(
!
downstream
->
tunnel_established
()
&&
nread
==
0
&&
if
(
nread
==
0
&&
downstream
->
get_response_state
()
==
Downstream
::
MSG_COMPLETE
)
{
*
eof
=
1
;
if
(
!
downstream
->
tunnel_established
())
{
*
eof
=
1
;
}
else
{
// For tunneling, issue RST_STREAM to finish the stream.
SpdyUpstream
*
upstream
;
upstream
=
reinterpret_cast
<
SpdyUpstream
*>
(
downstream
->
get_upstream
());
if
(
LOG_ENABLED
(
INFO
))
{
ULOG
(
INFO
,
upstream
)
<<
"RST_STREAM to tunneled stream stream_id="
<<
stream_id
;
}
upstream
->
rst_stream
(
downstream
,
SPDYLAY_CANCEL
);
}
}
if
(
nread
==
0
&&
*
eof
!=
1
)
{
return
SPDYLAY_ERR_DEFERRED
;
...
...
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