websockets: handle HTTP_CONNECTION more flexibly

This fixes issue #73 and contains a test for it