Fix handling of multiple cookie headers.

Closes GH-1310.