GithubHelp home page GithubHelp logo

Comments (4)

lilyball avatar lilyball commented on May 14, 2024

The solution here is to actually find the original cookie in the Jar and store that in the removed_cookies list instead of just storing the cookie name. This would have the side-effect of fixing what I consider to be another bug, which is that empty_jar.remove("foo") produces a Set-Cookie header even though there was no original cookie by that name.

from cookie-rs.

SergioBenitez avatar SergioBenitez commented on May 14, 2024

The browser does not pass along any other information besides the name and value of the cookie. As a result, unless cookie is storing cookies, proper deletion is simply impossible with the current API. I believe that the delete method should instead take in a Cookie and specify that it should have all of the original fields set. We can then set the max_age and expires fields properly.

from cookie-rs.

lilyball avatar lilyball commented on May 14, 2024

Oh crud, you're right. Or, if we're happy with the current behavior of Max-Age and Expires when removing, we could just have remove() take two more optional parameters for path and domain, e.g.

fn remove<N, P, D>(&self, cookie_name: N, path: Option<P>, domain: Option<D>)
    where N: Into<Cow<'static, str>>,
          P: Into<Cow<'static, str>>,
          D: Into<Cow<'static, str>>

from cookie-rs.

SergioBenitez avatar SergioBenitez commented on May 14, 2024

Yeah, we could do that as well.

I'll be revamping CookieJar in the near future, and I'll make sure to fix this along the way.

from cookie-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.