Ë
    "ïàj�h  ã                   óº  — d Z ddlZddlZddlZddlZddlZddlZddlZddlm	Z	 ddl
mZ ddlZddlmZmZ ddlmZmZ ddlmZ ddlmZ dd	lmZ 	 dd
lmZ dZdZ ej@                  d«      Z!d„ Z" G d„ dejF                  «      Z$d„ Z%d„ Z&d„ Z'd„ Z(d„ Z)d„ Z*d„ Z+d„ Z,d„ Z-d„ Z.e(e)e*e+e,e-e.dœZ/d„ Z0e1dk(  rddl2m3Z3  e3«         e0«        yy# e$ r	 dd
lmZ Y Œ�w xY w)a:  
server_cli
==========

:Author: Martin Wendt
:Copyright: Licensed under the MIT license, see LICENSE file in this package.

Standalone server that runs WsgiDAV.

These tasks are performed:

    - Set up the configuration from defaults, configuration file, and command line
      options.
    - Instantiate the WsgiDAVApp object (which is a WSGI application)
    - Start a WSGI server for this WsgiDAVApp object

Configuration is defined like this:

    1. Get the name of a configuration file from command line option
       ``--config-file=FILENAME`` (or short ``-cFILENAME``).
       If this option is omitted, we use ``wsgidav.yaml`` in the current
       directory.
    2. Set reasonable default settings.
    3. If configuration file exists: read and use it to overwrite defaults.
    4. If command line options are passed, use them to override settings:

       ``--host`` option overrides ``hostname`` setting.

       ``--port`` option overrides ``port`` setting.

       ``--root=FOLDER`` option creates a FilesystemProvider that publishes
       FOLDER on the '/' share.
é    N)Úpformat)ÚTimer)Ú__version__Úutil)ÚDEFAULT_CONFIGÚDEFAULT_VERBOSE)ÚFilesystemProvider)Ú
WsgiDAVApp)Úuse_lxml)ÚloadÚreStructuredText)zwsgidav.yamlzwsgidav.jsonÚwsgidavc                 óx  — t        j                  | j                  d«      | «      }t        j                  | j                  d«      | «      }t        j                  | j                  d«      | «      }| j                  dd«      }d}|r|rd}n|s|rt        d«      ‚|rd	nd
}|› d| d   › d| d   › �}|||||||dœ}|S )zCalculate some common info.Ússl_certificateÚssl_private_keyÚssl_certificate_chainÚssl_adapterÚbuiltinFTzEOption 'ssl_certificate' and 'ssl_private_key' must be used together.ÚhttpsÚhttpz://Úhostú:Úport)Úuse_sslÚssl_certÚssl_pkr   Ú	ssl_chainÚprotocolÚurl)r   Úfix_pathÚgetÚRuntimeError)	Úconfigr   r   r   r   r   r   r   Úinfos	            úH/srv/dav/.venv/lib/python3.12/site-packages/wsgidav/server/server_cli.pyÚ_get_common_infor&   D   sÕ   € ô —m‘m F§J¡JÐ/@Ó$AÀ6ÓJ€OÜ—m‘m F§J¡JÐ/@Ó$AÀ6ÓJ€OÜ ŸM™M¨&¯*©*Ð5LÓ*MÈvÓVÐØ—*‘*˜]¨IÓ6€KØ€GÙ™?Ø‰á	™OÜØSó
ð 	
ñ "‰w v€HØˆJ�c˜& ™.Ð)¨¨6°&©>Ð*:Ð
;€CàØ#Ø!Ø"Ø*ØØñ€Dð €Kó    c                   ó   — e Zd ZdZdd„Zy)ÚFullExpandedPathzExpand user- and relative-pathsNc                 óª   — t         j                  j                  t         j                  j                  |«      «      }t	        || j
                  |«       y ©N)ÚosÚpathÚabspathÚ
expanduserÚsetattrÚdest)ÚselfÚparserÚ	namespaceÚvaluesÚoption_stringÚnew_vals         r%   Ú__call__zFullExpandedPath.__call__e   s3   € Ü—'‘'—/‘/¤"§'¡'×"4Ñ"4°VÓ"<Ó=ˆÜ�	˜4Ÿ9™9 gÕ.r'   r+   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r8   © r'   r%   r)   r)   b   s
   „ Ù)ô/r'   r)   c            	      ó(  — d} d}t        j                  d| |dt         j                  ¬«      }|j                  ddt        d¬	«       |j                  d
dd¬«       |j                  dddt
        d¬«       |j                  ddd¬«       |j                  dt        j                  «       d¬«       |j                  ddd¬«       |j                  «       }|j                  ddddd ¬!«       |j                  d"d#d$dd%¬&«       |j                  «       }|j                  d'd(d)t
        d*t        › d+�¬«       |j                  d,d-d.t        › �¬/«       |j                  d0d-d1¬/«       |j                  d2d3d-d4¬/«       |j                  «       }|xj                  |j                  z  c_        |`|j                  rIt        j                  j!                  |j                  «      s |j                  › d5�}|j#                  |«       |j$                  r®|j                  d6k\  ryd7j'                  t(        t+        j,                  «       t.        j0                  t2        j4                  d8kD  rd9nd:t+        j*                  d;¬<«      «      }|d=t2        j6                  › �z  }nt(        › }t9        |«       t3        j:                  «        |j<                  rnñ|j>                  €pt        D ]f  }t        j                  jA                  |«      }t        j                  jC                  |«      sŒB|j                  dk\  rt9        d>|› �«       ||_         nw nut        j                  jA                  |j>                  «      |_        t        j                  jE                  |j>                  «      s|j#                  d?|j>                  › �«       |jF                  jI                  «       }	|j                  d@k\  r5t9        dA«       |	jK                  «       D ]  \  }
}t9        dB|
dC›dD|› �«       Œ |	|fS )Ez-Parse command line options into a dictionary.a5  
Run a WEBDAV server to share file system folders.

Examples:

  Share filesystem folder '/temp' for anonymous access (no config file used):
    wsgidav --port=80 --host=0.0.0.0 --root=/temp --auth=anonymous

  Run using a specific configuration file:
    wsgidav --port=80 --host=0.0.0.0 --config=~/my_wsgidav.yaml

  If no config file is specified, the application will look for a file named
  'wsgidav.yaml' in the current directory.
  See
    http://wsgidav.readthedocs.io/en/latest/run-configure.html
  for some explanation of the configuration file format.
  zbLicensed under the MIT license.
See https://github.com/mar10/wsgidav for additional information.

r   F)ÚprogÚdescriptionÚepilogÚallow_abbrevÚformatter_classz-pz--portz port to serve on (default: 8080))ÚtypeÚhelpz-Hz--hostzŒhost to serve from (default: localhost). 'localhost' is only accessible from the local computer. Use 0.0.0.0 to make your application public)rE   z-rz--rootÚ	root_pathz<path to a file system folder to publish for RW as share '/'.)r1   ÚactionrE   z--auth)Ú	anonymousÚntú	pam-loginzFquick configuration of a domain controller when no config file is used)ÚchoicesrE   z--serverz<type of pre-installed WSGI server to use (default: cheroot).z--ssl-adapter)r   Ú	pyopensslzOused by 'cheroot' server if SSL certificates are configured (default: builtin).z-vz	--verboseÚcounté   z>increment verbosity by one (default: %(default)s, range: 0..5))rG   ÚdefaultrE   z-qz--quietr   zdecrement verbosity by one)rO   rG   rE   z-cz--configÚconfig_filezconfiguration file (default: z in current directory)z--no-configÚ
store_truezdo not try to load default )rG   rE   z--browsezopen browser on startz-Vz	--versionz<print version info and exit (may be combined with --verbose)z is not a directoryé   zWsgiDAV/{} {}/{}({} bit) {}l        Ú64Ú32T)Úaliasedz
Python from: z"Using default configuration file: z-Could not find specified configuration file: é   zCommand line args:z    z>12z: )&ÚargparseÚArgumentParserÚRawTextHelpFormatterÚadd_argumentÚintr)   ÚSUPPORTED_SERVERSÚkeysÚadd_mutually_exclusive_groupÚDEFAULT_CONFIG_FILESÚ
parse_argsÚverboseÚquietrF   r,   r-   ÚisdirÚerrorÚversionÚformatr   ÚplatformÚpython_implementationr   ÚPYTHON_VERSIONÚsysÚmaxsizeÚ
executableÚprintÚexitÚ	no_configrP   r.   ÚexistsÚisfileÚ__dict__ÚcopyÚitems)r@   rA   r3   Úqv_groupÚargsÚmsgÚversion_infoÚfilenameÚdefPathÚcmdLineOptsÚkÚvs               r%   Ú_init_command_line_optionsr~   j   s  € ð€Kð&€Fô ×$Ñ$ØØØØÜ ×5Ñ5ô€Fð ×ÑØØÜà/ð ô ð ×ÑØØð!ð	 ô ð ×ÑØØØÜØKð ô ð ×ÑØØ0ØUð ô ð
 ×ÑØÜ!×&Ñ&Ó(àKð	 ô ð ×ÑØØ(ðð	 ô ð ×2Ñ2Ó4€HØ×ÑØØØØØMð ô ð ×ÑØˆi ¨7Ð9Uð ô ð ×2Ñ2Ó4€HØ×ÑØØØÜà+Ô,@Ð+AÐAWÐXð ô ð ×ÑØØØ*Ô+?Ð*@ÐAð ô ð ×ÑØØØ$ð ô ð ×ÑØØØØKð	 ô ð ×ÑÓ€Dà‡L‚L�D—J‘JÑ…LØˆ
à‡~‚~œbŸg™gŸm™m¨D¯N©NÔ;Ø—‘Ð Ð 3Ð4ˆØ�‰�SÔà‡|‚|Ø�<‰<˜1ÒØ8×?Ñ?ÜÜ×.Ñ.Ó0Ü×#Ñ#ÜŸ™ eÒ+‘°Ü×!Ñ!¨$Ô/óˆLð ˜o¬c¯n©nÐ-=Ð>Ñ>‰Lä)˜]ˆLÜˆlÔÜ�‰Œ
à‡~‚~Øà	×	Ñ	Ð	!ä,ò 	ˆHÜ—g‘g—o‘o hÓ/ˆGÜ�w‰w�~‰~˜gÕ&Ø—<‘< 1Ò$ÜÐ>¸w¸iÐHÔIØ#*�Ô Ùñ	ô Ÿ7™7Ÿ?™?¨4×+;Ñ+;Ó<ˆÔÜ�w‰w�~‰~˜d×.Ñ.Ô/Ø�L‰LØ?À×@PÑ@PÐ?QÐRôð
 —-‘-×$Ñ$Ó&€KØ‡|�|�qÒÜÐ"Ô#Ø×%Ñ%Ó'ò 	'‰DˆAˆqÜ�D˜˜3˜˜r ! Ð%Õ&ð	'à˜ÐÐr'   c                 ó  — t         j                  j                  | «      } t         j                  j                  | «      st	        d| ›d�«      ‚| j                  d«      r"t        | d¬«      5 }t        |«      }ddd«       nK| j                  d«      r,t        | d¬«      5 }t        j                  |«      }ddd«       nt	        d| › �«      ‚| d	<   t         j                  j                  | «      |d
<   |S # 1 sw Y   Œ2xY w# 1 sw Y   Œ>xY w)z2Read configuration file options into a dictionary.z!Couldn't open configuration file ú.z.jsonz	utf-8-sig)ÚencodingNz.yamlz8Unsupported config file format (expected yaml or json): Ú_config_fileÚ_config_root)r,   r-   r.   rp   r"   ÚendswithÚopenÚ	json_loadÚyamlÚ	safe_loadÚdirname)rP   Ú_verboseÚfpÚconfs       r%   Ú_read_config_filer�     sý   € ô —'‘'—/‘/ +Ó.€Kä�7‰7�>‰>˜+Ô&ÜÐ>¸{¸oÈQÐOÓPÐPà×Ñ˜GÔ$Ü�+¨Ô4ð 	!¸Ü˜R“=ˆD÷	!ð 	!ð 
×	Ñ	˜gÔ	&Ü�+¨Ô4ð 	&¸Ü—>‘> "Ó%ˆD÷	&ð 	&ô ØFÀ{ÀmÐTó
ð 	
ð '€DˆÑÜŸ7™7Ÿ?™?¨;Ó7€DˆÑØ€K÷	!ð 	!ú÷	&ð 	&ús   Á,C5ÂDÃ5C>ÄD
c                  ó4  — t        «       \  } }| d   }t        j                  t        «      }d|d<   t	        j
                  «       |d<   | j                  d«      }|rXt        ||«      }t        j                  ||«       |t        k7  r=d|v r9|dk\  rt        dj                  |d   |«      «       ||d<   n|dk\  rt        d«       | j                  d	«      r| j                  d	«      |d	<   | j                  d
«      r| j                  d
«      |d
<   | j                  d«      �d|d<   | j                  d«      �| j                  d«      |d<   | j                  d«      �| j                  d«      |d<   | j                  d«      t        k7  r| j                  d«      |d<   | j                  d«      rPt        j                  j                  | j                  d«      «      }t        ||j                  d«      ¬«      |d   d<   |d   dk\  r<t        j                   |«      }t        dj                  | d   t#        |«      «      «       |d   s|j%                  d«       | j                  d«      }t        j&                  |dd¬«      }	|r"|	j                  d«      r|j%                  d«       |dk(  r:|d   d   r|j%                  d«       |	j)                  d dddd!œ«       d"di|d   d<   n‡|d#k(  r>|j                  d$«      r|j%                  d%«       |	j)                  d&dd'd'd!œ«       i |d$<   nD|d(k(  r?|j                  d)«      r|j%                  d*«       |	j)                  d+dd'd'd!œ«       d,d-i|d)<   |d.   r*d/t        _        d0t,        j.                  d1   › �t        _        | |fS )2zQSetup configuration dictionary from default, command line and configuration file.ra   Nr‚   rƒ   rP   é   zHConfig file defines 'verbose: {}' but is overridden by command line: {}.z#Running without configuration file.r   r   ÚprofileTÚserverr   rF   Úfs_dav_provider)Úfs_optsÚprovider_mappingú/rV   zConfiguration({}):
{}zNo DAV provider defined.ÚauthÚhttp_authenticator©Úas_dictÚdomain_controllerzF--auth option can only be used when no domain_controller is configuredrH   Ú	simple_dcÚuser_mappingzD--auth=anonymous can only be used when no user_mapping is configuredz+wsgidav.dc.simple_dc.SimpleDomainController)rš   Úaccept_basicÚaccept_digestÚdefault_to_digestÚ*rI   Únt_dcz@--auth=nt can only be used when no nt_dc settings are configuredz#wsgidav.dc.nt_dc.NTDomainControllerFrJ   Úpam_dczH--auth=pam-login can only be used when no pam_dc settings are configuredz%wsgidav.dc.pam_dc.PAMDomainControllerÚserviceÚloginÚsuppress_version_infoÚWsgiDAVzPython/r   )r~   rs   Údeepcopyr   r,   Úgetcwdr!   r�   r   Údeep_updater   rm   rf   r-   r.   r	   Úpurge_passwordsr   rd   Úget_dict_valueÚupdateÚpublic_wsgidav_inforj   rx   Úpublic_python_info)
Úcli_optsr3   Úcli_verboser#   rP   Ú	file_optsrF   Úconfig_cleanedr–   Ú	auth_confs
             r%   Ú_init_configr´   /  sª  € ä1Ó3Ñ€HˆfØ˜9Ñ%€Kô �]‰]œ>Ó*€FØ!€Fˆ>ÑÜŸY™Y›[€Fˆ>Ñð —,‘,˜}Ó-€KÙÜ% k°;Ó?ˆ	Ü×Ñ˜ Ô+Øœ/Ò)¨i¸9Ñ.DØ˜aÒÜØ^×eÑeØ! )Ñ,¨kóôð
 !,ˆF�9Òà˜!ÒÜÐ7Ô8ð ‡|�|�FÔØ!Ÿ™ fÓ-ˆˆv‰Ø‡|�|�FÔØ!Ÿ™ fÓ-ˆˆv‰Ø‡|�|�IÓÐ*Ø ˆˆyÑØ‡|�|�HÓÐ)Ø#Ÿ<™<¨Ó1ˆˆxÑØ‡|�|�MÓ"Ð.Ø (§¡¨]Ó ;ˆˆ}Ñð ‡|�|�IÓ¤/Ò1Ø$ŸL™L¨Ó3ˆˆyÑà‡|�|�KÔ Ü—G‘G—O‘O H§L¡L°Ó$=Ó>ˆ	Ü*<ØØ—J‘JÐ0Ó1ô+
ˆÐ!Ñ" 3Ñ'ð
 ˆiÑ˜AÒä×-Ñ-¨fÓ5ˆÜØ$×+Ñ+Ø˜Ñ'¬°Ó)@óô	
ð Ð$Ò%Ø�‰Ð/Ô0ð �<‰<˜Ó€DÜ×#Ñ# FÐ,@È$ÔO€IÙ�	—‘Ð1Ô2Ø�‰ØTô	
ð ˆ{ÒØ�+Ñ˜~Ò.Ø�L‰LØVôð 	×Ñà%RØ $Ø!%Ø%)ñ	ô	
ð 03°D¨kˆˆ{Ñ˜NÒ+Ø	�ŠØ�:‰:�gÔØ�L‰LØRôð 	×Ñà%JØ $Ø!&Ø%*ñ	ô	
ð ˆˆwŠØ	�Ò	Ø�:‰:�hÔØ�L‰LØZôð 	×Ñà%LØ $Ø!&Ø%*ñ	ô	
ð & wÐ/ˆˆxÑð Ð%Ò&Ø#,ŒÔ Ø$+¬C×,<Ñ,<¸QÑ,?Ð+@Ð"AŒÔà�VÐÐr'   c                 óÔ  ‡— 	 ddl m}m} t        j                  › d|j                  j                  › dt        j                  › �}t        |«      }|d   rP|d   }|j                  |«      } ||d	   |d
   |d   «      |j                  _        t        j                  d|› �«       t        j                  d|› �«       t        j                  d|d   › d�«       |d   |d   f| |ddœ}t        j                   |dd¬«      }	|j#                  |	«        G ˆfd„d|j                  «      }
|j%                  d«      Š‰r	 |
di |¤Ž}n |j                  di |¤Ž}	 |j'                  «        |j-                  «        y# t        $ r- t        j                  d«       t        j                  d«       Y yw xY w# t(        $ r t        j+                  d«       Y Œjw xY w# |j-                  «        w xY w)zARun WsgiDAV using cheroot.server (https://cheroot.cherrypy.dev/).r   )r‘   Úwsgiz9Could not import Cheroot (https://cheroot.cherrypy.dev/).zTry `pip install cheroot`.Fú r   r   r   r   r   zSSL / HTTPS enabled. Adapter: úRunning úServing on r   ú ...r   r   é2   )Ú	bind_addrÚwsgi_appÚserver_nameÚ
numthreadsÚserver_argsTr˜   c                   ó&   •‡ — e Zd ZdZˆ ˆfd„Zˆ xZS )ú#_run_cheroot.<locals>.PatchedServerg      à?c                 óö   •— t         j                  d«       ‰rS‰j                  «       sCt        | j                  ‰j
                  «      j                  «        t         j                  d«       t        ‰| �   |i |¤ŽS )Nzwsgi.Server.servezwsgi.Server is ready)	Ú_loggerrd   Úis_setr   ÚSTARTUP_NOTIFICATION_DELAYÚsetÚstartÚsuperÚserve)r2   rv   ÚkwargsÚ	__class__Ústartup_events      €€r%   rÊ   z)_run_cheroot.<locals>.PatchedServer.serveÝ  s^   ø€ Ü�M‰MÐ-Ô.Ù ]×%9Ñ%9Ô%;Ü�d×5Ñ5°}×7HÑ7HÓI×OÑOÔQÜ—‘Ð4Ô5Ü‘7‘= $Ð1¨&Ñ1Ð1r'   )r9   r:   r;   rÆ   rÊ   Ú__classcell__)rÌ   rÍ   s   @€r%   ÚPatchedServerrÂ   Ú  s   ù„ Ø%(Ð"÷	2ñ 	2r'   rÏ   rÍ   úCaught Ctrl-C, shutting down...Nr=   )Úcherootr‘   r¶   ÚImportErrorrÄ   Ú	exceptionrd   r   r­   ÚServerre   r®   r&   Úget_ssl_adapter_classr   r$   r«   r¬   r!   rÈ   ÚKeyboardInterruptÚwarningÚstop)Úappr#   Ú_serverr‘   r¶   re   r$   r   rÀ   Úcustom_argsrÏ   rÍ   s              @r%   Ú_run_cherootrÜ   ³  sÖ  ø€ ðß(ô ×#Ñ#Ð
$ A d§k¡k×&9Ñ&9Ð%:¸!¼D×<SÑ<SÐ;TÐUð ô
 ˜FÓ#€Dð ˆI‚Ø˜=Ñ)ˆØ×2Ñ2°;Ó?ˆÙ"-Ø�Ñ˜d 8™n¨d°;Ñ.?ó#
ˆ�‰Ôô 	�‰Ð5°k°]ÐCÔDä‡L�L�8˜G˜9Ð%Ô&Ü‡L�L�;˜t E™{˜m¨4Ð0Ô1ð ˜V‘n f¨V¡nÐ5ØØàñ€Kô ×%Ñ% f¨mÀTÔJ€KØ×Ñ�{Ô#ö2˜Ÿ™ô 2ð —J‘J˜Ó/€MÙÙÑ- Ñ-‰à�—‘Ñ+˜{Ñ+ˆðØ�‰Œð 	�‰Œà
øôy ò Ü×ÑÐUÔVÜ�‰Ð2Ô3Ùðûôn ò ;Ü�‰Ð9Ö:ð;ûð 	�‰�ús5   ƒE8 ÅF1 Å83F.Æ-F.Æ1GÇG ÇGÇG ÇG'c                 ó¨   — ddl m} t        j                  d«       	 |j	                  || «       y# t
        $ r t        j                  d«       Y yw xY w)z@Run WsgiDAV using ext_wsgiutils_server from the wsgidav package.r   )Úext_wsgiutils_serverzQWARNING: This single threaded server (ext-wsgiutils) is not meant for production.rÐ   N)Úwsgidav.serverrÞ   rÄ   r×   rÊ   rÖ   )rÙ   r#   rÚ   rÞ   s       r%   Ú_run_ext_wsgiutilsrà   ö  sO   € å3ä‡O�OØ[ôð;Ø×"Ñ" 6¨3Ô/ð øô ò ;Ü�‰Ð9Õ:Ø
ð;ús   �0 °AÁAc                 óZ  ‡
‡‡— 	 ddl }ddl}ddlm} |j                  j                  «        t        |«      }d|j                  › �}t        j                  › d|› dt        j                  › �}| |d	   |d
   fdœ}t        j                  |dd¬«      }|j!                  |«       |d   r ||d   | |d   |d   |d   ¬«      Š
n ||d   | «      Š
|j#                  d«      Š‰rˆ
ˆˆfd„}	‰
j$                  Š|	‰
_        t
        j'                  d|› �«       t
        j'                  d|d   › d�«       	 |j)                  ‰
j+                  «       «       y# t        $ r- t
        j                  d«       t
        j                  d«       Y yw xY w# t,        $ r t
        j/                  d«       Y yw xY w)zúRun WsgiDAV using gevent if gevent (https://www.gevent.org).

    See
      https://github.com/gevent/gevent/blob/master/src/gevent/pywsgi.py#L1356
      https://github.com/gevent/gevent/blob/master/src/gevent/server.py#L38
    for more options.
    r   N)Ú
WSGIServerz0Could not import gevent (http://www.gevent.org).zTry `pip install gevent`.Fzgevent/r·   r   r   )r½   r¼   rÀ   Tr˜   r   r¼   r   r   r   ©ÚkeyfileÚcertfileÚca_certsrÍ   c                  ól   •— ‰‰ _          ‰«        t        j                  d«       ‰j                  «        y )Nzgevent is ready)Ústart_acceptingrÄ   r$   rÇ   )Ú
dav_serverÚ	org_startrÍ   s   €€€r%   Ú_patched_startz#_run_gevent.<locals>._patched_start3  s)   ø€ Ø)2ˆJÔ&ÙŒKÜ�L‰LÐ*Ô+Ø×ÑÕr'   r¸   r¹   r   rº   rÐ   )ÚgeventÚgevent.monkeyÚgevent.pywsgirâ   rÒ   rÄ   rÓ   rd   ÚmonkeyÚ	patch_allr&   r   r   r­   r®   r«   r¬   r!   rè   r$   ÚspawnÚserve_foreverrÖ   r×   )rÙ   r#   r‘   rì   râ   r$   re   rÀ   rÛ   rë   ré   rê   rÍ   s             @@@r%   Ú_run_geventró     s´  ú€ ðÛÛÝ,ð ‡M�M×ÑÔä˜FÓ#€DØ˜×*Ñ*Ð+Ð,€GÜ×)Ñ)Ð*¨!¨G¨9°A´d×6MÑ6MÐ5NÐO€Gð Ø˜V‘n f¨V¡nÐ5ñ€Kô ×%Ñ% f¨mÀTÔJ€KØ×Ñ�{Ô#àˆI‚ÙØ˜Ñ$ØØ˜‘NØ˜*Ñ%Ø˜+Ñ&ô
‰
ñ   ¨KÑ 8¸#Ó>ˆ
ð —J‘J˜Ó/€MÙö	 ð ×.Ñ.ˆ	Ø%3ˆ
Ô"ä‡L�L�8˜G˜9Ð%Ô&Ü‡L�L�;˜t E™{˜m¨4Ð0Ô1ð;Ø�‰�Z×-Ñ-Ó/Ô0ð øôe ò Ü×ÑÐLÔMÜ�‰Ð1Ô2Ùðûô` ò ;Ü�‰Ð9Õ:Ø
ð;ús#   …E Ä0F	 Å3FÆFÆ	F*Æ)F*c                 ó‚  — 	 ddl }t        |«      } G d„ d|j                  j                  j                  «      }dj                  |d	   |d
   «      dddœ}|d   r|j                  |d   |d   |d   dœ«       t        j                  |dd¬«      }|j                  |«       d|j                  › �}t        j                  › d|› dt        j                  › �}t        j!                  d|› d�«        || |«      j#                  «        y# t        $ r- t        j                  d«       t        j	                  d«       Y yw xY w)z2Run WsgiDAV using Gunicorn (https://gunicorn.org).r   Nz1Could not import Gunicorn (https://gunicorn.org).z'Try `pip install gunicorn` (UNIX only).Fc                   ó,   ‡ — e Zd Zdˆ fd„	Zd„ Zd„ Zˆ xZS )ú*_run_gunicorn.<locals>.GunicornApplicationc                 óF   •— |xs i | _         || _        t        ‰| �  «        y r+   )ÚoptionsÚapplicationrÉ   Ú__init__)r2   rÙ   rø   rÌ   s      €r%   rú   z3_run_gunicorn.<locals>.GunicornApplication.__init__Q  s!   ø€ Ø"š= bˆDŒLØ"ˆDÔÜ‰GÑÕr'   c                 ó"  — | j                   j                  «       D ��ci c]"  \  }}|| j                  j                  v r|�||“Œ$ }}}|j                  «       D ]/  \  }}| j                  j	                  |j                  «       |«       Œ1 y c c}}w r+   )rø   rt   ÚcfgÚsettingsrÇ   Úlower)r2   ÚkeyÚvaluer#   s       r%   Úload_configz6_run_gunicorn.<locals>.GunicornApplication.load_configV  s…   € ð #'§,¡,×"4Ñ"4Ó"6÷á�C˜Ø˜$Ÿ(™(×+Ñ+Ñ+°Ð0Að �U‘
