HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/web/hyperflight/apps/inxpress/.venv/Lib/site-packages/__pycache__/wfastcgi.cpython-311.pyc
�

��i����>�ddlmZmZmZdZdZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZ	ddlmZeZn#e$rddlmZmZYnwxYw	ddlmZn#e$r	ddlmZYnwxYwejdd	krd
�Znd�ZdZd
ZdZdZd	ZdZdZdZ dZ!d
Z"dZ#dZ$dZ%e%Z&dZ'dZ(dZ)dZ*d	Z+dZ,dZ-dZ.d	Z/dZ0dZ1dZ2Gd�de3��Z4Gd�de5��Z6ejdd	krd�Z7d�Z8d�Z9d �Z:d!�Z;d"�Z<e=Z>ndd#l?m@Z@d$�Z9d%�Z:d&�Z;d'�Z<eAZ=d(�Z>d)�ZBd*�ZCd+�ZDd,�ZEd-�ZFd.�ZGd/d0d1d2d3�ZHd4�ZId5�ZJd6�ZKd7�ZLd8�ZMeeCeeLeeIeeJe"eKe#eMiZNdaOd9�ZPd:�ZQdSd<�ZRd=�ZSejTjUjVZVejWeV_XejYejYejWejWejWejZejW��ejYejYgeV_[	dd>l\m]Z]m^Z^m_Z_m`Z`maZambZbmcZcn�#e$r�ejTjUjdZ]ejYe]_XejeejWejWejYejWejWejYge]_[ejTjUj^Z^ejYge^_[ejTjUj_Z_ejWe__XejTjUj`Z`ejYe`_XejWge`_[ejTjUjaZaejYejWgea_[ejWea_Xd	Zcd?ZbYnwxYwdZfdZgdZhdZid@ZjdAZkdBZldCZmdDZnGdE�dFejo��ZpdaqdG�ZrdH�ZsdI�ZtdJ�ZudK�ZvGdL�dMe3��ZwiZxdN�ZydO�ZzdP�Z{dQ�Z|e}dRkrey��dSdS)T�)�absolute_import�print_function�with_statementz.Microsoft Corporation <ptvshelp@microsoft.com>z3.0.0N)�minidom)�StringIO)r�BytesIO)�start_new_thread�c�N�|�tj����S�N)�decode�sys�getfilesystemencoding��values �DD:\web\hyperflight\apps\inxpress\.venv\Lib\site-packages\wfastcgi.py�to_strr)����|�|�C�5�7�7�8�8�8�c�N�|�tj����Sr)�encoderrrs rrr,rr��������	�
��FCGI_MAX_CONNS�
FCGI_MAX_REQS�FCGI_MPXS_CONNSc��eZdZdZd�Zd�ZdS)�
FastCgiRecordz�Represents a FastCgiRecord.  Encapulates the type, role, flags.  Holds
    onto the params which we will receive and update later.c�L�||_||_||_||_i|_dSr)�type�req_id�role�flags�params)�selfr(r)r*r+s     r�__init__zFastCgiRecord.__init__Vs)����	������	���
�����rc�<�d|j|j|j|jfzS)Nz<FastCgiRecord(%d, %d, %d, %d)>)r(r)r*r+)r-s r�__repr__zFastCgiRecord.__repr__]s*��0�D�I�48�K�48�I�48�J�4@�@�	@rN)�__name__�
__module__�__qualname__�__doc__r.r0�rrr&r&SsA������?�?����@�@�@�@�@rr&c��eZdZdS)�_ExitExceptionN)r1r2r3r5rrr7r7ps�������Drr7c��|Srr5��xs r�ordr;v����rc�"�t|f��Sr)�bytesr9s r�chrr?xs���a�U�|�|�rc�,�|�d��S�Nz
iso-8859-1)r
r9s r�wsgi_decoderB{����x�x��%�%�%rc�,�|�d��SrA)rr9s r�wsgi_encoderE}rCrc��|Srr5r9s r�	fs_encoderG�r<rc�,�|�|��Sr)�with_traceback��	exc_value�exc_tbs  r�exception_with_tracebackrM�s���'�'��/�/�/r)�openc��|Srr5r9s rrBrB�r<rc��|Srr5r9s rrErE�r<rc�|�t|t��r|n%|�tj����Sr)�
isinstance�strrrrr9s rrGrG�s0���q�#�&�&�Q�q�q�A�H�H�S�5N�5P�5P�,Q�,Q�Qrc��|Srr5rJs  rrMrM�s���rc��d|zS)N�r5)�lengths r�
zero_bytesrX�s�����rc	���|�d��}|st���tjd|��\}}}}}}|�|��}|�|��|tkrtd|z���t�|��}	|	�
|	|||��Std|z��t||tt|��td��z��dS)zreads the main fast cgi recordr�>BBHHBBzUnknown fastcgi version %sNzUnknown request type %sr)
�readr7�struct�unpack�FCGI_VERSION_1�	Exception�REQUEST_PROCESSORS�get�log�
send_response�FCGI_UNKNOWN_TYPEr?rX)
�stream�data�fcgi_ver�reqtyper)�content_size�padding_len�_�content�	processors
          r�read_fastcgi_recordrn�s����;�;�q�>�>�D�������>D�m�I�W[�>\�>\�;�H�g�v�|�[�!��k�k�,�'�'�G�
�K�K������>�!�A��4�x�?�@�@�@�"�&�&�w�/�/�I��2��y����1�1�1��!�G�+�,�,�,��&�&�"3�S��\�\�J�q�M�M�5Q�R�R�R��4rc	���tt|t|d��dzt|d��zt|d����}|t|<dS)z[reads the begin request body and updates our _REQUESTS table to include
    the new requestrrrrN)r&�FCGI_BEGIN_REQUESTr;�	_REQUESTS�rer)rl�ress    r�read_fastcgi_begin_requestrt�sY�����	�W�Q�Z���A�	��W�Q�Z���0��G�A�J���	��C��I�f���rc��tjd||��d}|dkr|dz|fS|dztjd||��ddzfS)N�>Br�rr�>Il����)r\�unpack_from)rl�offset�is   r�read_encoded_intr|�s]����4��&�1�1�!�4�A��4�x����z�1�}���A�:�v�)�$���@�@��C�k�Q�Q�Qrc��t||��\}}t||��\}}||||z�}||z
}||||z�}||z
}|||fS)z%Reads a FastCGI key/value pair stream)r|)rlrz�name_len�	value_len�namers      r�read_fastcgi_keyvalue_pairsr��su��(���8�8��F�H�(��&�9�9��F�I��6�6�H�,�-�.�D�
�h��F��F�F�Y�.�/�0�E�
�i��F��4���rc��|dkrtjd|��S|dkrtjd|dz��Std||fz���)zOWrites the length of a single name for a key or value in a key/value
    stream�rvlrxz3cannot encode value %s (%x) because it is too large)r\�pack�
ValueError)r{s r�get_encoded_intr��sa��	�D�y�Y��{�4��#�#�#�	
�Z��Y��{�4��Z��0�0�0��N�RS�UV�QW�W�X�X�Xrc���g}|���D]�\}}t|��}t|��}|�tt	|������|�tt	|������|�|��|�|����t���|��S)zBCreates a FastCGI key/value stream and returns it as a byte string)�itemsrE�appendr��lenr>�join)�pairs�parts�raw_key�	raw_value�keyrs      r�write_fastcgi_keyvalue_pairsr��s����E�#�k�k�m�m�������'�"�"���I�&�&��
���_�S��X�X�.�.�/�/�/�
���_�S��Z�Z�0�0�1�1�1�
���S����
���U������7�7�<�<����r�wsgi.script_name�wsgi.path_infozwsgi.query_string�wfastcgi.http_x_original_url)�SCRIPT_NAME�	PATH_INFO�QUERY_STRING�HTTP_X_ORIGINAL_URLc�2�|sdSd}t|j}|t|��krkt||��\}}}t	|��}t
�|��}|r|||<t	|��||<|t|��k�idSdS�Nr)rqr,r�r�rB�RAW_VALUE_NAMESra)rer)rlrzrsr�r�raw_names        r�read_fastcgi_paramsr�s������t�
�F�
�F�
�
"�C�
�3�w�<�<�
�'�9�'�6�J�J����e��4� � ��"�&�&�t�,�,���	"�!�C��M���&�&��D�	�
�3�w�<�<�
�'�'�'�'�'rc�|�t|j}d|vr||d<n|dxx|z
cc<|s
t|SdS)zYreads FastCGI std-in and stores it in wsgi.input passed in the
    wsgi environment array�
wsgi.inputN�rqr,rrs    r�read_fastcgi_inputr�sd���F�
�
"�C��3��%�#��L����L����W�$�����!��� � �!�!rc�`�t|j}d|vr||d<dS|dxx|z
cc<dS)z7reads FastCGI data stream and publishes it as wsgi.dataz	wsgi.dataNr�rrs    r�read_fastcgi_datar� sN��
�F�
�
"�C��#��$�"��K�����K����G�#�����rc��dS)zdreads the wsgi abort request, which we ignore, we'll send the
    finish execution request anyway...Nr5)rer)rls   r�read_fastcgi_abort_requestr�)s	��	�Drc�J�d}i}|t|��kr,t||��\}}}|||<|t|��k�,i}t|vr
