-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support authentication response are multiple frames #53
Conversation
…nto an HTTP response.
4f2ddcd
to
1a62d50
Compare
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.
Thanks! Looks great. :D Just a few comments.
src/main/java/com/microsoft/azure/proton/transport/proxy/HttpStatusLine.java
Show resolved
Hide resolved
src/main/java/com/microsoft/azure/proton/transport/proxy/impl/ProxyResponseImpl.java
Outdated
Show resolved
Hide resolved
src/test/java/com/microsoft/azure/proton/transport/proxy/impl/ProxyResponseImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/microsoft/azure/proton/transport/proxy/impl/ProxyResponseImplTest.java
Show resolved
Hide resolved
Reduced buffer size |
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.
Thanks! It looks good to me. I pinged @JamesBirdsall to see if he could take a quick look since they also use this library.
src/test/java/com/microsoft/azure/proton/transport/proxy/impl/HTTPStatusLineTest.java
Outdated
Show resolved
Hide resolved
@@ -34,79 +37,63 @@ public void testCreateProxyRequest() { | |||
Assert.assertEquals(expectedProxyRequest, actualProxyRequest); | |||
} | |||
|
|||
@ParameterizedTest | |||
@ValueSource(ints = {200, 201, 202, 203, 204, 205, 206}) |
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.
Is there a reason we removed all of these 2xx status code test cases?
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.
We changed the validation for proxy response. Now we only assume 200 Connection Established
is the successful response.
return status.getStatusCode() == 200
&& SUPPORTED_VERSIONS.contains(status.getProtocolVersion())
&& CONNECTION_ESTABLISHED.equalsIgnoreCase(status.getReason());
Previously, we use the pattern to do this validation. So the test verify all 2xx status code.
Pattern.compile("^http/1\\.(0|1) (?<statusCode>2[0-9]{2})", Pattern.CASE_INSENSITIVE);
Do you think we need add back and consider other 2xx status as successful response?
Looks reasonable to me! |
Fix #5124
Issue
When using proxy configuration, it is possible that the HTTP response does not come in a single frame, but multiple frames.
This will cause the authorization with the proxy failure with execption.
Changes
ProxyResponse
and implementationProxyResponseImpl
to save multiple frames into one response.ProxyImpl
and update validation logic by getting infomation fromProxyResponse
header.ProxyResponseResult
since all information are already saved inProxyResponse
.DigestProxyChallengeProcessorImpl
authentication logic since now we get types from header rather than error message.PROXY_HANDSHAKE_BUFFER_SIZE
from8 * 1024
to4 * 1024
.Test scenarios