madtrick/wsock — pull request #4 by ctradu (2014-05-23 08:35:35+00:00)
Title: Add support for cookie based authentication in the initial handshake

Add a new function open/4, which is open/3 with a forth parameter, which becomes an additional header - Cookie.
Assume this authentication cookie was obtained in a previous step using a http auth mechanism.

My usage scenario is using [ibrowse](https://github.com/cmullaparthi/ibrowse) to do the http authentication step in the following manner:
```erlang
Answer = ibrowse:send_req(Url, Headers, post, Body, Options),
case Answer of
{ok, Status, ResponseHeaders, _ResponseBody} ->
Cookies = get_cookies(ResponseHeaders),
AuthCookie = find_cookie(AuthCookiePattern, Cookies),
{ok, AuthCookie}
%...
end
HandshakeRequest = wsock_handshake:open(Resource, Url, Port, AuthCookie)
```