Add HTTPS tests, fix several bugs

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>