{{{
host = host[:-1] if host.endswith('.') else host
}}}
which strips the trailing dot if it exists, before matching (this code is
not ideal BTW, I think it will not work as intended if the host has a
port).
However, the sites framework (in contrib/sites/models.py,
{{{SiteManager._get_site_by_request}}}) fails to match in this case. This
causes 500 when {{{get_current_site()}}} is called whenever a user
requests some URL like "http://mysite.com./".
It would be nice if the sites framework was fixed to match trailing dot as
well, similar to how https://code.djangoproject.com/ticket/24834 was fixed
to deal with a {{{Host}}} like "mysite.com:80".
--
Ticket URL: <https://code.djangoproject.com/ticket/27181>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0
Comment:
Perhaps `http.request.split_domain_port()` should remove the trailing dot
rather than `validate_host()` looking for the trailing dot.
--
Ticket URL: <https://code.djangoproject.com/ticket/27181#comment:1>
* has_patch: 0 => 1
* version: 1.10 => master
Comment:
Added [https://github.com/django/django/pull/7470 PR 7470]
--
Ticket URL: <https://code.djangoproject.com/ticket/27181#comment:2>
* cc: zbigniew@… (added)
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/27181#comment:3>
* needs_tests: 1 => 0
Comment:
Added tests [https://github.com/django/django/pull/7470 PR 7470]
--
Ticket URL: <https://code.djangoproject.com/ticket/27181#comment:4>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/27181#comment:5>
* needs_better_patch: 1 => 0
Comment:
Added test [https://github.com/django/django/pull/7470 PR 7470]
--
Ticket URL: <https://code.djangoproject.com/ticket/27181#comment:6>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"05d2c5a66dd72c26e5221855e08834a66c844399" 05d2c5a]:
{{{
#!CommitTicketReference repository=""
revision="05d2c5a66dd72c26e5221855e08834a66c844399"
Fixed #27181 -- Allowed contrib.sites to match domains with trailing ".".
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27181#comment:7>