-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added small hacks to work around tests disabled by #1630 #1862
Conversation
0453105
to
de8d891
Compare
bc27332
to
a54930c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several questions and comments, which probably are good to be discussed
60b42f0
to
f4e58d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still things to fix and improve
return TFW_STR_EMPTY(&authority) || TFW_STR_EMPTY(&host) | ||
|| tfw_strcmp(&authority, &host) == 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do these validations in extract_req_host()
:
tfw_http_req_process()
is already too big- there is no sense to check the request version twice and spread the logic among many places (we already have the frang check)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix using TFW_HTTP_HDR_HOST
in cache.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still couple of not addressed comments and couple of a new comments to fix.
The logic looks good for me and I'd vote to fix it in the wiki (@const-t approve is required though).
e722ea3
to
5dde7e8
Compare
fw/http_limits.c
Outdated
" from Host header", | ||
&FRANG_ACC2CLI(ra)->addr, "\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&FRANG_ACC2CLI(ra)->addr
not properly aligned. Also we may do not break string argument even if it wider than 80.
fw/http_limits.c
Outdated
frang_msg("Request host from absolute URI differs" | ||
" from Host header", | ||
&FRANG_ACC2CLI(ra)->addr, "\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frang_msg("Request host from absolute URI differs" | |
" from Host header", | |
&FRANG_ACC2CLI(ra)->addr, "\n"); | |
frang_msg("Request host from absolute URI differs" | |
" from Host header", | |
&FRANG_ACC2CLI(ra)->addr, "\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just couple of unresolved comments from the previous review.
@@ -1025,7 +1025,7 @@ | |||
# http_header_cnt NUM; | |||
# http_header_chunk_cnt NUM; | |||
# http_body_chunk_cnt NUM; | |||
# http_host_required true|false; | |||
# http_strict_host_checking true|false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix all the Wiki docs by
tempesta.wiki$ grep http_host_required *
HTTP-security.md:`http_host_required [true|false]`
HTTP-security.md~:`http_host_required [true|false]`
HTTP-security.md.orig:`http_host_required [true|false]`
grep: scripts: Is a directory
grep: _static: Is a directory
grep: _templates: Is a directory
Vhost-Confusion.md: http_host_required;
Virtual-hosts-and-locations.md:* http_host_required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* HTTP/2 because it cannot have an absolute URI. | ||
* Also this MUST be removed after #1870 is complete*/ | ||
if (test_bit(TFW_HTTP_B_ABSOLUTE_URI, req->flags)) { | ||
TfwStr host; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add new line after host
declaration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor cleanup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ba0d303
to
03f9d96
Compare
- fixed panic when host/authority headers are empty - moved absolute uri/host headers equality check to frang
eb3c9b9
to
ea83be6
Compare
Current (27.04.2023) state of PR:
req->host
akapicked_authority
is selected from request data in the following priority:absoluteURI
(HTTP/1.1 and earlier versions):authority
header (HTTP/2)Host
header (all version)req->host
is now used for cache key calculation.Hard-coded checks (
check_authority_correctness()
):Host
header MUST be present even when request comes in form of an absolute-URI (HTTP/1.1)Frang check had been update accordingly:
:authority == Host
(HTTP/2) or (host_from_absolute_uri == Host
) (HTTP/1.1)host_from_forwarded_header == picked_authority
(both HTTP/1.1 and HTTP/2)