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
1a2dc1e8
Commit
1a2dc1e8
authored
Jun 12, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h2load: Add content-length header field for HTTP/2 and SPDY as well
parent
9bdf214f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
src/h2load.cc
src/h2load.cc
+24
-7
No files found.
src/h2load.cc
View file @
1a2dc1e8
...
...
@@ -2217,6 +2217,11 @@ int main(int argc, char **argv) {
}
}
std
::
string
content_length_str
;
if
(
config
.
data_fd
!=
-
1
)
{
content_length_str
=
util
::
utos
(
config
.
data_length
);
}
auto
method_it
=
std
::
find_if
(
std
::
begin
(
shared_nva
),
std
::
end
(
shared_nva
),
[](
const
Header
&
nv
)
{
return
nv
.
name
==
":method"
;
});
...
...
@@ -2247,10 +2252,10 @@ int main(int argc, char **argv) {
h1req
+=
nv
.
value
;
h1req
+=
"
\r\n
"
;
}
// TODO do this for h2 and spdy too.
if
(
config
.
data_fd
!=
-
1
)
{
if
(
!
content_length_str
.
empty
()
)
{
h1req
+=
"Content-Length: "
;
h1req
+=
util
::
utos
(
config
.
data_length
)
;
h1req
+=
content_length_str
;
h1req
+=
"
\r\n
"
;
}
h1req
+=
"
\r\n
"
;
...
...
@@ -2259,8 +2264,8 @@ int main(int argc, char **argv) {
// For nghttp2
std
::
vector
<
nghttp2_nv
>
nva
;
//
1 for :pa
th
nva
.
reserve
(
1
+
shared_nva
.
size
());
//
2 for :path, and possible content-leng
th
nva
.
reserve
(
2
+
shared_nva
.
size
());
nva
.
push_back
(
http2
::
make_nv_ls
(
":path"
,
req
));
...
...
@@ -2268,12 +2273,18 @@ int main(int argc, char **argv) {
nva
.
push_back
(
http2
::
make_nv
(
nv
.
name
,
nv
.
value
,
false
));
}
if
(
!
content_length_str
.
empty
())
{
nva
.
push_back
(
http2
::
make_nv
(
StringRef
::
from_lit
(
"content-length"
),
StringRef
{
content_length_str
}));
}
config
.
nva
.
push_back
(
std
::
move
(
nva
));
// For spdylay
std
::
vector
<
const
char
*>
cva
;
// 2 for :path and :version, 1 for terminal nullptr
cva
.
reserve
(
2
*
(
2
+
shared_nva
.
size
())
+
1
);
// 3 for :path, :version, and possible content-length, 1 for
// terminal nullptr
cva
.
reserve
(
2
*
(
3
+
shared_nva
.
size
())
+
1
);
cva
.
push_back
(
":path"
);
cva
.
push_back
(
req
.
c_str
());
...
...
@@ -2288,6 +2299,12 @@ int main(int argc, char **argv) {
}
cva
.
push_back
(
":version"
);
cva
.
push_back
(
"HTTP/1.1"
);
if
(
!
content_length_str
.
empty
())
{
cva
.
push_back
(
"content-length"
);
cva
.
push_back
(
content_length_str
.
c_str
());
}
cva
.
push_back
(
nullptr
);
config
.
nv
.
push_back
(
std
::
move
(
cva
));
...
...
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