[Django] #24460: Update documentation to explain why `HttpRequest.build_absolute_uri` doesn't have a scheme option

46 views
Skip to first unread message

Django

unread,
Mar 7, 2015, 2:47:08 PM3/7/15
to django-...@googlegroups.com
#24460: Update documentation to explain why `HttpRequest.build_absolute_uri`
doesn't have a scheme option
-------------------------------+--------------------
Reporter: rednaw | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Earlier I created #24459, where I wanted to add an option to
`HttpRequest.build_absolute_uri` to be able to create a https URI on a
http page, but we came to the conclusion this is the wrong solution to the
problem, so I would like to add the explanation for this to the
documentation.

I was thinking of a "Note" box with a text like:

"Django discourages mixing HTTP and HTTPS on the same domain. Therefore,
`build_absolute_uri` will always generate an absolute URI with the same
scheme the current request has."

--
Ticket URL: <https://code.djangoproject.com/ticket/24460>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 7, 2015, 2:47:55 PM3/7/15
to django-...@googlegroups.com
#24460: Update documentation to explain why `HttpRequest.build_absolute_uri`
doesn't have a scheme option
-------------------------------------+-------------------------------------
Reporter: rednaw | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: build_absolute_uri | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by rednaw):

* needs_better_patch: => 0
* component: Uncategorized => HTTP handling
* needs_tests: => 0
* version: 1.7 => master
* easy: 0 => 1
* keywords: => build_absolute_uri
* needs_docs: => 1
* type: Uncategorized => Cleanup/optimization


--
Ticket URL: <https://code.djangoproject.com/ticket/24460#comment:1>

Django

unread,
Mar 7, 2015, 2:52:26 PM3/7/15
to django-...@googlegroups.com
#24460: Update documentation to explain why `HttpRequest.build_absolute_uri`
doesn't have a scheme option
--------------------------------------+------------------------------------
Reporter: rednaw | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: build_absolute_uri | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by erikr):

* component: HTTP handling => Documentation
* stage: Unreviewed => Accepted


Comment:

As we discussed, this seems like a good idea to me. I would change it to
passive tense though, as the "Django recommends ..." looks a little odd to
me. Site also seems more appropriate than domain to me. So I suggest:
`Mixing HTTP and HTTPS on the same site is discouraged.`

--
Ticket URL: <https://code.djangoproject.com/ticket/24460#comment:2>

Django

unread,
Mar 7, 2015, 2:53:57 PM3/7/15
to django-...@googlegroups.com
#24460: Update documentation to explain why `HttpRequest.build_absolute_uri`
doesn't have a scheme option
--------------------------------------+------------------------------------
Reporter: rednaw | Owner: nobody

Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: build_absolute_uri | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by bpeschier):

I agree with Erik, otherwise the question "why does Django discourage it?"
arises quickly. Referencing some documentation about why it is a bad idea
might be a nice addition.

--
Ticket URL: <https://code.djangoproject.com/ticket/24460#comment:3>

Django

unread,
Mar 7, 2015, 2:59:43 PM3/7/15
to django-...@googlegroups.com
#24460: Update documentation to explain why `HttpRequest.build_absolute_uri`
doesn't have a scheme option
--------------------------------------+------------------------------------
Reporter: rednaw | Owner: nobody

Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: build_absolute_uri | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by rednaw):

I couldn't find a good website where they explain the disadvantages
clearly, and I think the explanation is maybe a bit too much to add in
this part of the documentation. It could maybe be added somewhere else and
linked to it, but I wouldn't know a good spot right of the top of my head
now.

--
Ticket URL: <https://code.djangoproject.com/ticket/24460#comment:4>

Django

unread,
Mar 8, 2015, 11:05:44 AM3/8/15
to django-...@googlegroups.com
#24460: Update documentation to explain why `HttpRequest.build_absolute_uri`
doesn't have a scheme option
--------------------------------------+------------------------------------
Reporter: rednaw | Owner: nobody

Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: build_absolute_uri | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by rednaw):

Created a pull request for this:

https://github.com/django/django/pull/4278

--
Ticket URL: <https://code.djangoproject.com/ticket/24460#comment:5>

Django

unread,
Mar 8, 2015, 11:09:10 AM3/8/15
to django-...@googlegroups.com
#24460: Update documentation to explain why `HttpRequest.build_absolute_uri`
doesn't have a scheme option
--------------------------------------+------------------------------------
Reporter: rednaw | Owner: nobody

Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: build_absolute_uri | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by bmispelon):

* needs_docs: 1 => 0
* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24460#comment:6>

Django

unread,
Mar 8, 2015, 11:18:30 AM3/8/15
to django-...@googlegroups.com
#24460: Update documentation to explain why `HttpRequest.build_absolute_uri`
doesn't have a scheme option
--------------------------------------+------------------------------------
Reporter: rednaw | Owner: rednaw
Type: Cleanup/optimization | Status: assigned

Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: build_absolute_uri | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by rednaw):

* status: new => assigned
* owner: nobody => rednaw


--
Ticket URL: <https://code.djangoproject.com/ticket/24460#comment:7>

Django

unread,
Mar 8, 2015, 11:21:13 AM3/8/15
to django-...@googlegroups.com
#24460: Update documentation to explain why `HttpRequest.build_absolute_uri`
doesn't have a scheme option
--------------------------------------+------------------------------------
Reporter: rednaw | Owner: rednaw
Type: Cleanup/optimization | Status: assigned
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: build_absolute_uri | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by erikr):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24460#comment:8>

Django

unread,
Mar 8, 2015, 11:34:35 AM3/8/15
to django-...@googlegroups.com
#24460: Update documentation to explain why `HttpRequest.build_absolute_uri`
doesn't have a scheme option
--------------------------------------+------------------------------------
Reporter: rednaw | Owner: rednaw
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed

Keywords: build_absolute_uri | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Erik Romijn <eromijn@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"794c3f74c32062d0f2ad021cb2af0e530b40730d"]:
{{{
#!CommitTicketReference repository=""
revision="794c3f74c32062d0f2ad021cb2af0e530b40730d"
Fixed #24460 -- Extended HttpRequest.build_absolute_uri documentation

Added explanation on why build_absolute_uri always enforces the
request's scheme.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24460#comment:9>

Reply all
Reply to author
Forward
0 new messages