Fix https detection together with specs

The latest merged pull request has syntax error. With the syntax error fixed (per pull request by @bokmann) specs are still broken. I've fixed the broken specs and added one for the case when request.ssl? returns true. =)

Cheers