Properly handle the SSL error queue

Errors were not getting cleared from the queue between various OpenSSL
function calls. This was causing the error queue to contain misleading
information on subsequent calls to SSL_get_error.

One degenerate case was incorrect dispatching of errors after a failed
SSL_read. Conditions that simply should have lead to another call to
SSL_read were being treated as fatal. This was verified while stracing a
stud process and seeing read() return with EAGAIN and stud immediately
closing the socket fd and logging an SSL_read error.
Merge branch 'ssl-error-queue-fix'

Conflicts:
	stud.c
Merge branch 'master-ssl-error-queue-fix' of https://github.com/dowski/stud