1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
U
Þ=®d8™ã@sZdZddlmZddlZddlZddlZddlZddlZddlZddl    Z    ddl
Z ddl m Z ddl mZddl mZddlmZddlmZdd    lmZdd
lmZd d lmZd d lmZd dlmZd dlmZz ddlZWn*ek
r
Gdd„dƒZeƒZYnXdZ ej!dkrDz e"dƒWnek
rBdZ YnXe#edƒZ$e$r\ej%Z%nGdd„dƒZ%z
ej&Z'Wne(k
rŽdZ'YnXdZ)e j*e j+de j,e-e j*e-fe j.dfZ/e j0røddl1m2Z2ddl1m3Z3ddl4m5Z5ddl6m7Z7Gd d!„d!ej8ƒZ9Gd"d#„d#eƒZ:d$d$d$d%œd&d'„Z;d^d(d)d*œd+d,„Z<d_d$d(d(d-d.œd/d0„Z=dd1œd2d3„Z>d`d$d(d4dd5œd6d7„Z?dad8d9d:œd;d<„Z@d$d=d>d?œd@dA„ZAd$d=d>dBdCœdDdE„ZBd>d$dFœdGdH„ZCGdIdJ„dJeƒZDGdKdL„dLejEeDƒZFGdMdN„dNe%eDƒZGdbd$d=dOd9d=dPd9dQd4dJdRœ
dSdT„ZHd9d1œdUdV„ZIdcd$d=dOd9d9d9dXdXd=d$d9d=dPdYd9dQdZd[œd\d]„ZJdS)daØA WSGI and HTTP server for use **during development only**. This
server is convenient to use, but is not designed to be particularly
stable, secure, or efficient. Use a dedicate WSGI server and HTTP
server when deploying to production.
 
It provides features like interactive debugging and code reloading. Use
``run_simple`` to start the server. Put this in a ``run.py`` script:
 
.. code-block:: python
 
    from myapp import create_app
    from werkzeug import run_simple
é)Ú annotationsN)Údatetime)Ú    timedelta)Útimezone)ÚBaseHTTPRequestHandler)Ú
HTTPServer)Úunquote)Úurlsplité©Ú_log)Ú_wsgi_encoding_dance)ÚInternalServerError)Ú
uri_to_iric@seZdZdddœdd„ZdS)Ú    _SslDummyÚstrút.Any©ÚnameÚreturncCs tdƒ‚dS)NzUSSL is unavailable because this Python runtime was not compiled with SSL/TLS support.)Ú RuntimeError©Úselfr©rúGd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\werkzeug/serving.pyÚ __getattr__*sÿz_SslDummy.__getattr__N)Ú__name__Ú
__module__Ú __qualname__rrrrrr)srTÚntÚcoloramaFÚforkc@s eZdZdS)Ú ForkingMixInN)rrrrrrrr"@sr"é€zssl.SSLContextÚadhoc)ÚWSGIApplication)ÚWSGIEnvironment)ÚRSAPrivateKeyWithSerialization)Ú Certificatec@sLeZdZdZdddœdd„Zddœd    d
„Zd dœd d „Zdd dœdd„ZdS)ÚDechunkedInputz8An input stream that handles Transfer-Encoding 'chunked'z t.IO[bytes]ÚNone)ÚrfilercCs||_d|_d|_dS)NFr)Ú_rfileÚ_doneÚ_len)rr+rrrÚ__init__[szDechunkedInput.__init__Úbool©rcCsdS)NTr©rrrrÚreadable`szDechunkedInput.readableÚintc
Csdz"|j ¡ d¡}t| ¡dƒ}Wn,tk
rN}ztdƒ|‚W5d}~XYnX|dkr`tdƒ‚|S)NÚlatin1ézInvalid chunk headerrz!Negative chunk length not allowed)r,ÚreadlineÚdecoder4ÚstripÚ
ValueErrorÚOSError)rÚliner.ÚerrrÚread_chunk_lencszDechunkedInput.read_chunk_lenÚ    bytearray)ÚbufrcCsød}|jsô|t|ƒkrô|jdkr*| ¡|_|jdkr:d|_|jdkrÎtt|ƒ|jƒ}||t|ƒkr |j t|ƒ|¡||d…<|jt|ƒ|8_t|ƒ}n.|j |¡||||…<|j|8_||7}|jdkr|j ¡}|dkrtdƒ‚q|S)NrT)ó
ó
ó z!Missing chunk terminating newline)    r-Úlenr.r>Úminr,Úreadr7r;)rr@rFÚnÚ
terminatorrrrÚreadintoms(
 
 
 
 
 
 
 
zDechunkedInput.readintoN)rrrÚ__doc__r/r3r>rIrrrrr)Xs
 
r)cseZdZUdZded<eddœdd„ƒZddœd    d
„Zd dœd d „Zd dœ‡fdd„ Z    d3ddd dœdd„Z
dddœ‡fdd„ Z ddœdd„Z ddœdd„Z e dd „ed!ƒed"d#ƒ•Dƒ¡Zd$eed%ƒ<d4d'd'd d(œd)d*„Zddd d+œd,d-„Zddd d+œd.d/„Zdddd d0œd1d2„Z‡ZS)5ÚWSGIRequestHandlerz3A request handler that implements WSGI dispatching.ÚBaseWSGIServerÚserverrr1cCsddlm}d|›S)Nr
)Ú __version__z    Werkzeug/)ÚrN)rrNrrrÚserver_version›s z!WSGIRequestHandler.server_versionr&cCst|jƒ}|jjdkrdnd}|js,d|_nt|jtƒrD|jdf|_|jsd|jrdd|j›|j›}n|j}t    |ƒ}d||j
t j |jj |jjd|j|j|jdt|ƒt|jƒt|jƒt|jƒ| ¡| ¡|jjdt|jjd    ƒ|jd
œ}|j ¡D]h\}}d |krqð| ¡ d d ¡}| d d¡}|dkrPd|›}||krP||›d|›}|||<qð| dd¡ ¡ ¡dkrŒd|d<t|dƒ|d<|jr¦|jr¦|j|d<z*|jj dd}|dk    rÎt! "|¡|d<Wn8t#k
rô|j $dd¡Ynt%k
rYnX|S)NÚhttpÚhttps)ú<local>rrú/)r
rFrOr
)z wsgi.versionzwsgi.url_schemeú
wsgi.inputz wsgi.errorszwsgi.multithreadzwsgi.multiprocessz wsgi.run_oncezwerkzeug.socketÚSERVER_SOFTWAREÚREQUEST_METHODZ SCRIPT_NAMEZ    PATH_INFOÚ QUERY_STRINGZ REQUEST_URIZRAW_URIÚ REMOTE_ADDRZ REMOTE_PORTZ SERVER_NAMEZ SERVER_PORTZSERVER_PROTOCOLÚ_ú-z
)Ú CONTENT_TYPEÚCONTENT_LENGTHZHTTP_ú,ZHTTP_TRANSFER_ENCODINGÚchunkedTzwsgi.input_terminatedrUZ    HTTP_HOST)Ú binary_formZSSL_CLIENT_CERTÚerrorz&Cannot fetch SSL peer certificate info)&r    ÚpathrMÚ ssl_contextÚclient_addressÚ
isinstancerÚschemeÚnetlocrr+ÚsysÚstderrÚ multithreadÚ multiprocessÚ
connectionrPÚcommandr ÚqueryÚaddress_stringÚ port_integerÚserver_addressÚrequest_versionÚheadersÚitemsÚupperÚreplaceÚgetr9Úlowerr)Ú getpeercertÚsslÚDER_cert_to_PEM_certr:ÚlogÚAttributeError)rÚ request_urlÚ
url_schemeZ    path_infoÚenvironÚkeyÚvalueZ    peer_certrrrÚ make_environ¡sn
 
ê
 
 
 
 
 
 
zWSGIRequestHandler.make_environr*c sŠˆj dd¡ ¡ ¡dkr&ˆj d¡ˆ ¡ˆ_‰d‰d‰d‰d‰d‰dddœ‡‡‡‡‡‡‡fd    d
„ ‰d‡‡‡‡fd d „    ‰d ddœ‡‡‡‡‡‡fdd„ }z|ˆjj    ƒWnÚt
t j fk
rÞ}zˆ  |ˆ¡W5d}~XYn¨tk
r„}zˆˆjjrú‚ˆdk    rˆrdˆ_z ˆdkr$d‰d‰|tƒƒWntk
rFYnXddlm}||ƒ ¡}ˆj dd|›¡W5d}~XYnXdS)NZExpectrOz 100-continuesHTTP/1.1 100 Continue
 
FÚbytesr*)Údatarcs€ˆdk    stdƒ‚ˆdk    s tdƒ‚ˆdkrˆ‰ˆ‰zˆ dd¡\}}Wntk
rdˆd}}YnXt|ƒ}ˆ ||¡tƒ}ˆD]"\}}ˆ ||¡| | ¡¡q„d|ksôˆddksôd|krÐdksôn|d    ksôˆj    d
krôd ‰ˆ d d ¡ˆ dd¡ˆ 
¡t |t ƒstdƒ‚|rrˆrTˆj  tt|ƒƒdd… ¡¡ˆj  d¡ˆj  |¡ˆrrˆj  d¡ˆj  ¡dS)Nzwrite() before start_responser
rOzcontent-lengthrWÚHEADédéÈ>é0éÌúHTTP/1.1TzTransfer-Encodingr_Ú
ConnectionÚclosezapplications must write bytesérB)ÚAssertionErrorÚsplitr:r4Z send_responseÚsetZ send_headerÚaddrxÚprotocol_versionZ end_headersrer„ÚwfileÚwriteÚhexrDÚencodeÚflush)r…Zcode_strÚmsgÚcodeZ header_keysrr‚)Úchunk_responser€Ú headers_sentÚ headers_setrÚ status_sentÚ
status_setrrr•ýsR
 
þ
ýüüûù          z*WSGIRequestHandler.run_wsgi.<locals>.writecs@|r(zˆr|d |d¡‚W5d}Xn ˆr4tdƒ‚|‰|‰ˆS)Nr
rŽzHeaders already set)Úwith_tracebackr)ÚstatusrsÚexc_info)rœrrŸr•rrÚstart_response6sz3WSGIRequestHandler.run_wsgi.<locals>.start_responser%)Úapprc
sÂ|ˆˆƒ}z2|D] }ˆ|ƒqˆs*ˆd    ƒˆr:ˆj   d
¡W5t ¡}| ˆjtj¡d}d}|jddr¢ˆj d¡}|t|ƒ7}|d7}|r¢|dks¢|dkr^q¢q^|     ¡t
|dƒr¼|     ¡XdS) Nrg{®Gáz„?)Útimeouti€–˜r
ld(    ièrós0
 
) Ú    selectorsÚDefaultSelectorÚregisterrlÚ
EVENT_READÚselectr+rFrDrÚhasattrr”r•)r¤Zapplication_iterÚselectorZ
total_sizeZ total_readsr…)r›r€rœrr£r•rrÚexecuteDs*
 
 
z,WSGIRequestHandler.run_wsgi.<locals>.executeTr
)ÚDebugTracebackrazError on request:
)N)rsrwrxr9r”r•rƒr€rMr¤ÚConnectionErrorÚsocketr¥Úconnection_droppedÚ    ExceptionÚpassthrough_errorsZclose_connectionrZ debug.tbtoolsr¯Zrender_traceback_textr|)rr®r=r¯r™r)    r›r€rœrrr£ržrŸr•rÚrun_wsgiòs<  9'
  zWSGIRequestHandler.run_wsgic
sŠztƒ ¡Wnvttjfk
r@}z| |¡W5d}~XYnFtk
r„}z(|jjdk    rrt    |ƒrr| 
d|¡n‚W5d}~XYnXdS)z/Handles a request ignoring dropped connections.NzSSL error occurred: %s) ÚsuperÚhandler°r±r¥r²r³rMrcÚ is_ssl_errorÚ    log_error)rr=©Ú    __class__rrr·…szWSGIRequestHandler.handleNÚ BaseExceptionzWSGIEnvironment | None)rar€rcCsdS)z`Called if the connection was closed by the client.  By default
        nothing happens.
        Nr)rrar€rrrr²‘sz%WSGIRequestHandler.connection_droppedrrcs| d¡r|jSttƒ|ƒS)NZdo_)Ú