d|t<t|vr
d|t<t|vr
d|t<t||tt|����dS)zPreads the fastcgi request to get parameter values, and immediately 
    respondsr�1�0N)r�r�r"r#r$rc�FCGI_GET_VALUES_RESULTr�)rer)rlrz�requestr�r�responses        r�read_fastcgi_get_valuesr�/s����F��G�
�3�w�<�<�
��9�'�6�J�J����e����
��3�w�<�<�
���H��� �'�#&��� ����&�"%�����'�!�(�$'���!�����$�X�.�.�	����rc	��tr#	t�|��n#YnxYwtj�d��}|r�t|dd���5}|�dd��}|�tj�	���d|�|�
d��rdnd����d	d	d	��d	S#1swxYwYd	Sd	S)
z;Logs messages to a log file if WSGI_LOG env var is defined.�WSGI_LOGza+zutf-8)�encoding�
�
�: �N)�APPINSIGHT_CLIENT�track_event�os�environrarN�replace�write�datetime�now�endswith)�txt�log_file�fs   rrbrbWsB����	��)�)�#�.�.�.�.��	��D�����z�~�~�j�)�)�H��e�
�(�D�7�
3�
3�
3�	e�q��+�+�f�d�+�+�C�
�G�G�(�"3�"7�"7�"9�"9�"9�"9�3�3�c�l�l�SW�FX�FX�@b���^b�@b�c�d�d�d�	e�	e�	e�	e�	e�	e�	e�	e�	e�	e�	e�	e����	e�	e�	e�	e�	e�	e�e�es�$�(�A&C�C�Cc�6�	t|��dS#YdSxYw)zoLogs messages to a log file if WSGI_LOG env var is defined, and does not
    raise exceptions if logging fails.N)rb)r�s r�	maybe_logr�es&��
��C�������
������s��Tc	��t|t��std|z���d}	tt	t|��|z
d��d��}t
jdt|||dd��||||z�z}||z
}tj
|���|��|dks|sn��|���dS)z�sends a response w/ the given id, type, and content to the server.
    If the content is streaming then an empty record is sent at the end to 
    terminate the streamz*content must be encoded before sending: %rrTi��rZN)
rRr>�	TypeError�max�minr�r\r�r^r�r��fileno�flush)rer)�	resp_typerl�	streamingrz�
len_remainingrfs        rrcrcms����g�u�%�%�P��D�w�N�O�O�O�
�F���C��G���v� 5�v�>�>��B�B�
��{������
�
�
�
�
�F�F�]�2�3�4�5��	�-���
�������$�'�'�'��A��	�Y�	��#�$�L�L�N�N�N�N�Nrc���tj�|d��}tj�|��siSi}t	j|��}|�d��}|D]{}|�d��}|D]a}|�d��}|D]G}	|	�d��}
|	�d��}|
r|�|||
���<�H�b�||S)Nz
Web.config�
configuration�appSettings�addr�r)	r��pathr��existsr�parse�getElementsByTagName�getAttribute�strip)�dir�
web_config�d�doc�config�
configSectionr��appSettingsSection�values�curAddr�rs            r�get_environmentr��s������c�<�0�0�J�
�7�>�>�*�%�%���	�
�A�
�-�
�
#�
#�C�
�
%�
%�o�
6�
6�F��+�+�
�#�8�8��G�G��"-�	+�	+��'�<�<�U�C�C�F� �
+�
+���)�)�%�0�0���+�+�G�4�4���+�5�+�%*�A�c�i�i�k�k�N��	
+�	+�
�Hr)�
CreateFile�CloseHandle�GetLastError�ExitProcess�WaitForSingleObject�INFINITE�
OPEN_EXISTING���ii�i�l��c�R�eZdZdejfdejfdejfdejfgZdS)�FILE_NOTIFY_INFORMATION�NextEntryOffset�Action�FileNameLength�FilenameN)r1r2r3�ctypes�c_uint32�c_wchar�_fields_r5rrr�r��s=������"�F�O�4��6�?�+�!�6�?�3��V�^�,�.�H�H�Hrr�c���td��trVtgc}a|D]@}	|���#t$r&tdtj��z��Y�=wxYwt�TdSdS)NzRunning on_exit taskszError in exit task: )r��_ON_EXIT_TASKSr_�	traceback�
format_exc)�tasks�ts  r�run_exit_tasksr��s���
�%�&�&�&�
�K� .����~��	K�	K�A�
K���������
K�
K�
K��0�9�3G�3I�3I�I�J�J�J�J�J�
K�����K�K�K�K�Ks�
1�-A!� A!c�8��t�wgxa}	ttjd������fd�}t	|d��n;#t
tf$r'tdtjd��z��YnwxYwt�|��dS)N�_FCGI_SHUTDOWN_EVENT_c�l��t�t��t��td��dSr�)r�r�r�r�)�evts�r�_wait_for_exitzon_exit.<locals>._wait_for_exit�s.���#�C��2�2�2�� � � ��A�����rr5zCould not wait on event %s)	r��intr��getenvr	r�r�r�r�)�taskr�r�r�s   @r�on_exitr�s�����1�!#�#���
	1��b�i� 7�8�8�9�9�C�
