Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPS simply doesn't work. #15

Open
coldeny opened this issue Aug 13, 2023 · 1 comment
Open

HTTPS simply doesn't work. #15

coldeny opened this issue Aug 13, 2023 · 1 comment

Comments

@coldeny
Copy link

coldeny commented Aug 13, 2023

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

But when I do this, it simply doesn't work and I put the error text below it:
curl -x localhost:8080 https://example.com
curl: (56) Proxy CONNECT aborted

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'``
@wRAR
Copy link

wRAR commented Oct 2, 2024

It doesn't work on Python 3 because some things are now bytes and e.g. many literals need to be bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants