Hello.
When I do these, it works (except for (http://)google.com -- it is giving me HTTP 301):
curl -x localhost:8080 http://example.com
curl -x localhost:8080 example.com
What am I doing wrong? I run the server.py directly. My twisted version is 22.10.0
Here is what I see in the terminal as soon as I do the request:
Traceback (most recent call last):
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\python\log.py", line 96, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\python\log.py", line 80, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\python\context.py", line 117, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\python\context.py", line 82, in callWithContext
return func(*args, **kw)
--- <exception caught here> ---
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\internet\selectreactor.py", line 148, in _doReadOrWrite
why = getattr(selectable, method)()
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\internet\tcp.py", line 248, in doRead
return self._dataReceived(data)
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\internet\tcp.py", line 253, in _dataReceived
rval = self.protocol.dataReceived(data)
File "C:\Users\useruser\Desktop\nvs\forward_proxy.py", line 90, in dataReceived
Proxy.dataReceived(self, data)
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\web\http.py", line 2465, in dataReceived
return basic.LineReceiver.dataReceived(self, data)
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\protocols\basic.py", line 549, in dataReceived
why = self.lineReceived(line)
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\web\http.py", line 2319, in lineReceived
self.allContentReceived()
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\web\http.py", line 2447, in allContentReceived
req.requestReceived(command, path, version)
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\web\http.py", line 1032, in requestReceived
self.process()
File "C:\Users\useruser\Desktop\nvs\forward_proxy.py", line 29, in process
ProxyRequest.process(self)
File "C:\Users\useruser\Desktop\nvs\venv\lib\site-packages\twisted\web\proxy.py", line 137, in process
port = self.ports[protocol]
builtins.KeyError: b'example.com'``