Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8f080b09
Commit
8f080b09
authored
5 years ago
by
Raymond Hettinger
Committed by
GitHub
5 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-26589: Add http status code 451 (GH-15413)
parent
120b707a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
0 deletions
+12
-0
Doc/library/http.rst
Doc/library/http.rst
+4
-0
Lib/http/__init__.py
Lib/http/__init__.py
+5
-0
Lib/test/test_httplib.py
Lib/test/test_httplib.py
+1
-0
Misc/NEWS.d/next/Library/2019-08-23-00-55-19.bpo-26589.M1xyxG.rst
...S.d/next/Library/2019-08-23-00-55-19.bpo-26589.M1xyxG.rst
+2
-0
No files found.
Doc/library/http.rst
View file @
8f080b09
...
...
@@ -106,6 +106,7 @@ Code Enum Name Details
``428`` ``PRECONDITION_REQUIRED`` Additional HTTP Status Codes :rfc:`6585`
``429`` ``TOO_MANY_REQUESTS`` Additional HTTP Status Codes :rfc:`6585`
``431`` ``REQUEST_HEADER_FIELDS_TOO_LARGE`` Additional HTTP Status Codes :rfc:`6585`
``451`` ``UNAVAILABLE_FOR_LEGAL_REASONS`` An HTTP Status Code to Report Legal Obstacles :rfc:`7725`
``500`` ``INTERNAL_SERVER_ERROR`` HTTP/1.1 :rfc:`7231`, Section 6.6.1
``501`` ``NOT_IMPLEMENTED`` HTTP/1.1 :rfc:`7231`, Section 6.6.2
``502`` ``BAD_GATEWAY`` HTTP/1.1 :rfc:`7231`, Section 6.6.3
...
...
@@ -126,3 +127,6 @@ equal to the constant name (i.e. ``http.HTTPStatus.OK`` is also available as
.. versionchanged:: 3.7
Added ``421 MISDIRECTED_REQUEST`` status code.
.. versionadded:: 3.8
Added ``451 UNAVAILABLE_FOR_LEGAL_REASONS`` status code.
This diff is collapsed.
Click to expand it.
Lib/http/__init__.py
View file @
8f080b09
...
...
@@ -15,6 +15,7 @@ class HTTPStatus(IntEnum):
* RFC 7238: Permanent Redirect
* RFC 2295: Transparent Content Negotiation in HTTP
* RFC 2774: An HTTP Extension Framework
* RFC 7725: An HTTP Status Code to Report Legal Obstacles
* RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2)
"""
def
__new__
(
cls
,
value
,
phrase
,
description
=
''
):
...
...
@@ -114,6 +115,10 @@ class HTTPStatus(IntEnum):
'Request Header Fields Too Large'
,
'The server is unwilling to process the request because its header '
'fields are too large'
)
UNAVAILABLE_FOR_LEGAL_REASONS
=
(
451
,
'Unavailable For Legal Reasons'
,
'The server is denying access to the '
'resource as a consequence of a legal demand'
)
# server errors
INTERNAL_SERVER_ERROR
=
(
500
,
'Internal Server Error'
,
...
...
This diff is collapsed.
Click to expand it.
Lib/test/test_httplib.py
View file @
8f080b09
...
...
@@ -1401,6 +1401,7 @@ class OfflineTest(TestCase):
'PRECONDITION_REQUIRED'
,
'TOO_MANY_REQUESTS'
,
'REQUEST_HEADER_FIELDS_TOO_LARGE'
,
'UNAVAILABLE_FOR_LEGAL_REASONS'
,
'INTERNAL_SERVER_ERROR'
,
'NOT_IMPLEMENTED'
,
'BAD_GATEWAY'
,
...
...
This diff is collapsed.
Click to expand it.
Misc/NEWS.d/next/Library/2019-08-23-00-55-19.bpo-26589.M1xyxG.rst
0 → 100644
View file @
8f080b09
Added a new status code to the http module: 451
UNAVAILABLE_FOR_LEGAL_REASONS
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment