Skip to content
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

Regex artifact in hosts #158

Open
Amith225 opened this issue Mar 8, 2023 · 0 comments
Open

Regex artifact in hosts #158

Amith225 opened this issue Mar 8, 2023 · 0 comments

Comments

@Amith225
Copy link

Amith225 commented Mar 8, 2023

consider the following host:
host(fr'^api', 'api.urls', name='api')

i went through the codebase and found self.compiled_regex = re.compile(r'%s%s(\.|:|$)' % (regex, suffix))
now internally the complied_regex = re.compile('^api(\\.|:|$)')

this creates a problem, if i go to api.localhost this works as expected, but if I go to api.xyz.localhost it still routes me to api.urls

so maybe change the complied_regex to re.compile(r'%s%s(:[0-9]+)?$)' % (regex, suffix)) ?
this will ensure the regex follows parent_host and is either followed by a port with atleast one digit, or no port at all

but this will also force user to give the parent_host, which i think would not be a major problem

if this makes sense, and is ok, i would like to be assigned 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

No branches or pull requests

1 participant