Per-thread storage for cookie lists + test case

Fixes issue with race condition for the cookie list