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
a6e1a40c
Commit
a6e1a40c
authored
Oct 20, 2014
by
Kenny (kang-yen) Peng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support uri list file input
parent
dd02c4cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
2 deletions
+38
-2
src/h2load.cc
src/h2load.cc
+38
-2
No files found.
src/h2load.cc
View file @
a6e1a40c
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <cassert>
#include <cassert>
#include <cstdlib>
#include <cstdlib>
#include <iostream>
#include <iostream>
#include <fstream>
#include <chrono>
#include <chrono>
#include <thread>
#include <thread>
#include <future>
#include <future>
...
@@ -605,7 +606,9 @@ void print_version(std::ostream& out)
...
@@ -605,7 +606,9 @@ void print_version(std::ostream& out)
namespace
{
namespace
{
void
print_usage
(
std
::
ostream
&
out
)
void
print_usage
(
std
::
ostream
&
out
)
{
{
out
<<
R"(Usage: h2load [OPTIONS]... <URI>...
out
<<
R"(
Usage: h2load [OPTIONS]... <URI>...
h2load [OPTIONS]... <URI_LIST_FILE>
benchmarking tool for HTTP/2 and SPDY server)"
<<
std
::
endl
;
benchmarking tool for HTTP/2 and SPDY server)"
<<
std
::
endl
;
}
}
}
// namespace
}
// namespace
...
@@ -623,6 +626,13 @@ void print_help(std::ostream& out)
...
@@ -623,6 +626,13 @@ void print_help(std::ostream& out)
host and port in the subsequent URIs, if present,
host and port in the subsequent URIs, if present,
are ignored. Those in the first URI are used
are ignored. Those in the first URI are used
solely.
solely.
<URI_LIST_FILE> Path of a file with multiple URIs are seperated
by EOLs. URIs are used in this order for each
client. All URIs are used, then first URI is
used and then 2nd URI, and so on. The scheme,
host and port in the subsequent URIs, if present,
are ignored. Those in the first URI are used
solely.
Options:
Options:
-n, --requests=<N> Number of requests. Default: )"
-n, --requests=<N> Number of requests. Default: )"
<<
config
.
nreqs
<<
R"(
<<
config
.
nreqs
<<
R"(
...
@@ -857,9 +867,20 @@ int main(int argc, char **argv)
...
@@ -857,9 +867,20 @@ int main(int argc, char **argv)
http_parser_url
u
;
http_parser_url
u
;
memset
(
&
u
,
0
,
sizeof
(
u
));
memset
(
&
u
,
0
,
sizeof
(
u
));
auto
uri
=
argv
[
optind
];
auto
uri
=
argv
[
optind
];
std
::
cout
<<
uri
<<
std
::
endl
;
std
::
ifstream
uri_file
;
std
::
string
line_uri
;
if
(
std
::
ifstream
(
uri
))
{
uri_file
.
open
(
uri
,
std
::
ifstream
::
in
);
std
::
getline
(
uri_file
,
line_uri
);
uri
=
(
char
*
)
line_uri
.
c_str
();
}
if
(
http_parser_parse_url
(
uri
,
strlen
(
uri
),
0
,
&
u
)
!=
0
||
if
(
http_parser_parse_url
(
uri
,
strlen
(
uri
),
0
,
&
u
)
!=
0
||
!
util
::
has_uri_field
(
u
,
UF_SCHEMA
)
||
!
util
::
has_uri_field
(
u
,
UF_HOST
))
{
!
util
::
has_uri_field
(
u
,
UF_SCHEMA
)
||
!
util
::
has_uri_field
(
u
,
UF_HOST
))
{
std
::
cerr
<<
"invalid URI: "
<<
uri
<<
std
::
endl
;
std
::
cerr
<<
"invalid URI
/URI_LIST_FILE
: "
<<
uri
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -889,6 +910,21 @@ int main(int argc, char **argv)
...
@@ -889,6 +910,21 @@ int main(int argc, char **argv)
reqlines
.
push_back
(
get_reqline
(
uri
,
u
));
reqlines
.
push_back
(
get_reqline
(
uri
,
u
));
}
}
if
(
uri_file
.
is_open
())
{
//load rest uris from URI_LIST_FILE
while
(
std
::
getline
(
uri_file
,
line_uri
))
{
auto
uri
=
(
char
*
)
line_uri
.
c_str
();
if
(
http_parser_parse_url
(
uri
,
strlen
(
uri
),
0
,
&
u
)
!=
0
)
{
std
::
cerr
<<
"invalid URI in URI_LIST_FILE: "
<<
uri
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
}
reqlines
.
push_back
(
get_reqline
(
uri
,
u
));
}
uri_file
.
close
();
}
if
(
config
.
max_concurrent_streams
==
-
1
)
{
if
(
config
.
max_concurrent_streams
==
-
1
)
{
config
.
max_concurrent_streams
=
reqlines
.
size
();
config
.
max_concurrent_streams
=
reqlines
.
size
();
}
}
...
...
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