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
Adapt to new Netty5 Header API #2484
Conversation
@pderop Is the decoding/encoding now |
most of the time, encoding/decoding is STRICT, except one use case, which seems to be a bug, see below, last use case:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the port is OK.
Please list in build.gradle
the removed APIs. Also prepare deprecation PR for 1.1.x
branch.
reactor-netty5-http/src/main/java/reactor/netty5/http/Cookies.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/main/java/reactor/netty5/http/Cookies.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/main/java/reactor/netty5/http/Cookies.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/main/java/reactor/netty5/http/client/HttpClient.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/main/java/reactor/netty5/http/client/HttpClient.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/client/HttpClientTest.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/client/HttpClientTest.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/client/HttpClientProxyTest.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/client/HttpClientProxyTest.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/client/HttpClientProxyTest.java
Outdated
Show resolved
Hide resolved
Please address this also |
I have addressed some of your feedbacks, except the following:
For the encoding (STRICT mode) of the Cookie header, I will make a PR for Netty. |
I see there is a conflict, let me check before reviewing. |
….codec.http.headers.HttpHeaders
…er/ClientCookieDecoder/ClientCookieEncoder classes, which are not available anymore. Replaced old netty Cookie class by HttpCookiePair/HttpSetCookie. The Cookies class is used to cache Set-Cookie headers found from http response headers. The ServerCookies class is used to cache Cookies headers found from http request headers.
32b1129
to
7f5f064
Compare
rebased on top of netty5 branch, to get #2462 and merge it. |
reactor-netty5-http/src/main/java/reactor/netty5/http/client/HttpClient.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/main/java/reactor/netty5/http/client/WebsocketClientOperations.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/main/java/reactor/netty5/http/server/HttpServerOperations.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/main/java/reactor/netty5/http/server/ServerCookies.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/main/java/reactor/netty5/http/server/WebsocketServerOperations.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/client/WebsocketClientOperationsTest.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/client/WebsocketClientOperationsTest.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/client/WebsocketTest.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/server/HttpServerTests.java
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/server/logging/AccessLogTest.java
Outdated
Show resolved
Hide resolved
I have attempted to address all feedbacks in the last commit. |
reactor-netty5-http/src/test/java/reactor/netty5/http/client/WebsocketClientOperationsTest.java
Outdated
Show resolved
Hide resolved
reactor-netty5-http/src/test/java/reactor/netty5/http/client/WebsocketClientOperationsTest.java
Outdated
Show resolved
Hide resolved
…ngs in WebsocketClientOperationsTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see CI green and then you can merge.
This PR attempts to adapt to the following Netty5 changes:
api
from theio.netty5.buffer.api
package path netty/netty#12792These changes have a quite important impact on the RN API. I have made some choices (it's a first attempt, let me know what you think ...)
So, this PR provides the following logical commits (in order to try to make easier the review):
8257106: renamed io.netty.buffer.api package to io.netty.buffer
0060895 renamed io.netty5.handler.codec.http.HttpHeaders package to io.netty5.handler.codec.http.headers.HttpHeaders
743c579: Adapted to new HttpHeaders API: This is a quite large commit, however, all changes are similar
6fb29bf: Removed the old ServerCookieEncoder/ServerCookieDecoder/ClientCookieDecoder/ClientCookieEncoder classes, which are not available anymore. Replaced old netty Cookie class by HttpCookiePair/HttpSetCookie.The RN Cookies class is used to cache Set-Cookie headers found from http response headers, and the ServerCookies class is used to cache Cookie headers found from http request headers.
About the 7062ace commit (Adapted to new HttpHeaders API):
Regarding the last commit 6fb29bf for Cookie/Set-Cookie changes:
Using the new API, a Cookie header is represented by HttpCookiePair and a Set-Cookie header is represented by HttpSetCookie, and the old Cookie is not available anymore.
In this PR, the HttpCookiePair is now used instead of the old Cookie.
The RN Cookies class was used to cache Set-Cookie headers from http response, so the new HttpSetCookie class is now used internally. Simplified the Cookies class which is only caching Set-Cookie header.
The RN ServerCookies class was used to cache Cookie headers from http requests , so the new HttpCookiePair is now used internally.
For inbound requests, the headers are validated using DefaultHttpHeaders.validateHeaderValue, and more specifically, Set-Cookies header are validated using DefaultHttpSetCookie.parseSetCookie. Such validation can be deacrivated as before, using HttpDecoderSpec.validateHeaders(boolean) method.
The ClientCookieEncoder is not available anymore. in STRICT mode, this encoder was checking if Cookie name and value chars were in the valid scope (RFC6265), and for methods that accept multiple cookies, the encoder sorted cookies into order of decreasing path length. But it seems we don't have the equivalent encoder using the new HttpHeader API (to be investigated further on).
The ClientCookieDecoder is not available anymore: in STRICT mode, It was used to decode Set-Cookie headers from http response, and was checking if Set-Cookie chars are in valid scope (RFC6265).
The ServerCookieEncoder is not available anymore: in STRICT mode, it was used to encode a Set-Cookie header and it validated that name and value chars were in the valid scope defined in RFC6265, and (for methods that accept multiple cookies) that only one cookie is encoded with any given name.
The ServerCookieDecoder is not available anymore: in STRICT mode, it was used to decode Cookie headers from http requests, and it was validating if chars were in valid scope (RFC6265).