crossbario / crossbario/autobahn-python
`WrappingWebSocketServerFactory` doesn't handle factories that return `None`.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 768
- PR merge metrics
- No merged PRs in 30d
Description
https://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IProtocolFactory.html#buildProtocol documents that buildProtocol can return None, but when I do that, I get
Traceback (most recent call last):
File ".../lib/python2.7/site-packages/twisted/protocols/basic.py", line 571, in dataReceived
why = self.lineReceived(line)
File ".../lib/python2.7/site-packages/twisted/web/http.py", line 1692, in lineReceived
self.allContentReceived()
File ".../lib/python2.7/site-packages/twisted/web/http.py", line 1781, in allContentReceived
req.requestReceived(command, path, version)
File ".../lib/python2.7/site-packages/twisted/web/http.py", line 768, in requestReceived
self.process()
--- <exception caught here> ---
File ".../lib/python2.7/site-packages/twisted/web/server.py", line 183, in process
self.render(resrc)
File ".../lib/python2.7/site-packages/twisted/web/server.py", line 234, in render
body = resrc.render(self)
File ".../lib/python2.7/site-packages/autobahn/twisted/resource.py", line 121, in render
protocol = self._factory.buildProtocol(request.transport.getPeer())
File ".../lib/python2.7/site-packages/autobahn/twisted/websocket.py", line 428, in buildProtocol
proto._proto.transport = proto
exceptions.AttributeError: 'NoneType' object has no attribute 'transport'
Incidentally, The last line in the traceback should probably be proto._proto.makeConnection(transport).
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 in autobahn/twisted/websocket.py at the buildProtocol implementation shown in the traceback, and compare it with the IProtocolFactory buildProtocol documentation. Reproduce the case where the wrapped factory returns None and verify that the server no longer raises AttributeError; also inspect whether the final connection call should be makeConnection(transport), as reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100