-
Notifications
You must be signed in to change notification settings - Fork 185
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
Convert scheme to lower case when parsing URI #2938
Conversation
servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/H2SchemeTest.java
Outdated
Show resolved
Hide resolved
...cetalk-http-netty/src/test/java/io/servicetalk/http/netty/MultiAddressUrlHttpClientTest.java
Outdated
Show resolved
Hide resolved
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.
Hi Gihwan,
Thanks for the interest in our project and sorry for the delayed review.
Please see my comments below:
servicetalk-http-api/src/main/java/io/servicetalk/http/api/HttpScheme.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/HttpScheme.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/HttpScheme.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/DefaultHttpRequestMetaData.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/HttpScheme.java
Outdated
Show resolved
Hide resolved
...tty/src/test/java/io/servicetalk/http/netty/DefaultMultiAddressUrlHttpClientBuilderTest.java
Outdated
Show resolved
Hide resolved
...tty/src/test/java/io/servicetalk/http/netty/DefaultMultiAddressUrlHttpClientBuilderTest.java
Show resolved
Hide resolved
...cetalk-http-netty/src/test/java/io/servicetalk/http/netty/MultiAddressUrlHttpClientTest.java
Outdated
Show resolved
Hide resolved
servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2ToStH1ClientDuplexHandler.java
Outdated
Show resolved
Hide resolved
servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/H2SchemeTest.java
Outdated
Show resolved
Hide resolved
HttpScheme
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.
Looks much better, thanks for refactoring!
servicetalk-http-api/src/test/java/io/servicetalk/http/api/Uri3986Test.java
Outdated
Show resolved
Hide resolved
...tty/src/test/java/io/servicetalk/http/netty/DefaultMultiAddressUrlHttpClientBuilderTest.java
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Uri3986.java
Outdated
Show resolved
Hide resolved
servicetalk-http-api/src/main/java/io/servicetalk/http/api/Uri3986.java
Outdated
Show resolved
Hide resolved
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.
Many thanks! Appreciate your contribution
Motivation: In apple#2938 we made it guaranteed that `HttpRequestMetaData#scheme()` result is always in lowercase. We can use that to simplify scheme checks inside `DefaultMultiAddressUrlHttpClientBuilder`. Modifications: - Replace all scheme checks from `equalsIgnoreCase` to `equals`; Result: No need to worry about cases for scheme check.
Motivation: In apple#2938 we made it guaranteed that `HttpRequestMetaData#scheme()` result is always in lowercase. We can use that to simplify scheme checks inside `DefaultMultiAddressUrlHttpClientBuilder`. Modifications: - Replace all scheme checks from `equalsIgnoreCase` to `equals`; Result: No need to worry about cases for scheme check.
Motivation: In #2938 we made it guaranteed that `HttpRequestMetaData#scheme()` result is always in lowercase. We can use that to simplify scheme checks inside `DefaultMultiAddressUrlHttpClientBuilder`. Modifications: - Replace all scheme checks from `equalsIgnoreCase` to `equals`; - Extract exact same instance of `https` string from `Uri3986` to speed up `equals` check; Result: No need to worry about cases for scheme check.
Motivation:
HttpRequestMetaData#scheme()
javadocs state the result will be lowercase, but this is not always the case becauseUri3986
parses the scheme as-is. As a result,DefaultMultiAddressUrlHttpClientBuilder
may have more than 1 client instance for the same address if users use URI with different scheme letters case.See #1423 for details.
Modifications:
Uri3986
reusing well-known schemes ("http" and "https")Result:
Fixes #1423.