Closed TBoshoven closed 2 years ago
Hi,
Thanks for the contribution. Does this case happen with a particular environment or server?
Merging #2043 (8d94723) into master (130572d) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## master #2043 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 63 63
Lines 6707 6715 +8
Branches 1238 1242 +4
=========================================
+ Hits 6707 6715 +8
Impacted Files | Coverage Δ | |
---|---|---|
falcon/asgi/request.py | 100.00% <100.00%> (ø) |
|
falcon/request.py | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 130572d...8d94723. Read the comment docs.
Does this case happen with a particular environment or server?
Not that I found. It's a generic issue when encountering a malformed request header. We came across this by accident by directly hitting a Falcon server.
Ah, I mistakenly created a markdown file instead of a restructuredtext one. Will fix :+1:
Sorry for taking a while. Merged master
into this branch.
Thanks @TBoshoven !
Summary of Changes
Fix a wrongful assumption where
forwarded_scheme
andforwarded_host
assume that if aForwarded
header is present, it is valid. When aForwarded
header cannot be parsed properly (or is plain empty), an empty list is returned byforwarded
. This resulted in anIndexError
inforwarded_scheme
andforwarded_host
. This PR changes that to use the existing fallback logic instead.While we could fall back on checking other headers (
X-Forwarded-For
and such) I think that if theForwarded
header is present but doesn't contain any relevant or correct entries, we can simply assume that there are none. Please let me know if you have a different opinion.Related Issues
N/A
Pull Request Checklist
This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once; it will save you a few review cycles!
If an item doesn't apply to your pull request, check it anyway to make it apparent that there's nothing to do.
docs/
.docs/
.versionadded
,versionchanged
, ordeprecated
directives.docs/_newsfragments/
, with the file name format{issue_number}.{fragment_type}.rst
. (Runtowncrier --draft
to ensure it renders correctly.)