Prepare for solving https://github.com/kanaka/websockify/issues/71:

Rename self.client to self.request, since this is what standard
SocketServer request handlers are using.
Prepare for fixing https://github.com/kanaka/websockify/issues/71:
Move around functions and methods, so that connection-related and
server-related stuff are close together.

This patch just moves things around - it does not change anything at
all. This can be verified with:

git diff websocket.py | grep ^- | cut -c 2- | sort > removed
git diff websocket.py | grep ^+ | cut -c 2- | sort > added
diff -u removed added
Prepare for fixing https://github.com/kanaka/websockify/issues/71:

* Move traffic_legend.

* Since websocket.WebSocketServer.socket is static, don't call it with
  self.socket.
Try to solve https://github.com/kanaka/websockify/issues/71 by
refactoring. Basically, we are dividing WebSocketServer into two
classes: One request handler following the SocketServer Requesthandler
API, and one optional server engine. The standard Python SocketServer
engine can also be used.

websocketproxy.py has been updated to match the API change. I've also
added a new option --libserver in order to use the Python built in
server instead.

I've done a lot of testing with the new code. This includes: verbose,
daemon, run-once, timeout, idle-timeout, ssl, web, libserver. I've
tested both Python 2 and 3. I've also tested websocket.py in another
external service.

Code details follows:

* The new request handler class is called WebSocketRequestHandler,
  inheriting SimpleHTTPRequestHandler.

* The service engine is called WebSocketServer, just like before.

* do_websocket_handshake: Using send_header() etc, instead of manually
  sending HTTP response.

* A new method called handle_websocket() upgrades the connection to
  WebSocket, if requested. Otherwise, it returns False. A typical
  application use is:

    def do_GET(self):
        if not self.handle_websocket():
	   # handle normal requests

* new_client has been renamed to new_websocket_client, in order to
  have a better name in the SocketServer/HTTPServer request handler
  hierarchy.

* Note that in the request handler, configuration variables must be
  provided by the "server" object, ie self.server.target_host.
Fix error with modern Python 2.X versions:

TypeError: exceptions must be old-style classes or derived from
BaseException, not str

Thus, we are not allowed to raise a string. Raise Exception instead.
Renamed CustomProxyServer to WebSocketProxy; this was the earlier name.

Also, call the server instance "server", not "httpd", even when using
LibProxyServer.
Corrected last commit.
Merge remote branch 'upstream/master'
Merge branch 'master' of github.com:astrand/websockify
Rename self.client to self.request, ie adapt to:

>commit b9e1295f7afa34a4c69618609e053af154e477d7
>    Prepare for solving https://github.com/kanaka/websockify/issues/71:
>
>    Rename self.client to self.request, since this is what standard
>    SocketServer request handlers are using.
Make echo.py and load.py work again, after the refactoring of
websocket.py:

* With echo.py, which doesn't need any server configuration, we can
  just switch over our application class to inherit from
  WebSocketRequestHandler instead of WebSocketServer. Also, need to
  use the new method name new_websocket_client.

* With load.py, since we have the "delay" configuration, we need both
  a server class and a request handler.

Note that for both tests, I've removed the raising of
self.EClose(closed). This is incorrect. First of all, it's described
as "An exception before the WebSocket connection was established", so
not suitable for our case. Second, it will cause send_close to be
called twice. Finally, self.EClose is now in the WebSocketServer
class, and not a member of the request handler.
Removed unused import of SimpleHTTPRequestHandler.
Move WebSocketProxy class so that it is defined after the
requesthandler. Removed comments about above/below which does not make
sense any longer. No functional changes.
Let our ProxyRequestHandler be default. This allows you to inherit
from WebSocketProxy without having to specify handler class.
Improved class documentation.
Fix Python3 compatibility when using --libserver.
Merge commit '2d078e8cd83735dad7d98fadcece652d93e2a037'

* commit '2d078e8cd83735dad7d98fadcece652d93e2a037':
  correctly include include directory in egg.
Merge commit '33e9a21ce4e38d52f43fe775fb154fc71c09c827'

* commit '33e9a21ce4e38d52f43fe775fb154fc71c09c827':
  Add gimite/web-socket-js submodule for DFSG compliance.
Merge commit '477947ba96a00032ae35ac55fd02a4a5f485497e'

* commit '477947ba96a00032ae35ac55fd02a4a5f485497e':
  Remove wsproxy references. Sync launch.sh from noVNC.
Merge commit 'b7f255ce0b21dc42189205b1f0e46b4f1d9854f9'

* commit 'b7f255ce0b21dc42189205b1f0e46b4f1d9854f9':
  Clarify messages when optional modules are not found.