summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2015-03-13 23:40:14 +0100
committerClaude Paroz <claude@2xlibre.net>2015-03-18 18:22:50 +0100
commita0c2eb46dd5a782c11c44f13c8efad2778be1641 (patch)
tree699c83457e903200607ae550abaacbd74d33941f /docs
parent0339844b70895d6162b4595ae615e6edf843c6cd (diff)
Fixed #23960 -- Removed http.fix_location_header
Thanks Carl Meyer for the report and Tim Graham for the review.
Diffstat (limited to 'docs')
-rw-r--r--docs/internals/deprecation.txt4
-rw-r--r--docs/ref/request-response.txt6
-rw-r--r--docs/releases/1.9.txt15
-rw-r--r--docs/topics/testing/tools.txt15
4 files changed, 29 insertions, 11 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index cb5d989450..db351ede16 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -22,6 +22,10 @@ details on these changes.
* The ``assignment_tag`` helper will be removed.
+* The ``host`` argument to ``assertsRedirects`` will be removed. The
+ compatibility layer which allows absolute URLs to be considered equal to
+ relative ones when the path is identical will also be removed.
+
.. _deprecation-removed-in-2.0:
2.0
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index a555ba76eb..36588cc18a 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -824,8 +824,10 @@ types of HTTP responses. Like ``HttpResponse``, these subclasses live in
The first argument to the constructor is required -- the path to redirect
to. This can be a fully qualified URL
- (e.g. ``'http://www.yahoo.com/search/'``) or an absolute path with no
- domain (e.g. ``'/search/'``). See :class:`HttpResponse` for other optional
+ (e.g. ``'http://www.yahoo.com/search/'``), an absolute path with no domain
+ (e.g. ``'/search/'``), or even a relative path (e.g. ``'search/'``). In that
+ last case, the client browser will reconstruct the full URL itself
+ according to the current path. See :class:`HttpResponse` for other optional
constructor arguments. Note that this returns an HTTP status code 302.
.. attribute:: HttpResponseRedirect.url
diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt
index 2c787fc40a..c290739c95 100644
--- a/docs/releases/1.9.txt
+++ b/docs/releases/1.9.txt
@@ -266,6 +266,21 @@ a directory. Now, Django only silences the exception if the template source
does not exist. All other situations result in the original ``IOError`` being
raised.
+HTTP redirects no longer forced to absolute URIs
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Relative redirects are no longer converted to absolute URIs. :rfc:`2616`
+required the ``Location`` header in redirect responses to be an absolute URI,
+but it has been superseded by :rfc:`7231` which allows relative URIs in
+``Location``, recognizing the actual practice of user agents, almost all of
+which support them.
+
+Consequently, the expected URLs passed to ``assertRedirects`` should generally
+no longer include the scheme and domain part of the URLs. For example,
+``self.assertRedirects(response, 'http://testserver/some-url/')`` should be
+replaced by ``self.assertRedirects(response, '/some-url/')`` (unless the
+redirection specifically contained an absolute URL, of course).
+
Miscellaneous
~~~~~~~~~~~~~
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index f3b78d3b31..67f58cccf3 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -1398,7 +1398,7 @@ your test suite.
You can use this as a context manager in the same way as
:meth:`~SimpleTestCase.assertTemplateUsed`.
-.. method:: SimpleTestCase.assertRedirects(response, expected_url, status_code=302, target_status_code=200, host=None, msg_prefix='', fetch_redirect_response=True)
+.. method:: SimpleTestCase.assertRedirects(response, expected_url, status_code=302, target_status_code=200, msg_prefix='', fetch_redirect_response=True)
Asserts that the response returned a ``status_code`` redirect status,
redirected to ``expected_url`` (including any ``GET`` data), and that the
@@ -1408,14 +1408,6 @@ your test suite.
``target_status_code`` will be the url and status code for the final
point of the redirect chain.
- The ``host`` argument sets a default host if ``expected_url`` doesn't
- include one (e.g. ``"/bar/"``). If ``expected_url`` is an absolute URL that
- includes a host (e.g. ``"http://testhost/bar/"``), the ``host`` parameter
- will be ignored. Note that the test client doesn't support fetching external
- URLs, but the parameter may be useful if you are testing with a custom HTTP
- host (for example, initializing the test client with
- ``Client(HTTP_HOST="testhost")``.
-
If ``fetch_redirect_response`` is ``False``, the final page won't be
loaded. Since the test client can't fetch externals URLs, this is
particularly useful if ``expected_url`` isn't part of your Django app.
@@ -1425,6 +1417,11 @@ your test suite.
the original request's scheme is used. If present, the scheme in
``expected_url`` is the one used to make the comparisons to.
+ .. deprecated:: 1.9
+
+ The ``host`` argument is deprecated, as redirections are no longer
+ forced to be absolute URLs.
+
.. method:: SimpleTestCase.assertHTMLEqual(html1, html2, msg=None)
Asserts that the strings ``html1`` and ``html2`` are equal. The comparison