#32601: Optimize split_domain_port() by leveraging the regex
-------------------------------------+-------------------------------------
Reporter: Chris | Owner: nobody
Jerdonek |
Type: | Status: new
Cleanup/optimization |
Component: HTTP | Version: dev
handling | Keywords:
Severity: Normal | split_domain_port,regex
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I noticed that almost all of the pure Python can be removed from Django's
`split_domain_port()` function:
https://github.com/django/django/blob/2f13c476abe4ba787b6cb71131818341911f43cc/django/http/request.py#L643-L650
by modifying the `host_validation_re` regex slightly and then accessing it
via its groups:
https://github.com/django/django/blob/2f13c476abe4ba787b6cb71131818341911f43cc/django/http/request.py#L26
Currently, the function uses the regex to determine if there's a match,
and then uses pure Python to reparse out the components (work which the
regex has already done for the most part).
I can do this once accepted.
--
Ticket URL: <https://code.djangoproject.com/ticket/32601>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.f6d039305a1a5e6d03b9d536cb2790a0%40djangoproject.com.