Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-109096: Deprecatehttp.server.CGIHTTPRequestHandler#109387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from2 commits
6ea9d69fd3dbe524ebc80d1f0c733e3a5d3e1e9b220c447587cd0b6fd95be85File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -502,11 +502,22 @@ following command runs an HTTP/1.1 conformant server:: | ||
| Note that CGI scripts will be run with UID of user nobody, for security | ||
| reasons. Problems with the CGI script will be translated to error 403. | ||
| .. deprecated-removed:: 3.13 3.15 | ||
| :class:`CGIHTTPRequestHandler` is being removed in 3.15. CGI has not been | ||
gpshead marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| considered a good way to do things for well over a decade, this code has | ||
| been unmaintained for a while now and sees very little practical use. | ||
| Retaining it could lead to further | ||
| :ref:`security considerations <http.server-security>`. | ||
gpshead marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| :class:`CGIHTTPRequestHandler` can be enabled in the command line by passing | ||
| the ``--cgi`` option:: | ||
| python -m http.server --cgi | ||
| .. deprecated-removed:: 3.13 3.15 | ||
| :mod:`http.server` command line ``--cgi`` support is being removed because | ||
| :class:`CGIHTTPRequestHandler` is being removed. | ||
gpshead marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| .. _http.server-security: | ||
| Security Considerations | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2,18 +2,18 @@ | ||
| Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see | ||
| SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST, | ||
| and(deprecated)CGIHTTPRequestHandler for CGI scripts. | ||
| It does, however, optionally implement HTTP/1.1 persistent connections. | ||
| Notes on CGIHTTPRequestHandler | ||
| ------------------------------ | ||
| This classdeprecated. Itimplements GET and POST requests to cgi-bin scripts. | ||
gpshead marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| If the os.fork() function is not present (Windows), subprocess.Popen() is used, | ||
| with slightly altered but never documented semantics. Use from a threaded | ||
| processes is likely to trigger a warning at os.fork() time. | ||
gpshead marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| In all cases, the implementation is intentionally naive -- all | ||
| requests are executed synchronously. | ||
| @@ -986,6 +986,12 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): | ||
| """ | ||
| def __init__(self, *args, **kwargs): | ||
| import warnings | ||
| warnings._deprecated("http.server.CGIHTTPRequestHandler", | ||
| remove=(3, 15)) | ||
| super().__init__(*args, **kwargs) | ||
| # Determine platform specifics | ||
| have_fork = hasattr(os, 'fork') | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| :class:`http.server.CGIHTTPRequestHandler` has been deprecated for removal | ||
| in 3.15. Its design is old and the web world has long since moved beyond | ||
| CGI. |