0

RFC 6265 defines 3 path matching conditions.

One of the path matching conditions is:

The cookie-path is a prefix of the request-path, and the first character of the request-path that is not included in the cookie-path is a %x2F ("/") character.

This condition confuses me. I'm not sure what it means by "not included".

Is this Python code capable of checking for this condition?

cookie_path = "/"
request_path = "/test"

if (request_path.startswith(cookie_path[1:]) 
    and request_path[0] == cookie_path[0] == "/"):

And what is more confusing

If request_path is an empty string, is this condition always false?

I mean, if the cookie path is a "/" but the request path is empty, should we send a cookie to that server? If so, how does this condition become True when the request path is empty?

khelwood
  • 55,782
  • 14
  • 81
  • 108
Karen Petrosyan
  • 372
  • 2
  • 7

0 Answers0