ðˆFñ ð
 %Ÿl™l›nò 1‘
��UØ—‘—‘˜SŸY™Y›[¨%Õ0ñ1ùós   ž'Bc                 ó   — | j                   S r+   )rù   )r2   s    r%   r   z/_run_gunicorn.<locals>.GunicornApplication.load_  s   € Ø×#Ñ#Ð#r'   r+   )r9   r:   r;   rú   r  r   rÎ   )rÌ   s   @r%   ÚGunicornApplicationrö   P  s   ø„ õ	ò
	1ö	$r'   r  z{}:{}r   r   r»   i°  )ÚbindÚthreadsÚtimeoutr   r   r   r   rã   rÀ   Tr˜   z	gunicorn/r·   r¸   rº   )Úgunicorn.app.baserÒ   rÄ   rÓ   rd   r&   rÙ   ÚbaseÚBaseApplicationrf   r¬   r   r«   r   r­   r®   r$   Úrun)	rÙ   r#   r‘   Úgunicornr$   r  rÀ   rÛ   re   s	            r%   Ú_run_gunicornr  E  s>  € ðÛ ô ˜FÓ#€Dô$˜hŸl™l×/Ñ/×?Ñ?ô $ð( —‘˜v f™~¨v°f©~Ó>ØØñ€Kð
 ˆI‚Ø×Ñà ™>Ø  Ñ,Ø  Ñ-ñô		
