Compare commits
2 Commits
f77e826490
...
ab6879d54f
| Author | SHA1 | Date | |
|---|---|---|---|
| ab6879d54f | |||
| 8c93b9a015 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "stapler"
|
name = "stapler"
|
||||||
version = "1.2.5"
|
version = "1.2.6"
|
||||||
description = "Static pages as simple as a gzip file"
|
description = "Static pages as simple as a gzip file"
|
||||||
requires-python = ">=3.14"
|
requires-python = ">=3.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -300,6 +300,8 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler, BaseHandler):
|
|||||||
self.__target_spa: str | None = None
|
self.__target_spa: str | None = None
|
||||||
try:
|
try:
|
||||||
super().__init__(*args, directory=params.data_dir, **kwargs, params=params) # ty:ignore[unknown-argument]
|
super().__init__(*args, directory=params.data_dir, **kwargs, params=params) # ty:ignore[unknown-argument]
|
||||||
|
except (BrokenPipeError, ConnectionResetError) as e:
|
||||||
|
self.logger.error("Connection lost: %s", str(e)) # noqa: TRY400
|
||||||
except:
|
except:
|
||||||
self.logger.exception("Could not handle request")
|
self.logger.exception("Could not handle request")
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,21 @@ class TestRequestHandler(BaseHandlerTestCase):
|
|||||||
token_manager=self.token_manager,
|
token_manager=self.token_manager,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_handle_disconnect_silently(self) -> None:
|
||||||
|
with self.patch("http.server.BaseHTTPRequestHandler.__init__") as mock:
|
||||||
|
mock.side_effect = BrokenPipeError
|
||||||
|
logging.basicConfig(level=logging.CRITICAL)
|
||||||
|
RequestHandler(
|
||||||
|
unittest.mock.MagicMock(),
|
||||||
|
"127.0.0.1",
|
||||||
|
unittest.mock.MagicMock(),
|
||||||
|
params=Parameters(
|
||||||
|
data_dir=self.get_tmp_dir(), certbot_www=str(self.certbot_www)
|
||||||
|
),
|
||||||
|
registry=self.registry,
|
||||||
|
token_manager=self.token_manager,
|
||||||
|
)
|
||||||
|
|
||||||
def test_do_head_forward(self) -> None:
|
def test_do_head_forward(self) -> None:
|
||||||
handler = self._get_handler()
|
handler = self._get_handler()
|
||||||
with (
|
with (
|
||||||
|
|||||||
Reference in New Issue
Block a user