Skip to content

Fix port issue on host-based routing#1322

Merged
aminalaee merged 9 commits intoKludex:masterfrom
WhiteApfel:fix-port-host-matching
Nov 25, 2021
Merged

Fix port issue on host-based routing#1322
aminalaee merged 9 commits intoKludex:masterfrom
WhiteApfel:fix-port-host-matching

Conversation

@WhiteApfel
Copy link
Contributor

@WhiteApfel WhiteApfel commented Oct 26, 2021

Host.host_regex is only used to check "Host" header: (routing.py:432)

host = headers.get("host", "").split(":")[0]
match = self.host_regex.match(host)

However, when generating Host.host_regex, the port remained: (routing.py:149)

path_regex += re.escape(path[idx:]) + "$"

I added one small fix. Now the port is also removed from Host.host_regex

UPD: Before this fix, the code from #1317 example returned Not found, and after Hello World

@WhiteApfel WhiteApfel changed the title Fix port issue on host-based routing (#1317) Fix port issue on host-based routing Oct 26, 2021
@aminalaee aminalaee requested a review from a team October 26, 2021 07:38
@WhiteApfel
Copy link
Contributor Author

If you accept this change, then we will need to update info in the documentation (I added a note in #1313). I can commit to this pull request, or create a new one. What should I do?

@PrettyWood
Copy link

Hey thanks for that. Surely a unit test can be added!

Copy link
Contributor

@parz3val parz3val left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aminalaee aminalaee linked an issue Oct 27, 2021 that may be closed by this pull request
2 tasks
@aminalaee
Copy link
Contributor

If you accept this change, then we will need to update info in the documentation (I added a note in #1313). I can commit to this pull request, or create a new one. What should I do?

Yes, I think we can update the doc in the same PR since they are related.

@WhiteApfel
Copy link
Contributor Author

I think that in general the pull request is ready. But I'm not sure about the quality of the wording in the note

@WhiteApfel
Copy link
Contributor Author

These errors are not caused by code, is it?

@aminalaee
Copy link
Contributor

These errors are not caused by code, is it?

Probably Github's issue:

GitHub Actions has encountered an internal error when running your job.

@Kludex
Copy link
Owner

Kludex commented Nov 5, 2021

It looks like is running now. I've relaunch the pipeline.

Copy link
Contributor

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Different Host behavior for setting host argument and getting Host header

5 participants