Fixed #16746 - added more HTTP code/string mappings.

This moves the arbitrary line on which HTTP codes to include away from
RFC 2616 and to the IANA assignments, thus picking up WebDAV and a couple
others.

Thanks to vfaronov for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16732 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2011-09-09 16:57:35 +00:00
parent ddaca29d3d
commit 4584069c8a
1 changed files with 13 additions and 1 deletions

View File

@ -16,10 +16,11 @@ from django.utils.log import getLogger
logger = getLogger('django.request') logger = getLogger('django.request')
# See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html # See http://www.iana.org/assignments/http-status-codes
STATUS_CODE_TEXT = { STATUS_CODE_TEXT = {
100: 'CONTINUE', 100: 'CONTINUE',
101: 'SWITCHING PROTOCOLS', 101: 'SWITCHING PROTOCOLS',
102: 'PROCESSING',
200: 'OK', 200: 'OK',
201: 'CREATED', 201: 'CREATED',
202: 'ACCEPTED', 202: 'ACCEPTED',
@ -27,6 +28,9 @@ STATUS_CODE_TEXT = {
204: 'NO CONTENT', 204: 'NO CONTENT',
205: 'RESET CONTENT', 205: 'RESET CONTENT',
206: 'PARTIAL CONTENT', 206: 'PARTIAL CONTENT',
207: 'MULTI-STATUS',
208: 'ALREADY REPORTED',
226: 'IM USED',
300: 'MULTIPLE CHOICES', 300: 'MULTIPLE CHOICES',
301: 'MOVED PERMANENTLY', 301: 'MOVED PERMANENTLY',
302: 'FOUND', 302: 'FOUND',
@ -53,12 +57,20 @@ STATUS_CODE_TEXT = {
415: 'UNSUPPORTED MEDIA TYPE', 415: 'UNSUPPORTED MEDIA TYPE',
416: 'REQUESTED RANGE NOT SATISFIABLE', 416: 'REQUESTED RANGE NOT SATISFIABLE',
417: 'EXPECTATION FAILED', 417: 'EXPECTATION FAILED',
422: 'UNPROCESSABLE ENTITY',
423: 'LOCKED',
424: 'FAILED DEPENDENCY',
426: 'UPGRADE REQUIRED',
500: 'INTERNAL SERVER ERROR', 500: 'INTERNAL SERVER ERROR',
501: 'NOT IMPLEMENTED', 501: 'NOT IMPLEMENTED',
502: 'BAD GATEWAY', 502: 'BAD GATEWAY',
503: 'SERVICE UNAVAILABLE', 503: 'SERVICE UNAVAILABLE',
504: 'GATEWAY TIMEOUT', 504: 'GATEWAY TIMEOUT',
505: 'HTTP VERSION NOT SUPPORTED', 505: 'HTTP VERSION NOT SUPPORTED',
506: 'VARIANT ALSO NEGOTIATES',
507: 'INSUFFICIENT STORAGE',
508: 'LOOP DETECTED',
510: 'NOT EXTENDED',
} }
class LimitedStream(object): class LimitedStream(object):