-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add support for http2 prior knowledge mode. (#164) #179
Add support for http2 prior knowledge mode. (#164) #179
Conversation
What means : |
@jjtyro See Contributing , you could run |
@JervyShi OhOhOh, I ran 'mvn clean compile' and then I saw one line of code changed and I deleted the extra space. |
@JervyShi oraclejdk8 and openjdk6 successed. openjdk7 failed? why? |
@jjtyro You can figure it out or just retry. |
I run jdk7 again |
Codecov Report
@@ Coverage Diff @@
## master #179 +/- ##
============================================
+ Coverage 68.89% 69.02% +0.12%
- Complexity 951 955 +4
============================================
Files 341 341
Lines 14183 14194 +11
Branches 2276 2278 +2
============================================
+ Hits 9772 9797 +25
+ Misses 3241 3232 -9
+ Partials 1170 1165 -5
Continue to review full report at Codecov.
|
/** | ||
* Whether the Http2 Cleartext protocol client uses Prior Knowledge to start Http2 | ||
*/ | ||
public static final String TRANSPORT_H2C_USE_PRIOR_KNOWLEDGE = "transport.h2c.use_prior_knowledge"; |
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.
change to transport.client.h2c.usePriorKnowledge
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.
Ok
@@ -258,6 +258,8 @@ PS:大家也看到了,本JSON文档是支持注释的,而标准JSON是不支 | |||
"compress.open": false, | |||
// 开启压缩的大小基线 | |||
"compress.size.baseline": 2048, | |||
//Whether the Http2 Cleartext protocol client uses Prior Knowledge to start Http2 | |||
"transport.h2c.use_prior_knowledge": false, |
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.
default value can set to true
.
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.
Set false to keep the original default behavior of using upgrade h2c
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.
It 's ok to set true
because we know exactly the protocol of provider is h2c
.
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.
Ok, I changed it to true.
@@ -74,7 +83,11 @@ public void initChannel(SocketChannel ch) throws Exception { | |||
if (RpcConstants.PROTOCOL_TYPE_H2.equals(protocol)) { | |||
configureSsl(ch); | |||
} else if (RpcConstants.PROTOCOL_TYPE_H2C.equals(protocol)) { | |||
configureClearText(ch); | |||
if (!useH2cPriorKnowledge) { | |||
configureClearText(ch); |
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.
configureClearTextWithHttpUgrade()
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.
Ok. I will modify it.
if (!useH2cPriorKnowledge) { | ||
configureClearText(ch); | ||
} else { | ||
configureClearTextPriorKnowledge(ch); |
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.
configureClearTextWithPriorKnowledge()
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.
Ok. I will modify it.
private static class PrefaceFrameWrittenEventHandler extends ChannelInboundHandlerAdapter { | ||
@Override | ||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { | ||
System.out.println("User Event Handler :" + evt.toString()); |
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.
Use LOGGER
instead of System.out.println
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.
ah, it is learned from previous code's UserEventLogger, I will change it
RpcConfigs.putValue("transport.client.h2c.usePriorKnowledge", false); | ||
ActivelyDestroyTest.adBeforeClass(); | ||
} | ||
|
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.
Should add @AfterClass
method for reset default value of transport.client.h2c.usePriorKnowledge
, and use RpcOptions.TRANSPORT_CLIENT_H2C_USE_PRIOR_KNOWLEDGE
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.
Ok!
…_USE_PRIOR_KNOWLEDGE in Test code
Fixes #164
Add some code for http transport to support http2 Prior-Knowledge mode connection.