ACC SHELL

Path : /usr/lib/python/
File Upload :
Current File : //usr/lib/python/CGIHTTPServer.pyo

Ńň
nÄMc	@sĹdZdZdgZddkZddkZddkZddkZddkZddkZdei	fd„ƒYZ
d„Zea
d„Zd„Ze
eid	„Zed
joeƒ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„Zdd	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/lib/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/lib/python2.6/CGIHTTPServer.pyRAs
cCs5t|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_splittpathtcgi_directoriestcgi_infotTruetFalse(Rt	splitpath((s#/usr/lib/python2.6/CGIHTTPServer.pyRHs
	s/cgi-bins/htbincCs
t|ƒS(s1Test whether argument path is an executable file.(t
executable(RR
((s#/usr/lib/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(tosR
tsplitexttlower(RR
theadttail((s#/usr/lib/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_SOFTWAREtSERVER_NAMEsCGI/1.1tGATEWAY_INTERFACEtSERVER_PROTOCOLtSERVER_PORTtREQUEST_METHODt	PATH_INFOtPATH_TRANSLATEDtSCRIPT_NAMEtQUERY_STRINGtREMOTE_HOSTtREMOTE_ADDRt
authorizationii˙˙˙˙t	AUTH_TYPEtbasict:tREMOTE_USERtCONTENT_TYPEscontent-lengthtCONTENT_LENGTHtreferertHTTP_REFERERtaccepts	

 it,tHTTP_ACCEPTs
user-agenttHTTP_USER_AGENTtcookies, tHTTP_COOKIEiČsScript output followst+t t=sCGI script exit status %#xisw.exeiű˙˙˙iü˙˙˙s-uscommand: %ststdintstdouttstderrtposts%ssCGI script exited OK(R'R(R0R6R8R2(RR
Rtfindtlenttranslate_pathRtisdirtrfindtexistsRtisfileRt	have_forkthave_popen2thave_popen3Rtversion_stringtservertserver_nametprotocol_versiontstrtserver_porttcommandturllibtunquotetaddress_stringtclient_addresstheaderst	getheadertsplittbase64tbinasciiRtdecodestringtErrort
typeheadertNonettypetgetallmatchingheaderstappendtstriptjointfiltert
getheaderst
setdefaulttenvirontupdatet
send_responsetreplacet
nobody_uidtwfiletflushRtwaitpidtselecttrfiletreadt	log_errortsetuidterrortdup2tfilenotexecvethandle_errortrequestt_exitt
subprocesstsysRtendswithtlog_messagetlist2cmdlinetintt	TypeErrort
ValueErrortPopentPIPEt_socktrecvtcommunicatetwritet
returncode((RR
tdirtresttitnextdirtnextrestt	scriptdirtquerytscriptt
scriptnamet
scriptfiletispytenvtuqrestthostR*RXRYtlengthR1R3tlinetuatcotkt
decoded_querytargstnobodytpidtstsRztcmdlinetinterptnbytestptdataR=R>tstatus((s#/usr/lib/python2.6/CGIHTTPServer.pyRds>	


 


	





	
	

#
		
		#&
	(t__name__t
__module__t__doc__thasattrRRGRHRItrbufsizeRRRRRRR(((s#/usr/lib/python2.6/CGIHTTPServer.pyR"s					cCsg}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(R
t
path_partstpartt_[1]t	tail_partt
head_parts((s#/usr/lib/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/lib/python2.6/CGIHTTPServer.pyt<lambda>]s(RžtpwdtImportErrortgetpwnamtKeyErrortmaxtmaptgetpwall(Rľ((s#/usr/lib/python2.6/CGIHTTPServer.pyRjQs'cCs>yti|ƒ}Wntij
otSX|id@djS(sTest for executable file.iIi(RtstatRsRtst_mode(R
tst((s#/usr/lib/python2.6/CGIHTTPServer.pyRas
cCsti||ƒdS(N(R	ttest(tHandlerClasstServerClass((s#/usr/lib/python2.6/CGIHTTPServer.pyRżjst__main__(RŠt__version__t__all__RR{RQtBaseHTTPServerR	RnR
RRR]RžRjRt
HTTPServerRżR§(((s#/usr/lib/python2.6/CGIHTTPServer.pyt<module>s$	˙	'			


ACC SHELL 2018