Your IP : 18.224.51.49


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.pyc

�
�'Pgc@s5ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	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"dkr1e�edd�edd�ye�Wn!e#k
r
edd ��nXedd�ed!d�y
e�Z$Wn!e#k
rXed!d ��nXed!d�ed"d�yTe�Z%e%dk	s�t'�e%\Z(Z)e�e!e)ej*e$j+�Z,ee(�Wn!e#k
r�ed"d ��nXed"d�e�e,j-�yej.e(�Wq1e/k
r-q1XndS($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
		cCsVtjd�}|dk	s!t�|d}t|d��}tj|�aWdQXdS(NtPASSENGER_SPAWN_WORK_DIRs
/args.jsontr(tostgetenvtNonetAssertionErrorRtjsontloadtoptions(twork_dirR
R((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytread_startup_arguments5s

cCsgtjd�}|dk	s!t�|d|j�}t|d|�t|dttj���dS(NRs/response/steps/s/states/begin_time(RRRRtlowerRtstrttime(tsteptstateR#tstep_dir((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytrecord_journey_step_begin>s
cCs�tjd�}|dk	s!t�|d|j�}t|d|�tjj|d�r�tjj|d�r�t|dtt	j	���nt|dtt	j	���dS(NRs/response/steps/s/states/begin_times/begin_time_monotonics	/end_time(
RRRRR%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|�}|dk	sut�tj|�}|j
dk	s�t�|j
j|�|Stjd|�SdS(Nitstartup_filespassenger_wsgi.pyiiitpassenger_wsgi(RR
tinsertRtgetcwdR"tgettversion_infoRtspec_from_file_locationRRtmodule_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"R2ttempfilet
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�(
REtAF_UNIXtSOCK_STREAMRtstructtunpackRturandomtbindtlisten(R>RIR=tst
socket_suffixtfilename((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyRDts(


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_framestitemstappendR2t	tracebackt
extract_stacktstriptjoin(tsigtframetthtid2nametcodet	thread_idtstackRYtlinenoR_tline((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytdebug~s1#""cs�||�tjd�dS(Ni(RR(RgRh(Rp(sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytdebug_and_exit�s
(tsignaltSIGABRT(Rq((RpsL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytinstall_signal_handlers}s	cCs�tjd�}|dk	s!t�|d}iidd6d|d6dd6d	d
6td6gd6}t|d
��}tj||�WdQXdS(NRs/response/properties.jsontmainR_sunix:taddresstsessiontprotocolitconcurrencytaccept_http_requeststsocketsR(RRRRRRR tdump(tsocket_filenameR#R
tdocR((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytadvertise_sockets�s
cCsTtjd�}|dk	s!t�|d}t|d��}|jd�WdQXdS(NRs/response/finishRt1(RRRRRR(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(RW((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((RW((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	tgetattrRGtEPIPER
t	exceptiont	ExceptiontshutdownREtSHUT_WRtclose(R�tdonetclientRvtsocket_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�tfilenotacceptR(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(
NRZiis>Isii(NN(NN(tlentrecvRRRRStsplittpopR�(R�R�tbufttmptheader_sizetheadersR�RJ((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyR��s*
"t_fileobjectcCstj|dd�S(Ntrbi(RER�(R�tsock((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pytwrap_input_socketscCstjj|dd�S(NR�i(REtmakefile(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�(RtsendallR�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�RR(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_socketRZR�(ii(R�R�R�R�(
R�RRR�RR2RR�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�RRER�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((0RRR\RrRcRER�RRR
RGRBR R'R3t	importlibRR8R"RRRR$R+R-R<RKRDRtRR�R�R�R�R�R�R�R;ttupleRRR}R�tstdintapplicationthandlerR�tremovetOSError(((sL/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/wsgi-loader.pyt<module>sxx$&																				�










	






?>