Add support for secure cookies to fix issue #8

A fix for issue #8

(sorry I wasn't sure how to actually run the tests so I didn't add a test)