diff options
| author | 2024-02-20 13:29:04 +0100 | |
|---|---|---|
| committer | 2024-02-20 13:29:04 +0100 | |
| commit | f183536067dc694f37445148c15821f1621f5034 (patch) | |
| tree | 5cdd6f6a2863c620272ffcebf6dcf583bc96c104 | |
| parent | 503b2959fcbd6af46022cf7e483fc2578c59fe4d (diff) | |
| download | client-f183536067dc694f37445148c15821f1621f5034.tar.gz client-f183536067dc694f37445148c15821f1621f5034.tar.bz2 client-f183536067dc694f37445148c15821f1621f5034.zip | |
Fixed content lengthv2.0.2
| -rw-r--r-- | ttun/client.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ttun/client.py b/ttun/client.py index 097ebc5..a75c882 100644 --- a/ttun/client.py +++ b/ttun/client.py | |||
| @@ -1,12 +1,9 @@ | |||
| 1 | import asyncio | 1 | import asyncio |
| 2 | import json | 2 | import json |
| 3 | import logging | ||
| 4 | from asyncio import create_task | ||
| 5 | from asyncio import get_running_loop | 3 | from asyncio import get_running_loop |
| 6 | from base64 import b64decode | 4 | from base64 import b64decode |
| 7 | from base64 import b64encode | 5 | from base64 import b64encode |
| 8 | from datetime import datetime | 6 | from datetime import datetime |
| 9 | from pprint import pformat | ||
| 10 | from time import perf_counter | 7 | from time import perf_counter |
| 11 | from typing import Awaitable | 8 | from typing import Awaitable |
| 12 | from typing import Callable | 9 | from typing import Callable |
| @@ -120,7 +117,7 @@ class Client: | |||
| 120 | ) | 117 | ) |
| 121 | ) | 118 | ) |
| 122 | 119 | ||
| 123 | loop.create_task( | 120 | await loop.create_task( |
| 124 | self.proxy_request( | 121 | self.proxy_request( |
| 125 | session=session, | 122 | session=session, |
| 126 | request=request, | 123 | request=request, |
| @@ -168,7 +165,8 @@ class Client: | |||
| 168 | headers=[ | 165 | headers=[ |
| 169 | (key, value) | 166 | (key, value) |
| 170 | for key, value in response.headers.items() | 167 | for key, value in response.headers.items() |
| 171 | if key.lower() not in ["transfer-encoding", "content-encoding"] | 168 | if key.lower() |
| 169 | not in ["transfer-encoding", "content-encoding", "content-length"] | ||
| 172 | ], | 170 | ], |
| 173 | body=b64encode(await response.read()).decode(), | 171 | body=b64encode(await response.read()).decode(), |
| 174 | ) | 172 | ) |
