-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/
File Upload :
Current File : //usr/lib/python2.7/CGIHTTPServer.pyc

ó
ºV}]c@sÏdZdZdgZddlZddlZddlZddlZddlZddlZddl	Z	dej
fd„ƒYZd„Ze
ad„Zd„Zeejd	„Zed
krË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„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-|jƒr|jƒn|jddƒ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.7/CGIHTTPServer.pytdo_POST6s
cCs*|jƒr|jƒStjj|ƒSdS(s-Version of send_head that support CGI scriptsN(RRtSimpleHTTPServertSimpleHTTPRequestHandlert	send_head(R((s#/usr/lib/python2.7/CGIHTTPServer.pyRBs
cCsittj|jƒƒ}|jddƒ}|| ||d}}||jkre||f|_tStS(s2Test 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.

        If any exception is raised, the caller should assume that
        self.path was rejected as invalid and act accordingly.

        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).
        t/i(	t_url_collapse_pathturllibtunquotetpathtfindtcgi_directoriestcgi_infotTruetFalse(Rtcollapsed_pathtdir_septheadttail((s#/usr/lib/python2.7/CGIHTTPServer.pyRIss/cgi-bins/htbincCs
t|ƒS(s1Test whether argument path is an executable file.(t
executable(RR((s#/usr/lib/python2.7/CGIHTTPServer.pyt
is_executableascCs(tjj|ƒ\}}|jƒdkS(s.Test whether argument path is a Python script.s.pys.pyw(s.pys.pyw(tosRtsplitexttlower(RRRR((s#/usr/lib/python2.7/CGIHTTPServer.pyt	is_pythonesc(
Csï|j\}}|d|}|jdt|ƒdƒ}xv|dkr±|| }||d}|j|ƒ}tjj|ƒr­||}}|jdt|ƒdƒ}q<Pq<W|jdƒ}|dkré|| ||d}}nd}|jdƒ}|dkr"|| ||}	}n
|d}	}|d|	}
|j|
ƒ}tjj|ƒsv|j	dd|
ƒdStjj
|ƒs |j	d	d
|
ƒdS|j|
ƒ}|s|jpÍ|j
pÍ|jsè|j	d	d|
ƒdS|j|ƒs|j	d	d|
ƒdSntjtjƒ}
|jƒ|
d
<|jj|
d<d|
d<|j|
d<t|jjƒ|
d<|j|
d<tj|ƒ}||
d<|j|ƒ|
d<|
|
d<|rÇ||
d<n|jƒ}||jdkró||
d<n|jd|
d<|jjdƒ}|rß|j ƒ}t|ƒdkrßddl!}ddl"}|d|
d<|dj#ƒdkrÜy|j$|dƒ}Wn|j%k
r£qÙX|j dƒ}t|ƒdkrÙ|d|
d <qÙqÜqßn|jj&dkr|jj(|
d!<n|jj&|
d!<|jjd"ƒ}|r9||
d#<n|jjd$ƒ}|r^||
d%<ng}xW|jj)d&ƒD]C}|d d'kr£|j*|j+ƒƒqw||d(j d)ƒ}qwWd)j,|ƒ|
d*<|jjd+ƒ}|rö||
d,<nt-d|jj.d-ƒƒ}|r-d.j,|ƒ|
d/<nxdCD]}|
j/|dƒq4W|j0d0d1ƒ|j1d2d3ƒ}|jrä|	g}d4|krž|j*|ƒnt2ƒ}|j3j4ƒtj5ƒ}|dkr@tj6|dƒ\}}x<t7j7|j8gggdƒdr"|j8j9dƒsçPqçqçW|r<|j:d5|ƒndSyqytj;|ƒWntj<k
rjnXtj=|j8j>ƒdƒtj=|j3j>ƒdƒtj?|||
ƒWqë|jj@|jA|jƒtjBd6ƒqëXnddlC}|g} |j|ƒrNtDjE}!|!j#ƒjFd7ƒr;|!d8 |!d9}!n|!d:g| } nd4|krj| j*|ƒn|jGd;|jH| ƒƒytI|ƒ}"WntJtKfk
r²d}"nX|jL| d<|jMd=|jMd>|jMd?|
ƒ}#|jj#ƒd@kr|"dkr|j8j9|"ƒ}$nd}$xBt7j7|j8jNgggdƒdrc|j8jNjOdƒs"Pq"q"W|#jP|$ƒ\}%}&|j3jQ|%ƒ|&r¢|j:dA|&ƒn|#jRjSƒ|#jTjSƒ|#jU}'|'rÞ|j:d5|'ƒn
|jGdBƒdS(DsExecute a CGI script.R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: %ststdintstdouttstderrtenvtposts%ssCGI script exited OK(R+R,R4R:R<R6(VRRtlenttranslate_pathRRtisdirtrfindtexistsRtisfileRt	have_forkthave_popen2thave_popen3Rtcopytdeepcopytenvirontversion_stringtservertserver_nametprotocol_versiontstrtserver_porttcommandRRtaddress_stringtclient_addresstheaderst	getheadertsplittbase64tbinasciiRtdecodestringtErrort
typeheadertNonettypetgetallmatchingheaderstappendtstriptjointfiltert
getheaderst
setdefaultt
send_responsetreplacet
nobody_uidtwfiletflushRtwaitpidtselecttrfiletreadt	log_errortsetuidterrortdup2tfilenotexecvethandle_errortrequestt_exitt
subprocesstsysRtendswithtlog_messagetlist2cmdlinetintt	TypeErrort
ValueErrortPopentPIPEt_socktrecvtcommunicatetwriteRBtcloseRAt
returncode((RtdirtrestRtitnextdirtnextrestt	scriptdirtquerytscriptt
scriptnamet
scriptfiletispyRCtuqrestthostR.R]R^tlengthR5R7tlinetuatcotkt
decoded_querytargstnobodytpidtstsR}tcmdlinetinterptnbytestptdataRARBtstatus((s#/usr/lib/python2.7/CGIHTTPServer.pyRjs8













			
%		
				!(

	(t__name__t
__module__t__doc__thasattrRRKRLRMtrbufsizeRRRRRRR(((s#/usr/lib/python2.7/CGIHTTPServer.pyR#s					cCsé|jdƒ}g}xM|d D]A}|dkr?|jƒq |r |dkr |j|ƒq q W|r·|jƒ}|r½|dkrœ|jƒd}q´|dkr´d}q´q½nd}ddj|ƒ|f}dj|ƒ}|S(s`
    Given a URL path, remove extra '/'s and '.' path elements and collapse
    any '..' references and returns a colllapsed path.

    Implements something akin to RFC-2396 5.2 step 6 to parse relative paths.
    The utility of this function is limited to is_cgi method and helps
    preventing some security attacks.

    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.

    Riÿÿÿÿs..t.R!(R\tpopReRg(Rt
path_partst
head_partstpartt	tail_partt	splitpathR((s#/usr/lib/python2.7/CGIHTTPServer.pyR
.s&

	cCs€tr
tSyddl}Wntk
r.dSXy|jdƒdaWn3tk
r{dttd„|jƒƒƒanXtS(s$Internal routine to get nobody's uidiÿÿÿÿNR¡iicSs|dS(Ni((tx((s#/usr/lib/python2.7/CGIHTTPServer.pyt<lambda>fs(R¡tpwdtImportErrortgetpwnamtKeyErrortmaxtmaptgetpwall(R¸((s#/usr/lib/python2.7/CGIHTTPServer.pyRmZs

&cCs<ytj|ƒ}Wntjk
r*tSX|jd@dkS(sTest for executable file.iIi(RtstatRvRtst_mode(Rtst((s#/usr/lib/python2.7/CGIHTTPServer.pyRjs
cCstj||ƒdS(N(R	ttest(tHandlerClasstServerClass((s#/usr/lib/python2.7/CGIHTTPServer.pyRÂsst__main__(R¬t__version__t__all__RR~RtBaseHTTPServerR	RqRNR
RR
RbR¡RmRt
HTTPServerRÂRª(((s#/usr/lib/python2.7/CGIHTTPServer.pyt<module>s&	ÿ	*			

Copyright © 2017 || Recoded By Mr.Bumblebee