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
72aef67c
Commit
72aef67c
authored
Jan 20, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttp: Replace build-in headers completely with -H option
parent
d647799c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
22 deletions
+10
-22
src/nghttp.cc
src/nghttp.cc
+10
-22
No files found.
src/nghttp.cc
View file @
72aef67c
...
@@ -922,16 +922,6 @@ int submit_request
...
@@ -922,16 +922,6 @@ int submit_request
const
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>&
headers
,
const
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>&
headers
,
Request
*
req
)
Request
*
req
)
{
{
enum
eStaticHeaderPosition
{
POS_METHOD
=
0
,
POS_PATH
,
POS_SCHEME
,
POS_AUTHORITY
,
POS_ACCEPT
,
POS_ACCEPT_ENCODING
,
POS_USERAGENT
};
auto
path
=
req
->
make_reqpath
();
auto
path
=
req
->
make_reqpath
();
auto
scheme
=
get_uri_field
(
req
->
uri
.
c_str
(),
req
->
u
,
UF_SCHEMA
);
auto
scheme
=
get_uri_field
(
req
->
uri
.
c_str
(),
req
->
u
,
UF_SCHEMA
);
auto
build_headers
=
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
auto
build_headers
=
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
...
@@ -942,24 +932,22 @@ int submit_request
...
@@ -942,24 +932,22 @@ int submit_request
{
"accept"
,
"*/*"
},
{
"accept"
,
"*/*"
},
{
"accept-encoding"
,
"gzip, deflate"
},
{
"accept-encoding"
,
"gzip, deflate"
},
{
"user-agent"
,
"nghttp2/"
NGHTTP2_VERSION
}};
{
"user-agent"
,
"nghttp2/"
NGHTTP2_VERSION
}};
auto
num_initial_headers
=
build_headers
.
size
();
if
(
req
->
data_prd
)
{
if
(
req
->
data_prd
)
{
build_headers
.
emplace_back
(
"content-length"
,
util
::
utos
(
req
->
data_length
));
build_headers
.
emplace_back
(
"content-length"
,
util
::
utos
(
req
->
data_length
));
}
}
for
(
auto
&
kv
:
headers
)
{
for
(
auto
&
kv
:
headers
)
{
auto
key
=
kv
.
first
.
c_str
();
size_t
i
;
if
(
util
::
strieq
(
key
,
"accept"
)
)
{
for
(
i
=
0
;
i
<
num_initial_headers
;
++
i
)
{
build_headers
[
POS_ACCEPT
].
second
=
kv
.
second
;
if
(
util
::
strieq
(
kv
.
first
,
build_headers
[
i
].
first
))
{
}
build_headers
[
i
].
second
=
kv
.
second
;
else
if
(
util
::
strieq
(
key
,
"user-agent"
)
)
{
break
;
build_headers
[
POS_USERAGENT
].
second
=
kv
.
second
;
}
}
else
if
(
util
::
strieq
(
key
,
":authority"
)
)
{
build_headers
[
POS_AUTHORITY
].
second
=
kv
.
second
;
}
}
else
{
if
(
i
<
num_initial_headers
)
{
build_headers
.
push_back
(
kv
)
;
continue
;
}
}
build_headers
.
push_back
(
kv
);
}
}
std
::
stable_sort
(
std
::
begin
(
build_headers
),
std
::
end
(
build_headers
),
std
::
stable_sort
(
std
::
begin
(
build_headers
),
std
::
end
(
build_headers
),
[](
const
std
::
pair
<
std
::
string
,
std
::
string
>&
lhs
,
[](
const
std
::
pair
<
std
::
string
,
std
::
string
>&
lhs
,
...
...
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