startswithrµÚgetattrr¶rrºrrr˜s
zWSGIRequestHandler.__getattr__cCs*t|ddƒr|jdS|js dS|jdS)Nr€rYrSr)r¾r€rdr2rrrro s
 
z!WSGIRequestHandler.address_stringr4cCs
|jdS)Nr
)rdr2rrrrp©szWSGIRequestHandler.port_integercCsi|]}|d|d›“qS)z\xZ02xr)Ú.0ÚcrrrÚ
<dictcomp>®szWSGIRequestHandler.<dictcomp>é éé z\\ú\r[z    int | str)ršÚsizercCsôz&t|jƒ}|j›d|›d|j›}Wntk
r@|j}YnX| |j¡}t|ƒ}|ddkrnt    |dƒ}np|dkrxnf|dkrŒt    |dƒ}nR|ddkr¤t    |d    ƒ}n:|d
kr¸t    |d ƒ}n&|dd krÒt    |dd ƒ}n t    |ddƒ}| 
dd|||¡dS)Nú rÚ1ÚboldZ200Z304ÚcyanÚ3ÚgreenZ404ÚyellowÚ4ÚredÚmagentaÚinfoz
"%s" %s %s) rrbrmrrr}Z requestlineÚ    translateÚ_control_char_tablerÚ _ansi_styler|)rršrÆrbr™rrrÚ log_request²s*
          zWSGIRequestHandler.log_request)ÚformatÚargsrcGs|jd|f|žŽdS)Nra©r|©rrÖr×rrrr¹ÏszWSGIRequestHandler.log_errorcGs|jd|f|žŽdS)NrÑrØrÙrrrÚ log_messageÒszWSGIRequestHandler.log_message©ÚtypeÚmessager×rcGs.t|| ¡›d| ¡›d|›df|žŽdS)Nz - - [z] Ú
)r roZlog_date_time_string©rrÜrÝr×rrrr|Õs þýzWSGIRequestHandler.log)N)r[r[)rrrrJÚ__annotations__ÚpropertyrPrƒrµr·r²rrorprÚ    maketransÚrangerÓÚordrÕr¹rÚr|Ú __classcell__rrrºrrK–s*
Q ÿ    ÿ rKr)r‚ÚstylesrcGsBts|Sdddddddœ}|D]}d||›d    |›}q|›d
S) Nr
érÂé!é#é$)rÉrÏrÌrÍrÐrÊz[Úmz)Ú_log_add_style)r‚ræÚcodesÚstylerrrrÔÝsú    rÔz
str | Nonez2tuple[Certificate, RSAPrivateKeyWithSerialization])Úcnrc
Cs:z@ddlm}ddlm}ddlm}ddlm}ddlm    }Wnt
k
r^t dƒd‚YnX|ƒ}|j dd    |d
}|dkr‚d }|  | |jd ¡| |j|¡g¡}|ƒ}| ¡ |¡ |¡ | ¡¡ | ¡¡ t tj¡¡ t tj¡td d¡j| |j g¡ddj| !| "|¡g¡dd #|| $¡|¡}    |    |fS)Nr)Úx509)ÚNameOID)Údefault_backend)Úhashes)Úrsaz<Using ad-hoc certificates requires the cryptography library.ii)Zpublic_exponentZkey_sizeÚbackendÚ*zDummy Certificateim)ÚdaysF)Úcritical)%Z cryptographyrðZcryptography.x509.oidrñZcryptography.hazmat.backendsròÚcryptography.hazmat.primitivesróZ)cryptography.hazmat.primitives.asymmetricrôÚ ImportErrorÚ    TypeErrorZgenerate_private_keyÚNameZ NameAttributeZORGANIZATION_NAMEZ COMMON_NAMEZCertificateBuilderZ subject_nameZ issuer_nameZ
public_keyZ serial_numberZrandom_serial_numberZnot_valid_beforeÚdtÚnowrÚutcZnot_valid_afterrÚ add_extensionZExtendedKeyUsageZOID_SERVER_AUTHZSubjectAlternativeNameZDNSNameÚsignÚSHA256)
rïrðrñròrórôrõÚpkeyÚsubjectÚcertrrrÚgenerate_adhoc_ssl_pairðsf    ÿþÿ  þÿÿþýü
ûú ùø    ÷ÿ rztuple[str, str])Ú    base_pathÚhostrïrc        Cs°|dk    rd|›d|›}t|d\}}ddlm}|›d}|›d}t|d    ƒ}| | |jj¡¡W5QRXt|d    ƒ(}| |j|jj|j    j
|  ¡d
¡W5QRX||fS) aÂCreates an SSL key for development.  This should be used instead of
    the ``'adhoc'`` key which generates a new cert on each server start.
    It accepts a path for where it should store the key and cert and
    either a host or CN.  If a host is given it will use the CN
    ``*.host/CN=host``.
 
    For more information see :func:`run_simple`.
 
    .. versionadded:: 0.9
 
    :param base_path: the path to the certificate and key.  The extension
                      ``.crt`` is added for the certificate, ``.key`` is
                      added for the key.
    :param host: the name of the host.  This can be used as an alternative
                 for the `cn`.
    :param cn: the `CN` to use.
    Nz*.z/CN=)rïr©Ú serializationz.crtz.keyÚwb©ÚencodingrÖZencryption_algorithm) rrùr
