Your IP : 18.223.108.134


Current Path : /opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/
Upload File :
Current File : //opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyo

�
�'Pgc@s#ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZej
ddkr�ej
ddkr�ddlmZnddlZiad�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zej
ddkr�d�Zd�Zd�Z nd�Zd�Zd�Z dd#d��YZ!e"dkre�edd�edd�ye�Wn!e#k
r
edd ��nXedd�ed!d�y
e�Z$Wn!e#k
rXed!d ��nXed!d�ed"d�yBe�Z%e%\Z&Z'e�e!e'ej(e$j)�Z*ee&�Wn!e#k
r�ed"d ��nXed"d�e�e*j+�yej,e&�Wqe-k
rqXndS($i����Niiii(tutilcCs%tjj|d�tjd�dS(Ns
i(tsyststderrtwritetexit(tmessage((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytabort#scCs_y)t|d��}|j|�WdQXWn/tk
rZ}tjd|d|j�nXdS(NtwsWarning: unable to write to s: (topenRtIOErrortloggingtwarntstrerror(tpathtcontentstfte((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyttry_write_file's
cCs<tjdtjdd�ttd�r8tjt�ndS(Ntleveltformats2[ pid=%(process)d, time=%(asctime)s ]: %(message)stcaptureWarnings(R
tbasicConfigtWARNINGthasattrRtTrue(((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytinitialize_logging.s
		cCsDtjd�}|d}t|d��}tj|�aWdQXdS(NtPASSENGER_SPAWN_WORK_DIRs
/args.jsontr(tostgetenvRtjsontloadtoptions(twork_dirR
R((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytread_startup_arguments5s
cCsUtjd�}|d|j�}t|d|�t|dttj���dS(NRs/response/steps/s/states/begin_time(RRtlowerRtstrttime(tsteptstateR!tstep_dir((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytrecord_journey_step_begin>scCs�tjd�}|d|j�}t|d|�tjj|d�r�tjj|d�r�t|dttj���nt|dttj���dS(NRs/response/steps/s/states/begin_times/begin_time_monotonics	/end_time(RRR#RR
texistsR$R%(R&R'R!R(((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytrecord_journey_step_endEs. cCs�tjjdtj��tjdd�}tjddkr�tjddkr�tj	d|�}tj
|�}|jj|�|St
jd|�SdS(Nitstartup_filespassenger_wsgi.pyiiitpassenger_wsgi(RR
tinsertRtgetcwdR tgettversion_infoRtspec_from_file_locationtmodule_from_spectloadertexec_moduletimptload_source(R,tspect
app_module((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytload_appNs&cCs�ttjdd��}dtkr7td}d}ntj�}d}d}xw|dkr�yt|||�SWqRtjk
r�}|jtj	kr�|d7}|dkr�|�q�q�|�qRXqRWdS(	Nt
UNIX_PATH_MAXidt
socket_dirtwsgit
PsgWsgiAppii�i(
tintR R0ttempfilet
gettempdirtmake_sockettsocketterrorterrnot
EADDRINUSE(R;R<t
socket_prefixtiR((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytcreate_server_socket]s 
	
cCs�tjtjtj�}ttjdtjd��dd�}|d|d|}|d|!}|j|�|j	d�||fS(NtQiitxt/t.i�(
RCtAF_UNIXtSOCK_STREAMRtstructtunpackRturandomtbindtlisten(R<RGR;tst
socket_suffixtfilename((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyRBts(


cs/d���fd�}tjtj|�dS(NcSs�tgtj�D]}|j|jf^q�}g}x�tj�j�D]�\}}|jd|j	|d�|f�x]t
j|�D]L\}}}	}
|jd|||	f�|
r�|jd|
j��q�q�WqJWdj
|�GHdS(Ns
# Thread: %s(%d)ts  File: "%s", line %d, in %ss    %ss
(tdictt	threadingt	enumeratetidenttnameRt_current_framestitemstappendR0t	tracebackt
extract_stacktstriptjoin(tsigtframetthtid2nametcodet	thread_idtstackRWtlinenoR]tline((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytdebug~s1#""cs�||�tjd�dS(Ni(RR(ReRf(Rn(sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytdebug_and_exit�s
(tsignaltSIGABRT(Ro((RnsL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytinstall_signal_handlers}s	cCs|tjd�}|d}iidd6d|d6dd6d	d
6td6gd6}t|d
��}tj||�WdQXdS(NRs/response/properties.jsontmainR]sunix:taddresstsessiontprotocolitconcurrencytaccept_http_requeststsocketsR(RRRRRtdump(tsocket_filenameR!R
tdocR((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytadvertise_sockets�s
cCsBtjd�}|d}t|d��}|jd�WdQXdS(NRs/response/finishRt1(RRRR(R!R
R((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytadvertise_readiness�s
cCs"|dj|d|d��dS(Niii(twith_traceback(texc_info((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytreraise_exception�scCs
|jd�S(Nslatin-1(tdecode(tb((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytbytes_to_str�scCs$t|t�r|S|jd�SdS(Nslatin-1(t
isinstancetbytestencode(RU((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytstr_to_bytes�scBsddUdS(Ns+raise exc_info[0], exc_info[1], exc_info[2]((R�((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR��scCs|S(N((R�((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR��scCs|S(N((RU((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR��stRequestHandlercBsbeZd�Zd�Zd�Zd�Zeed�rEd�Zn	d�Zd�Z	d�Z
RS(	cCs||_||_||_dS(N(tservert
owner_pipetapp(tselft
server_socketR�R�((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyt__init__�s		cCsst}yUxN|sY|j�\}}|s4t}Pnt}z�yW|j|�\}}|r�|ddkr{|j|�q�|j|||�}nWn{tk
r�t}netk
r�}t|dt�s�|j	t	j
krtjd�qnt
k
rtjd�nXWd|sUy|jtj�WnnXy|j�WqUqUXnXqWWntk
rnnXdS(NtREQUEST_METHODtpingt	passengers)WSGI application raised an I/O exception!s%WSGI application raised an exception!(tFalsetaccept_connectionRt
parse_requesttprocess_pingtprocess_requesttKeyboardInterruptR	tgetattrREtEPIPER
t	exceptiont	ExceptiontshutdownRCtSHUT_WRtclose(R�tdonetclientRttsocket_hijackedtenvtinput_streamR((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyt	main_loop�sB	
	%

cCsUtj|j|jj�ggg�d}|jj�|krM|jj�SdSdS(Ni(NN(tselectR�R�tfilenotaccepttNone(R�tresult((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR��s+
cCs:d}xOt|�dkrW|jdt|��}t|�dkrJdS||7}q	Wtjd|�d}d}xOt|�|kr�|j|t|��}t|�dkr�d	S||7}qwW|jd�}|j�i}d}xB|t|�kr/t||d�|t||�<|d7}q�W||fS(
NRXiis>Isii(NN(NN(tlentrecvR�RPRQtsplittpopR�(R�R�tbufttmptheader_sizetheadersR�RH((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR��s*
"t_fileobjectcCstj|dd�S(Ntrbi(RCR�(R�tsock((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytwrap_input_socketscCstjj|dd�S(NR�i(RCtmakefile(R�R�((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR�scsc|j|��d<tj�d<d�d<t�d<t�d<t�d<�jd	d
�dkrmd�d<n
d�d<g�g��ddk�����fd��d���fd�}t��fd�}|�d<|j�|�}d�krtSz;x!|D]}|r�|�qqW�s>�d�nWdt|d�r^|j	�nXtS(Ns
wsgi.inputswsgi.errorsiiswsgi.versionswsgi.multithreadswsgi.multiprocesss
wsgi.run_oncetHTTPStofftonR~ttruetyesthttpsswsgi.url_schemethttpR�tHEADcs�y��std��nl�s��\}}�(�jtd||f��x%|D]}�jtd|��qSW�jd�n�s��jt|��nWn)tk
r�}t|dt�|�nXdS(Nswrite() before start_response()s,HTTP/1.1 %s
Status: %s
Connection: close
s%s: %s
s
R�(tAssertionErrortsendallR�R	tsetattrR(tdatatstatustresponse_headerstheaderR(theaders_senttheaders_settis_headt
output_stream(sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR.s 	
csP|r*z�rt|�nWdd}Xn�r?td��n||g�(�S(NsHeaders already set!(R�R�R�(R�R�R�(R�R�R(sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytstart_responseCs

cs|r��d<�SdS(Nspassenger.hijacked_socket((tdo_it(R�R�(sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pythijackUs
spassenger.hijackspassenger.hijacked_socketRXR�(ii(R�R~R�R�(
R�RRR�RR0R�R�RR�(R�R�R�R�R�R�R�R�((R�R�R�R�R�RsL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR�s8








cCs|jd�dS(Ntpong(R�(R�R�((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR�ms(t__name__t
__module__R�R�R�R�RRCR�R�R�(((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR��s		'				Vt__main__tSUBPROCESS_EXEC_WRAPPERtSTEP_PERFORMEDtSUBPROCESS_WRAPPER_PREPARATIONtSTEP_IN_PROGRESStSTEP_ERROREDtSUBPROCESS_APP_LOAD_OR_EXECtSUBPROCESS_LISTEN((.RRRZRpRaRCR�RPR
RER@RR%R1t	importlibRR6R RRRR"R)R+R:RIRBRrR}RR�R�R�R�R�R�R9ttupleR{R�tstdintapplicationthandlerR�tremovetOSError(((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyt<module>svx$&																				�










	






?>