MCPcopy Index your code
hub / github.com/RustPython/RustPython / run

Method run

Lib/test/test_ssl.py:2373–2470  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2371 self.sock.close()
2372
2373 def run(self):
2374 self.running = True
2375 if not self.server.starttls_server:
2376 if not self.wrap_conn():
2377 return
2378 while self.running:
2379 try:
2380 msg = self.read()
2381 stripped = msg.strip()
2382 if not stripped:
2383 # eof, so quit this handler
2384 self.running = False
2385 try:
2386 self.sock = self.sslconn.unwrap()
2387 except OSError:
2388 # Many tests shut the TCP connection down
2389 # without an SSL shutdown. This causes
2390 # unwrap() to raise OSError with errno=0!
2391 pass
2392 else:
2393 self.sslconn = None
2394 self.close()
2395 elif stripped == b'over':
2396 if support.verbose and self.server.connectionchatty:
2397 sys.stdout.write(" server: client closed connection\n")
2398 self.close()
2399 return
2400 elif (self.server.starttls_server and
2401 stripped == b'STARTTLS'):
2402 if support.verbose and self.server.connectionchatty:
2403 sys.stdout.write(" server: read STARTTLS from client, sending OK...\n")
2404 self.write(b"OK\n")
2405 if not self.wrap_conn():
2406 return
2407 elif (self.server.starttls_server and self.sslconn
2408 and stripped == b'ENDTLS'):
2409 if support.verbose and self.server.connectionchatty:
2410 sys.stdout.write(" server: read ENDTLS from client, sending OK...\n")
2411 self.write(b"OK\n")
2412 self.sock = self.sslconn.unwrap()
2413 self.sslconn = None
2414 if support.verbose and self.server.connectionchatty:
2415 sys.stdout.write(" server: connection is now unencrypted...\n")
2416 elif stripped == b'CB tls-unique':
2417 if support.verbose and self.server.connectionchatty:
2418 sys.stdout.write(" server: read CB tls-unique from client, sending our CB data...\n")
2419 data = self.sslconn.get_channel_binding("tls-unique")
2420 self.write(repr(data).encode("us-ascii") + b"\n")
2421 elif stripped == b'PHA':
2422 if support.verbose and self.server.connectionchatty:
2423 sys.stdout.write(" server: initiating post handshake auth\n")
2424 try:
2425 self.sslconn.verify_client_post_handshake()
2426 except ssl.SSLError as e:
2427 self.write(repr(e).encode("us-ascii") + b"\n")
2428 else:
2429 self.write(b"OK\n")
2430 elif stripped == b'HASCERT':

Callers

nothing calls this directly

Calls 15

wrap_connMethod · 0.95
readMethod · 0.95
closeMethod · 0.95
writeMethod · 0.95
reprFunction · 0.85
lenFunction · 0.85
isinstanceFunction · 0.85
handle_errorFunction · 0.85
to_bytesMethod · 0.80
printFunction · 0.50
stripMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected