Code Monkey home page Code Monkey logo

Comments (7)

SergioBenitez avatar SergioBenitez commented on May 21, 2024

Please provide a test case and a screenshot of the browser as well as the exact version of the browser.

from rocket.

HaHa421 avatar HaHa421 commented on May 21, 2024

Browser : Microsoft Edge
Version 121.0.2277.112 (Official build) (64-bit)

here is the cookie after "removal" , content is erased but this remains

Name
test_cookie
Content
Domain

Path
/
Send for
Same-site connections only
Created
Friday, February 16, 2024 at 12:28:14 AM
Expires
Sunday, September 20, 5838270 at 12:09:20 AM

the code is pruned from other routes :

use rocket::*;
use rocket::http::{Cookie,CookieJar};

#[get("/set_cookie")]
async fn set_cookie(cookies: &CookieJar<'_>,) {
    cookies.add(Cookie::new("test_cookie", "val"));
}

#[get("/remove_cookie")]
async fn remove_cookie(cookies: &CookieJar<'_>) {
    cookies.remove("test_cookie");
}

#[tokio::main]
async fn main() -> Result<(), Error> {
  let _ = rocket::build()
        .mount("/", routes![set_cookie,remove_cookie])
       .launch()
        .await?;
  Ok(())
}

from rocket.

SergioBenitez avatar SergioBenitez commented on May 21, 2024

I'm sorry, but you're going to need to provide clearer information about what's going on. I have tried to reproduce the issue you're describing without success. On both macOS and Windows, Edge successfully clears the cookie.

Here's what I need from you:

  • A console log of Rocket with your reproduction showing incoming and outgoing requests where the issue occurs with debug logging enabled. This was requested in the issue template but was ignored.
  • A screenshot of the developer tools in your Edge browser that shows the information you're describing here. When a cookie is deleted, both max-age and Expires are set. I need to see what the browser is receiving, exactly. Ideally, this is two things: the response headers and the cookie information.

Please also format your responses with markdown so that they're easier to read.

Please do not ignore issue templates in the future. They are designed so that this back-and-forth is avoided as much as possible. When you ignore the issue template, you increase workload on maintainers unnecessarily.

from rocket.

HaHa421 avatar HaHa421 commented on May 21, 2024

rocket log writes as expected:

 sending response: Response {
    status: 200,
    version: HTTP/1.1,
    headers: {
        "set-cookie": "test_cookie=; SameSite=Lax; Path=/; Max-Age=0; Expires=Thu, 16 Feb 2023 01:41:49 GMT",
        "server": "Rocket",
        "x-content-type-options": "nosniff",
        "x-frame-options": "SAMEORIGIN",
        "permissions-policy": "interest-cohort=()",
        "content-length": "0",
    },
    body: Body(
        Streaming,
    ),
}

and I get only this warning in Edge developer tools console:

Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'interest-cohort'.

Edge keeps setting the cookie expiration date at : Sunday, September 20, 5838270 at 12:09:20 AM

from rocket.

HaHa421 avatar HaHa421 commented on May 21, 2024

I get the same behavior from Edge on a linux machine

from rocket.

SergioBenitez avatar SergioBenitez commented on May 21, 2024

Please post the following:

I need to see what the browser is receiving, exactly. Ideally, this is two things: the response headers and the cookie information.

This can be found in the developer tools.

Also, is your clock set correctly?

from rocket.

HaHa421 avatar HaHa421 commented on May 21, 2024

When an inspect cookies in the Application tab of developer tools, the cookie doesn't show after removal which is good
I added the route

#[get("/check_cookie")]
async fn check_cookie(cookies: &CookieJar<'_>)->String {
    match cookies.get("test_cookie") {
      Some(_)=>String::from("Cookie found"),
      _=>String::from("Cookie not found"),
    }
}

and everything is ok
Meanwhile the cookie still shows up in "View Site Information --> Cookies" ,which might be annoying from a user perspective.
anyway , this seems to be related to Edge implementation so I suppose we can close the issue

from rocket.

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.