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
Aug 23, 2019
by
Raymond Hettinger
Committed by
GitHub
Aug 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-26589: Add http status code 451 (GH-15413)
parent
120b707a
Changes
4
Hide 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
...
@@ -106,6 +106,7 @@ Code Enum Name Details
``428`` ``PRECONDITION_REQUIRED`` Additional HTTP Status Codes :rfc:`6585`
``428`` ``PRECONDITION_REQUIRED`` Additional HTTP Status Codes :rfc:`6585`
``429`` ``TOO_MANY_REQUESTS`` 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`
``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
``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
``501`` ``NOT_IMPLEMENTED`` HTTP/1.1 :rfc:`7231`, Section 6.6.2
``502`` ``BAD_GATEWAY`` HTTP/1.1 :rfc:`7231`, Section 6.6.3
``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
...
@@ -126,3 +127,6 @@ equal to the constant name (i.e. ``http.HTTPStatus.OK`` is also available as
.. versionchanged:: 3.7
.. versionchanged:: 3.7
Added ``421 MISDIRECTED_REQUEST`` status code.
Added ``421 MISDIRECTED_REQUEST`` status code.
.. versionadded:: 3.8
Added ``451 UNAVAILABLE_FOR_LEGAL_REASONS`` status code.
Lib/http/__init__.py
View file @
8f080b09
...
@@ -15,6 +15,7 @@ class HTTPStatus(IntEnum):
...
@@ -15,6 +15,7 @@ class HTTPStatus(IntEnum):
* RFC 7238: Permanent Redirect
* RFC 7238: Permanent Redirect
* RFC 2295: Transparent Content Negotiation in HTTP
* RFC 2295: Transparent Content Negotiation in HTTP
* RFC 2774: An HTTP Extension Framework
* 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)
* RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2)
"""
"""
def
__new__
(
cls
,
value
,
phrase
,
description
=
''
):
def
__new__
(
cls
,
value
,
phrase
,
description
=
''
):
...
@@ -114,6 +115,10 @@ class HTTPStatus(IntEnum):
...
@@ -114,6 +115,10 @@ class HTTPStatus(IntEnum):
'Request Header Fields Too Large'
,
'Request Header Fields Too Large'
,
'The server is unwilling to process the request because its header '
'The server is unwilling to process the request because its header '
'fields are too large'
)
'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
# server errors
INTERNAL_SERVER_ERROR
=
(
500
,
'Internal Server Error'
,
INTERNAL_SERVER_ERROR
=
(
500
,
'Internal Server Error'
,
...
...
Lib/test/test_httplib.py
View file @
8f080b09
...
@@ -1401,6 +1401,7 @@ class OfflineTest(TestCase):
...
@@ -1401,6 +1401,7 @@ class OfflineTest(TestCase):
'PRECONDITION_REQUIRED'
,
'PRECONDITION_REQUIRED'
,
'TOO_MANY_REQUESTS'
,
'TOO_MANY_REQUESTS'
,
'REQUEST_HEADER_FIELDS_TOO_LARGE'
,
'REQUEST_HEADER_FIELDS_TOO_LARGE'
,
'UNAVAILABLE_FOR_LEGAL_REASONS'
,
'INTERNAL_SERVER_ERROR'
,
'INTERNAL_SERVER_ERROR'
,
'NOT_IMPLEMENTED'
,
'NOT_IMPLEMENTED'
,
'BAD_GATEWAY'
,
'BAD_GATEWAY'
,
...
...
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
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