WebRequest.SetCookie path

Whipping up a sample for a login scheme that works with browser password autofill, I ran into this…

If I have a special web request, “/special/login/form”, and in app.HandleSpecialURL I try to set a cookie with path “/”, the browser gets the cookie with path “/special/login/form”:

request.SetCookie("loginCookie", loginCookie, nil, ".", "/")

I verify this issue by checking the cookies in Chrome after this gets set. If I manually set the cookie header myself, it works as expected:

request.Header("Set-Cookie") = "loginCookie=" + loginCookie + "; Path=/"

Bug, or am I missing something?

Are you returning True from the HandleSpecialURL event?

Yeah.

Without looking at the code (I don’t remember it) I’d say that’s a bug. It’s at least different than I expect.

I’ll strip that project down and post a feedback. More soon.

Hey, check this out. There is already a feedback case. From March:

<https://xojo.com/issue/25268>

I’ll add a project to it.

Just got an email. Fixed by Greg. Cool.