Úopenr•Ú public_bytesÚEncodingÚPEMÚ private_bytesÚ PrivateFormatÚTraditionalOpenSSLÚ NoEncryption)    rrrïrrr
Ú    cert_fileÚ    pkey_fileÚfrrrÚmake_ssl_devcerts" 
 
  ýÿrr1c
Cs¶ddl}ddl}tƒ\}}ddlm}| ¡\}}| ¡\}}| tj|¡| tj|¡t     || 
|j j ¡¡t     ||j |j j |jj| ¡d¡t |¡t |¡t||ƒ}    |    S)z:Generates an adhoc SSL context for the development server.rNr    r )ÚtempfileÚatexitrrùr
Úmkstempr©ÚosÚremover•rrrrrrrrÚload_ssl_context)
rrrrr
Z cert_handlerZ pkey_handlerÚctxrrrÚgenerate_adhoc_ssl_contextJs*
   ýþ    
 
 
r!ú
int | None)rrÚprotocolrcCs(|dkrtj}t |¡}| ||¡|S)aãLoads SSL context from cert/private key files and optional protocol.
    Many parameters are directly taken from the API of
    :py:class:`ssl.SSLContext`.
 
    :param cert_file: Path of the certificate to use.
    :param pkey_file: Path of the private key to use. If not given, the key
                      will be obtained from the certificate file.
    :param protocol: A ``PROTOCOL`` constant from the :mod:`ssl` module.
        Defaults to :data:`ssl.PROTOCOL_TLS_SERVER`.
    N)rzÚPROTOCOL_TLS_SERVERÚ
