crossbario / crossbario/autobahn-python
WSS over explicit proxies not implemented for asyncio
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 768
- PR merge metrics
- No merged PRs in 30d
Description
Steps to Reproduce
- Use asyncio
- Use the Component API
- Pass a proxy in the transport for a wss router
- Invoke sample code thusly:
sample.py wss://myrouter.com/ws realm1 myproxy.com:3128
Expected Result
autobahn connects successfully
Actual Result
2019-09-27T14:10:02 connecting once using transport type "websocket" over endpoint "tcp"
2019-09-27T14:10:02 Exception in callback WebSocketAdapterProtocol._consume.<locals>.process(<Future finished result=None>) at /home/fferrell/src/proxy_example/venv/lib/python3.6/site-packages/autobahn/asyncio/websocket.py:106
handle: <Handle WebSocketAdapterProtocol._consume.<locals>.process(<Future finished result=None>) at /home/fferrell/src/proxy_example/venv/lib/python3.6/site-packages/autobahn/asyncio/websocket.py:106>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
self._callback(*self._args)
File "/home/fferrell/src/proxy_example/venv/lib/python3.6/site-packages/autobahn/asyncio/websocket.py", line 110, in process
self._dataReceived(data)
File "/home/fferrell/src/proxy_example/venv/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 1213, in _dataReceived
self.consumeData()
File "/home/fferrell/src/proxy_example/venv/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 1232, in consumeData
self.processProxyConnect()
File "/home/fferrell/src/proxy_example/venv/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 3514, in processProxyConnect
self.startTLS()
File "/home/fferrell/src/proxy_example/venv/lib/python3.6/site-packages/autobahn/asyncio/websocket.py", line 230, in startTLS
raise Exception("WSS over explicit proxies not implemented")
Exception: WSS over explicit proxies not implemented
Sample Code
import sys
from autobahn.asyncio.component import Component, run
proxy_host, proxy_port = sys.argv[3].split( ':' )
comp = Component(
transports = dict(
url = sys.argv[1],
proxy = dict(
host = proxy_host,
port = int( proxy_port )
),
),
realm = sys.argv[2],
)
@comp.on_join
def joined( session, details ):
print( 'session ready' )
run( [ comp ] )
Notes
This works with twisted. Change the import in the sample code to autobahn.twisted.component and it connects as expected.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with autobahn/asyncio/websocket.py, especially WebSocketAdapterProtocol.startTLS, and follow the proxy path into autobahn/websocket/protocol.py at processProxyConnect. Compare the asyncio behavior with the working Twisted implementation and verify the sample.py WSS connection through an explicit proxy succeeds without the reported exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100