You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2016/12/17 11:36:21 UTC
svn commit: r1774743 - in
/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2:
config/H2Config.java impl/nio/AbstractHttp2StreamMultiplexer.java
Author: olegk
Date: Sat Dec 17 11:36:20 2016
New Revision: 1774743
URL: http://svn.apache.org/viewvc?rev=1774743&view=rev
Log:
Added flag to enable immediate message exchange initiation without waiting for setting ack from the opposite endpoint (required for compatibility with Apache HTTP server 2.4)
Modified:
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java?rev=1774743&r1=1774742&r2=1774743&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java Sat Dec 17 11:36:20 2016
@@ -48,9 +48,11 @@ public class H2Config {
private final int initialWindowSize;
private final int maxFrameSize;
private final int maxHeaderListSize;
+ private final boolean settingAckNeeded;
H2Config(final int headerTableSize, final boolean pushEnabled, final int maxConcurrentStreams,
- final int initialWindowSize, final int maxFrameSize, final int maxHeaderListSize) {
+ final int initialWindowSize, final int maxFrameSize, final int maxHeaderListSize,
+ final boolean settingAckNeeded) {
super();
this.headerTableSize = headerTableSize;
this.pushEnabled = pushEnabled;
@@ -58,6 +60,7 @@ public class H2Config {
this.initialWindowSize = initialWindowSize;
this.maxFrameSize = maxFrameSize;
this.maxHeaderListSize = maxHeaderListSize;
+ this.settingAckNeeded = settingAckNeeded;
}
public int getHeaderTableSize() {
@@ -84,6 +87,10 @@ public class H2Config {
return maxHeaderListSize;
}
+ public boolean isSettingAckNeeded() {
+ return settingAckNeeded;
+ }
+
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
@@ -93,6 +100,7 @@ public class H2Config {
.append(", initialWindowSize=").append(this.initialWindowSize)
.append(", maxFrameSize=").append(this.maxFrameSize)
.append(", maxHeaderListSize=").append(this.maxHeaderListSize)
+ .append(", settingAckNeeded=").append(this.settingAckNeeded)
.append("]");
return builder.toString();
}
@@ -109,7 +117,8 @@ public class H2Config {
.setMaxConcurrentStreams(config.getMaxConcurrentStreams())
.setInitialWindowSize(config.getInitialWindowSize())
.setMaxFrameSize(config.getMaxFrameSize())
- .setMaxHeaderListSize(config.getMaxHeaderListSize());
+ .setMaxHeaderListSize(config.getMaxHeaderListSize())
+ .setSettingAckNeeded(config.isSettingAckNeeded());
}
public static class Builder {
@@ -120,6 +129,7 @@ public class H2Config {
private int initialWindowSize;
private int maxFrameSize;
private int maxHeaderListSize;
+ private boolean settingAckNeeded;
Builder() {
this.headerTableSize = 8192;
@@ -128,6 +138,7 @@ public class H2Config {
this.initialWindowSize = 65535;
this.maxFrameSize = FrameConsts.MIN_FRAME_SIZE * 4;
this.maxHeaderListSize = FrameConsts.MAX_FRAME_SIZE;
+ this.settingAckNeeded = true;
}
public Builder setHeaderTableSize(final int headerTableSize) {
@@ -165,9 +176,15 @@ public class H2Config {
return this;
}
+ public Builder setSettingAckNeeded(final boolean settingAckNeeded) {
+ this.settingAckNeeded = settingAckNeeded;
+ return this;
+ }
+
public H2Config build() {
return new H2Config(
- headerTableSize, pushEnabled, maxConcurrentStreams, initialWindowSize, maxFrameSize, maxHeaderListSize);
+ headerTableSize, pushEnabled, maxConcurrentStreams, initialWindowSize, maxFrameSize, maxHeaderListSize,
+ settingAckNeeded);
}
}
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java?rev=1774743&r1=1774742&r2=1774743&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java Sat Dec 17 11:36:20 2016
@@ -476,7 +476,8 @@ abstract class AbstractHttp2StreamMultip
}
}
- if (connState == ConnectionHandshake.ACTIVE && remoteSettingState == SettingsHandshake.ACKED) {
+ if (connState == ConnectionHandshake.ACTIVE
+ && (remoteSettingState == SettingsHandshake.ACKED || !localConfig.isSettingAckNeeded())) {
processPendingCommands();
} else if (connState == ConnectionHandshake.SHUTDOWN) {
outputLock.lock();