ô ×%Ñ% f¨mÀTÔJ€KØ×Ñ�{Ô#à˜(×.Ñ.Ð/Ð0€GÜ×)Ñ)Ð*¨!¨G¨9°A´d×6MÑ6MÐ5NÐO€GÜ‡L�L�8˜G˜9 DÐ)Ô*á˜˜[Ó)×-Ñ-Õ/øôe ò Ü×ÑÐMÔNÜ�‰Ð?Ô@Ùðús   ‚D Ä3D>Ä=D>c                 óè  ‡	— 	 ddl m} t        |«      }|j                  j                  }t        j                  › d|› dt        j                  › �}|j                  | |d   |d   |d	d¬
«      }|d   dk\  r,|j                  j                  Š	ˆ	fd„}||j                  _        t        j                  d|› d�«       |j                   \  }}|dk(  rt        j                  d|› d|› �«       nt        j                  d|d   › �«       	 |j#                  «        y# t        $ r- t        j	                  d«       t        j                  d«       Y yw xY w# t$        $ r t        j'                  d«       Y yw xY w)zˆRun WsgiDAV using paste.httpserver, if Paste is installed.

    See http://pythonpaste.org/modules/httpserver.html for more options
    r   )Ú
httpserverzCCould not import paste.httpserver (https://github.com/cdent/paste).zTry `pip install paste`.Fr·   r   r   zHTTP/1.1)r   r   Úserver_versionÚprotocol_versionÚ
start_loopra   rV   c                 óŠ   •—  ‰| «       | j                   dk(  rt        j                  d«       y t        j                  d«       y )Né   zHTTP Connection : closezHTTP Connection : continue)Úclose_connectionrÄ   Údebug)r2   Ú__handle_one_requests    €r%   Úhandle_one_requestz&_run_paste.<locals>.handle_one_requestŸ  s3   ø€ Ù  Ô&Ø×$Ñ$¨Ò)Ü—‘Ð7Õ8ä—‘Ð:Õ;r'   r¸   rº   ú0.0.0.0zServing on 0.0.0.0:z view at http://127.0.0.1:r¹   r   rÐ   N)Úpaster  rÒ   rÄ   rÓ   rd   r&   ÚWSGIHandlerr  r   r­   r®   rÊ   ÚRequestHandlerClassr  r$   Úserver_addressrò   rÖ   r×   )
rÙ   r#   r‘   r  r$   re   r  r   r   r  s
            @r%   Ú