SSLContextÚload_cert_chain)rrr#r rrrrhs
 
 rzException | Noner0)rarcCs(|dkrt tt ¡d¡}t|tjƒS)z?Checks if the given error (or the current one) is an SSL error.Nr
)ÚtÚcastr³rhr¢rerzÚSSLError)rarrrr¸}sr¸r4zsocket.AddressFamily)rÚportrcCs.| d¡rtjSd|kr(ttdƒr(tjStjS)zUReturn ``AF_INET4``, ``AF_INET6``, or ``AF_UNIX`` depending on
    the host and port.zunix://ú:ÚAF_INET6)r½r±ÚAF_UNIXr¬r,ÚAF_INET)rr*rrrÚselect_address_family„s
 
r/útuple[str, int] | str)rr*ÚfamilyrcCsd|tkrtj | d¡d¡Szt |||tjtj¡}Wntj    k
rV||fYSX|ddS)zVReturn a fully qualified socket address that can be passed to
    :func:`socket.bind`.ú://rŽré)
Úaf_unixrrbÚabspathÚ    partitionr±Ú getaddrinfoÚ SOCK_STREAMÚ IPPROTO_TCPÚgaierror)rr*r1ÚresrrrÚ get_sockaddrŽsÿr<)r1rc
CsŠ|tjkrdnd}t |tj¡`}z| |df¡Wn2tk
rf|tjkrRdndYW5QR£SX| ¡dW5QR£SQRXdS)zˆGet the IP address of an external interface. Used when binding to
    0.0.0.0 or ::1 to show a more useful URL.
 
    :meta private:
    zfd31:f903:5ab5:1::1z10.253.155.219i2ãz::1ú    127.0.0.1rN)r±r,Ú
SOCK_DGRAMÚconnectr;Ú getsockname)r1rÚsrrrÚget_interface_ipŸs$rBc
s”eZdZdZdZdZeZdZd ddddd    d
d d d œ‡fdd„ Z    dddd dœdd„Z
d!dd dœ‡fdd„ Z ddd dœ‡fdd„ Z d dœdd„Z ‡ZS)"rLzuA WSGI server that that handles one request at a time.
 
    Use :func:`make_server` to create a server instance.
    FTNrr4r%útype[WSGIRequestHandler] | Noner0ú_TSSLContextArg | Noner"r*)rr*r¤Úhandlerr´rcÚfdrc
s|dkr t}dt|ƒkr*|js$|jr*d|_||_||_||_||_t    ||ƒ|_
}t |t |ƒ|ƒ}    |t kr”|dkr”t t|    ¡}    tj |    ¡r”t |    ¡tƒj|    |dd|dkrtz| ¡| ¡Wn¬tk
rR}
zn| ¡t|
jtjd|
jtj kr8td|›dtjdtj!dkr8|d    kr8td
tjdt "d ¡W5d}
~
XYn t#k
rp| ¡‚YnXn&| ¡t$ %||t$j&¡|_$|j$ '¡|_(|t kr°|j(d |_|dk    rút)|t*ƒrÐt+|Ž}n|d kràt,ƒ}|j-|j$d d|_$||_.nd|_.dS)Nr“r‹F)Úbind_and_activate)ÚfilezPort zp is in use by another program. Either identify and stop that program, or start the server with a different port.ÚdarwiniˆzZOn macOS, try disabling the 'AirPlay Receiver' service from System Preferences -> Sharing.r
r$T)Ú server_side)/rKÚvarsrjrkr“rr*r¤r´r/Úaddress_familyr<r4r4r'r(rrrbÚexistsÚunlinkr¶r/Ú server_bindÚserver_activater;Ú server_closeÚprintÚstrerrorrhriÚerrnoZ
EADDRINUSEÚplatformÚexitr¼r±Úfromfdr8r@rqreÚtuplerr!Ú wrap_socketrc) rrr*r¤rEr´rcrFrLrqr=rºrrr/¼sr
 ÿÿ  
ý
 
üý
 
 
 
 
zBaseWSGIServer.__init__rrÛcGst||f|žŽdS©Nr rßrrrr|szBaseWSGIServer.logçà?Úfloat)Ú poll_intervalrcs<z,ztƒj|dWntk
r(YnXW5| ¡XdS)N)r])rQr¶Ú serve_foreverÚKeyboardInterrupt)rr]rºrrr^"s
 
zBaseWSGIServer.serve_foreverr0)Úrequestrdrcs|jr‚tƒ ||¡SrZ)r´r¶Ú handle_error)rr`rdrºrrra*szBaseWSGIServer.handle_errorr1cCsöd}t|ddƒ}|g}|jtkr4| d|j›¡n®|jdkrBdnd}|j}|jdkr°| d    |j›d
¡|jd kr„d }ttjƒ}nd }ttj    ƒ}| d|›d|›d|j
›¡d|krÄd|›d}| d|›d|›d|j
›¡t dd  |¡ƒdS)z<Show information about the address when starting the server.zvWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.rÉrÏz * Running on NrQrR>ú::ú0.0.0.0z * Running on all addresses (ú)rcr=z[::1]r2r+ú[ú]rÑrÞ) rÔrLr4ÚappendrrcrBr±r.r,r*r Újoin)rZ dev_warningÚmessagesrfZdisplay_hostnameÚ    localhostrrrÚ log_startup2s(ÿ 
 
 
 
 zBaseWSGIServer.log_startup)NFNN)r[)rrrrJrjrkÚ LISTEN_QUEUEÚrequest_queue_sizeÚallow_reuse_addressr/r|r^rarkrårrrºrrL±sø"crLc@seZdZdZdZdZdS)ÚThreadedWSGIServerz†A WSGI server that handles concurrent requests in separate
    threads.
 
    Use :func:`make_server` to create a server instance.
    TN)rrrrJrjÚdaemon_threadsrrrrroUsroc s<eZdZdZdZdddddd    d
