OLD | NEW |
(Empty) | |
| 1 import utils |
| 2 |
| 3 content_types = utils.invert_dict({"text/html": ["htm", "html"], |
| 4 "application/json": ["json"], |
| 5 "application/xhtml+xml": ["xht", "xhtm", "xht
ml"], |
| 6 "application/xml": ["xml"], |
| 7 "application/x-xpinstall": ["xpi"], |
| 8 "text/javascript": ["js"], |
| 9 "text/css": ["css"], |
| 10 "text/plain": ["txt", "md"], |
| 11 "image/svg+xml": ["svg"], |
| 12 "image/gif": ["gif"], |
| 13 "image/jpeg": ["jpg", "jpeg"], |
| 14 "image/png": ["png"], |
| 15 "image/bmp": ["bmp"], |
| 16 "text/event-stream": ["event_stream"], |
| 17 "text/cache-manifest": ["manifest"], |
| 18 "video/mp4": ["mp4", "m4v"], |
| 19 "audio/mp4": ["m4a"], |
| 20 "audio/mpeg": ["mp3"], |
| 21 "video/webm": ["webm"], |
| 22 "audio/webm": ["weba"], |
| 23 "video/ogg": ["ogg", "ogv"], |
| 24 "audio/ogg": ["oga"], |
| 25 "audio/x-wav": ["wav"], |
| 26 "text/vtt": ["vtt"],}) |
| 27 |
| 28 response_codes = { |
| 29 100: ('Continue', 'Request received, please continue'), |
| 30 101: ('Switching Protocols', |
| 31 'Switching to new protocol; obey Upgrade header'), |
| 32 |
| 33 200: ('OK', 'Request fulfilled, document follows'), |
| 34 201: ('Created', 'Document created, URL follows'), |
| 35 202: ('Accepted', |
| 36 'Request accepted, processing continues off-line'), |
| 37 203: ('Non-Authoritative Information', 'Request fulfilled from cache'), |
| 38 204: ('No Content', 'Request fulfilled, nothing follows'), |
| 39 205: ('Reset Content', 'Clear input form for further input.'), |
| 40 206: ('Partial Content', 'Partial content follows.'), |
| 41 |
| 42 300: ('Multiple Choices', |
| 43 'Object has several resources -- see URI list'), |
| 44 301: ('Moved Permanently', 'Object moved permanently -- see URI list'), |
| 45 302: ('Found', 'Object moved temporarily -- see URI list'), |
| 46 303: ('See Other', 'Object moved -- see Method and URL list'), |
| 47 304: ('Not Modified', |
| 48 'Document has not changed since given time'), |
| 49 305: ('Use Proxy', |
| 50 'You must use proxy specified in Location to access this ' |
| 51 'resource.'), |
| 52 307: ('Temporary Redirect', |
| 53 'Object moved temporarily -- see URI list'), |
| 54 |
| 55 400: ('Bad Request', |
| 56 'Bad request syntax or unsupported method'), |
| 57 401: ('Unauthorized', |
| 58 'No permission -- see authorization schemes'), |
| 59 402: ('Payment Required', |
| 60 'No payment -- see charging schemes'), |
| 61 403: ('Forbidden', |
| 62 'Request forbidden -- authorization will not help'), |
| 63 404: ('Not Found', 'Nothing matches the given URI'), |
| 64 405: ('Method Not Allowed', |
| 65 'Specified method is invalid for this resource.'), |
| 66 406: ('Not Acceptable', 'URI not available in preferred format.'), |
| 67 407: ('Proxy Authentication Required', 'You must authenticate with ' |
| 68 'this proxy before proceeding.'), |
| 69 408: ('Request Timeout', 'Request timed out; try again later.'), |
| 70 409: ('Conflict', 'Request conflict.'), |
| 71 410: ('Gone', |
| 72 'URI no longer exists and has been permanently removed.'), |
| 73 411: ('Length Required', 'Client must specify Content-Length.'), |
| 74 412: ('Precondition Failed', 'Precondition in headers is false.'), |
| 75 413: ('Request Entity Too Large', 'Entity is too large.'), |
| 76 414: ('Request-URI Too Long', 'URI is too long.'), |
| 77 415: ('Unsupported Media Type', 'Entity body in unsupported format.'), |
| 78 416: ('Requested Range Not Satisfiable', |
| 79 'Cannot satisfy request range.'), |
| 80 417: ('Expectation Failed', |
| 81 'Expect condition could not be satisfied.'), |
| 82 |
| 83 500: ('Internal Server Error', 'Server got itself in trouble'), |
| 84 501: ('Not Implemented', |
| 85 'Server does not support this operation'), |
| 86 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'), |
| 87 503: ('Service Unavailable', |
| 88 'The server cannot process the request due to a high load'), |
| 89 504: ('Gateway Timeout', |
| 90 'The gateway server did not receive a timely response'), |
| 91 505: ('HTTP Version Not Supported', 'Cannot fulfill request.'), |
| 92 } |
OLD | NEW |