_run_paster  ~  s~  ø€ ð
Ý$ô ˜FÓ#€Dà×$Ñ$×3Ñ3€GÜ×)Ñ)Ð*¨!¨G¨9°A´d×6MÑ6MÐ5NÐO€Gð ×ÑØØ�F‰^Ø�F‰^Øà#Øð ó €Fð ˆiÑ˜AÒØ%×9Ñ9×LÑLÐô	<ð 9Kˆ×"Ñ"Ô5ä‡L�L�8˜G˜9 DÐ)Ô*Ø×&Ñ&�J€Dˆ$ØˆyÒÜ�‰Ð*¨4¨&Ð0JÈ4È&ÐQÕRä�‰�{ 4¨¡; -Ð0Ô1ð;Ø×ÑÔð øô] ò Ü×ÑØQô	
ô 	�‰Ð0Ô1ÙðûôX ò ;Ü�‰Ð9Õ:Ø
ð;ús#   ƒD ÄE Ä3EÅEÅE1Å0E1c                 ó  — 	 ddl }t        |«      }d|d   |d   d	œ}|d
   r|j                  |d   |d   |d   dœ«       t        j                  |dd¬«      }|j                  |«       d|j                  › �}t        j                  › d|› dt        j                  › �}t        j                  d|› d�«        |j                  | fi |¤Ž y# t        $ r- t        j                  d«       t        j	                  d«       Y yw xY w)z4Run WsgiDAV using Uvicorn (https://www.uvicorn.org).r   Nz3Could not import Uvicorn (https://www.uvicorn.org).zTry `pip install uvicorn`.Fr¶   r   r   )Ú	interfacer   r   r   r   r   r   )Ússl_keyfileÚssl_certfileÚssl_ca_certsrÀ   Tr˜   zuvicorn/r·   r¸   rº   )ÚuvicornrÒ   rÄ   rÓ   rd   r&   r¬   r   r«   r   r­   r®   r$   r
  )rÙ   r#   r‘   r#  r$   rÀ   rÛ   re   s           r%   Ú_run_uvicornr$  ¶  s  € ðÛô ˜FÓ#€Dð Ø�v‘Ø�v‘ñ€Kð ˆI‚Ø×Ñà# H™~Ø $ ZÑ 0Ø $ [Ñ 1ñô
	
