--
Ticket URL: <https://code.djangoproject.com/ticket/17092>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: leanmeandonothingmachine (added)
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:1>
* status: new => closed
* resolution: => wontfix
* stage: Unreviewed => Accepted
Comment:
One can not assume that all responses Django will serve will be going
through a CGI spec compliant interface. So it does not make sense to make
this change in core.
There are a number of other limitations with the feature, one being that
the request_method is converted to GET and any request content is lost. If
the redirect is just to static content, there is likely something better
that can be done with mod_rewrite, or in a real edge case, one could put
together django middleware that would strip out the host portion before
returning.
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:2>
Comment (by anonymous):
This cannot be done with middleware. apply_response_fixes gets called
after middleware has already had it's shot at the response. Mod_rewrite
doesn't help when you want django to do some checks and only conditionally
pass the internal redirect response. Leaving the only possible option an
ugly hack.
{{{
request.get_host = lambda: ''
}}}
While we shouldn't assume that all responses will support the CGI spec, it
also doesn't seem right to me to break a widely used standard such as CGI
in core with no clean way to get the standard behavior.
I'm leaving as closed but in case any core devs reconsider I would still
be happy to contribute a patch that would allow a clean way to get this
behavior.
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:3>
* status: closed => reopened
* resolution: wontfix =>
Comment:
Given that both CGI and `mod_wsgi` support this, I think that Django
should provide a clean way to return a host-free Location header (not by
default, but by request). Not entirely sure what that ought to look like,
but a flag on `HttpResponse` sounds as reasonable as anything.
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:4>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:5>
Comment (by anonymous):
Anyone have any feedback on add_host_to_location.3.diff.
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:6>
* needs_better_patch: 0 => 1
Comment:
I could not apply patch. I'm getting this:
{{{
$ curl https://code.djangoproject.com/raw-
attachment/ticket/17092/add_host_to_location.3.diff | git apply
fatal: corrupt patch at line 97
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:8>
* needs_better_patch: 1 => 0
* version: 1.3 => 1.6
Comment:
After 3 years a patch goes stale, updated it. Lets see if it takes another
three years for someone to look at it.
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:9>
Comment (by aaugustin):
I think this asks the broader question of Django's unconditional fixes. We
recently removed some fixes for IE 4-6 and Netscape 4.
Rather than tainting the `HttpResponse` API with a kwarg for each
unconditional "fix" (or "break"), shouldn't we move them to the
`CommonMiddleware`?
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:10>
Comment (by anonymous):
I would agree with that, but before putting the time for that sort of re-
factor, i'd like to make sure it's going to get accepted.
Time for django-developers i guess.
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:11>
Comment (by aaugustin):
Yes, django-developers it is.
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:12>
* needs_better_patch: 0 => 1
Comment:
Reading the [https://groups.google.com/d/topic/django-
developers/YXv3tszQXzA/discussion django-developers thread] it seems like
a different solution is desired.
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:13>
Comment (by collinanderson):
This should in theory get fixed by #23960
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:14>
* status: new => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/17092#comment:15>