genotrance / px

An HTTP proxy server to automatically authenticate through an NTLM proxy
MIT License
952 stars 98 forks source link

"PROXY" prefix in web.pac #160

Closed marcOcram closed 2 years ago

marcOcram commented 2 years ago

I'm coming from v0.4.0 and tried to upgrade to v0.8.2.

EDIT: I tested it, it is broken since v0.8.0. Using v0.7.2 for now.

Our company web.pac returns the following line for a proxy return "PROXY xx.xx.xx.xx:yy"; which cannot be understood by curl (as far as I understand the log)

Process-1: MainThread: 1658130862: /start_worker/parse_config/__init__: Proxy mode = MODE_CONFIG_PAC
Process-1: MainThread: 1658130862: /parse_config/__init__/print_curl_version: libcurl/7.83.1 OpenSSL/3.0.2 (Schannel) zlib/1.2.12 brotli/1.0.9 libidn2/2.3.2 libssh2/1.10.0 nghttp2/1.47.0 ngtcp2/0.5.0 nghttp3/0.4.1 libgsasl/1.10.0
Process-1: MainThread: 1658130862: /parse_config/__init__/print_curl_version: CURL_VERSION_SSL: True
Process-1: MainThread: 1658130862: /parse_config/__init__/print_curl_version: CURL_VERSION_SSPI: True
Process-1: MainThread: 1658130862: /parse_config/__init__/print_curl_version: CURL_VERSION_SPNEGO: True
Process-1: MainThread: 1658130862: /parse_config/__init__/print_curl_version: CURL_VERSION_GSSAPI: False
Process-1: MainThread: 1658130862: /parse_config/__init__/print_curl_version: CURL_VERSION_GSSNEGOTIATE: False
Process-1: MainThread: 1658130862: /parse_config/__init__/print_curl_version: CURL_VERSION_KERBEROS5: True
Process-1: MainThread: 1658130862: /parse_config/__init__/print_curl_version: CURL_VERSION_NTLM: True
Process-1: MainThread: 1658130862: /parse_config/__init__/print_curl_version: CURL_VERSION_NTLM_WB: False
Process-1: MainThread: 1658130862: /parse_config/__init__/print_curl_version: Host: x86_64-pc-win32
Serving at 127.0.0.1:3128 proc Process-1
Process-1: MainThread: 1658130862: /start_worker/print_banner/detach_console: Freed console successfully
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:server = 
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:pac = http://xxx/web.pac
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:listen = 127.0.0.1
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:port = 3128
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:gateway = 0
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:hostonly = 0
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:allow = *.*.*.*
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:noproxy = 
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:useragent = 
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:username = 
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: proxy:auth = 
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: settings:workers = 2
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: settings:threads = 5
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: settings:idle = 30
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: settings:socktimeout = 20.0
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: settings:proxyreload = 60
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: settings:foreground = 0
Process-1: MainThread: 1658130862: /run/start_worker/print_banner: settings:log = 1
Process-1: MainThread: 1658130867: /serve_forever/_handle_request_noblock/verify_request: Client address: 127.0.0.1
Process-1: Thread_0: 1658130867: /do_GET/do_curl/__init__: 465ceb595891810ca5c2b2ab11dd0907929c7c32: New curl instance
Process-1: Thread_0: 1658130867: /do_curl/__init__/_setup: 465ceb595891810ca5c2b2ab11dd0907929c7c32: GET xxx using HTTP/1.1
Process-1: Thread_0: 1658130867: /handle_one_request/do_GET/do_curl: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Path = xxx
Process-1: Thread_0: 1658130867: /find_proxy_for_url/find_proxy_for_url/get_netloc: netloc = ('aaa', bbb), path = xxx
Process-1: Thread_0: 1658130867: /find_proxy_for_url/find_proxy_for_url/__init__: Loading PAC utils
Process-1: Thread_0: 1658130867: /find_proxy_for_url/find_proxy_for_url/load_url: Loading PAC url: http://xxx/web.pac
Process-1: Thread_0: 1658130867: /find_proxy_for_url/load_url/__init__: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: New curl instance
Process-1: Thread_0: 1658130867: /load_url/__init__/_setup: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: GET xxx/web.pac using HTTP/1.1
Process-1: Thread_0: 1658130867: /find_proxy_for_url/load_url/buffer: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Setting up buffers for bridge
Process-1: Thread_0: 1658130867: /load_url/buffer/bridge: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Setting up bridge
Process-1: Thread_0: 1658130867: /perform/do/add: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Handles = 0
Process-1: Thread_0: 1658130867: /do/add/_add_handle: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Add handle
Process-1: Thread_0: 1658130867: /do/add/_add_handle: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Added handle
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Curl info: Trying xxx:yy...
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Curl info: Connected to xxx (xxx) port yy (#0)
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Sent header => GET xxx/web.pac HTTP/1.1
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Sent header => Host: xxx
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Sent header => Accept: */*
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Curl info: Mark bundle as not supporting multiuse
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Received header <= HTTP/1.1 200 OK
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Received header <= Content-Type: text/plain
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Received header <= Last-Modified: Wed, 25 May 2022 14:13:46 GMT
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Received header <= Accept-Ranges: bytes
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Received header <= ETag: "97d7e7a54170d81:0"
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Received header <= Server: Microsoft-IIS/8.5
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Received header <= X-Powered-By: ASP.NET
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Received header <= Date: Mon, 18 Jul 2022 07:54:27 GMT
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Received header <= Content-Length: 14768
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_header_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Done sending headers
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_write_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Wrote 5094 bytes
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_write_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Wrote 9674 bytes
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Curl info: Connection #0 to host xxx left intact
Process-1: Thread_0: 1658130867: /perform/remove/_remove_handle: 6b0d6c471c6f8c8b7c8fa8cfd567d60aefbb53aa: Remove handle: 
Process-1: Thread_0: 1658130867: /do_GET/do_curl/get_destination: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Proxy = [('PROXY xx.xx.xx.xx', yy)]
Process-1: Thread_0: 1658130867: /handle_one_request/do_GET/do_curl: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Configuring proxy settings
Process-1: Thread_0: 1658130867: /handle_one_request/do_GET/do_curl: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Using SSPI to login
Process-1: Thread_0: 1658130867: /do_GET/do_curl/bridge: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Setting up bridge
Process-1: Thread_0: 1658130867: /do_GET/do_curl/set_headers: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Skipping header =!> Proxy-Connection: Keep-Alive
Process-1: Thread_0: 1658130867: /do_curl/do/add: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Handles = 0
Process-1: Thread_0: 1658130867: /do/add/_add_handle: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Add handle
Process-1: Thread_0: 1658130867: /do/add/_add_handle: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Added handle
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Curl info: Unsupported proxy syntax in 'PROXY xx.xx.xx.xx'
Process-1: Thread_0: 1658130867: /_perform/_socket_action/_debug_callback: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Curl info: Closing connection -1
Process-1: Thread_0: 1658130867: /handle_one_request/do_GET/do_curl: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Connection failed: 5; 
Process-1: Thread_0: 1658130867: /send_error/log_error/log_message: code 503, message 5; 
Process-1: Thread_0: 1658130867: /send_response/log_request/log_message: "GET xxx HTTP/1.1" 503 -
Process-1: Thread_0: 1658130867: /do_curl/remove/_remove_handle: 465ceb595891810ca5c2b2ab11dd0907929c7c32: Remove handle: 5; 
genotrance commented 2 years ago

Thanks for the report, especially the info that this broke in v0.8.0. I have a fix which will be out soon.

marcOcram commented 2 years ago

works as intended, thanks