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
f8472f47
Commit
f8472f47
authored
Jan 15, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Remove backend priority handling code
Currently, this does not do anything useful.
parent
698f0059
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
23 additions
and
103 deletions
+23
-103
src/shrpx_downstream.cc
src/shrpx_downstream.cc
+2
-14
src/shrpx_downstream.h
src/shrpx_downstream.h
+1
-13
src/shrpx_downstream_connection.h
src/shrpx_downstream_connection.h
+0
-1
src/shrpx_downstream_test.cc
src/shrpx_downstream_test.cc
+4
-4
src/shrpx_http2_downstream_connection.cc
src/shrpx_http2_downstream_connection.cc
+2
-22
src/shrpx_http2_downstream_connection.h
src/shrpx_http2_downstream_connection.h
+0
-1
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+1
-25
src/shrpx_http2_session.h
src/shrpx_http2_session.h
+2
-5
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+3
-5
src/shrpx_http_downstream_connection.h
src/shrpx_http_downstream_connection.h
+0
-1
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+2
-5
src/shrpx_spdy_upstream.cc
src/shrpx_spdy_upstream.cc
+5
-6
src/shrpx_spdy_upstream.h
src/shrpx_spdy_upstream.h
+1
-1
No files found.
src/shrpx_downstream.cc
View file @
f8472f47
...
...
@@ -112,12 +112,12 @@ void downstream_wtimeoutcb(struct ev_loop *loop, ev_timer *w, int revents) {
// upstream could be nullptr for unittests
Downstream
::
Downstream
(
Upstream
*
upstream
,
MemchunkPool
*
mcpool
,
int32_t
stream_id
,
int32_t
priority
)
int32_t
stream_id
)
:
dlnext
(
nullptr
),
dlprev
(
nullptr
),
response_sent_body_length
(
0
),
request_start_time_
(
std
::
chrono
::
high_resolution_clock
::
now
()),
request_buf_
(
mcpool
),
response_buf_
(
mcpool
),
upstream_
(
upstream
),
blocked_link_
(
nullptr
),
num_retry_
(
0
),
stream_id_
(
stream_id
),
priority_
(
priority
),
downstream_stream_id_
(
-
1
),
downstream_stream_id_
(
-
1
),
response_rst_stream_error_code_
(
NGHTTP2_NO_ERROR
),
request_state_
(
INITIAL
),
response_state_
(
INITIAL
),
dispatch_state_
(
DISPATCH_NONE
),
upgraded_
(
false
),
chunked_request_
(
false
),
...
...
@@ -604,14 +604,6 @@ int Downstream::on_read() {
return
dconn_
->
on_read
();
}
int
Downstream
::
change_priority
(
int32_t
pri
)
{
if
(
!
dconn_
)
{
DLOG
(
INFO
,
this
)
<<
"dconn_ is NULL"
;
return
-
1
;
}
return
dconn_
->
on_priority_change
(
pri
);
}
void
Downstream
::
set_response_state
(
int
state
)
{
response_state_
=
state
;
}
int
Downstream
::
get_response_state
()
const
{
return
response_state_
;
}
...
...
@@ -661,10 +653,6 @@ bool Downstream::validate_response_recv_body_length() const {
return
true
;
}
void
Downstream
::
set_priority
(
int32_t
pri
)
{
priority_
=
pri
;
}
int32_t
Downstream
::
get_priority
()
const
{
return
priority_
;
}
void
Downstream
::
check_upgrade_fulfilled
()
{
if
(
req_
.
method
==
HTTP_CONNECT
)
{
upgraded_
=
200
<=
resp_
.
http_status
&&
resp_
.
http_status
<
300
;
...
...
src/shrpx_downstream.h
View file @
f8472f47
...
...
@@ -191,15 +191,12 @@ struct Response {
class
Downstream
{
public:
Downstream
(
Upstream
*
upstream
,
MemchunkPool
*
mcpool
,
int32_t
stream_id
,
int32_t
priority
);
Downstream
(
Upstream
*
upstream
,
MemchunkPool
*
mcpool
,
int32_t
stream_id
);
~
Downstream
();
void
reset_upstream
(
Upstream
*
upstream
);
Upstream
*
get_upstream
()
const
;
void
set_stream_id
(
int32_t
stream_id
);
int32_t
get_stream_id
()
const
;
void
set_priority
(
int32_t
pri
);
int32_t
get_priority
()
const
;
void
pause_read
(
IOCtrlReason
reason
);
int
resume_read
(
IOCtrlReason
reason
,
size_t
consumed
);
void
force_resume_read
();
...
...
@@ -316,12 +313,6 @@ public:
// connection.
int
on_read
();
// Change the priority of downstream
int
change_priority
(
int32_t
pri
);
bool
get_rst_stream_after_end_stream
()
const
;
void
set_rst_stream_after_end_stream
(
bool
f
);
// Resets upstream read timer. If it is active, timeout value is
// reset. If it is not active, timer will be started.
void
reset_upstream_rtimer
();
...
...
@@ -411,9 +402,6 @@ private:
size_t
num_retry_
;
// The stream ID in frontend connection
int32_t
stream_id_
;
// The priority value in frontend connection, currently not used in
// a meaningful way.
int32_t
priority_
;
// stream ID in backend connection
int32_t
downstream_stream_id_
;
// RST_STREAM error_code from downstream HTTP2 connection
...
...
src/shrpx_downstream_connection.h
View file @
f8472f47
...
...
@@ -56,7 +56,6 @@ public:
virtual
int
on_timeout
()
{
return
0
;
}
virtual
void
on_upstream_change
(
Upstream
*
uptream
)
=
0
;
virtual
int
on_priority_change
(
int32_t
pri
)
=
0
;
virtual
size_t
get_group
()
const
=
0
;
// true if this object is poolable.
...
...
src/shrpx_downstream_test.cc
View file @
f8472f47
...
...
@@ -72,7 +72,7 @@ void test_downstream_field_store_header(void) {
}
void
test_downstream_crumble_request_cookie
(
void
)
{
Downstream
d
(
nullptr
,
nullptr
,
0
,
0
);
Downstream
d
(
nullptr
,
nullptr
,
0
);
auto
&
req
=
d
.
request
();
req
.
fs
.
add_header
(
":method"
,
"get"
);
req
.
fs
.
add_header
(
":path"
,
"/"
);
...
...
@@ -112,7 +112,7 @@ void test_downstream_crumble_request_cookie(void) {
}
void
test_downstream_assemble_request_cookie
(
void
)
{
Downstream
d
(
nullptr
,
nullptr
,
0
,
0
);
Downstream
d
(
nullptr
,
nullptr
,
0
);
auto
&
req
=
d
.
request
();
req
.
fs
.
add_header
(
":method"
,
"get"
);
req
.
fs
.
add_header
(
":path"
,
"/"
);
...
...
@@ -125,7 +125,7 @@ void test_downstream_assemble_request_cookie(void) {
void
test_downstream_rewrite_location_response_header
(
void
)
{
{
Downstream
d
(
nullptr
,
nullptr
,
0
,
0
);
Downstream
d
(
nullptr
,
nullptr
,
0
);
auto
&
req
=
d
.
request
();
auto
&
resp
=
d
.
response
();
d
.
set_request_downstream_host
(
"localhost:3000"
);
...
...
@@ -138,7 +138,7 @@ void test_downstream_rewrite_location_response_header(void) {
CU_ASSERT
(
"https://localhost/"
==
(
*
location
).
value
);
}
{
Downstream
d
(
nullptr
,
nullptr
,
0
,
0
);
Downstream
d
(
nullptr
,
nullptr
,
0
);
auto
&
req
=
d
.
request
();
auto
&
resp
=
d
.
response
();
d
.
set_request_downstream_host
(
"localhost"
);
...
...
src/shrpx_http2_downstream_connection.cc
View file @
f8472f47
...
...
@@ -390,11 +390,9 @@ int Http2DownstreamConnection::push_request_headers() {
nghttp2_data_provider
data_prd
;
data_prd
.
source
.
ptr
=
this
;
data_prd
.
read_callback
=
http2_data_read_callback
;
rv
=
http2session_
->
submit_request
(
this
,
downstream_
->
get_priority
(),
nva
.
data
(),
nva
.
size
(),
&
data_prd
);
rv
=
http2session_
->
submit_request
(
this
,
nva
.
data
(),
nva
.
size
(),
&
data_prd
);
}
else
{
rv
=
http2session_
->
submit_request
(
this
,
downstream_
->
get_priority
(),
nva
.
data
(),
nva
.
size
(),
nullptr
);
rv
=
http2session_
->
submit_request
(
this
,
nva
.
data
(),
nva
.
size
(),
nullptr
);
}
if
(
rv
!=
0
)
{
DCLOG
(
FATAL
,
this
)
<<
"nghttp2_submit_request() failed"
;
...
...
@@ -496,24 +494,6 @@ StreamData *Http2DownstreamConnection::detach_stream_data() {
return
nullptr
;
}
int
Http2DownstreamConnection
::
on_priority_change
(
int32_t
pri
)
{
int
rv
;
if
(
downstream_
->
get_priority
()
==
pri
)
{
return
0
;
}
downstream_
->
set_priority
(
pri
);
if
(
http2session_
->
get_state
()
!=
Http2Session
::
CONNECTED
)
{
return
0
;
}
rv
=
http2session_
->
submit_priority
(
this
,
pri
);
if
(
rv
!=
0
)
{
DLOG
(
FATAL
,
this
)
<<
"nghttp2_submit_priority() failed"
;
return
-
1
;
}
http2session_
->
signal_write
();
return
0
;
}
int
Http2DownstreamConnection
::
on_timeout
()
{
if
(
!
downstream_
)
{
return
0
;
...
...
src/shrpx_http2_downstream_connection.h
View file @
f8472f47
...
...
@@ -60,7 +60,6 @@ public:
virtual
int
on_timeout
();
virtual
void
on_upstream_change
(
Upstream
*
upstream
)
{}
virtual
int
on_priority_change
(
int32_t
pri
);
virtual
size_t
get_group
()
const
;
// This object is not poolable because we dont' have facility to
...
...
src/shrpx_http2_session.cc
View file @
f8472f47
...
...
@@ -567,7 +567,7 @@ void Http2Session::remove_stream_data(StreamData *sd) {
delete
sd
;
}
int
Http2Session
::
submit_request
(
Http2DownstreamConnection
*
dconn
,
int32_t
pri
,
int
Http2Session
::
submit_request
(
Http2DownstreamConnection
*
dconn
,
const
nghttp2_nv
*
nva
,
size_t
nvlen
,
const
nghttp2_data_provider
*
data_prd
)
{
assert
(
state_
==
CONNECTED
);
...
...
@@ -605,30 +605,6 @@ int Http2Session::submit_rst_stream(int32_t stream_id, uint32_t error_code) {
return
0
;
}
int
Http2Session
::
submit_priority
(
Http2DownstreamConnection
*
dconn
,
int32_t
pri
)
{
assert
(
state_
==
CONNECTED
);
if
(
!
dconn
)
{
return
0
;
}
int
rv
;
// TODO Disabled temporarily
// rv = nghttp2_submit_priority(session_, NGHTTP2_FLAG_NONE,
// dconn->get_downstream()->
// get_downstream_stream_id(), pri);
rv
=
0
;
if
(
rv
<
NGHTTP2_ERR_FATAL
)
{
SSLOG
(
FATAL
,
this
)
<<
"nghttp2_submit_priority() failed: "
<<
nghttp2_strerror
(
rv
);
return
-
1
;
}
return
0
;
}
nghttp2_session
*
Http2Session
::
get_session
()
const
{
return
session_
;
}
bool
Http2Session
::
get_flow_control
()
const
{
return
flow_control_
;
}
...
...
src/shrpx_http2_session.h
View file @
f8472f47
...
...
@@ -74,14 +74,11 @@ public:
void
remove_stream_data
(
StreamData
*
sd
);
int
submit_request
(
Http2DownstreamConnection
*
dconn
,
int32_t
pri
,
const
nghttp2_nv
*
nva
,
size_t
nvlen
,
const
nghttp2_data_provider
*
data_prd
);
int
submit_request
(
Http2DownstreamConnection
*
dconn
,
const
nghttp2_nv
*
nva
,
size_t
nvlen
,
const
nghttp2_data_provider
*
data_prd
);
int
submit_rst_stream
(
int32_t
stream_id
,
uint32_t
error_code
);
int
submit_priority
(
Http2DownstreamConnection
*
dconn
,
int32_t
pri
);
int
terminate_session
(
uint32_t
error_code
);
nghttp2_session
*
get_session
()
const
;
...
...
src/shrpx_http2_upstream.cc
View file @
f8472f47
...
...
@@ -127,7 +127,6 @@ int Http2Upstream::upgrade_upstream(HttpsUpstream *http) {
downstream
->
set_stream_id
(
1
);
downstream
->
reset_upstream_rtimer
();
downstream
->
set_stream_id
(
1
);
downstream
->
set_priority
(
0
);
auto
ptr
=
downstream
.
get
();
...
...
@@ -226,9 +225,8 @@ int on_begin_headers_callback(nghttp2_session *session,
auto
handler
=
upstream
->
get_client_handler
();
// TODO Use priority 0 for now
auto
downstream
=
make_unique
<
Downstream
>
(
upstream
,
handler
->
get_mcpool
(),
frame
->
hd
.
stream_id
,
0
);
frame
->
hd
.
stream_id
);
nghttp2_session_set_stream_user_data
(
session
,
frame
->
hd
.
stream_id
,
downstream
.
get
());
...
...
@@ -553,7 +551,7 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame,
}
auto
downstream
=
make_unique
<
Downstream
>
(
upstream
,
handler
->
get_mcpool
(),
promised_stream_id
,
0
);
promised_stream_id
);
auto
&
req
=
downstream
->
request
();
// As long as we use nghttp2_session_mem_send(), setting stream
...
...
@@ -1953,7 +1951,7 @@ Http2Upstream::on_downstream_push_promise(Downstream *downstream,
// promised_stream_id is for backend HTTP/2 session, not for
// frontend.
auto
promised_downstream
=
make_unique
<
Downstream
>
(
this
,
handler_
->
get_mcpool
(),
0
,
0
);
make_unique
<
Downstream
>
(
this
,
handler_
->
get_mcpool
(),
0
);
auto
&
promised_req
=
promised_downstream
->
request
();
promised_downstream
->
set_downstream_stream_id
(
promised_stream_id
);
...
...
src/shrpx_http_downstream_connection.h
View file @
f8472f47
...
...
@@ -57,7 +57,6 @@ public:
virtual
int
on_write
();
virtual
void
on_upstream_change
(
Upstream
*
upstream
);
virtual
int
on_priority_change
(
int32_t
pri
)
{
return
0
;
}
virtual
size_t
get_group
()
const
;
virtual
bool
poolable
()
const
{
return
true
;
}
...
...
src/shrpx_https_upstream.cc
View file @
f8472f47
...
...
@@ -71,9 +71,7 @@ int htp_msg_begin(http_parser *htp) {
auto
handler
=
upstream
->
get_client_handler
();
// TODO specify 0 as priority for now
auto
downstream
=
make_unique
<
Downstream
>
(
upstream
,
handler
->
get_mcpool
(),
0
,
0
);
auto
downstream
=
make_unique
<
Downstream
>
(
upstream
,
handler
->
get_mcpool
(),
0
);
upstream
->
attach_downstream
(
std
::
move
(
downstream
));
...
...
@@ -810,8 +808,7 @@ void HttpsUpstream::error_reply(unsigned int status_code) {
auto
downstream
=
get_downstream
();
if
(
!
downstream
)
{
attach_downstream
(
make_unique
<
Downstream
>
(
this
,
handler_
->
get_mcpool
(),
1
,
1
));
attach_downstream
(
make_unique
<
Downstream
>
(
this
,
handler_
->
get_mcpool
(),
1
));
downstream
=
get_downstream
();
}
...
...
src/shrpx_spdy_upstream.cc
View file @
f8472f47
...
...
@@ -146,8 +146,8 @@ void on_ctrl_recv_callback(spdylay_session *session, spdylay_frame_type type,
<<
frame
->
syn_stream
.
stream_id
;
}
auto
downstream
=
upstream
->
add_pending_downstream
(
frame
->
syn_stream
.
stream_id
,
frame
->
syn_stream
.
pri
);
auto
downstream
=
upstream
->
add_pending_downstream
(
frame
->
syn_stream
.
stream_id
);
auto
&
req
=
downstream
->
request
();
...
...
@@ -913,10 +913,9 @@ int SpdyUpstream::error_reply(Downstream *downstream,
return
0
;
}
Downstream
*
SpdyUpstream
::
add_pending_downstream
(
int32_t
stream_id
,
int32_t
priority
)
{
auto
downstream
=
make_unique
<
Downstream
>
(
this
,
handler_
->
get_mcpool
(),
stream_id
,
priority
);
Downstream
*
SpdyUpstream
::
add_pending_downstream
(
int32_t
stream_id
)
{
auto
downstream
=
make_unique
<
Downstream
>
(
this
,
handler_
->
get_mcpool
(),
stream_id
);
spdylay_session_set_stream_user_data
(
session_
,
stream_id
,
downstream
.
get
());
auto
res
=
downstream
.
get
();
...
...
src/shrpx_spdy_upstream.h
View file @
f8472f47
...
...
@@ -56,7 +56,7 @@ public:
virtual
int
downstream_write
(
DownstreamConnection
*
dconn
);
virtual
int
downstream_eof
(
DownstreamConnection
*
dconn
);
virtual
int
downstream_error
(
DownstreamConnection
*
dconn
,
int
events
);
Downstream
*
add_pending_downstream
(
int32_t
stream_id
,
int32_t
priority
);
Downstream
*
add_pending_downstream
(
int32_t
stream_id
);
void
remove_downstream
(
Downstream
*
downstream
);
int
rst_stream
(
Downstream
*
downstream
,
int
status_code
);
...
...
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