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
863434fa
Commit
863434fa
authored
Dec 03, 2020
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h2load: Enable --data for HTTP/3
parent
4660252b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
3 deletions
+42
-3
src/h2load.cc
src/h2load.cc
+9
-0
src/h2load.h
src/h2load.h
+2
-0
src/h2load_http3_session.cc
src/h2load_http3_session.cc
+29
-3
src/h2load_http3_session.h
src/h2load_http3_session.h
+2
-0
No files found.
src/h2load.cc
View file @
863434fa
...
...
@@ -34,6 +34,7 @@
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif // HAVE_FCNTL_H
#include <sys/mman.h>
#include <cstdio>
#include <cassert>
...
...
@@ -90,6 +91,7 @@ Config::Config()
"CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256"
),
groups
(
"X25519:P-256:P-384:P-521"
),
data_length
(
-
1
),
data
(
nullptr
),
addrs
(
nullptr
),
nreqs
(
1
),
nclients
(
1
),
...
...
@@ -2661,6 +2663,13 @@ int main(int argc, char **argv) {
exit
(
EXIT_FAILURE
);
}
config
.
data_length
=
data_stat
.
st_size
;
auto
addr
=
mmap
(
nullptr
,
config
.
data_length
,
PROT_READ
,
MAP_SHARED
,
config
.
data_fd
,
0
);
if
(
addr
==
MAP_FAILED
)
{
std
::
cerr
<<
"-d: Could not mmap file "
<<
datafile
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
}
config
.
data
=
static_cast
<
uint8_t
*>
(
addr
);
}
if
(
!
logfile
.
empty
())
{
...
...
src/h2load.h
View file @
863434fa
...
...
@@ -81,6 +81,8 @@ struct Config {
std
::
string
groups
;
// length of upload data
int64_t
data_length
;
// memory mapped upload data
uint8_t
*
data
;
addrinfo
*
addrs
;
size_t
nreqs
;
size_t
nclients
;
...
...
src/h2load_http3_session.cc
View file @
863434fa
...
...
@@ -64,6 +64,29 @@ int Http3Session::submit_request() {
return
0
;
}
namespace
{
nghttp3_ssize
read_data
(
nghttp3_conn
*
conn
,
int64_t
stream_id
,
nghttp3_vec
*
vec
,
size_t
veccnt
,
uint32_t
*
pflags
,
void
*
user_data
,
void
*
stream_user_data
)
{
auto
s
=
static_cast
<
Http3Session
*>
(
user_data
);
s
->
read_data
(
vec
,
veccnt
,
pflags
);
return
1
;
}
}
// namespace
void
Http3Session
::
read_data
(
nghttp3_vec
*
vec
,
size_t
veccnt
,
uint32_t
*
pflags
)
{
assert
(
veccnt
>
0
);
auto
config
=
client_
->
worker
->
config
;
vec
[
0
].
base
=
config
->
data
;
vec
[
0
].
len
=
config
->
data_length
;
*
pflags
|=
NGHTTP3_DATA_FLAG_EOF
;
}
int64_t
Http3Session
::
submit_request_internal
()
{
int
rv
;
int64_t
stream_id
;
...
...
@@ -76,9 +99,12 @@ int64_t Http3Session::submit_request_internal() {
return
rv
;
}
rv
=
nghttp3_conn_submit_request
(
conn_
,
stream_id
,
reinterpret_cast
<
nghttp3_nv
*>
(
nva
.
data
()),
nva
.
size
(),
nullptr
,
nullptr
);
nghttp3_data_reader
dr
{};
dr
.
read_data
=
h2load
::
read_data
;
rv
=
nghttp3_conn_submit_request
(
conn_
,
stream_id
,
reinterpret_cast
<
nghttp3_nv
*>
(
nva
.
data
()),
nva
.
size
(),
config
->
data_fd
==
-
1
?
nullptr
:
&
dr
,
nullptr
);
if
(
rv
!=
0
)
{
return
rv
;
}
...
...
src/h2load_http3_session.h
View file @
863434fa
...
...
@@ -66,6 +66,8 @@ public:
int
add_write_offset
(
int64_t
stream_id
,
size_t
ndatalen
);
int
add_ack_offset
(
int64_t
stream_id
,
size_t
datalen
);
void
read_data
(
nghttp3_vec
*
vec
,
size_t
veccnt
,
uint32_t
*
pflags
);
private:
Client
*
client_
;
nghttp3_conn
*
conn_
;
...
...
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