ô ×%Ñ% f¨mÀTÔJ€KØ×Ñ�{Ô#à˜×,Ñ,Ð-Ð.€GÜ×)Ñ)Ð*¨!¨G¨9°A´d×6MÑ6MÐ5NÐO€GÜ‡L�L�8˜G˜9 DÐ)Ô*à€G‡K�K�Ñ#�{Ó#øôE ò Ü×ÑÐOÔPÜ�‰Ð2Ô3Ùðús   ‚C Ã3DÄ Dc                 óJ  — ddl m}m} |j                  }t        j
                  › d|› �}t        j                  d|› d�«       t        j                  d«       ||_         ||d   |d   | «      }	 |j                  «        y
# t        $ r t        j                  d	«       Y y
w xY w)zYRun WsgiDAV using wsgiref.simple_server (https://docs.python.org/3/library/wsgiref.html).r   )ÚWSGIRequestHandlerÚmake_serverr·   r¸   rº   zKWARNING: This single threaded server (wsgiref) is not meant for production.r   r   rÐ   N)Úwsgiref.simple_serverr&  r'  r  r   r­   rÄ   r$   r×   rò   rÖ   )rÙ   r#   rÚ   r&  r'  re   Úhttpds          r%   Ú_run_wsgirefr*  ß  s£   € çEà ×/Ñ/€GÜ×)Ñ)Ð*¨!¨G¨9Ð5€GÜ‡L�L�8˜G˜9 DÐ)Ô*ä‡O�OØUôð )0ÐÔ%Ù˜˜v™¨¨v©¸Ó<€Eð;Ø×ÑÔð øô ò ;Ü�‰Ð9Õ:Ø
ð;ús   Á0B ÂB"Â!B")rÑ   zext-wsgiutilsrì   r  r  r#  Úwsgirefc            	      ó²  ‡— t        «       \  } }d|d   d<   t        |«      Št        |«      }|d   }t        j	                  |«      }|s<t        dj                  |dj                  t        j                  «       «      «      «      ‚t        s|d   dk\  rt        j                  d	«       | d
   r!d}ˆfd„}t        ||«      j                  «         ||||«       y )NTÚloggingÚenabler‘   z,Unsupported server type {!r} (expected {!r})z', 'ra   rN   z€Could not import lxml: using xml instead (up to 10% slower). Consider `pip install lxml`(see https://pypi.python.org/pypi/lxml).Úbrowseg       @c                  ó�   •— ‰d   } | j                  dd«      } t        j                  d| › d�«       t        j                  | «       y )Nr   r  z	127.0.0.1zStarting browser on rº   )ÚreplacerÄ   r$   Ú
webbrowserr…   )r   r$   s    €r%   Ú_workerzrun.<locals>._worker  s>   ø€ Ø�u‘+ˆCØ—+‘+˜i¨Ó5ˆCÜ�L‰LÐ/°¨u°DÐ9Ô:Ü�O‰O˜CÕ r'   )r´   r&   r
   r\   r!   r"   rf   Újoinr]   r   rÄ   r×   r   rÈ   )r¯   r#   rÙ   r‘   ÚhandlerÚBROWSE_DELAYr3  r$   s          @r%   r
  r
  ÿ  sß   ø€ Ü#“~Ñ€Hˆfð #'€Fˆ9Ñ�hÑä˜FÓ#€Dä
