Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
1251fafc
Kaydet (Commit)
1251fafc
authored
Haz 03, 2012
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 14989: http.server --cgi option can enable the CGI http server.
üst
c68e1368
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
http.server.rst
Doc/library/http.server.rst
+6
-0
server.py
Lib/http/server.py
+15
-7
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/http.server.rst
Dosyayı görüntüle @
1251fafc
...
...
@@ -400,3 +400,9 @@ the previous example, this serves files relative to the current directory. ::
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.
:class:`CGIHTTPRequestHandler` can be enabled in the command line by passing
the ``--cgi`` option.::
python -m http.server --cgi 8000
Lib/http/server.py
Dosyayı görüntüle @
1251fafc
...
...
@@ -100,6 +100,8 @@ import sys
import
time
import
urllib.parse
import
copy
import
argparse
# Default error message template
DEFAULT_ERROR_MESSAGE
=
"""
\
...
...
@@ -1173,18 +1175,13 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
def
test
(
HandlerClass
=
BaseHTTPRequestHandler
,
ServerClass
=
HTTPServer
,
protocol
=
"HTTP/1.0"
):
ServerClass
=
HTTPServer
,
protocol
=
"HTTP/1.0"
,
port
=
8000
):
"""Test the HTTP request handler class.
This runs an HTTP server on port 8000 (or the first command line
argument).
"""
if
sys
.
argv
[
1
:]:
port
=
int
(
sys
.
argv
[
1
])
else
:
port
=
8000
server_address
=
(
''
,
port
)
HandlerClass
.
protocol_version
=
protocol
...
...
@@ -1200,4 +1197,15 @@ def test(HandlerClass = BaseHTTPRequestHandler,
sys
.
exit
(
0
)
if
__name__
==
'__main__'
:
test
(
HandlerClass
=
SimpleHTTPRequestHandler
)
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--cgi'
,
action
=
'store_true'
,
help
=
'Run as CGI Server'
)
parser
.
add_argument
(
'port'
,
action
=
'store'
,
default
=
8000
,
type
=
int
,
nargs
=
'?'
,
help
=
'Specify alternate port [default: 8000]'
)
args
=
parser
.
parse_args
()
if
args
.
cgi
:
test
(
HandlerClass
=
CGIHTTPRequestHandler
,
port
=
args
.
port
)
else
:
test
(
HandlerClass
=
SimpleHTTPRequestHandler
,
port
=
args
.
port
)
Misc/NEWS
Dosyayı görüntüle @
1251fafc
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.3.0 Beta 1?
Library
-------
- Issue #14989: Make the CGI enable option to http.server available via command
line.
- Issue #14987: Add a missing import statement to inspect.
- Issue #1079: email.header.decode_header now correctly parses all the examples
...
...
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