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
54d5dda6
Commit
54d5dda6
authored
Feb 14, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spdycat: Add --multiply option
parent
ba8bc5ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
src/spdycat.cc
src/spdycat.cc
+20
-7
No files found.
src/spdycat.cc
View file @
54d5dda6
...
@@ -74,6 +74,7 @@ struct Config {
...
@@ -74,6 +74,7 @@ struct Config {
bool
get_assets
;
bool
get_assets
;
bool
stat
;
bool
stat
;
bool
no_tls
;
bool
no_tls
;
int
multiply
;
int
spdy_version
;
int
spdy_version
;
// milliseconds
// milliseconds
int
timeout
;
int
timeout
;
...
@@ -83,7 +84,7 @@ struct Config {
...
@@ -83,7 +84,7 @@ struct Config {
std
::
map
<
std
::
string
,
std
::
string
>
headers
;
std
::
map
<
std
::
string
,
std
::
string
>
headers
;
std
::
string
datafile
;
std
::
string
datafile
;
Config
()
:
null_out
(
false
),
remote_name
(
false
),
verbose
(
false
),
Config
()
:
null_out
(
false
),
remote_name
(
false
),
verbose
(
false
),
get_assets
(
false
),
stat
(
false
),
no_tls
(
false
),
get_assets
(
false
),
stat
(
false
),
no_tls
(
false
),
multiply
(
1
),
spdy_version
(
-
1
),
timeout
(
-
1
),
window_bits
(
-
1
)
spdy_version
(
-
1
),
timeout
(
-
1
),
window_bits
(
-
1
)
{}
{}
};
};
...
@@ -299,6 +300,8 @@ struct SessionStat {
...
@@ -299,6 +300,8 @@ struct SessionStat {
}
}
};
};
Config
config
;
struct
SpdySession
{
struct
SpdySession
{
std
::
vector
<
Request
*>
reqvec
;
std
::
vector
<
Request
*>
reqvec
;
// Map from stream ID to Request object.
// Map from stream ID to Request object.
...
@@ -350,7 +353,9 @@ struct SpdySession {
...
@@ -350,7 +353,9 @@ struct SpdySession {
if
(
path_cache
.
count
(
uri
))
{
if
(
path_cache
.
count
(
uri
))
{
return
false
;
return
false
;
}
else
{
}
else
{
path_cache
.
insert
(
uri
);
if
(
config
.
multiply
==
1
)
{
path_cache
.
insert
(
uri
);
}
reqvec
.
push_back
(
new
Request
(
uri
,
u
,
data_prd
,
data_length
,
level
));
reqvec
.
push_back
(
new
Request
(
uri
,
u
,
data_prd
,
data_length
,
level
));
return
true
;
return
true
;
}
}
...
@@ -361,7 +366,6 @@ struct SpdySession {
...
@@ -361,7 +366,6 @@ struct SpdySession {
}
}
};
};
Config
config
;
extern
bool
ssl_debug
;
extern
bool
ssl_debug
;
void
submit_request
(
Spdylay
&
sc
,
const
std
::
string
&
hostport
,
void
submit_request
(
Spdylay
&
sc
,
const
std
::
string
&
hostport
,
...
@@ -842,8 +846,10 @@ int run(char **uris, int n)
...
@@ -842,8 +846,10 @@ int run(char **uris, int n)
prev_host
=
get_uri_field
(
uri
.
c_str
(),
u
,
UF_HOST
);
prev_host
=
get_uri_field
(
uri
.
c_str
(),
u
,
UF_HOST
);
prev_port
=
port
;
prev_port
=
port
;
}
}
spdySession
.
add_request
(
uri
,
u
,
data_fd
==
-
1
?
0
:
&
data_prd
,
for
(
int
j
=
0
;
j
<
config
.
multiply
;
++
j
)
{
data_stat
.
st_size
);
spdySession
.
add_request
(
uri
,
u
,
data_fd
==
-
1
?
0
:
&
data_prd
,
data_stat
.
st_size
);
}
}
}
}
}
if
(
!
spdySession
.
reqvec
.
empty
())
{
if
(
!
spdySession
.
reqvec
.
empty
())
{
...
@@ -858,7 +864,7 @@ int run(char **uris, int n)
...
@@ -858,7 +864,7 @@ int run(char **uris, int n)
void
print_usage
(
std
::
ostream
&
out
)
void
print_usage
(
std
::
ostream
&
out
)
{
{
out
<<
"Usage: spdycat [-Oadnsv23] [-t <SECONDS>] [-w <WINDOW_BITS>] [--cert=<CERT>]
\n
"
out
<<
"Usage: spdycat [-Oadnsv23] [-t <SECONDS>] [-w <WINDOW_BITS>] [--cert=<CERT>]
\n
"
<<
" [--key=<KEY>] [--no-tls] <URI>..."
<<
" [--key=<KEY>] [--no-tls]
[-m <N>]
<URI>..."
<<
std
::
endl
;
<<
std
::
endl
;
}
}
...
@@ -894,6 +900,9 @@ void print_help(std::ostream& out)
...
@@ -894,6 +900,9 @@ void print_help(std::ostream& out)
<<
" SPDY protocol version to use.
\n
"
<<
" SPDY protocol version to use.
\n
"
<<
" -d, --data=<FILE> Post FILE to server. If - is given, data
\n
"
<<
" -d, --data=<FILE> Post FILE to server. If - is given, data
\n
"
<<
" will be read from stdin.
\n
"
<<
" will be read from stdin.
\n
"
<<
" -m, --multiply=<N> Request each URI <N> times. By default, same
\n
"
<<
" URI is not requested twice. This option
\n
"
<<
" disables it too.
\n
"
<<
std
::
endl
;
<<
std
::
endl
;
}
}
...
@@ -917,10 +926,11 @@ int main(int argc, char **argv)
...
@@ -917,10 +926,11 @@ int main(int argc, char **argv)
{
"header"
,
required_argument
,
0
,
'H'
},
{
"header"
,
required_argument
,
0
,
'H'
},
{
"no-tls"
,
no_argument
,
&
flag
,
3
},
{
"no-tls"
,
no_argument
,
&
flag
,
3
},
{
"data"
,
required_argument
,
0
,
'd'
},
{
"data"
,
required_argument
,
0
,
'd'
},
{
"multiply"
,
required_argument
,
0
,
'm'
},
{
0
,
0
,
0
,
0
}
{
0
,
0
,
0
,
0
}
};
};
int
option_index
=
0
;
int
option_index
=
0
;
int
c
=
getopt_long
(
argc
,
argv
,
"Oad:nhH:v23st:w:"
,
long_options
,
int
c
=
getopt_long
(
argc
,
argv
,
"Oad:
m:
nhH:v23st:w:"
,
long_options
,
&
option_index
);
&
option_index
);
if
(
c
==
-
1
)
{
if
(
c
==
-
1
)
{
break
;
break
;
...
@@ -997,6 +1007,9 @@ int main(int argc, char **argv)
...
@@ -997,6 +1007,9 @@ int main(int argc, char **argv)
case
'd'
:
case
'd'
:
config
.
datafile
=
strcmp
(
"-"
,
optarg
)
==
0
?
"/dev/stdin"
:
optarg
;
config
.
datafile
=
strcmp
(
"-"
,
optarg
)
==
0
?
"/dev/stdin"
:
optarg
;
break
;
break
;
case
'm'
:
config
.
multiply
=
strtoul
(
optarg
,
0
,
10
);
break
;
case
'?'
:
case
'?'
:
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
case
0
:
case
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