Fixed tabs, and added support for non-ssl sockets (not fully tested).