�VÓ
€Cà�HÑ€FÜ×#Ñ# FÓ+€GÙÜØ:×AÑAØ˜Ÿ™Ô$5×$:Ñ$:Ó$<Ó=óó
ð 	
õ ˜˜yÑ)¨QÒ.Ü�‰ðRô	
ð
 �ÒØˆô	!ô 	ˆl˜GÓ$×*Ñ*Ô,áˆC�˜Ô Ø
r'   Ú__main__)Úfreeze_support)4r<   rW   rs   r-  r,   rg   rj   r2  Úpprintr   Ú	threadingr   r‡   r   r   r   Úwsgidav.default_confr   r   Úwsgidav.fs_dav_providerr	   Úwsgidav.wsgidav_appr
   Úwsgidav.xml_toolsr   Úpyjson5r   r†   rÒ   Újson5Ú__docformat__r_   Ú	getLoggerrÄ   r&   ÚActionr)   r~   r�   r´   rÜ   rà   ró   r  r  r$  r*  r\   r
  r9   Úmultiprocessingr8  r=   r'   r%   ú<module>rE     s  ðñ óD Û Û Û 	Û Û 
Û Ý Ý ã ç %ß @Ý 6Ý *Ý &ð(å)ð
 #€ð 8Ð à
ˆ'×
Ñ
˜IÓ
&€òô</�x—‘ô /òhòVò4AòH@òFò>òB60òr5òp&$òRð, Ø'ØØØØØñÐ ò%ðP ˆzÒå.áÔá…Eð øð_ ò (ß'ð(ús   ÁC ÃCÃC