From e8dd82a6ba8b21c495c93563cbf6fbf8367a817e Mon Sep 17 00:00:00 2001 From: Kumi Date: Sun, 14 Jan 2024 22:06:32 +0100 Subject: [PATCH] Enhanced HTTP connection handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactored the HTTP wrapper classes to introduce `HTÜPVerbindung`, a new class that supports configurable timeout, source address, and block size for HTTP connections, enhancing flexibility and control for HTTP requests in the Deuthon project. The `HTÜPAntwort` class now focuses solely on reading the response. --- src/deuthon/wrappers/htüp/kundin.deu | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/deuthon/wrappers/htüp/kundin.deu b/src/deuthon/wrappers/htüp/kundin.deu index 1979125..4424e95 100644 --- a/src/deuthon/wrappers/htüp/kundin.deu +++ b/src/deuthon/wrappers/htüp/kundin.deu @@ -1,9 +1,28 @@ importiere http.client -klasse HTÜPAntwort(http.client.HTTPResponse): - definiere __init__(selbst, *argumente, **swargumente): - super().__init__(*argumente, **swargumente) +klasse HTÜPVerbindung(http.client.HTTPConnection): + definiere __init__(selbst, gastgeber, anschluss, + auszeit=Nichts, quelladdresse=Nicht, + blockgröße=Nichts): + swargumente = { + "host": gastgeber, + "port": anschluss, + } + + falls auszeit: + swargumente["timeout"] = auszeit + + falls quelladresse: + swargumente["source_address"] = quelladresse + + falls blockgröße: + swargumente["blocksize"] = blockgröße + + super().__init__(selbst, **swargumente) + + +klasse HTÜPAntwort(http.client.HTTPResponse): definiere lesen(selbst, *argumente, **swargumente): return super().read(*argumente, **swargumente)