[openssl] Support wildcard hostname verification

Most of this code comes from version Curl 7.35.
Use poll(2) for timeouts on socket

Use poll(2) instead of select(2) to do timeout operations on sockets. This helps
with the situation where the fd is larger than FD_MAXSIZE.

Fixes #168