Check cookie domain length properly

Adds a test to ensure we catch this if it crops up again.

Fixes #131.