Add support for connecting to ws endpoints requiring prior cookie based authentication

Assume you have to connect to an endpoint that requires http authentication.
Following a successful authentication step, the client is presented by the server with a cookie.
This cookie needs to be used on the websocket upgrade connection step.

In order to make this work I also made a commit (under pull request) on wsock.