bugfix: return 404 (not found) instead of server error
Added support for GnuTLS. Log errors to correct place.