Skip to content

Commit 5c6604a

Browse files
committed
fix: Adjust response headers by removing Content-Encoding and updating Content-Length
1 parent 696a78c commit 5c6604a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

cf_bypasser/core/mirror.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,17 @@ async def mirror_request(
182182
await asyncio.sleep(.5)
183183
continue
184184

185+
# remove the Content-Encoding and Content-Length headers
186+
final_headers = {}
187+
for k, v in response_headers.items():
188+
k_lower = k.lower()
189+
if k_lower == "content-encoding":
190+
final_headers[k] = "identity"
191+
elif k_lower == "content-length":
192+
final_headers[k] = str(len(response.content))
193+
185194
logging.info(f"Request to {hostname} completed with status {status_code}")
186-
return status_code, response_headers, response_content
195+
return status_code, final_headers, response_content
187196

188197
except Exception as e:
189198
if attempt < max_retries:

0 commit comments

Comments
 (0)