Client cookie properties are missing

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Client cookie properties are missing

John Jiang
Hi,
It looks Jetty server misses client cookie properties, like $Path, $Domain.

Please consider the below simple Servlet,
public class TestServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        Cookie[] cookies = request.getCookies();
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                System.out.printf(
                        "%s=%s; $Path=%s; $Domain=%s%n",
                        cookie.getName(),
                        cookie.getValue(),
                        cookie.getPath(),
                        cookie.getDomain());
            }
        }
    }
}

The path and domain are always null even though some client cookies set these properties.

In my testings, this problem raised on Jetty 9.4.20 and 10.0.0-alpha0, but NOT on Jetty 9.3.21.
Is it an known issue? Or, should I do something else on the latest Jetty releases.

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Client cookie properties are missing

John Jiang

On Wed, Sep 18, 2019 at 4:28 PM John Jiang <[hidden email]> wrote:
Hi,
It looks Jetty server misses client cookie properties, like $Path, $Domain.

Please consider the below simple Servlet,
public class TestServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        Cookie[] cookies = request.getCookies();
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                System.out.printf(
                        "%s=%s; $Path=%s; $Domain=%s%n",
                        cookie.getName(),
                        cookie.getValue(),
                        cookie.getPath(),
                        cookie.getDomain());
            }
        }
    }
}

The path and domain are always null even though some client cookies set these properties.

In my testings, this problem raised on Jetty 9.4.20 and 10.0.0-alpha0, but NOT on Jetty 9.3.21.
Is it an known issue? Or, should I do something else on the latest Jetty releases.

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Client cookie properties are missing

Simone Bordet-3
Hi,

On Thu, Sep 19, 2019 at 3:53 AM John Jiang <[hidden email]> wrote:
>
> Anyway, I just filed issue: https://github.com/eclipse/jetty.project/issues/4102

FTR, newer Jetty versions use RFC 6265 for Cookies, which does not
support attributes in the Cookie header.
You can configure the cookie compliance if you really need attributes,
but it's probably best to not send them.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users