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
9f9c0cbc
Commit
9f9c0cbc
authored
Jul 28, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpd: Add -F and -f option to disable connection/stream level flow control
parent
56db10cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
6 deletions
+42
-6
src/HttpServer.cc
src/HttpServer.cc
+26
-4
src/HttpServer.h
src/HttpServer.h
+2
-0
src/nghttpd.cc
src/nghttpd.cc
+14
-2
No files found.
src/HttpServer.cc
View file @
9f9c0cbc
...
...
@@ -72,6 +72,8 @@ Config::Config()
data_ptr
(
nullptr
),
verify_client
(
false
),
no_tls
(
false
),
no_connection_flow_control
(
false
),
no_stream_flow_control
(
false
),
output_upper_thres
(
1024
*
1024
)
{}
...
...
@@ -346,13 +348,28 @@ int Http2Handler::on_connect()
if
(
r
!=
0
)
{
return
r
;
}
nghttp2_settings_entry
entry
;
entry
.
settings_id
=
NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
;
entry
.
value
=
NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS
;
r
=
nghttp2_submit_settings
(
session_
,
&
entry
,
1
);
nghttp2_settings_entry
entry
[
2
];
size_t
niv
=
1
;
entry
[
0
].
settings_id
=
NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
;
entry
[
0
].
value
=
NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS
;
if
(
sessions_
->
get_config
()
->
no_connection_flow_control
&&
sessions_
->
get_config
()
->
no_stream_flow_control
)
{
entry
[
niv
].
settings_id
=
NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS
;
entry
[
niv
].
value
=
1
;
++
niv
;
}
r
=
nghttp2_submit_settings
(
session_
,
entry
,
niv
);
if
(
r
!=
0
)
{
return
r
;
}
if
(
sessions_
->
get_config
()
->
no_connection_flow_control
&&
!
sessions_
->
get_config
()
->
no_stream_flow_control
)
{
r
=
nghttp2_submit_window_update
(
session_
,
NGHTTP2_FLAG_END_FLOW_CONTROL
,
0
,
0
);
if
(
r
!=
0
)
{
return
r
;
}
}
return
on_write
();
}
...
...
@@ -698,6 +715,11 @@ void hd_on_frame_recv_callback
auto
req
=
util
::
make_unique
<
Request
>
(
stream_id
);
append_nv
(
req
.
get
(),
frame
->
headers
.
nva
,
frame
->
headers
.
nvlen
);
hd
->
add_stream
(
stream_id
,
std
::
move
(
req
));
if
(
!
hd
->
get_config
()
->
no_connection_flow_control
&&
hd
->
get_config
()
->
no_stream_flow_control
)
{
nghttp2_submit_window_update
(
session
,
NGHTTP2_FLAG_END_FLOW_CONTROL
,
stream_id
,
0
);
}
break
;
}
case
NGHTTP2_HCAT_HEADERS
:
...
...
src/HttpServer.h
View file @
9f9c0cbc
...
...
@@ -57,6 +57,8 @@ struct Config {
void
*
data_ptr
;
bool
verify_client
;
bool
no_tls
;
bool
no_connection_flow_control
;
bool
no_stream_flow_control
;
size_t
output_upper_thres
;
Config
();
};
...
...
src/nghttpd.cc
View file @
9f9c0cbc
...
...
@@ -45,7 +45,7 @@ namespace nghttp2 {
namespace
{
void
print_usage
(
std
::
ostream
&
out
)
{
out
<<
"Usage: nghttpd [-
DV
hv] [-d <PATH>] [--no-tls] <PORT> [<PRIVATE_KEY> <CERT>]"
out
<<
"Usage: nghttpd [-
FDVf
hv] [-d <PATH>] [--no-tls] <PORT> [<PRIVATE_KEY> <CERT>]"
<<
std
::
endl
;
}
}
// namespace
...
...
@@ -73,6 +73,10 @@ void print_help(std::ostream& out)
<<
" -v, --verbose Print debug information such as reception/
\n
"
<<
" transmission of frames and name/value pairs.
\n
"
<<
" --no-tls Disable SSL/TLS.
\n
"
<<
" -F, --no-connection-flow-control
\n
"
<<
" Disables connection level flow control.
\n
"
<<
" -f, --no-stream-flow-control
\n
"
<<
" Disables stream level flow control.
\n
"
<<
" -h, --help Print this help.
\n
"
<<
std
::
endl
;
}
...
...
@@ -90,14 +94,19 @@ int main(int argc, char **argv)
{
"verbose"
,
no_argument
,
0
,
'v'
},
{
"verify-client"
,
no_argument
,
0
,
'V'
},
{
"no-tls"
,
no_argument
,
&
flag
,
1
},
{
"no-connection-flow-control"
,
no_argument
,
0
,
'F'
},
{
"no-stream-flow-control"
,
no_argument
,
0
,
'f'
},
{
0
,
0
,
0
,
0
}
};
int
option_index
=
0
;
int
c
=
getopt_long
(
argc
,
argv
,
"
DVd:
hv"
,
long_options
,
&
option_index
);
int
c
=
getopt_long
(
argc
,
argv
,
"
FDVd:f
hv"
,
long_options
,
&
option_index
);
if
(
c
==
-
1
)
{
break
;
}
switch
(
c
)
{
case
'F'
:
config
.
no_connection_flow_control
=
true
;
break
;
case
'D'
:
config
.
daemon
=
true
;
break
;
...
...
@@ -107,6 +116,9 @@ int main(int argc, char **argv)
case
'd'
:
config
.
htdocs
=
optarg
;
break
;
case
'f'
:
config
.
no_stream_flow_control
=
true
;
break
;
case
'h'
:
print_help
(
std
::
cout
);
exit
(
EXIT_SUCCESS
);
...
...
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