adafruit-circuitpython-httpserver 4.8.3__py3-none-any.whl → 4.8.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {adafruit_circuitpython_httpserver-4.8.3.dist-info → adafruit_circuitpython_httpserver-4.8.4.dist-info}/METADATA +1 -1
- {adafruit_circuitpython_httpserver-4.8.3.dist-info → adafruit_circuitpython_httpserver-4.8.4.dist-info}/RECORD +7 -7
- adafruit_httpserver/__init__.py +1 -1
- adafruit_httpserver/server.py +23 -6
- {adafruit_circuitpython_httpserver-4.8.3.dist-info → adafruit_circuitpython_httpserver-4.8.4.dist-info}/WHEEL +0 -0
- {adafruit_circuitpython_httpserver-4.8.3.dist-info → adafruit_circuitpython_httpserver-4.8.4.dist-info}/licenses/LICENSE +0 -0
- {adafruit_circuitpython_httpserver-4.8.3.dist-info → adafruit_circuitpython_httpserver-4.8.4.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
adafruit_circuitpython_httpserver-4.8.
|
|
2
|
-
adafruit_httpserver/__init__.py,sha256=
|
|
1
|
+
adafruit_circuitpython_httpserver-4.8.4.dist-info/licenses/LICENSE,sha256=gyhZwtwoqSsDGoSrV4MrLpKKWyG_jE3eROTZp1EjIUM,1102
|
|
2
|
+
adafruit_httpserver/__init__.py,sha256=aX4gnVzJrgC_Mwy94nr_AticnqA94EUOcNg_0-voGWA,1994
|
|
3
3
|
adafruit_httpserver/authentication.py,sha256=zBBFsAv3Qfl8meUjlS1jPQoSxhHWKNAPwbiS8MRagsg,2026
|
|
4
4
|
adafruit_httpserver/exceptions.py,sha256=790rlZj4ij29hG6lSMAfWMHvDRtKetAUxuulGj6JQrg,1948
|
|
5
5
|
adafruit_httpserver/headers.py,sha256=8PnkazQmun6ARU9CQFdw6FVgSuqcZN9VMvU50F4hOec,4510
|
|
@@ -9,9 +9,9 @@ adafruit_httpserver/mime_types.py,sha256=rGNoC9kop2O3hAzMAppb3Qt6qH6VsF8l9NzsZ8J
|
|
|
9
9
|
adafruit_httpserver/request.py,sha256=uG4jfgruoknz41SYndV7wnDAXvTHAHoIk_z3IgLu80A,14823
|
|
10
10
|
adafruit_httpserver/response.py,sha256=Sx8rtjtK1bcpNVWSQ5UazRGLLGUf7GN-V4tdyHAXO3I,34979
|
|
11
11
|
adafruit_httpserver/route.py,sha256=C-2i1T_ykr2KAuDuREJ6P_1G5Llh3d-g0r_a1ETDMJc,6125
|
|
12
|
-
adafruit_httpserver/server.py,sha256=
|
|
12
|
+
adafruit_httpserver/server.py,sha256=_l3d_14b5XCvxNuOINMjUIZdIU6hazjOfDq1PWWpmhI,23382
|
|
13
13
|
adafruit_httpserver/status.py,sha256=YyMleWebUadx4dwJDldYoo9aLEPDd6NVdvB2w4uY7sk,1825
|
|
14
|
-
adafruit_circuitpython_httpserver-4.8.
|
|
15
|
-
adafruit_circuitpython_httpserver-4.8.
|
|
16
|
-
adafruit_circuitpython_httpserver-4.8.
|
|
17
|
-
adafruit_circuitpython_httpserver-4.8.
|
|
14
|
+
adafruit_circuitpython_httpserver-4.8.4.dist-info/METADATA,sha256=0neoUZOmwCueQHSUDd089oGc82fUmE_tMjNdTyDqK7c,4838
|
|
15
|
+
adafruit_circuitpython_httpserver-4.8.4.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
16
|
+
adafruit_circuitpython_httpserver-4.8.4.dist-info/top_level.txt,sha256=N8L9ONfZQ9bILxcOPVWXOjUDA-BNLPKFir7KqAbMQbA,20
|
|
17
|
+
adafruit_circuitpython_httpserver-4.8.4.dist-info/RECORD,,
|
adafruit_httpserver/__init__.py
CHANGED
adafruit_httpserver/server.py
CHANGED
|
@@ -56,13 +56,23 @@ MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE = -30592
|
|
|
56
56
|
# Errors after which poll() closes the connection and returns NO_REQUEST.
|
|
57
57
|
#
|
|
58
58
|
# Built once here so poll() does not allocate a new tuple on every error.
|
|
59
|
-
|
|
60
|
-
EAGAIN, # No data available right now
|
|
61
|
-
ECONNRESET, # Connection reset by peer
|
|
62
|
-
MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE, #
|
|
59
|
+
_IGNORED_ERRNOS = (
|
|
60
|
+
EAGAIN, # No data available right now.
|
|
61
|
+
ECONNRESET, # Connection reset by peer.
|
|
62
|
+
MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE, # The client sent a fatal TLS alert.
|
|
63
63
|
)
|
|
64
64
|
|
|
65
65
|
|
|
66
|
+
def _is_tls_error(error: OSError) -> bool:
|
|
67
|
+
"""True if the error came from the TLS layer, such as a failed handshake."""
|
|
68
|
+
# CircuitPython's ssl module has no SSLError. It raises OSError with a negative
|
|
69
|
+
# mbedTLS error code, and other OSErrors have positive errnos.
|
|
70
|
+
# CPython raises ssl.SSLError, whose errno is positive.
|
|
71
|
+
if implementation.name == "circuitpython":
|
|
72
|
+
return isinstance(error.errno, int) and error.errno < 0
|
|
73
|
+
return isinstance(error, SSLError)
|
|
74
|
+
|
|
75
|
+
|
|
66
76
|
class Server:
|
|
67
77
|
"""A basic socket-based HTTP server."""
|
|
68
78
|
|
|
@@ -491,7 +501,14 @@ class Server:
|
|
|
491
501
|
if self.debug:
|
|
492
502
|
_debug_start_time = monotonic()
|
|
493
503
|
|
|
494
|
-
|
|
504
|
+
try:
|
|
505
|
+
conn, client_address = self._sock.accept()
|
|
506
|
+
except OSError as error:
|
|
507
|
+
# On an HTTPS server, accept() also does the TLS handshake.
|
|
508
|
+
# If it fails, drop this client and keep serving others.
|
|
509
|
+
if self.https and _is_tls_error(error):
|
|
510
|
+
return NO_REQUEST
|
|
511
|
+
raise
|
|
495
512
|
conn.settimeout(self._timeout)
|
|
496
513
|
|
|
497
514
|
# Receive the whole request
|
|
@@ -521,7 +538,7 @@ class Server:
|
|
|
521
538
|
return REQUEST_HANDLED_RESPONSE_SENT
|
|
522
539
|
|
|
523
540
|
except Exception as error:
|
|
524
|
-
if (isinstance(error, OSError) and error.errno in
|
|
541
|
+
if (isinstance(error, OSError) and error.errno in _IGNORED_ERRNOS) or (
|
|
525
542
|
# CPython-specific: ignore unknown SSL certificate errors.
|
|
526
543
|
implementation.name != "circuitpython"
|
|
527
544
|
and isinstance(error, SSLError)
|
|
File without changes
|
|
File without changes
|