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
51b2ed51
Commit
51b2ed51
authored
May 16, 2012
by
Hynek Schlawack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#14809: Add HTTP status codes from RFC 6585 to http.server and http.client
Patch by EungJun Yi.
parent
313fbe21
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
1 deletion
+36
-1
Doc/library/http.client.rst
Doc/library/http.client.rst
+15
-0
Lib/http/client.py
Lib/http/client.py
+8
-0
Lib/http/server.py
Lib/http/server.py
+9
-1
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/http.client.rst
View file @
51b2ed51
...
@@ -339,6 +339,15 @@ and also the following constants for integer status codes:
...
@@ -339,6 +339,15 @@ and also the following constants for integer status codes:
| :const:`UPGRADE_REQUIRED` | ``426`` | HTTP Upgrade to TLS, |
| :const:`UPGRADE_REQUIRED` | ``426`` | HTTP Upgrade to TLS, |
| | | :rfc:`2817`, Section 6 |
| | | :rfc:`2817`, Section 6 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`PRECONDITION_REQUIRED` | ``428`` | Additional HTTP Status Codes, |
| | | :rfc:`6585`, Section 3 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`TOO_MANY_REQUESTS` | ``429`` | Additional HTTP Status Codes, |
| | | :rfc:`6585`, Section 4 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`REQUEST_HEADER_FIELDS_TOO_LARGE` | ``431`` | Additional HTTP Status Codes, |
| | | :rfc:`6585`, Section 5 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`INTERNAL_SERVER_ERROR` | ``500`` | HTTP/1.1, `RFC 2616, Section |
| :const:`INTERNAL_SERVER_ERROR` | ``500`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.5.1 |
| | | 10.5.1 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1>`_ |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1>`_ |
...
@@ -369,6 +378,12 @@ and also the following constants for integer status codes:
...
@@ -369,6 +378,12 @@ and also the following constants for integer status codes:
| :const:`NOT_EXTENDED` | ``510`` | An HTTP Extension Framework, |
| :const:`NOT_EXTENDED` | ``510`` | An HTTP Extension Framework, |
| | | :rfc:`2774`, Section 7 |
| | | :rfc:`2774`, Section 7 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`NETWORK_AUTHENTICATION_REQUIRED` | ``511`` | Additional HTTP Status Codes, |
| | | :rfc:`6585`, Section 6 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
.. versionchanged:: 3.3
Added codes ``428``, ``429``, ``431`` and ``511`` from :rfc:`6585`.
.. data:: responses
.. data:: responses
...
...
Lib/http/client.py
View file @
51b2ed51
...
@@ -141,6 +141,9 @@ UNPROCESSABLE_ENTITY = 422
...
@@ -141,6 +141,9 @@ UNPROCESSABLE_ENTITY = 422
LOCKED
=
423
LOCKED
=
423
FAILED_DEPENDENCY
=
424
FAILED_DEPENDENCY
=
424
UPGRADE_REQUIRED
=
426
UPGRADE_REQUIRED
=
426
PRECONDITION_REQUIRED
=
428
TOO_MANY_REQUESTS
=
429
REQUEST_HEADER_FIELDS_TOO_LARGE
=
431
# server error
# server error
INTERNAL_SERVER_ERROR
=
500
INTERNAL_SERVER_ERROR
=
500
...
@@ -151,6 +154,7 @@ GATEWAY_TIMEOUT = 504
...
@@ -151,6 +154,7 @@ GATEWAY_TIMEOUT = 504
HTTP_VERSION_NOT_SUPPORTED
=
505
HTTP_VERSION_NOT_SUPPORTED
=
505
INSUFFICIENT_STORAGE
=
507
INSUFFICIENT_STORAGE
=
507
NOT_EXTENDED
=
510
NOT_EXTENDED
=
510
NETWORK_AUTHENTICATION_REQUIRED
=
511
# Mapping status codes to official W3C names
# Mapping status codes to official W3C names
responses
=
{
responses
=
{
...
@@ -192,6 +196,9 @@ responses = {
...
@@ -192,6 +196,9 @@ responses = {
415
:
'Unsupported Media Type'
,
415
:
'Unsupported Media Type'
,
416
:
'Requested Range Not Satisfiable'
,
416
:
'Requested Range Not Satisfiable'
,
417
:
'Expectation Failed'
,
417
:
'Expectation Failed'
,
428
:
'Precondition Required'
,
429
:
'Too Many Requests'
,
431
:
'Request Header Fields Too Large'
,
500
:
'Internal Server Error'
,
500
:
'Internal Server Error'
,
501
:
'Not Implemented'
,
501
:
'Not Implemented'
,
...
@@ -199,6 +206,7 @@ responses = {
...
@@ -199,6 +206,7 @@ responses = {
503
:
'Service Unavailable'
,
503
:
'Service Unavailable'
,
504
:
'Gateway Timeout'
,
504
:
'Gateway Timeout'
,
505
:
'HTTP Version Not Supported'
,
505
:
'HTTP Version Not Supported'
,
511
:
'Network Authentication Required'
,
}
}
# maximal amount of data to read at one time in _safe_read
# maximal amount of data to read at one time in _safe_read
...
...
Lib/http/server.py
View file @
51b2ed51
...
@@ -573,7 +573,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
...
@@ -573,7 +573,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
# Table mapping response codes to messages; entries have the
# Table mapping response codes to messages; entries have the
# form {code: (shortmessage, longmessage)}.
# form {code: (shortmessage, longmessage)}.
# See RFC 2616.
# See RFC 2616
and 6585
.
responses
=
{
responses
=
{
100
:
(
'Continue'
,
'Request received, please continue'
),
100
:
(
'Continue'
,
'Request received, please continue'
),
101
:
(
'Switching Protocols'
,
101
:
(
'Switching Protocols'
,
...
@@ -628,6 +628,12 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
...
@@ -628,6 +628,12 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
'Cannot satisfy request range.'
),
'Cannot satisfy request range.'
),
417
:
(
'Expectation Failed'
,
417
:
(
'Expectation Failed'
,
'Expect condition could not be satisfied.'
),
'Expect condition could not be satisfied.'
),
428
:
(
'Precondition Required'
,
'The origin server requires the request to be conditional.'
),
429
:
(
'Too Many Requests'
,
'The user has sent too many requests '
'in a given amount of time ("rate limiting").'
),
431
:
(
'Request Header Fields Too Large'
,
'The server is unwilling to '
'process the request because its header fields are too large.'
),
500
:
(
'Internal Server Error'
,
'Server got itself in trouble'
),
500
:
(
'Internal Server Error'
,
'Server got itself in trouble'
),
501
:
(
'Not Implemented'
,
501
:
(
'Not Implemented'
,
...
@@ -638,6 +644,8 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
...
@@ -638,6 +644,8 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
504
:
(
'Gateway Timeout'
,
504
:
(
'Gateway Timeout'
,
'The gateway server did not receive a timely response'
),
'The gateway server did not receive a timely response'
),
505
:
(
'HTTP Version Not Supported'
,
'Cannot fulfill request.'
),
505
:
(
'HTTP Version Not Supported'
,
'Cannot fulfill request.'
),
511
:
(
'Network Authentication Required'
,
'The client needs to authenticate to gain network access.'
),
}
}
...
...
Misc/ACKS
View file @
51b2ed51
...
@@ -1129,6 +1129,7 @@ Florent Xicluna
...
@@ -1129,6 +1129,7 @@ Florent Xicluna
Hirokazu Yamamoto
Hirokazu Yamamoto
Ka-Ping Yee
Ka-Ping Yee
Jason Yeo
Jason Yeo
EungJun Yi
Bob Yodlowski
Bob Yodlowski
Danny Yoo
Danny Yoo
George Yoshida
George Yoshida
...
...
Misc/NEWS
View file @
51b2ed51
...
@@ -34,6 +34,9 @@ Core and Builtins
...
@@ -34,6 +34,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #14809: Add HTTP status codes introduced by RFC 6585 to http.server
and http.client. Patch by EungJun Yi.
- Issue #14777: tkinter may return undecoded UTF-8 bytes as a string when
- Issue #14777: tkinter may return undecoded UTF-8 bytes as a string when
accessing the Tk clipboard. Modify clipboad_get() to first request type
accessing the Tk clipboard. Modify clipboad_get() to first request type
UTF8_STRING when no specific type is requested in an X11 windowing
UTF8_STRING when no specific type is requested in an X11 windowing
...
...
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