d d d dœ    ‡fdd„ Z‡ZS)ÚForkingWSGIServerzA WSGI server that handles concurrent requests in separate forked
    processes.
 
    Use :func:`make_server` to create a server instance.
    Té(NFrr4r%rCr0rDr"r*)    rr*r¤Ú    processesrEr´rcrFrc            s.ts tdƒ‚tƒ |||||||¡||_dS)Nz'Your platform does not support forking.)Úcan_forkr:r¶r/Z max_children)    rrr*r¤rsrEr´rcrFrºrrr/is zForkingWSGIServer.__init__)rrNFNN)rrrrJrkr/rårrrºrrq`s÷rqr%rCrD)
rr*r¤ÚthreadedrsÚrequest_handlerr´rcrFrc        
Csd|r|dkrtdƒ‚|r.t|||||||dS|dkrNt||||||||dSt|||||||dS)a6Create an appropriate WSGI server instance based on the value of
    ``threaded`` and ``processes``.
 
    This is called from :func:`run_simple`, but can be used separately
    to have access to the server object, such as to run it in a separate
    thread.
 
    See :func:`run_simple` for parameter docs.
    r
z4Cannot have a multi-thread and multi-process server.©rF)r:rorqrL)    rr*r¤rursrvr´rcrFrrrÚ make_server{s@ ÿø ÿrxcCstj d¡dkS)zqCheck if the server is running as a subprocess within the
    Werkzeug reloader.
 
    .. versionadded:: 0.10
    ZWERKZEUG_RUN_MAINÚtrue)rr€rwrrrrÚis_running_from_reloader¨srzÚautozt.Iterable[str] | Nonez'dict[str, str | tuple[str, str]] | Noner*)Úhostnamer*Ú applicationÚ use_reloaderÚ use_debuggerÚ
