PkgDB: store cookies

Store cookies in pickle file if possible. This makes the client do two
requests instead for each authenticated one to determine whether it is
authenticated. It would be better if the requests that require
authentication just fail if it is missing.