mirror of
https://github.com/NoCLin/LightMirrors
synced 2025-08-04 17:22:51 +08:00
Compare commits
No commits in common. "e6e2eae60048ead8126fe64d3043a127cc61ca77" and "2e1ae11ad4826b2fb2bf2ec7109f2690612ea405" have entirely different histories.
e6e2eae600
...
2e1ae11ad4
@ -67,7 +67,7 @@ async def direct_proxy(
|
||||
async with httpx.AsyncClient() as client:
|
||||
req_headers = request.headers.mutablecopy()
|
||||
for key in req_headers.keys():
|
||||
if key in ["host"]:
|
||||
if key not in ["user-agent", "accept", "authorization"]:
|
||||
del req_headers[key]
|
||||
|
||||
httpx_req: HttpxRequest = client.build_request(
|
||||
@ -79,15 +79,17 @@ async def direct_proxy(
|
||||
httpx_req = await pre_process_request(request, httpx_req, pre_process)
|
||||
|
||||
upstream_response = await client.send(
|
||||
httpx_req,
|
||||
follow_redirects=follow_redirects,
|
||||
httpx_req, follow_redirects=follow_redirects
|
||||
)
|
||||
|
||||
res_headers = {key: value for key, value in upstream_response.headers.items()}
|
||||
res_headers = upstream_response.headers
|
||||
|
||||
if request.method != "HEAD":
|
||||
res_headers.pop("content-length", None)
|
||||
res_headers.pop("content-encoding", None)
|
||||
res_headers.pop("content-length", None)
|
||||
res_headers.pop("content-encoding", None)
|
||||
|
||||
logger.info(
|
||||
f"proxy {request.url} to {target_url} {upstream_response.status_code}"
|
||||
)
|
||||
|
||||
content = upstream_response.content
|
||||
response = Response(
|
||||
|
Loading…
x
Reference in New Issue
Block a user