From a6443f7068cdeaeb680f92849241be042fdc561d Mon Sep 17 00:00:00 2001 From: Prashanth Pai Date: Tue, 17 Sep 2013 12:24:29 +0530 Subject: [PATCH] Add HTTPSeeOther(303) and HTTPTemporaryRedirect(307) to swob RFC 1945 and RFC 2068 specify that the client is not allowed to change the method on the redirected request. However, most existing user agent implementations treat 302 as if it were a 303 response, performing a GET on the Location field-value regardless of the original request method. The status codes 303 and 307 have been added for servers that wish to make unambiguously clear which kind of reaction is expected of the client. HTTP/1.1 RFC for 302: http://tools.ietf.org/html/rfc2616#section-10.3.4 HTTP/1.1 RFC for 307: http://tools.ietf.org/html/rfc2616#section-10.3.8 Change-Id: I354e2f4f3e3eb6a1553b3d9c60b613d8f0c37531 Signed-off-by: Prashanth Pai --- swift/common/swob.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/swift/common/swob.py b/swift/common/swob.py index 73efa60700..a8114bb38d 100644 --- a/swift/common/swob.py +++ b/swift/common/swob.py @@ -60,7 +60,9 @@ RESPONSE_REASONS = { 204: ('No Content', ''), 206: ('Partial Content', ''), 301: ('Moved Permanently', 'The resource has moved permanently.'), - 302: ('Found', ''), + 302: ('Found', 'The resource has moved temporarily.'), + 303: ('See Other', 'The response to the request can be found under a ' + 'different URI.'), 304: ('Not Modified', ''), 307: ('Temporary Redirect', 'The resource has moved temporarily.'), 400: ('Bad Request', 'The server could not comply with the request since ' @@ -1213,7 +1215,9 @@ HTTPAccepted = status_map[202] HTTPNoContent = status_map[204] HTTPMovedPermanently = status_map[301] HTTPFound = status_map[302] +HTTPSeeOther = status_map[303] HTTPNotModified = status_map[304] +HTTPTemporaryRedirect = status_map[307] HTTPBadRequest = status_map[400] HTTPUnauthorized = status_map[401] HTTPForbidden = status_map[403]