353073 allows null masks for websocket client
This commit is contained in:
parent
68d562008e
commit
a7a45bf7d9
|
@ -36,6 +36,7 @@ import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
import org.eclipse.jetty.util.thread.ThreadPool;
|
||||||
|
import org.eclipse.jetty.websocket.WebSocketGeneratorD12.MaskGen;
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -88,6 +89,7 @@ public class WebSocketClient extends AggregateLifeCycle
|
||||||
private int _maxIdleTime=-1;
|
private int _maxIdleTime=-1;
|
||||||
|
|
||||||
private WebSocketBuffers _buffers;
|
private WebSocketBuffers _buffers;
|
||||||
|
private boolean _nullMask;
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -234,6 +236,24 @@ public class WebSocketClient extends AggregateLifeCycle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
/**
|
||||||
|
* @return True if a null mask is used.
|
||||||
|
*/
|
||||||
|
public boolean isNullMask()
|
||||||
|
{
|
||||||
|
return _nullMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
/**
|
||||||
|
* @param maskGen
|
||||||
|
*/
|
||||||
|
public void setNullMaskGen(boolean nullMask)
|
||||||
|
{
|
||||||
|
_nullMask=nullMask;
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/** Open a WebSocket connection.
|
/** Open a WebSocket connection.
|
||||||
* Open a websocket connection to the URI and block until the connection is accepted or there is an error.
|
* Open a websocket connection to the URI and block until the connection is accepted or there is an error.
|
||||||
|
@ -531,7 +551,8 @@ public class WebSocketClient extends AggregateLifeCycle
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Buffer header=_parser.getHeaderBuffer();
|
Buffer header=_parser.getHeaderBuffer();
|
||||||
WebSocketConnectionD12 connection = new WebSocketConnectionD12(_holder.getWebSocket(),_endp,_buffers,System.currentTimeMillis(),_holder.getMaxIdleTime(),_holder.getProtocol(),null,10, new WebSocketGeneratorD12.RandomMaskGen());
|
MaskGen maskGen=_nullMask?new WebSocketGeneratorD12.FixedMaskGen():new WebSocketGeneratorD12.RandomMaskGen();
|
||||||
|
WebSocketConnectionD12 connection = new WebSocketConnectionD12(_holder.getWebSocket(),_endp,_buffers,System.currentTimeMillis(),_holder.getMaxIdleTime(),_holder.getProtocol(),null,10,maskGen);
|
||||||
|
|
||||||
if (header.hasContent())
|
if (header.hasContent())
|
||||||
connection.fillBuffersFrom(header);
|
connection.fillBuffersFrom(header);
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
package org.eclipse.jetty.websocket;
|
package org.eclipse.jetty.websocket;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
|
|
Loading…
Reference in New Issue