Add support for cookies

Very basic support for cookies. I needed it myself and thought I'd just submit as a PR.