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
4b6f124b
Commit
4b6f124b
authored
Jul 03, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add API to check half-closed state for both direction of stream
parent
119fb05c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
21 deletions
+49
-21
lib/includes/nghttp2/nghttp2.h
lib/includes/nghttp2/nghttp2.h
+19
-0
lib/nghttp2_session.c
lib/nghttp2_session.c
+28
-0
src/shrpx_downstream.cc
src/shrpx_downstream.cc
+1
-12
src/shrpx_downstream.h
src/shrpx_downstream.h
+0
-4
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+1
-5
No files found.
lib/includes/nghttp2/nghttp2.h
View file @
4b6f124b
...
@@ -1995,6 +1995,25 @@ int32_t nghttp2_session_get_effective_local_window_size
...
@@ -1995,6 +1995,25 @@ int32_t nghttp2_session_get_effective_local_window_size
int32_t
nghttp2_session_get_stream_remote_window_size
(
nghttp2_session
*
session
,
int32_t
nghttp2_session_get_stream_remote_window_size
(
nghttp2_session
*
session
,
int32_t
stream_id
);
int32_t
stream_id
);
/**
* @function
*
* Returns 1 if local peer half closed the given stream |stream_id|.
* Returns 0 if it did not. Returns -1 if no such stream exists.
*/
int
nghttp2_session_get_stream_local_close
(
nghttp2_session
*
session
,
int32_t
stream_id
);
/**
* @function
*
* Returns 1 if remote peer half closed the given stream |stream_id|.
* Returns 0 if it did not. Returns -1 if no such stream exists.
*/
int
nghttp2_session_get_stream_remote_close
(
nghttp2_session
*
session
,
int32_t
stream_id
);
/**
/**
* @function
* @function
*
*
...
...
lib/nghttp2_session.c
View file @
4b6f124b
...
@@ -5627,3 +5627,31 @@ int nghttp2_session_upgrade(nghttp2_session *session,
...
@@ -5627,3 +5627,31 @@ int nghttp2_session_upgrade(nghttp2_session *session,
}
}
return
0
;
return
0
;
}
}
int
nghttp2_session_get_stream_local_close
(
nghttp2_session
*
session
,
int32_t
stream_id
)
{
nghttp2_stream
*
stream
;
stream
=
nghttp2_session_get_stream
(
session
,
stream_id
);
if
(
!
stream
)
{
return
-
1
;
}
return
(
stream
->
shut_flags
&
NGHTTP2_SHUT_WR
)
!=
0
;
}
int
nghttp2_session_get_stream_remote_close
(
nghttp2_session
*
session
,
int32_t
stream_id
)
{
nghttp2_stream
*
stream
;
stream
=
nghttp2_session_get_stream
(
session
,
stream_id
);
if
(
!
stream
)
{
return
-
1
;
}
return
(
stream
->
shut_flags
&
NGHTTP2_SHUT_RD
)
!=
0
;
}
src/shrpx_downstream.cc
View file @
4b6f124b
...
@@ -67,8 +67,7 @@ Downstream::Downstream(Upstream *upstream, int stream_id, int priority)
...
@@ -67,8 +67,7 @@ Downstream::Downstream(Upstream *upstream, int stream_id, int priority)
request_http2_expect_body_
(
false
),
request_http2_expect_body_
(
false
),
chunked_response_
(
false
),
chunked_response_
(
false
),
response_connection_close_
(
false
),
response_connection_close_
(
false
),
response_header_key_prev_
(
false
),
response_header_key_prev_
(
false
)
rst_stream_after_end_stream_
(
false
)
{}
{}
Downstream
::~
Downstream
()
Downstream
::~
Downstream
()
...
@@ -796,14 +795,4 @@ void Downstream::set_response_rst_stream_error_code
...
@@ -796,14 +795,4 @@ void Downstream::set_response_rst_stream_error_code
response_rst_stream_error_code_
=
error_code
;
response_rst_stream_error_code_
=
error_code
;
}
}
bool
Downstream
::
get_rst_stream_after_end_stream
()
const
{
return
rst_stream_after_end_stream_
;
}
void
Downstream
::
set_rst_stream_after_end_stream
(
bool
f
)
{
rst_stream_after_end_stream_
=
f
;
}
}
// namespace shrpx
}
// namespace shrpx
src/shrpx_downstream.h
View file @
4b6f124b
...
@@ -282,10 +282,6 @@ private:
...
@@ -282,10 +282,6 @@ private:
bool
chunked_response_
;
bool
chunked_response_
;
bool
response_connection_close_
;
bool
response_connection_close_
;
bool
response_header_key_prev_
;
bool
response_header_key_prev_
;
// If true, RST_STREAM with NGHTTP2_NO_ERROR is issued after
// response is closed with END_STREAM.
bool
rst_stream_after_end_stream_
;
};
};
}
// namespace shrpx
}
// namespace shrpx
...
...
src/shrpx_http2_upstream.cc
View file @
4b6f124b
...
@@ -1013,9 +1013,7 @@ ssize_t downstream_data_read_callback(nghttp2_session *session,
...
@@ -1013,9 +1013,7 @@ ssize_t downstream_data_read_callback(nghttp2_session *session,
if
(
!
downstream
->
get_upgraded
())
{
if
(
!
downstream
->
get_upgraded
())
{
*
data_flags
|=
NGHTTP2_DATA_FLAG_EOF
;
*
data_flags
|=
NGHTTP2_DATA_FLAG_EOF
;
if
(
downstream
->
get_rst_stream_after_end_stream
()
&&
if
(
nghttp2_session_get_stream_remote_close
(
session
,
stream_id
)
==
0
)
{
downstream
->
get_request_state
()
!=
Downstream
::
MSG_COMPLETE
)
{
upstream
->
rst_stream
(
downstream
,
NGHTTP2_NO_ERROR
);
upstream
->
rst_stream
(
downstream
,
NGHTTP2_NO_ERROR
);
}
}
}
else
{
}
else
{
...
@@ -1079,8 +1077,6 @@ int Http2Upstream::error_reply(Downstream *downstream,
...
@@ -1079,8 +1077,6 @@ int Http2Upstream::error_reply(Downstream *downstream,
status_code
,
downstream
);
status_code
,
downstream
);
}
}
downstream
->
set_rst_stream_after_end_stream
(
true
);
return
0
;
return
0
;
}
}
...
...
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