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
97366bf5
Commit
97366bf5
authored
Apr 10, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Set content-length after complete request/response headers
parent
87cadca3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+8
-6
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+8
-6
No files found.
src/shrpx_http2_session.cc
View file @
97366bf5
...
...
@@ -757,12 +757,6 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame,
auto
token
=
http2
::
lookup_token
(
name
,
namelen
);
if
(
token
==
http2
::
HD_CONTENT_LENGTH
)
{
// libnghttp2 guarantees this can be parsed
auto
len
=
util
::
parse_uint
(
value
,
valuelen
);
downstream
->
set_response_content_length
(
len
);
}
downstream
->
add_response_header
(
name
,
namelen
,
value
,
valuelen
,
flags
&
NGHTTP2_NV_FLAG_NO_INDEX
,
token
);
return
0
;
...
...
@@ -844,6 +838,14 @@ int on_response_headers(Http2Session *http2session, Downstream *downstream,
return
0
;
}
auto
content_length
=
downstream
->
get_response_header
(
http2
::
HD_CONTENT_LENGTH
);
if
(
content_length
)
{
// libnghttp2 guarantees this can be parsed
auto
len
=
util
::
parse_uint
(
content_length
->
value
);
downstream
->
set_response_content_length
(
len
);
}
if
(
downstream
->
get_response_content_length
()
==
-
1
&&
downstream
->
expect_response_body
())
{
// Here we have response body but Content-Length is not known in
...
...
src/shrpx_http2_upstream.cc
View file @
97366bf5
...
...
@@ -233,12 +233,6 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame,
auto
token
=
http2
::
lookup_token
(
name
,
namelen
);
if
(
token
==
http2
::
HD_CONTENT_LENGTH
)
{
// libnghttp2 guarantees this can be parsed
auto
len
=
util
::
parse_uint
(
value
,
valuelen
);
downstream
->
set_request_content_length
(
len
);
}
downstream
->
add_request_header
(
name
,
namelen
,
value
,
valuelen
,
flags
&
NGHTTP2_NV_FLAG_NO_INDEX
,
token
);
return
0
;
...
...
@@ -300,6 +294,14 @@ int Http2Upstream::on_request_headers(Downstream *downstream,
http2
::
dump_nv
(
get_config
()
->
http2_upstream_dump_request_header
,
nva
);
}
auto
content_length
=
downstream
->
get_request_header
(
http2
::
HD_CONTENT_LENGTH
);
if
(
content_length
)
{
// libnghttp2 guarantees this can be parsed
auto
len
=
util
::
parse_uint
(
content_length
->
value
);
downstream
->
set_request_content_length
(
len
);
}
auto
authority
=
downstream
->
get_request_header
(
http2
::
HD__AUTHORITY
);
auto
path
=
downstream
->
get_request_header
(
http2
::
HD__PATH
);
auto
method
=
downstream
->
get_request_header
(
http2
::
HD__METHOD
);
...
...
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