Fix WebSocket upgrade issues on Firefox.

Closes GH-1232.