use_evalexÚ extra_filesÚexclude_patternsÚreloader_intervalÚ reloader_typerursrvÚ static_filesr´rcrc Csút|tƒstdƒ‚| r,ddlm}||| ƒ}|rHddlm}|||d}tƒsTd}nttj    dƒ}t
||||
| | |||d    }|j   d    ¡t | ¡ƒtj    d<tƒs¸| ¡td
td d ƒƒ|rîdd lm}z||j||||    dW5| ¡Xn| ¡dS)aStart a development server for a WSGI application. Various
    optional features can be enabled.
 
    .. warning::
 
        Do not use the development server when deploying to production.
        It is intended for use only during local development. It is not
        designed to be particularly efficient, stable, or secure.
 
    :param hostname: The host to bind to, for example ``'localhost'``.
        Can be a domain, IPv4 or IPv6 address, or file path starting
        with ``unix://`` for a Unix socket.
    :param port: The port to bind to, for example ``8080``. Using ``0``
        tells the OS to pick a random free port.
    :param application: The WSGI application to run.
    :param use_reloader: Use a reloader process to restart the server
        process when files are changed.
    :param use_debugger: Use Werkzeug's debugger, which will show
        formatted tracebacks on unhandled exceptions.
    :param use_evalex: Make the debugger interactive. A Python terminal
        can be opened for any frame in the traceback. Some protection is
        provided by requiring a PIN, but this should never be enabled
        on a publicly visible server.
    :param extra_files: The reloader will watch these files for changes
        in addition to Python modules. For example, watch a
        configuration file.
    :param exclude_patterns: The reloader will ignore changes to any
        files matching these :mod:`fnmatch` patterns. For example,
        ignore cache files.
    :param reloader_interval: How often the reloader tries to check for
        changes.
    :param reloader_type: The reloader to use. The ``'stat'`` reloader
        is built in, but may require significant CPU to watch files. The
        ``'watchdog'`` reloader is much more efficient but requires
        installing the ``watchdog`` package first.
    :param threaded: Handle concurrent requests using threads. Cannot be
        used with ``processes``.
    :param processes: Handle concurrent requests using up to this number
        of processes. Cannot be used with ``threaded``.
    :param request_handler: Use a different
        :class:`~BaseHTTPServer.BaseHTTPRequestHandler` subclass to
        handle requests.
    :param static_files: A dict mapping URL prefixes to directories to
        serve static files from using
        :class:`~werkzeug.middleware.SharedDataMiddleware`.
    :param passthrough_errors: Don't catch unhandled exceptions at the
        server level, let the server crash instead. If ``use_debugger``
        is enabled, the debugger will still catch such errors.
    :param ssl_context: Configure TLS to serve over HTTPS. Can be an
        :class:`ssl.SSLContext` object, a ``(cert_file, key_file)``
        tuple to create a typical context, or the string ``'adhoc'`` to
        generate a temporary self-signed certificate.
 
    .. versionchanged:: 2.1
        Instructions are shown for dealing with an "address already in
        use" error.
 
    .. versionchanged:: 2.1
        Running on ``0.0.0.0`` or ``::`` shows the loopback IP in
        addition to a real IP.
 
    .. versionchanged:: 2.1
        The command-line interface was removed.
 
    .. versionchanged:: 2.0
        Running on ``0.0.0.0`` or ``::`` shows a real IP address that
        was bound as well as a warning not to run the development server
        in production.
 
    .. versionchanged:: 2.0
        The ``exclude_patterns`` parameter was added.
 
    .. versionchanged:: 0.15
        Bind to a Unix socket by passing a ``hostname`` that starts with
        ``unix://``.
 
    .. versionchanged:: 0.10
        Improved the reloader and added support for changing the backend
        through the ``reloader_type`` parameter.
 
    .. versionchanged:: 0.9
        A command-line interface was added.
 
    .. versionchanged:: 0.8
        ``ssl_context`` can be a tuple of paths to the certificate and
        private key files.
 
    .. versionchanged:: 0.6
        The ``ssl_context`` parameter was added.
 
    .. versionchanged:: 0.5
       The ``static_files`` and ``passthrough_errors`` parameters were
       added.
    zport must be an integerr
)ÚSharedDataMiddleware)ÚDebuggedApplication)ZevalexNZWERKZEUG_SERVER_FDrwTrÑzPress CTRL+C to quitrÍ)Úrun_with_reloader)rr‚Úintervalr„)rer4rûZmiddleware.shared_datar†Údebugr‡rzrr€rxr±Úset_inheritablerÚfilenorkr rÔZ    _reloaderrˆrQr^)r|r*r}r~rr€rr‚rƒr„rursrvr…r´rcr†r‡rFZsrvrˆrrrÚ
run_simple±sNp
 
  ÷  û
 r)N)NN)NN)N)Fr
NFNN) FFTNNr
r{Fr
NNFN)KrJÚ
__future__rrTÚiorr§r±Ú socketserverrhÚtypingr'rrýrrZ http.serverrrÚ urllib.parserr    Ú    _internalr r Ú
exceptionsrÚurlsrrzrúrrìrÚ
__import__r¬rtr"r-r4r}rlÚOptionalÚUnionÚTuplerÚLiteralZ_TSSLContextArgÚ TYPE_CHECKINGZ_typeshed.wsgir%r&Z-cryptography.hazmat.primitives.asymmetric.rsar'Zcryptography.x509r(Ú    RawIOBaser)rKrÔrrr!rr¸r/r<rBrLÚThreadingMixInrorqrxrzrrrrrÚ<module>s¸                
 
 
 
$ÿ    >Iÿ/ÿ,ÿ
% ÷"- ð