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
3a145a18
Kaydet (Commit)
3a145a18
authored
Kas 11, 2009
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
CGIHTTPRequestHandler.run_cgi() to use subprocess for Non Unix platforms. Fix
based on Issue1235.
üst
47dded64
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
54 deletions
+23
-54
CGIHTTPServer.py
Lib/CGIHTTPServer.py
+23
-54
No files found.
Lib/CGIHTTPServer.py
Dosyayı görüntüle @
3a145a18
...
...
@@ -253,75 +253,44 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
self
.
server
.
handle_error
(
self
.
request
,
self
.
client_address
)
os
.
_exit
(
127
)
elif
self
.
have_popen2
or
self
.
have_popen3
:
# Windows -- use popen2 or popen3 to create a subprocess
import
shutil
if
self
.
have_popen3
:
popenx
=
os
.
popen3
else
:
popenx
=
os
.
popen2
cmdline
=
scriptfile
else
:
# Non Unix - use subprocess
import
subprocess
cmdline
=
[
scriptfile
]
if
self
.
is_python
(
scriptfile
):
interp
=
sys
.
executable
if
interp
.
lower
()
.
endswith
(
"w.exe"
):
# On Windows, use python.exe, not pythonw.exe
interp
=
interp
[:
-
5
]
+
interp
[
-
4
:]
cmdline
=
"
%
s -u
%
s"
%
(
interp
,
cmdline
)
if
'='
not
in
query
and
'"'
not
in
query
:
cmdline
=
'
%
s "
%
s"'
%
(
cmdline
,
query
)
self
.
log_message
(
"command:
%
s"
,
cmdline
)
cmdline
=
[
interp
,
'-u'
]
+
cmdline
if
'='
not
in
query
:
cmdline
.
append
(
query
)
self
.
log_message
(
"command:
%
s"
,
subprocess
.
list2cmdline
(
cmdline
))
try
:
nbytes
=
int
(
length
)
except
(
TypeError
,
ValueError
):
nbytes
=
0
files
=
popenx
(
cmdline
,
'b'
)
fi
=
files
[
0
]
fo
=
files
[
1
]
if
self
.
have_popen3
:
fe
=
files
[
2
]
files
=
subprocess
.
Popen
(
cmdline
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
if
self
.
command
.
lower
()
==
"post"
and
nbytes
>
0
:
data
=
self
.
rfile
.
read
(
nbytes
)
fi
.
write
(
data
)
else
:
data
=
None
# throw away additional data [see bug #427345]
while
select
.
select
([
self
.
rfile
.
_sock
],
[],
[],
0
)[
0
]:
if
not
self
.
rfile
.
_sock
.
recv
(
1
):
break
fi
.
close
()
shutil
.
copyfileobj
(
fo
,
self
.
wfile
)
if
self
.
have_popen3
:
errors
=
fe
.
read
()
fe
.
close
()
if
errors
:
self
.
log_error
(
'
%
s'
,
errors
)
sts
=
fo
.
close
()
if
sts
:
self
.
log_error
(
"CGI script exit status
%#
x"
,
sts
)
else
:
self
.
log_message
(
"CGI script exited OK"
)
else
:
# Other O.S. -- execute script in this process
save_argv
=
sys
.
argv
save_stdin
=
sys
.
stdin
save_stdout
=
sys
.
stdout
save_stderr
=
sys
.
stderr
try
:
save_cwd
=
os
.
getcwd
()
try
:
sys
.
argv
=
[
scriptfile
]
if
'='
not
in
decoded_query
:
sys
.
argv
.
append
(
decoded_query
)
sys
.
stdout
=
self
.
wfile
sys
.
stdin
=
self
.
rfile
execfile
(
scriptfile
,
{
"__name__"
:
"__main__"
})
finally
:
sys
.
argv
=
save_argv
sys
.
stdin
=
save_stdin
sys
.
stdout
=
save_stdout
sys
.
stderr
=
save_stderr
os
.
chdir
(
save_cwd
)
except
SystemExit
,
sts
:
self
.
log_error
(
"CGI script exit status
%
s"
,
str
(
sts
))
stdout
,
stderr
=
p
.
communicate
(
data
)
self
.
wfile
.
write
(
stdout
)
if
stderr
:
self
.
log_error
(
'
%
s'
,
stderr
)
status
=
p
.
returncode
if
status
:
self
.
log_error
(
"CGI script exit status
%#
x"
,
status
)
else
:
self
.
log_message
(
"CGI script exited OK"
)
...
...
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