b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 104.21.65.202 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 /
Filename/usr/lib64/python2.6/CGIHTTPServer.pyc
Size10.57 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 05:25
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc @sÅdZdZdgZddkZddkZddkZddkZddkZddkZdei fd��YZ
d�Z e a
d�Zd�Ze
eid �Zed
jo e�ndS( súCGI-savvy HTTP Server.

This module builds on SimpleHTTPServer by implementing GET and POST
requests to cgi-bin scripts.

If the os.fork() function is not present (e.g. on Windows),
os.popen2() is used as a fallback, with slightly altered semantics; if
that function is not present either (e.g. on Macintosh), only Python
scripts are supported, and they are executed by the current process.

In all cases, the implementation is intentionally naive -- all
requests are executed sychronously.

SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL
-- it may execute arbitrary Python code or external programs.

Note that status code 200 is sent prior to execution of a CGI script, so
scripts cannot send other status codes such as 302 (redirect).
s0.4tCGIHTTPRequestHandleriÿÿÿÿNcBs�eZdZeed�Zeed�Zeed�ZdZd�Z d�Z
d�Z dd gZ d
�Z
d �Zd �ZRS(
s­Complete HTTP server with GET, HEAD and POST commands.

GET and HEAD also support running CGI scripts.

The POST command is *only* implemented for CGI scripts.

tforktpopen2tpopen3icCs/|i�o|i�n|idd�dS(sRServe a POST request.

This is only implemented for CGI scripts.

iõsCan only POST to CGI scriptsN(tis_cgitrun_cgit
send_error(tself((s%/usr/lib64/python2.6/CGIHTTPServer.pytdo_POST5s
cCs,|i�o |i�Stii|�SdS(s-Version of send_head that support CGI scriptsN(RRtSimpleHTTPServertSimpleHTTPRequestHandlert send_head(R((s%/usr/lib64/python2.6/CGIHTTPServer.pyR As
 cCs>tti|i��}|d|ijo||_tStS(s°Test whether self.path corresponds to a CGI script.

Returns True and updates the cgi_info attribute to the tuple
(dir, rest) if self.path requires running a CGI script.
Returns False otherwise.

The default implementation tests whether the normalized url
path begins with one of the strings in self.cgi_directories
(and the next character is a '/' or the end of the string).
i(t_url_collapse_path_splitturllibtunquotetpathtcgi_directoriestcgi_infotTruetFalse(Rt splitpath((s%/usr/lib64/python2.6/CGIHTTPServer.pyRHs
 s/cgi-bins/htbincCs
t|�S(s1Test whether argument path is an executable file.(t
executable(RR((s%/usr/lib64/python2.6/CGIHTTPServer.pyt
is_executable[scCs(tii|�\}}|i�djS(s.Test whether argument path is a Python script.s.pys.pyw(s.pys.pyw(tosRtsplitexttlower(RRtheadttail((s%/usr/lib64/python2.6/CGIHTTPServer.pyt is_python_sc(Cs |i}|i\}}|idt|�d�}xz|djol|| }||d}|i|�}tii|�o-||}}|idt|�d�}q7Pq7W|id�}|djo|| ||d}}nd}|id�}|djo|| ||} }n|d} }|d| }
|i|
�} tii| �p|i dd|
�dStii
| �p|i d d
|
�dS|i |
�} | pd|i p|i
p|ip|i d d |
�dS|i| �p|i d d |
�dSnh}
|i�|
d
<|ii|
d<d|
d<|i|
d<t|ii�|
d<|i|
d<ti|�}||
d<|i|�|
d<|
|
d<|o||
d<n|i�}||idjo||
d<n|id|
d<|iid�}|oÌ|i�}t|�djo©ddk}ddk}|d|
d<|di �djohy|i!|d�}Wn|i"j
oqèX|id�}t|�djo|d|
d <qèqìqðn|ii#djo|ii%|
d!<n|ii#|
d!<|iid"�}|o||
d#<n|iid$�}|o||
d%<ng}xY|ii&d&�D]E}|d d'jo|i'|i(��q�||d(id)�}q�Wd)i)|�|
d*<|iid+�}|o||
d,<nt*d|ii+d-��}|od.i)|�|
d/<nxdBD]}|
i,|d�qQWti-i.|
�|i/d0d1�|i0d2d3�}|i o{| g}d4|jo|i'|�nt1�}|i2i3�ti4�}|djo{ti5|d�\}}x@t6i6|i7gggd�do|i7i8d�pPqqW|o|i9d5|�ndSyvyti:|�Wnti;j
onXti<|i7i=�d�ti<|i2i=�d�ti>| |ti-�Wq |ii?|i@|i�tiAd6�q XnûddkB}| g} |i | �oItCiD}!|!i �iEd7�o|!d8 |!d9}!n|!d:g| } nd4|jo| i'|�n|iFd;|iG| ��ytH|�}"WntItJfj
o
d}"nX|iK| d<|iLd=|iLd>|iL�}#|ii �d?jo#|"djo|i7i8|"�}$nd}$xFt6i6|i7iMgggd�do|i7iMiNd�pPqeqeW|#iO|$�\}%}&|i2iP|%�|&o|i9d@|&�n|#iQ}'|'o|i9d5|'�n|iFdA�dS(CsExecute a CGI script.t/iit?ti�sNo such CGI script (%r)Ni�s#CGI script is not a plain file (%r)s&CGI script is not a Python script (%r)s!CGI script is not executable (%r)tSERVER_SOFTWAREt SERVER_NAMEsCGI/1.1tGATEWAY_INTERFACEtSERVER_PROTOCOLt SERVER_PORTtREQUEST_METHODt PATH_INFOtPATH_TRANSLATEDt SCRIPT_NAMEt QUERY_STRINGt REMOTE_HOSTt REMOTE_ADDRt
authorizationiiÿÿÿÿt AUTH_TYPEtbasict:t REMOTE_USERt CONTENT_TYPEscontent-lengthtCONTENT_LENGTHtreferert HTTP_REFERERtaccepts
it,t HTTP_ACCEPTs
user-agenttHTTP_USER_AGENTtcookies, t HTTP_COOKIEiÈsScript output followst+t t=sCGI script exit status %#xisw.exeiûÿÿÿiüÿÿÿs-us command: %ststdintstdouttstderrtposts%ssCGI script exited OK(R)R*R2R8R:R4(RRRtfindtlenttranslate_pathRtisdirtrfindtexistsRtisfileRt have_forkt have_popen2t have_popen3Rtversion_stringtservert server_nametprotocol_versiontstrt server_porttcommandR
Rtaddress_stringtclient_addresstheaderst getheadertsplittbase64tbinasciiRt decodestringtErrort
typeheadertNonettypetgetallmatchingheaderstappendtstriptjointfiltert
getheaderst
setdefaulttenvirontupdatet
send_responsetreplacet
nobody_uidtwfiletflushRtwaitpidtselecttrfiletreadt log_errortsetuidterrortdup2tfilenotexecvet handle_errortrequestt_exitt
subprocesstsysRtendswitht log_messaget list2cmdlinetintt TypeErrort
ValueErrortPopentPIPEt_socktrecvt communicatetwritet
returncode((RRtdirtresttitnextdirtnextrestt scriptdirtquerytscriptt
scriptnamet
scriptfiletispytenvtuqrestthostR,RXRYtlengthR3R5tlinetuatcotkt
decoded_querytargstnobodytpidtstsRztcmdlinetinterptnbytestptdataR?R@tstatus((s%/usr/lib64/python2.6/CGIHTTPServer.pyRds> 


 


    




  
 
 
 
#
   
     #&
 (t__name__t
__module__t__doc__thasattrRRIRJRKtrbufsizeRR RRRRR(((s%/usr/lib64/python2.6/CGIHTTPServer.pyR"s     c Csg}xB|id�D]1}|djo|id�q|i|�qWg}|d D]}|o ||qZqZ~|d}|o|i�}nd}g}x6|D].}|djo|i�q­|i|�q­W|o!|djo|i�d}nddi|�|fS(sÔ
Given a URL path, remove extra '/'s and '.' path elements and collapse
any '..' references.

Implements something akin to RFC-2396 5.2 step 6 to parse relative paths.

Returns: A tuple of (head, tail) where tail is everything after the final /
and head is everything before it. Head will always start with a '/' and,
if it contains anything else, never have a trailing '/'.

Raises: IndexError if too many '..' occur within the path.
Rt.Riÿÿÿÿs..(RWR`tpopRb(Rt
path_partstpartt_[1]t tail_partt
head_parts((s%/usr/lib64/python2.6/CGIHTTPServer.pyR (s(
8


c Cs�totSyddk}Wntj
odSXy|id�daWn5tj
o)dttd�|i���anXtS(s$Internal routine to get nobody's uidiÿÿÿÿNR�iicSs|dS(i((tx((s%/usr/lib64/python2.6/CGIHTTPServer.pyt<lambda>]s(R�tpwdt ImportErrortgetpwnamtKeyErrortmaxtmaptgetpwall(Rµ((s%/usr/lib64/python2.6/CGIHTTPServer.pyRjQs'cCs>yti|�}Wntij
otSX|id@djS(sTest for executable file.iIi(RtstatRsRtst_mode(Rtst((s%/usr/lib64/python2.6/CGIHTTPServer.pyRas
cCsti||�dS(N(R ttest(t HandlerClasst ServerClass((s%/usr/lib64/python2.6/CGIHTTPServer.pyR¿jst__main__(R©t __version__t__all__RR{R
tBaseHTTPServerR RnR
RR R]R�RjRt
HTTPServerR¿R§(((s%/usr/lib64/python2.6/CGIHTTPServer.pyt<module>s$       ÿ '