kanaka/websockify — pull request #74 by rmk40 (2013-03-23 00:18:56+00:00)
Title: Eliminate attribute errors on last code/msg

When using websockify via nova-vncproxy or nova-spiceproxy, there is a continuous stream of exceptions such as the following:

126: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 774, in top_new_client
self.client = self.do_handshake(startsock, address)
File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 706, in do_handshake
if wsh.last_code == 101:
AttributeError: WSRequestHandler instance has no attribute 'last_code'

This patch checks for the existence of last_code and last_message via exception handler. There may be a better way to fix this issue but this worked for me.