�
�
�
�
�

�^�R�0�0�0�0���:�&�	Y�	Y�	Y��2�R�Y�?V�5W�5W�W�X�X�X�X�X�	Y�������$�����s�!A�5A=�<A=c������d�n�sdSd��td|�d�������fd�}tj���}t|||f��dS)Nz.*((\.py)|(\.config))$c
3�`K�tjd��}tj��}	t|tt
tztzdttd��}n #t$rtd��YdSwxYw|r|tkrtd��dS	t||tj|��dttj|��dd��}|r�tj|��}	tj|tjt(����}tj|dz|jjdz��}|V�|jjdkrn||jjz}�vn=t3��t4krt7|��dV�dSt7|��dS��)	z�Returns a generator that blocks until a change occurs, then yields
        the filename of the changed file.

        Yields an empty string and stops if the buffer overruns, indicating that
        too many files were changed.i�rzUnable to create watcherNT�rr�)r��create_string_bufferr�r��FILE_LIST_DIRECTORY�FILE_SHARE_READ�FILE_SHARE_WRITE�FILE_SHARE_DELETEr��FILE_FLAG_BACKUP_SEMANTICS�OSErrorr��INVALID_HANDLE_VALUE�ReadDirectoryChangesW�sizeof�FILE_NOTIFY_CHANGE_LAST_WRITE�byref�	addressof�cast�POINTERr��
wstring_at�contentsr�r�r��ERROR_NOTIFY_ENUM_DIRr�)r��buffer�	bytes_ret�the_dir�ret_code�cur_pointer�fni�filenames        r�enum_changesz(start_file_watcher.<locals>.enum_changes�s������,�Y�7�7���O�%�%�	�	� ��#��"2�2�5F�F���*����G�G���	�	�	��0�1�1�1��F�F�	�����	�'�%9�9�	��0�1�1�1��F�	�,����
�f�%�%��-���Y�'�'���	�	�H��
�$�.�v�6�6��M� �+�k�6�>�BY�3Z�3Z�[�[�C�%�0��r�1A�3�<�C^�bc�Cc�d�d�H�"�N�N�N��|�3�q�8���"-���0L�"L�K�M�����#8�8�
��G�$�$�$��������G�$�$�$���9	s�9A%�%B�Bz'wfastcgi.py will restart when files in z are changed: c����|��D]x}|s-td��t��td���1|�|��r2td|�d�����t��td���ydS)Nz/wfastcgi.py exiting because the buffer was fullrzwfastcgi.py exiting because z has changed, matching )rbr�r��match)r��restartrr�
restart_regexs   ��r�watcherz#start_file_watcher.<locals>.watcher8s����$��T�*�*�
	�
	�H��	
��E�F�F�F�� � � ��A��������x�(�(�
���QY�QY�QY�[h�[h�i�j�j�j�� � � ��A�����
	�
	r)rb�re�compiler	)r�r"r#r!rs `  @r�start_file_watcherr&�s�������2�
�
�
����8�8�8�t�C�t�t�t�]�]�[�\�\�\��������j��'�'�G��W�t�W�o�.�.�.�.�.rc��|std���t|t��st|��}|�d��\}}}|�d��}|r
|dd�n|}||fg}d}d}|r�	t
||ddg���}d}|D]!\}}t||��}|r
|��}�"n~#t$ro|�d��\}}}|�d��}|r
|dd�n|}|�	d||f��d}dtj��z}YnwxYw|��|�td	|�d
|�����|S)Nz WSGI_HANDLER env var must be set�.z()���r�r)�fromlistr��"z" could not be imported)
r_rRrSr�
rpartitionr��
__import__�getattr�ImportError�insertr�r�r�)	�handler_name�module_namerk�
callable_name�should_call�	name_list�handler�last_tbr�s	         r�get_wsgi_handlerr8Hs����<��:�;�;�;��l�C�(�(�,��l�+�+��$0�$;�$;�C�$@�$@�!�K��M��(�(��.�.�K�*5�H�M�#�2�#�&�&�=�M���-�.�I��G��G�
�4�	4� ��	�!��Q��7H�I�I�I�G��G�%.�
(�
(�!��k�!�'�4�0�0���(�%�g�i�i�G�����	4�	4�	4�,7�,B�,B�3�,G�,G�)�K��M�'�0�0��6�6�K�2=�P�M�#�2�#�.�.�=�M����Q��� <�=�=�=��G��Y�1�3�3�3�G�G�G�
	4�����4�"�S��j�<�<�<���Q�R�R�R��Ns�>AC�A6D<�;D<c��t|��}tj�|��d�|���D��D]U}tjdd�|��}tj�	d�|�
d��D�����Vttjd����}tjd��}|rg	dd	l
m}|||��}|jat#|jj��n3#t&$r&t)d
t+j��z��YnwxYw||fS)Nc3�PK�|]!\}}|���dk�|V��"dS)�
pythonpathN)�lower)�.0�k�vs   r�	<genexpr>z$read_wsgi_handler.<locals>.<genexpr>ps8����H�H�t�q�!�a�g�g�i�i�<�.G�H��H�H�H�H�H�Hrz%(\w+?)%c�R�tj|�d��d��S)Nrr�)r�r��group)�ms r�<lambda>z#read_wsgi_handler.<locals>.<lambda>ts��b�i�����
�
�B�/�/�rc3�8K�|]}|�t|��V��dSr)rG)r=�ps  rr@z$read_wsgi_handler.<locals>.<genexpr>ws-����L�L��!�L�	�!���L�L�L�L�L�Lr�;�WSGI_HANDLER�APPINSIGHTS_INSTRUMENTATIONKEYr)�WSGIApplicationz&Failed to import applicationinsights: )r�r�r��updater�r$�subrr��extend�splitr8r��applicationinsights.requestsrJ�clientr�rr�r/r�r�r�)�
physical_path�envr��
expanded_pathr6�	instr_keyrJs       r�read_wsgi_handlerrUlsi��
�-�
(�
(�C��J���c����H�H�s�y�y�{�{�H�H�H�M�M�����/�/��
�
�
�
	����L�L�m�.A�.A�#�.F�.F�L�L�L�L�L�L�L��r�y��8�8�9�9�G��	�:�;�;�I��*�
	*�
E�D�D�D�D�D�&�o�i��9�9�G� '����G�N�(�)�)�)�)��
�	Y�	Y�	Y��>��AU�AW�AW�W�X�X�X�X�X�	Y������<�s�D�-D>�=D>c�J�eZdZdZd�Zd�Zd�Zed���Zd
d�Z	dd	�Z
dS)�handle_responsez�A context manager for handling the response. This will ensure that
    exceptions in the handler are correctly reported, and the FastCGI request is
    properly terminated.
    c��||_||_||_||_d|_d|_d|_d|_d|_dS)Nr�F)	re�record�_get_output�_get_errors�
error_message�fatal_errorsrQ�header_bytes�sent_headers)r-rerY�
get_output�
get_errorss     rr.zhandle_response.__init__�sN��������%���%������!������ ���!����rc���|j}t|jd��|jd<d|jd<|j�dd�����dkrdnd|jd	<d
|jd<d|jd
<d|jd<|j�dt
j�t����|_	d|jvr*|jd|jd<|jd|jd<|jd�
d��d|jd<|jd�
td����d|jd<|S)Nr�)rrzwsgi.version�HTTPSr��on�https�httpzwsgi.url_schemeTzwsgi.multiprocessFzwsgi.multithreadz
wsgi.run_once�APPL_PHYSICAL_PATHr�r�r�r��?r)rYrr,rar<r�r��dirname�__file__rQ�	partitionrE)r-rYs  r�	__enter__zhandle_response.__enter__�sW�����&-�f�m�L�.I�&J�&J��
�l�#�(.��
�n�%�6<�m�6G�6G��QS�6T�6T�6Z�6Z�6\�6\�`d�6d�+p�7�7�jp��
�'�(�-1��
�)�*�,1��
�(�)�).��
�o�&�#�]�.�.�/C�R�W�_�_�U]�E^�E^�_�_��� �F�M�1�	\�*0��7L�)M�F�M�+�&�.4�m�<Z�.[�F�M�*�+�&,�]�;�%?�%I�%I�#�%N�%N�q�%Q��
�k�"�*0�-�8H�*I�*S�*S�T_�`c�Td�Td�*e�*e�fg�*h��
�&�'��rc	��|r�|tur�|jpd�dd�tj|||�����d|����d|�����}|jr|jstd��|_|�
tt|����t|��|�
ttd��d�	��t|jj=|jS)
NzError occurredz:

r�z


StdOut: z


StdErr: z#Status: 500 Internal Server Error
rF)r�)r7r\r�r��format_exceptionrZr[r^r_rE�send�FCGI_STDERRr��FCGI_END_REQUESTrXrqrYr)r])r-�exc_typerKrL�	error_msgs     r�__exit__zhandle_response.__exit__�s���
	!���6�
	!��"�6�&6�6�6����	�2�8�Y��O�O�P�P�P�P�� � �"�"�"�"�� � �"�"�"�	�I��$�
Y�D�,=�
Y�$/�0W�$X�$X��!��I�I�k�;�y�#9�#9�:�:�:�
�i� � � �	
�	�	�"�J�q�M�M�U�	�C�C�C�
�d�k�(�)��$�$�$rc��t|t��st|��}t|t��st|��}||fSr)rRrSrB)r�rs  r�_decode_headerzhandle_response._decode_header�sJ���#�s�#�#�	#��c�"�"�C��%��%�%�	'���&�&�E��E�z�rNc�d��|r/	�jrt|d|d���	d}n#d}wxYw�jrtd���t	|t
��st
|��}d|z}|r"|d�d�|D����z
}t|dz���_�fd	�S)
zZStarts sending the response. The response is ended when the context
        manager exits.rrNz&start_response has already been calledzStatus: %s
r�c3�8K�|]}dtj|�zV��dS)z%s: %s
N)rWrv)r=r{s  rr@z(handle_response.start.<locals>.<genexpr>�s1����"f�"f�YZ�<�/�2P�RS�2T�#T�"f�"f�"f�"f�"f�"frr�c�:����t|��Sr)ro�FCGI_STDOUT)rlr-s �rrDz'handle_response.start.<locals>.<lambda>�s���t�y�y��g�>�>�r)	r_rMr^r_rRrSrBr�rE)r-�status�headers�exc_info�header_texts`    r�startzhandle_response.start�s�����	F�
 ��$�M�2�8�A�;����L�L�L�M� ����4������
�
�	F��D�E�E�E��&�#�&�&�	)� ��(�(�F�&��/���	g��2�7�7�"f�"f�^e�"f�"f�"f�f�f�f�K�'��f�(<�=�=���>�>�>�>�>s�#,�0Tc���|jsO|jstd���d|_t|j|jjt|j��d|_t|j|jj|||��S)zSends part of the response.z&start_response has not yet been calledTN)r_r^r_rcrerYr)rz)r-r�rlr�s    rrozhandle_response.send�st��� �	%��$�
J�� H�I�I�I� $�D���$�+�t�{�'9�;��HY�Z�Z�Z� $�D���T�[�$�+�*<�i��R[�\�\�\rr�T)r1r2r3r4r.rlrt�staticmethodrvrror5rrrWrW�s���������
	"�	"�	"����.%�%�%�4����\��?�?�?�?�,
]�
]�
]�
]�
]�
]rrWc�*�d}tdtz��tdtjz��	tjddkrtj���ntj}	ddl}|�|�	��tj��n#t$rYnwxYw	t|��}|s�t��x}xt_xt_|jd<t��x}xt_t_t)|||j|j��5}|�s�tdtz��tj|j��d	tjd<d|_d
|_t7|j��\}}d|_t9|j|�d����|�d
��}	|	r�|�d��pd�dd��}
	t?|
