-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
java.lang.ClassCastException: class org.eclipse.jetty.http.HttpField cannot be cast to class org.eclipse.jetty.http.HttpCookie$SetCookieHttpField #8294
Comments
Your code snippet ...
Key piece of information in your stacktrace ...
This occurred during a The |
It is clear that a custom cookie is not available in the PushBuilder request. I did not expect that at all. But there should be no exception. |
Incorrect, for a Push to succeed, the response headers need to be sane, that is especially true for the Now what that exception is, is a totally different question. |
@joakime I tend to agree with the OP that we should not be throwing such an exception. The code is making the assumption that all setCookie fields have been set via a particular API, but there are alternative paths. So I think this is a bug. |
Can you tell me where this is specified?
The current cookie API is not compatible with RFC6265. That this is a workaround. |
Jetty has a CookieCompliance mode for RFC6265. Which is the default for Jetty 10+ Is there some specific detail of RFC6265 that you are struggling with? If you want to manage
|
@joakime I'm not sure that calling addHeader for a set cookie is really an "abuse" of the API. I think it is a "do so at your own risk" kind of thing. @Horcrux7 As indicated above, we do use he cookie comment field as a work around for the limitations of the Cookie API, so you should be able to set most (all?) fields you need via that API. The benefit then is that we are internally more efficient and don't have to re-parse any set-cookie added via other APIs. |
Reparse cookie added with addCookie Signed-off-by: Greg Wilkins <[email protected]>
It would be good to have an example of the RFC6265 |
Added extra test to ensure maxAge is being parsed Signed-off-by: Greg Wilkins <[email protected]>
Added extra test to ensure maxAge is being parsed with other cookie attributes Signed-off-by: Greg Wilkins <[email protected]>
Yes, it for the SameSite attribute. Even though most of our customers use our software together with a Jetty, not all of them do. That we can't use Jetty only features. It must also work with other servlet engines. Here are some sample of cookies that we send. Also If I think that my cookies are not relevant.
PS: You check only the age of the cookie to make it available in the push request. If you want emulate the browser behavior then also the path should check? Also if exotic the push request can in a path that does not match the path for a push resource. |
* Fix #8294 push added cookie Reparse cookie added with addCookie Added extra test to ensure maxAge is being parsed with other cookie attributes Signed-off-by: Greg Wilkins <[email protected]>
Jetty version(s)
10.0.11
Java version/vendor
17
Description
After we have call the follow code:
we get the follow exception:
The text was updated successfully, but these errors were encountered: