Closed LoickZoty closed 3 weeks ago
proxy.py
is working as expected. You need to understand how CONNECT
(https) requests work for a proxy server, which will never see a PUT
request going through it, but only the initial CONNECT
request. ChatGPT can help and explain nowadays :)
Describe the bug File hosting on a cloud server: request.total_size has an inconsistent value.
To Reproduce Steps to reproduce the behavior:
from proxy.http.proxy import HttpProxyBasePlugin
DEFAULT_HTTPS_PROXY_ACCESS_LOG_FORMAT = '{client_ip}:{client_port} - ' + \ '{request_method} {server_host}:{server_port} - ' + \ 'request_size: {request_bytes} bytes, response_size: {response_bytes} bytes - ' + \ '{connection_time_ms}ms'
logger = logging.getLogger(name)
class CustomLogPlugin(HttpProxyBasePlugin): def init(self, *args, *kwargs) -> None: super().init(args, **kwargs)
Expected behavior In my case, I use Google Drive, I host a 5MB file. The request goes through a PUT method with a Content-Length of 5242880. The logs do not mention any PUT request (only CONNECT) and the total_size never exceeds 300 bytes.
What is strange is that I reproduced the file hosting with a local server and the logs are consistent:
I do receive both requests: CONNECT & PUT.
Even stranger, when I download what I hosted on Google Drive, the response.total_size has a consistent value but it comes from a CONNECT request and not a GET.
Version information