Your IP : 18.217.17.116
�
��f�Pc
@spdZddlmZmZmZddlmZddlZddlZddl Z dddd d
dgZ
dd
dddddgZeddddddddddddg
Z
dd �Zd!d"d#d$d%d&d'd(d)d*h
jZd+d,�Zd-d�ZGd.d�d�ZGd/d�de�ZGd0d�de�ZGd1d �d e�ZGd2d
�d
e�ZdS(3u/Base classes for server/gateway implementationsi(uFileWrapperuguess_schemeu
is_hop_by_hop(uHeadersiNuBaseHandleru
SimpleHandleruBaseCGIHandleru
CGIHandleru
IISCGIHandleruread_environuMonuTueuWeduThuuFriuSatuSunuJanuFebuMaruApruMayuJunuJuluAuguSepuOctuNovuDecc
CsOtj|�\ }}}}}}}}} dt||t|||||fS(Nu#%s, %02d %3s %4d %02d:%02d:%02d GMT(utimeugmtimeu_weekdaynameu
_monthname(
u timestampuyearumonthudayuhhummussuwduyuz((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuformat_date_times*uformat_date_timeuSCRIPT_NAMEu PATH_INFOuQUERY_STRINGuREQUEST_METHODu AUTH_TYPEuCONTENT_TYPEuCONTENT_LENGTHuHTTPSuREMOTE_USERuREMOTE_IDENTcCsMt|�pL|jd�pL|jd�pL|jd�oLt|dd��S(NuHTTP_uSSL_u REDIRECT_i (u_is_requestu
startswithu_needs_transcode(uk((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu_needs_transcodes*u_needs_transcodec
CsYtj�}d}ydjd|�Wntk
r@d}YnXi}xtjj�D]�\}}t|�rGtjdkr)tjj dd�j
�}|jd�r�|jd�jd�}qD|jd �r�qD|jd
�rd|kr|jd�jd�}qD|j|d�jd�}qG|j||�jd�}n|||<qWW|S(u'Read environment, fixing HTTP variablesusurrogateescapeuuutf-8ureplaceuwin32uSERVER_SOFTWAREumicrosoft-iis/u
iso-8859-1uapache/usimplehttp/upython/3(
usysugetfilesystemencodinguencodeuLookupErroruosuenvironuitemsu_needs_transcodeuplatformugetuloweru
startswithudecode(uencuescuenvironukuvusoftware((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuread_environ"s,
cBs�|EeZdZdZd:Zd;Zd;Zd<Z d;Z
dZd9Z
e�ZeZeZd9ZdZd=gZdZd9ZZd<Zd9ZdZd d
�Zdd�Zd
d�Zdd�Z dd�Z!dd�Z"d9dd�Z#dd�Z$dd�Z%dd�Z&dd�Z'dd �Z(d!d"�Z)d#d$�Z*d%d&�Z+d'd(�Z,d)d*�Z-d+d,�Z.d-d.�Z/d/d0�Z0d1d2�Z1d3d4�Z2d5d6�Z3d7d8�Z4d9S(>uBaseHandleru+Manage the invocation of a WSGI applicationiiu1.0u500 Internal Server ErroruContent-Typeu
text/plains;A server error occurred. Please contact the administrator.cCsey0|j�||j|j�|_|j�Wn.y|j�Wn|j��YnXYnXdS(uInvoke the applicationN(u
setup_environuenvironustart_responseuresultufinish_responseuhandle_erroruclose(uselfuapplication((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyurun�s
uBaseHandler.runcCs�|jj�}|_|j�|j�|d<|j�|d<|j|d<|j|d<|j�|d<|j |d<|j
|d<|jd
k r�|j|d<n|j
r�|jr�|jd |j�nd
S(u&Set up the environment for one requestu
wsgi.inputuwsgi.errorsuwsgi.versionu
wsgi.run_onceuwsgi.url_schemeuwsgi.multithreaduwsgi.multiprocessuwsgi.file_wrapperuSERVER_SOFTWAREN(u
os_environucopyuenvironuadd_cgi_varsu get_stdinu
get_stderruwsgi_versionu
wsgi_run_onceu
get_schemeuwsgi_multithreaduwsgi_multiprocessuwsgi_file_wrapperuNoneu
origin_serveruserver_softwareu
setdefault(uselfuenv((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu
setup_environ�s
uBaseHandler.setup_environc
Cs^zL|j�s|j�rKx|jD]}|j|�q'W|j�nWd|j�XdS(u>Send any iterable data, then close self and the iterable
Subclasses intended for use in asynchronous servers will
want to redefine this method, such that it sets up callbacks
in the event loop to iterate over the data, and to call
'self.close()' once the response is finished.
N(uresult_is_fileusendfileuresultuwriteufinish_contentuclose(uselfudata((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyufinish_response�suBaseHandler.finish_responsecCs
t|j�S(u Return the URL scheme being used(uguess_schemeuenviron(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu
get_scheme�suBaseHandler.get_schemec
Cs[yt|j�}Wntttfk
r0Yn'X|dkrWt|j�|jd<dSdS(u@Compute Content-Length or switch to chunked encoding if possibleiuContent-LengthN(ulenuresultu TypeErroruAttributeErroruNotImplementedErrorustru
bytes_sentuheaders(uselfublocks((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuset_content_length�suBaseHandler.set_content_lengthcCs d|jkr|j�ndS(uqMake any necessary header changes or defaults
Subclasses can extend this to add other defaults.
uContent-LengthN(uheadersuset_content_length(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyucleanup_headers�suBaseHandler.cleanup_headerscCs�|rDz1|jr6|d|d�j|d��nWdd}Xn|jdk rbtd��n||_|j|�|_|j|d�}|jS(u4'start_response()' callable as specified by PEP 3333iiiNuHeaders already set!uStatus( uheaders_sentuwith_tracebackuNoneuheadersuAssertionErrorustatusu
headers_classu_convert_string_typeuwrite(uselfustatusuheadersuexc_info((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyustart_response�s (
uBaseHandler.start_responsecCs8t|�tkr|Stdj|t|����dS(uConvert/check value type.u!{0} must be of type str (got {1})N(utypeustruAssertionErroruformaturepr(uselfuvalueutitle((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu_convert_string_type�su BaseHandler._convert_string_typecCs�|jr�|j�r�|jd|j|jfjd��d|jkrs|jdttj��jd��n|j r�d|jkr�|jd|j jd��q�q�n|jd|jjd��dS( u6Transmit version/status/date/server, via self._write()uHTTP/%s %s
u
iso-8859-1uDateu
Date: %s
uServeruServer: %s
uStatus: %s
N(
u
origin_serveruclient_is_modernu_writeuhttp_versionustatusuencodeuheadersuformat_date_timeutimeuserver_software(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu
send_preamble�s &#&uBaseHandler.send_preamblecCsm|jstd��n:|js=t|�|_|j�n|jt|�7_|j|�|j�dS(u+'write()' callable as specified by PEP 3333uwrite() before start_response()N(ustatusuAssertionErroruheaders_sentulenu
bytes_sentusend_headersu_writeu_flush(uselfudata((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuwrites
uBaseHandler.writecCsdS(uPlatform-specific file transmission
Override this method in subclasses to support platform-specific
file transmission. It is only called if the application's
return iterable ('self.result') is an instance of
'self.wsgi_file_wrapper'.
This method should return a true value if it was able to actually
transmit the wrapped file-like object using a platform-specific
approach. It should return a false value if normal iteration
should be used instead. An exception can be raised to indicate
that transmission was attempted, but failed.
NOTE: this method should call 'self.send_headers()' if
'self.headers_sent' is false and it is going to attempt direct
transmission of the file.
F(uFalse(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyusendfilesuBaseHandler.sendfilecCs-|js)|jjdd�|j�ndS(u.Ensure headers and content have both been sentuContent-Lengthu0N(uheaders_sentuheadersu
setdefaultusend_headers(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyufinish_content0s
uBaseHandler.finish_contentcCs^z&t|jd�r%|jj�nWdd|_|_|_|_d|_d|_ XdS(u�Close the iterable (if needed) and reset all instance vars
Subclasses may want to also drop the client connection.
ucloseNiF(
uhasattruresultucloseuNoneuheadersustatusuenvironu
bytes_sentuFalseuheaders_sent(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuclose:s uBaseHandler.closecCsP|j�d|_|js)|j�rL|j�|jt|j��ndS(u1Transmit headers to the client, via self._write()NT( ucleanup_headersuTrueuheaders_sentu
origin_serveruclient_is_modernu
send_preambleu_writeubytesuheaders(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyusend_headersGs
uBaseHandler.send_headerscCs%|j}|dk o$t|j|�S(u@True if 'self.result' is an instance of 'self.wsgi_file_wrapper'N(uwsgi_file_wrapperuNoneu
isinstanceuresult(uselfuwrapper((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuresult_is_filePs uBaseHandler.result_is_filecCs|jdj�dkS(u,True if client can accept status and headersuSERVER_PROTOCOLuHTTP/0.9(uenvironuupper(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuclient_is_modernVsuBaseHandler.client_is_moderncCs]zOddlm}|j�}||d|d|d|j|�|j�Wdd}XdS(u�Log the 'exc_info' tuple in the server log
Subclasses may override to retarget the output or change its format.
i(uprint_exceptioniiN(u tracebackuprint_exceptionu
get_stderrutraceback_limituflushuNone(uselfuexc_infouprint_exceptionustderr((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu
log_exception[s
uBaseHandler.log_exceptioncCsH|jtj��|jsD|j|j|j�|_|j�ndS(u>Log current error, and send error output to client if possibleN( u
log_exceptionusysuexc_infouheaders_sentuerror_outputuenvironustart_responseuresultufinish_response(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuhandle_errorks uBaseHandler.handle_errorcCs0||j|jdd�tj��|jgS(uZWSGI mini-app to create error output
By default, this just uses the 'error_status', 'error_headers',
and 'error_body' attributes to generate an output page. It can
be overridden in a subclass to dynamically generate diagnostics,
choose an appropriate message for the user's preferred language, etc.
Note, however, that it's not recommended from a security perspective to
spit out diagnostics to any old user; ideally, you should have to do
something special to enable diagnostic output, which is why we don't
include any here!
N(uerror_statusu
error_headersusysuexc_infou
error_body(uselfuenvironustart_response((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuerror_outputss
&uBaseHandler.error_outputcCs
t�dS(uOverride in subclass to buffer data for send to client
It's okay if this method actually transmits the data; BaseHandler
just separates write and flush operations for greater efficiency
when the underlying system actually has such a distinction.
N(uNotImplementedError(uselfudata((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu_write�suBaseHandler._writecCs
t�dS(u�Override in subclass to force sending of recent '_write()' calls
It's okay if this method is a no-op (i.e., if '_write()' actually
sends the data.
N(uNotImplementedError(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu_flush�suBaseHandler._flushcCs
t�dS(u4Override in subclass to return suitable 'wsgi.input'N(uNotImplementedError(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu get_stdin�suBaseHandler.get_stdincCs
t�dS(u5Override in subclass to return suitable 'wsgi.errors'N(uNotImplementedError(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu
get_stderr�suBaseHandler.get_stderrcCs
t�dS(u>Override in subclass to insert CGI variables in 'self.environ'N(uNotImplementedError(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuadd_cgi_vars�suBaseHandler.add_cgi_varsN(iiTF(uContent-Typeu
text/plain(5u__name__u
__module__u__qualname__u__doc__uwsgi_versionuTrueuwsgi_multithreaduwsgi_multiprocessuFalseu
wsgi_run_onceu
origin_serveruhttp_versionuNoneuserver_softwareuread_environu
os_environuFileWrapperuwsgi_file_wrapperuHeadersu
headers_classutraceback_limituerror_statusu
error_headersu
error_bodyustatusuresultuheaders_sentuheadersu
bytes_senturunu
setup_environufinish_responseu
get_schemeuset_content_lengthucleanup_headersustart_responseu_convert_string_typeu
send_preambleuwriteusendfileufinish_contentucloseusend_headersuresult_is_fileuclient_is_modernu
log_exceptionuhandle_erroruerror_outputu_writeu_flushu get_stdinu
get_stderruadd_cgi_vars(u
__locals__((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuBaseHandler^sV
cBsh|EeZdZdZdddd�Zdd�Zdd�Zdd �Z d
d�Z
dd
�ZdS(u
SimpleHandleruqHandler that's just initialized with streams, environment, etc.
This handler subclass is intended for synchronous HTTP/1.0 origin servers,
and handles sending the entire response output, given the correct inputs.
Usage::
handler = SimpleHandler(
inp,out,err,env, multithread=False, multiprocess=True
)
handler.run(app)cCs:||_||_||_||_||_||_dS(N(ustdinustdoutustderrubase_envuwsgi_multithreaduwsgi_multiprocess(uselfustdinustdoutustderruenvironumultithreadumultiprocess((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu__init__�s uSimpleHandler.__init__cCs|jS(N(ustdin(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu get_stdin�suSimpleHandler.get_stdincCs|jS(N(ustderr(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu
get_stderr�suSimpleHandler.get_stderrcCs|jj|j�dS(N(uenvironuupdateubase_env(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuadd_cgi_vars�suSimpleHandler.add_cgi_varscCs|jj|�dS(N(ustdoutuwrite(uselfudata((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu_write�suSimpleHandler._writecCs |jj�|jj|_dS(N(ustdoutuflushu_flush(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu_flush�s
uSimpleHandler._flushNTF(u__name__u
__module__u__qualname__u__doc__uTrueuFalseu__init__u get_stdinu
get_stderruadd_cgi_varsu_writeu_flush(u
__locals__((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu
SimpleHandler�s cBs |EeZdZdZdZdS(uBaseCGIHandleru�CGI-like systems using input/output/error streams and environ mapping
Usage::
handler = BaseCGIHandler(inp,out,err,env)
handler.run(app)
This handler class is useful for gateway protocols like ReadyExec and
FastCGI, that have usable input/output/error streams and an environment
mapping. It's also the base class for CGIHandler, which just uses
sys.stdin, os.environ, and so on.
The constructor also takes keyword arguments 'multithread' and
'multiprocess' (defaulting to 'True' and 'False' respectively) to control
the configuration sent to the application. It sets 'origin_server' to
False (to enable CGI-like output), and assumes that 'wsgi.run_once' is
False.
NF(u__name__u
__module__u__qualname__u__doc__uFalseu
origin_server(u
__locals__((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyuBaseCGIHandler�scBs2|EeZdZdZdZiZdd�ZdS(u
CGIHandleru�CGI-based invocation via sys.stdin/stdout/stderr and os.environ
Usage::
CGIHandler().run(app)
The difference between this class and BaseCGIHandler is that it always
uses 'wsgi.run_once' of 'True', 'wsgi.multithread' of 'False', and
'wsgi.multiprocess' of 'True'. It does not take any initialization
parameters, but always uses 'sys.stdin', 'os.environ', and friends.
If you need to override any of these parameters, use BaseCGIHandler
instead.
c
Cs;tj|tjjtjjtjt�dddd�dS(NumultithreadumultiprocessFT(
uBaseCGIHandleru__init__usysustdinubufferustdoutustderruread_environuFalseuTrue(uself((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu__init__�suCGIHandler.__init__NT(u__name__u
__module__u__qualname__u__doc__uTrueu
wsgi_run_onceu
os_environu__init__(u
__locals__((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu
CGIHandler�scBs2|EeZdZdZdZiZdd�ZdS(u
IISCGIHandleruCGI-based invocation with workaround for IIS path bug
This handler should be used in preference to CGIHandler when deploying on
Microsoft IIS without having set the config allowPathInfo option (IIS>=7)
or metabase allowPathInfoForScriptMappings (IIS<7).
c
Cs�t�}|jdd�}|jdd�}|dj|d�ra|t|�d�|d<ntj|tjjtj jtj
|dddd�dS( Nu PATH_INFOuuSCRIPT_NAMEu/umultithreadumultiprocessFT(
uread_environugetu
startswithulenuBaseCGIHandleru__init__usysustdinubufferustdoutustderruFalseuTrue(uselfuenvironupathuscript((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu__init__s uIISCGIHandler.__init__NT(u__name__u
__module__u__qualname__u__doc__uTrueu
wsgi_run_onceu
os_environu__init__(u
__locals__((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu
IISCGIHandlers(u__doc__uutiluFileWrapperuguess_schemeu
is_hop_by_hopuheadersuHeadersusysuosutimeu__all__u_weekdaynameuNoneu
_monthnameuformat_date_timeu__contains__u_is_requestu_needs_transcodeuread_environuBaseHandleru
SimpleHandleruBaseCGIHandleru
CGIHandleru
IISCGIHandler(((u5/opt/alt/python33/lib64/python3.3/wsgiref/handlers.pyu<module>s($<�G(
?>