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
b6a9cf9f
Commit
b6a9cf9f
authored
Dec 03, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Accept and ignore content-length: 0 in 204 response for now
parent
5645cad5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
6 deletions
+32
-6
src/http2.cc
src/http2.cc
+5
-0
src/http2.h
src/http2.h
+3
-0
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+23
-5
src/shrpx_mruby_module_response.cc
src/shrpx_mruby_module_response.cc
+1
-1
No files found.
src/http2.cc
View file @
b6a9cf9f
...
...
@@ -477,6 +477,11 @@ void dump_nv(FILE *out, const HeaderRefs &nva) {
fflush
(
out
);
}
void
erase_header
(
HeaderRef
*
hd
)
{
hd
->
name
=
StringRef
{};
hd
->
token
=
-
1
;
}
StringRef
rewrite_location_uri
(
BlockAllocator
&
balloc
,
const
StringRef
&
uri
,
const
http_parser_url
&
u
,
const
StringRef
&
match_host
,
...
...
src/http2.h
View file @
b6a9cf9f
...
...
@@ -227,6 +227,9 @@ void dump_nv(FILE *out, const Headers &nva);
void
dump_nv
(
FILE
*
out
,
const
HeaderRefs
&
nva
);
// Ereases header in |hd|.
void
erase_header
(
HeaderRef
*
hd
);
// Rewrites redirection URI which usually appears in location header
// field. The |uri| is the URI in the location header field. The |u|
// stores the result of parsed |uri|. The |request_authority| is the
...
...
src/shrpx_http_downstream_connection.cc
View file @
b6a9cf9f
...
...
@@ -720,15 +720,33 @@ int htp_hdrs_completecb(http_parser *htp) {
// 204. Also server MUST NOT send Transfer-Encoding with a status
// code 200 to a CONNECT request. Same holds true with
// Content-Length.
if
(
resp
.
http_status
==
204
||
resp
.
http_status
/
100
==
1
||
(
resp
.
http_status
==
200
&&
req
.
method
==
HTTP_CONNECT
))
{
if
(
resp
.
http_status
==
204
)
{
if
(
resp
.
fs
.
header
(
http2
::
HD_TRANSFER_ENCODING
))
{
return
-
1
;
}
// Some server send content-length: 0 for 204. Until they get
// fixed, we accept, but ignore it.
// Calling parse_content_length() detects duplicated
// content-length header fields.
if
(
resp
.
fs
.
parse_content_length
()
!=
0
)
{
return
-
1
;
}
if
(
resp
.
fs
.
content_length
!=
0
)
{
return
-
1
;
}
if
(
resp
.
fs
.
content_length
==
0
)
{
auto
cl
=
resp
.
fs
.
header
(
http2
::
HD_CONTENT_LENGTH
);
assert
(
cl
);
http2
::
erase_header
(
cl
);
}
}
else
if
(
resp
.
http_status
/
100
==
1
||
(
resp
.
http_status
==
200
&&
req
.
method
==
HTTP_CONNECT
))
{
if
(
resp
.
fs
.
header
(
http2
::
HD_CONTENT_LENGTH
)
||
resp
.
fs
.
header
(
http2
::
HD_TRANSFER_ENCODING
))
{
return
-
1
;
}
}
if
(
resp
.
fs
.
parse_content_length
()
!=
0
)
{
}
else
if
(
resp
.
fs
.
parse_content_length
()
!=
0
)
{
downstream
->
set_response_state
(
Downstream
::
MSG_BAD_HEADER
);
return
-
1
;
}
...
...
src/shrpx_mruby_module_response.cc
View file @
b6a9cf9f
...
...
@@ -233,7 +233,7 @@ mrb_value response_return(mrb_state *mrb, mrb_value self) {
(
resp
.
http_status
==
200
&&
req
.
method
==
HTTP_CONNECT
))
{
if
(
cl
)
{
// Delete content-length here
cl
->
name
=
StringRef
{}
;
http2
::
erase_header
(
cl
)
;
}
resp
.
fs
.
content_length
=
-
1
;
...
...
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