Issue #207 - allowing untrusted sessions to have non-validating generators

This commit is contained in:
Joakim Erdfelt 2017-04-21 17:21:47 -07:00
parent 36f40689cc
commit 1d18522a99
2 changed files with 17 additions and 4 deletions

View File

@ -62,8 +62,9 @@ public class Generator
private final WebSocketBehavior behavior;
private final ByteBufferPool bufferPool;
private final boolean validating;
private final boolean readOnly;
private boolean validating = true;
/**
* Are any flags in use
@ -374,7 +375,12 @@ public class Generator
{
return bufferPool;
}
public boolean isValidating()
{
return validating;
}
public void setRsv1InUse(boolean rsv1InUse)
{
if (readOnly)
@ -401,7 +407,12 @@ public class Generator
}
flagsInUse = (byte)((flagsInUse & 0xEF) | (rsv3InUse?0x10:0x00));
}
public void setValidating(boolean validating)
{
this.validating = validating;
}
public boolean isRsv1InUse()
{
return (flagsInUse & 0x40) != 0;

View File

@ -33,7 +33,9 @@ public class UntrustedWSSession extends WebSocketSession implements AutoCloseabl
public UntrustedWSSession(WebSocketContainerScope containerScope, URI requestURI, Object endpoint, LogicalConnection connection)
{
super(containerScope, requestURI, endpoint, connection);
this.untrustedConnection = new UntrustedWSConnection((AbstractWebSocketConnection) connection);
AbstractWebSocketConnection abstractWebSocketConnection = (AbstractWebSocketConnection) connection;
abstractWebSocketConnection.getGenerator().setValidating(false);
this.untrustedConnection = new UntrustedWSConnection(abstractWebSocketConnection);
this.untrustedEndpoint = (UntrustedWSEndpoint) endpoint;
}