Skip to content

Commit

Permalink
Renamed option flag to performFrameUnmasking
Browse files Browse the repository at this point in the history
Signed-off-by: stecolet@gmail.com <stecolet@gmail.com>
  • Loading branch information
stecolet authored and vietj committed Feb 2, 2017
1 parent 44abbef commit ac9efa9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
Expand Up @@ -92,9 +92,9 @@ public static void fromJson(JsonObject json, HttpClientOptions obj) {
if (json.getValue("verifyHost") instanceof Boolean) {
obj.setVerifyHost((Boolean)json.getValue("verifyHost"));
}
if(json.getValue("unmaskedFrame") instanceof Boolean)
if(json.getValue("performFrameUnmasking") instanceof Boolean)
{
obj.setUnmaskedFrame((Boolean)json.getValue("unmaskedFrame"));
obj.setPerformFrameUnmasking((Boolean)json.getValue("performFrameUnmasking"));
}
}

Expand Down
Expand Up @@ -68,9 +68,9 @@ public static void fromJson(JsonObject json, HttpServerOptions obj) {
if (json.getValue("websocketSubProtocols") instanceof String) {
obj.setWebsocketSubProtocols((String)json.getValue("websocketSubProtocols"));
}
if(json.getValue("unmaskedFrame") instanceof Boolean)
if(json.getValue("performFrameUnmasking") instanceof Boolean)
{
obj.setUnmaskedFrame((Boolean)json.getValue("unmaskedFrame"));
obj.setPerformFrameUnmasking((Boolean)json.getValue("performFrameUnmasking"));
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/io/vertx/core/http/HttpClientOptions.java
Expand Up @@ -159,7 +159,7 @@ public class HttpClientOptions extends ClientOptionsBase {
private Http2Settings initialSettings;
private List<HttpVersion> alpnVersions;
private boolean http2ClearTextUpgrade;
private boolean unmaskedFrame;
private boolean performFrameUnmasking;

/**
* Default constructor
Expand Down Expand Up @@ -196,7 +196,7 @@ public HttpClientOptions(HttpClientOptions other) {
this.initialSettings = other.initialSettings != null ? new Http2Settings(other.initialSettings) : null;
this.alpnVersions = other.alpnVersions != null ? new ArrayList<>(other.alpnVersions) : null;
this.http2ClearTextUpgrade = other.http2ClearTextUpgrade;
this.unmaskedFrame = other.isUnmaskedFrame();
this.performFrameUnmasking = other.isPerformFrameUnmasking();
}

/**
Expand Down Expand Up @@ -572,18 +572,18 @@ public HttpClientOptions setTryUseCompression(boolean tryUseCompression) {
* Is Unmasking frame enabled. It's false as default
* @return
*/
public boolean isUnmaskedFrame() {
return unmaskedFrame;
public boolean isPerformFrameUnmasking() {
return performFrameUnmasking;
}

/**
* Set whether unmasking frame is enabled
*
* @param unmaskedFrame true if enabled
* @param performFrameUnmasking true if enabled
* @return a reference to this, so the API can be used fluently
*/
public HttpClientOptions setUnmaskedFrame(boolean unmaskedFrame) {
this.unmaskedFrame = unmaskedFrame;
public HttpClientOptions setPerformFrameUnmasking(boolean performFrameUnmasking) {
this.performFrameUnmasking = performFrameUnmasking;
return this;
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/io/vertx/core/http/HttpServerOptions.java
Expand Up @@ -106,7 +106,7 @@ public class HttpServerOptions extends NetServerOptions {
private List<HttpVersion> alpnVersions;
private int http2ConnectionWindowSize;
private boolean decompressionSupported;
private boolean unmaskedFrame;
private boolean performFrameUnmasking;

/**
* Default constructor
Expand Down Expand Up @@ -136,7 +136,7 @@ public HttpServerOptions(HttpServerOptions other) {
this.alpnVersions = other.alpnVersions != null ? new ArrayList<>(other.alpnVersions) : null;
this.http2ConnectionWindowSize = other.http2ConnectionWindowSize;
this.decompressionSupported = other.isDecompressionSupported();
this.unmaskedFrame = other.isUnmaskedFrame();
this.performFrameUnmasking = other.isPerformFrameUnmasking();
}

/**
Expand Down Expand Up @@ -402,12 +402,12 @@ public HttpServerOptions setCompressionLevel(int compressionLevel) {
return this;
}

public boolean isUnmaskedFrame() {
return unmaskedFrame;
public boolean isPerformFrameUnmasking() {
return performFrameUnmasking;
}

public HttpServerOptions setUnmaskedFrame(boolean unmaskedFrame) {
this.unmaskedFrame = unmaskedFrame;
public HttpServerOptions setPerformFrameUnmasking(boolean performFrameUnmasking) {
this.performFrameUnmasking = performFrameUnmasking;
return this;
}

Expand Down
Expand Up @@ -136,7 +136,7 @@ synchronized void toWebSocket(String requestURI, MultiMap headers, WebsocketVers
nettyHeaders = null;
}
handshaker = WebSocketClientHandshakerFactory.newHandshaker(wsuri, version, subProtocols, false,
nettyHeaders, maxWebSocketFrameSize,!client.getOptions().isUnmaskedFrame(),false);
nettyHeaders, maxWebSocketFrameSize,!client.getOptions().isPerformFrameUnmasking(),false);
ChannelPipeline p = channel.pipeline();
p.addBefore("handler", "handshakeCompleter", new HandshakeInboundHandler(wsConnect, version != WebSocketVersion.V00));
handshaker.handshake(channel).addListener(future -> {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/vertx/core/http/impl/HttpServerImpl.java
Expand Up @@ -843,7 +843,7 @@ WebSocketServerHandshaker createHandshaker(Channel ch, HttpRequest request) {

WebSocketServerHandshakerFactory factory =
new WebSocketServerHandshakerFactory(getWebSocketLocation(ch.pipeline(), request), subProtocols, false,
options.getMaxWebsocketFrameSize(),options.isUnmaskedFrame());
options.getMaxWebsocketFrameSize(),options.isPerformFrameUnmasking());
WebSocketServerHandshaker shake = factory.newHandshaker(request);

if (shake == null) {
Expand Down
8 changes: 3 additions & 5 deletions src/test/java/io/vertx/test/core/WebsocketTest.java
Expand Up @@ -28,9 +28,7 @@
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.*;
import io.vertx.core.impl.ConcurrentHashSet;
import io.vertx.core.net.KeyCertOptions;
import io.vertx.core.net.NetSocket;
import io.vertx.core.net.TrustOptions;
import io.vertx.core.streams.ReadStream;
import io.vertx.test.core.tls.Cert;
import io.vertx.test.core.tls.Trust;
Expand Down Expand Up @@ -1204,8 +1202,8 @@ private void testUpgrade(boolean delayed) {
@Test
public void testUnmaskedFrameRequest(){

client = vertx.createHttpClient(new HttpClientOptions().setUnmaskedFrame(true));
server = vertx.createHttpServer(new HttpServerOptions().setPort(HttpTestBase.DEFAULT_HTTP_PORT).setUnmaskedFrame(true));
client = vertx.createHttpClient(new HttpClientOptions().setPerformFrameUnmasking(true));
server = vertx.createHttpServer(new HttpServerOptions().setPort(HttpTestBase.DEFAULT_HTTP_PORT).setPerformFrameUnmasking(true));
server.requestHandler(req -> {
req.response().setChunked(true).write("connect");
});
Expand All @@ -1231,7 +1229,7 @@ public void handle(Buffer data) {
@Test
public void testInvalidUnmaskedFrameRequest(){

client = vertx.createHttpClient(new HttpClientOptions().setUnmaskedFrame(true));
client = vertx.createHttpClient(new HttpClientOptions().setPerformFrameUnmasking(true));
server = vertx.createHttpServer(new HttpServerOptions().setPort(HttpTestBase.DEFAULT_HTTP_PORT));
server.requestHandler(req -> {
req.response().setChunked(true).write("connect");
Expand Down

0 comments on commit ac9efa9

Please sign in to comment.