views:

77

answers:

1

I've been searching on this but can't seem to figure out how I can delete a specific cookie using Google Apps Engine, Python version. I am setting the cookie like below and I need to update its value, I figure I may not be able to update and just need to delete and re-create but can't seem to find the way to do that, I am creating it as below:

        str = 'if_loggedin_username='+ self.username
        self.from_obj.response.headers.add_header(
                                 'Set-Cookie', str)

Thanks for any advice.

+4  A: 

There is no way for the server to delete an HTTP cookie. To update the value, just send a new cookie with the same name and it will be updated; to "delete" the cookie, set an expiration time in the past.

Wooble
hmmm.. well I tried that--just setting a new cookie and it seemed to create another one with the same name, so there were 2 of them. I will test again if see if it just was a fluke, so it should just update it instead of creating another one?
Rick
nevermind, I had been setting a different path for the 2nd one which is why it was giving 2... thanks for the help, this clears the issue up for me
Rick
It should be impossible for a browser to store 2 cookies with the same name for the same domain. A browser that allows this isn't compliant with RFC 2109.
Wooble
well its storing the same name but different path, I'm using latest ver of firefox
Rick