d��}n7#t@$rd}Yn)tB$rtd|
dz��d}YnwxYw|
drZ|rX	ddl"}|
d|f}
|�#|	|
���td|
z��n#t$rtd��YnwxYwd|_d|_tdtz��d}tj$�%|��dtj$vr!d|jd<tMd��|jd<dtj$vr�|jd�'���(tj$d�'����r�tj$d|jd<|jdtS|jd��d�|jd<tM|jd��|jd<tM|jd��|jd<||j|j*��}	|D]}|r|�+tX|��� 	t[|d��r|�.��n*#t[|d��r|�.��wwxYwddd��n#1swxYwY��#t^$rYn_t`$r&tcd tej3��z��Yn1th$r%tcd tej3��z���wxYwtk��tcd!tz��dS#tk��tcd!tz��wxYw)"NFzwfastcgi.py %s startedzPython version: %srr
Tzwsgi.errorszwfastcgi.py %s initializingr(z)Error occurred while reading WSGI handlerz$Error occurred starting file watcher�WSGI_RESTART_FILE_REGEX�WSGI_PTVSD_SECRET�WSGI_PTVSD_ADDRESSzlocalhost:5678�:rri.z-"%s" is not a valid port number for debugging)�secret�addresszdebugging enabled on %s:%sz*unable to import ptvsd to enable debuggingr�zwfastcgi.py %s initialized�AllowPathInfoForScriptMappingsr�r�r�r��closez$Unhandled exception in wfastcgi.py: zwfastcgi.py %s closed)6rb�__version__r�version�version_info�stdin�detach�msvcrt�setmoder�r��O_BINARYr/rnr�stderr�
__stderr__r,�stdout�
__stdout__rW�getvalue�chdirrQr�r]r\rUr&rarNr��LookupErrorr��ptvsd�
enable_attachr�rKrEr<�
startswithr�rrorz�hasattrr�r7r_r�r�r��
BaseExceptionr�)�initialized�fcgi_streamr�rY�errors�outputr�rRr6�ptvsd_secret�
ptvsd_address�
ptvsd_portr��addr�result�parts                r�mainr��sB���K�� �;�.�/�/�/���s�{�*�+�+�+�c9�,/�,<�Q�,?�1�,D�S�c�i�&�&�(�(�(�#�)��	��M�M�M��N�N�;�-�-�/�/���=�=�=�=���	�	�	��D�	����Q	'�(��5�5�F��
��RZ�R\�R\�\�F�\�S�Z�\�#�.�6�=��3O�3;�:�:�=�F�=�S�Z�#�.� ��f�f�o�v��W�W�I
'�[c�"�)'��5��C�D�D�D��H�X�3�4�4�4�"%�C�H�Q�K�-1�H�)�-X�H�*�#4�X�5K�#L�#L�L�C��-S�H�*�&�x�'=�s�w�w�G`�?a�?a�b�b�b�$'�7�7�+>�#?�#?�L�#�I�),���1E�)F�)F�)Z�JZ�(a�(a�be�gh�(i�(i�
�+�),�]�1�-=�)>�)>�J�J��*�.�.�.�)-�J�J�J�)�+�+�+�� O�R_�`a�Rb� b�c�c�c�)*�J�J�J�+����)��+�I�
�I�I� ,����(5�Q�'7��'C�� %� 3� 3�<�QU� 3� V� V� V� #�$@�4�$G� H� H� H� H��$/�R�R�R� #�$P� Q� Q� Q� Q� Q�R����.0�H�*�,1�H�)��4�{�B�C�C�C�"&�K��
�!�!�#�&�&�&�4�2�:�E�H�35�F�M�-�0�8C�B���F�M�"4�5�!�B�J�.�^�6�=��3M�3S�3S�3U�3U�3`�3`�ac�ak�ly�az�bA�bA�bC�bC�4D�4D�^�35�:�m�3L�F�M�-�0�17��{�1K�C�PV�P]�^k�Pl�Lm�Lm�Ln�Ln�1o�F�M�+�.�8C�F�M�R_�D`�8a�8a�F�M�"4�5�6A�&�-�P[�B\�6]�6]�F�M�"2�3�!������?�?��'� &�=�=���=�$�M�M�+�t�<�<�<��=��v�w�/�/�'����������v�w�/�/�'��������'����QI
'�I
'�I
'�I
'�I
'�I
'�I
'�I
'�I
'�I
'�I
'����I
'�I
'�I
'�I
'�Q	'��d�
�
�
����S�S�S��8�9�;O�;Q�;Q�Q�R�R�R�R�R������8�9�;O�;Q�;Q�Q�R�R�R�
�����	�����)�K�7�8�8�8�8�8��	�����)�K�7�8�8�8�8���s��AS�86B/�.S�/
B<�9S�;B<�<BS�CS�H4�3S�4I(�S�#I(�%S�'I(�(
S�6J.�:4S�.K
�S�	K
�
FS�"R�1%S�'R=�=S�S�S�S�S�S�
U�#U+�%,U�U+�.U�U+�+'Vc�T�ddlm}m}ttj��dkrDtj�tjd��rtjdd�}n5tj�	t
j
d��ddd��g}tj�|d��std|tj�	��d
S||z}	||��S#|$r/}td|ztj�	��|j
cYd}~Sd}~wwxYw)Nr)�
check_call�CalledProcessErrorr�
SystemRoot�system32�inetsrvz
appcmd.exez2IIS configuration tool appcmd.exe was not found at)�filer�zeAn error occurred running the command:

%r

