Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jetty-12 ee9 Double parsing of cookies #9762

Closed
janbartel opened this issue May 11, 2023 · 1 comment
Closed

jetty-12 ee9 Double parsing of cookies #9762

janbartel opened this issue May 11, 2023 · 1 comment
Assignees
Labels
Bug For general bugs on Jetty side TCK For various Specification Test Compatibility Kits (eg: Servlet, WebSocket, HTTP/2, etc)

Comments

@janbartel
Copy link
Contributor

Relevant tck tests:

com/sun/ts/tests/servlet/api/jakarta_servlet_http/cookie/URLClient.java.getPathTest
com/sun/ts/tests/servlet/api/jakarta_servlet_http/cookie/URLClient.java.getDomainTest
com/sun/ts/tests/servlet/api/jakarta_servlet_http/cookie/URLClient.java.getVersionTest
com/sun/ts/tests/servlet/pluggability/api/jakarta_servlet_http/cookie/URLClient.java.getDomainTest
com/sun/ts/tests/servlet/pluggability/api/jakarta_servlet_http/cookie/URLClient.java.getPathTest
com/sun/ts/tests/servlet/pluggability/api/jakarta_servlet_http/cookie/URLClient.java.getVersionTest

When a request enters jetty, the SessionHandler needs to see the list of cookies and calls org.eclipse.jetty.server.Request.getCookies() which parses them. Later on, application code calls org.eclipse.jetty.ee9.nested.Request.getCookies() to retrieve the list of cookies. Unfortunately the nested Request maintains a completely separate list of cookies and cookie parsing state, so thus parses them all over again. Moreover, it parses them differently to the o.e.j.s.Request.

For example, given the following cookie header, and a compliance mode of RFC6265:
$Version="1"; name1="value1"; $Path="/servlet_jsh_cookie_web"; $Domain="localhost"

The o.e.j.s.Request parsing produces the (correct) list:

$Version="1"
name1="value1"
$Path="/servlet_jsh_cookie_web"
$Domain="localhost"

The o.e.j.ee9.n.Request parsing produces the (incorrect) list:
name1="value1"

@janbartel janbartel added Bug For general bugs on Jetty side TCK For various Specification Test Compatibility Kits (eg: Servlet, WebSocket, HTTP/2, etc) labels May 11, 2023
@janbartel janbartel self-assigned this May 12, 2023
janbartel added a commit that referenced this issue May 12, 2023
janbartel added a commit that referenced this issue May 12, 2023
* Issue #9762 ee9 double parses cookies

* implemented the TODOs to cache servlet cookies

---------

Co-authored-by: gregw <[email protected]>
@janbartel
Copy link
Contributor Author

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side TCK For various Specification Test Compatibility Kits (eg: Servlet, WebSocket, HTTP/2, etc)
Projects
None yet
Development

No branches or pull requests

1 participant