Self-review of websocket.c. Many small fixes, some more major ones.