Ensure your user has sufficient privileges and try again.)�
subprocessr�r�r�r�argvr�r��isfiler�r��printr��
returncode)�argsr�r��appcmd�exs     r�_run_appcmdr�bsH��9�9�9�9�9�9�9�9�
�3�8�}�}�q��^�R�W�^�^�C�H�Q�K�8�8�^���!�"�"�����'�,�,�r�y��6�6�
�I�|�\�\�]��
�7�>�>�&��)�$�$��
�B�F�QT�Q[�\�\�\�\��r��D�=�D���z�$���������
�=�@D�	D�KN�*�		V�	V�	V�	V�
�}�����������
���s�(
C3�3D'�8$D"�D'�"D'c��dtjvrdtjzdzntj}dtvr
dtzdznt}tdddd|zdz|zdzg��}|d	krt	d|�d
|�d���|S)N� r+�setr��!/section:system.webServer/fastCGIz
/+[fullPath='�', arguments='�%', signalBeforeTerminateSeconds='30']r�|z/" can now be used as a FastCGI script processor�r�
executablerjr�r��r��quoted_filerss   r�enabler�ys���/2�c�n�/D�X��s�~�%��+�+�#�.�J�*-��/�G�#��.�3�&�&�x�K�
�
�x�<��*�$�'7�7�+�E�Ho�o����C�
�a�x�c�
�����U`�U`�U`�a�b�b�b��Jrc��dtjvrdtjzdzntj}dtvr
dtzdznt}tdddd|zdz|zdzg��}|d	krt	d|�d
|�d���|S)Nr�r+r�r�r�z
/-[fullPath='r�r�rr�z." is no longer registered for use with FastCGIr�r�s   r�disabler��s���/2�c�n�/D�X��s�~�%��+�+�#�.�J�*-��/�G�#��.�3�&�&�x�K�
�
�x�<��*�$�'7�7�+�E�Ho�o����C�
�a�x�b�
��
�
�
�T_�T_�T_�`�a�a�a��Jr�__main__r�)~�
__future__rrr�
__author__r�r�r�r�r$r\rr��xml.domr�	cStringIOrrr/�io�threadr	�_threadr�rr^�FCGI_HEADER_LENrp�FCGI_ABORT_REQUESTrq�FCGI_PARAMS�
FCGI_STDINrzrp�	FCGI_DATA�FCGI_GET_VALUESr�rd�FCGI_MAXTYPE�FCGI_NULL_REQUEST_ID�FCGI_KEEP_CONN�FCGI_RESPONDER�FCGI_AUTHORIZER�FCGI_FILTER�FCGI_REQUEST_COMPLETE�FCGI_CANT_MPX_CONN�FCGI_OVERLOADED�FCGI_UNKNOWN_ROLEr"r#r$�objectr&r_r7r;r?rBrErGrMr>rX�codecsrNrSrnrtr|r�r�r�r�r�r�r�r�r�r`r�rbr�rcr��windll�kernel32r
r��restype�c_void_pr�argtypes�_winapir�r�r�r�r�r�r��CreateFileW�	c_wchar_prrrr	r
�MAX_PATHrrr�	Structurer�r�r�rr&r8rUrWrqr�r�r�r�r1r5rr�<module>r�s��� G�F�F�F�F�F�F�F�F�F�
=�
���
�
�
�
�����	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
�����������%�"�"�"�"�"�"��G�G���%�%�%�$�$�$�$�$�$�$�$�$�$�%����)�'�'�'�'�'�'�'���)�)�)�(�(�(�(�(�(�(�(�)������A��!��9�9�9�9�9�9�9�9��������������
������	������� ��������������������"��!�
�#��@�@�@�@�@�F�@�@�@�:	�	�	�	�	�Y�	�	�	���A��!��'�������&�&�&�&�&�&����0�0�0��J�J�������������R�R�R����
�E�������2���&R�R�R����Y�Y�Y����$'�"�(�:�	���'�'�'�!�!�!�$�$�$�	�	�	����<�3��3��%��#�
�!��-�
����e�e�e�
�
�
�����8
�
�
�&�
�.�D�� &����
�O�
�O�
�O�
�O�
�O��F�N�6�?�#�#�
�O�
�O�	#����G�G�G�G�G�G�G�G�G�G�G�G�G�G�G�G�G�G�G��������'�3�J���J�����������������J���-�(�4�K�"�O�,�K���=�)�6�L�!�?�L���-�(�4�K� �/�K��#�_�-�K�� �-�0�D��$*�O�V�_�#E�� �"(�/����M��H�H�H�9����<��������'����!%����!��.�.�.�.�.�f�.�.�.�.���	K�	K�	K� � � �"P/�P/�P/�d"�"�"�H���<j]�j]�j]�j]�j]�f�j]�j]�j]�X
�	�h9�h9�h9�T���.
�
�
�
�
�
��z����D�F�F�F�F�F��s4�;�
A�
A�A�A$�#A$�4G�C,J6�5J6