genotrance / px

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

IndexError wproxy.DIRECT #225

Open svaningelgem opened 2 months ago

svaningelgem commented 2 months ago

I got this error this morning:

----------------------------------------
Exception occurred during processing of request from ('127.0.0.1', 58976)
Traceback (most recent call last):
  File "socketserver.py", line 692, in process_request_thread
  File "socketserver.py", line 362, in finish_request
  File "socketserver.py", line 761, in __init__
  File "http\server.py", line 436, in handle
  File "PX\Lib\site-packages\px\handler.py", line 128, in handle_one_request
    http.server.BaseHTTPRequestHandler.handle_one_request(self)
  File "http\server.py", line 424, in handle_one_request
  File "PX\Lib\site-packages\px\handler.py", line 230, in do_GET
    self.do_curl()
  File "PX\Lib\site-packages\px\handler.py", line 159, in do_curl
    ipport = self.get_destination()
             ^^^^^^^^^^^^^^^^^^^^^^
  File "PX\Lib\site-packages\px\handler.py", line 257, in get_destination
    if servers[0] == wproxy.DIRECT:
       ~~~~~~~^^^
IndexError: list index out of range
----------------------------------------

The reason is normal: I didn't have any network at the time because my computer wasn't connected to either a cable or the wifi.

It would be nice to dump a nicer error message to say something like "Are you sure you're connected to the network?" instead of a stackdump ;-)