Make handleRequest optional in WebSocketResources
If no request handler is provided, respond with 404 to any incoming requests.
This commit is contained in:
parent
cd363bd84d
commit
637cbcbf99
2 changed files with 16 additions and 2 deletions
|
@ -38563,7 +38563,14 @@ TextSecureWebSocket = function (url, opts) {
|
|||
);
|
||||
};
|
||||
|
||||
window.WebSocketResource = function(socket, handleRequest, keepalive) {
|
||||
window.WebSocketResource = function(socket, opts) {
|
||||
opts = opts || {};
|
||||
var handleRequest = opts.handleRequest;
|
||||
if (typeof handleRequest !== 'function') {
|
||||
handleRequest = function(request) {
|
||||
request.respond(404);
|
||||
};
|
||||
}
|
||||
this.sendRequest = function(options) {
|
||||
return new OutgoingWebSocketRequest(options, socket);
|
||||
};
|
||||
|
|
|
@ -92,7 +92,14 @@
|
|||
);
|
||||
};
|
||||
|
||||
window.WebSocketResource = function(socket, handleRequest, keepalive) {
|
||||
window.WebSocketResource = function(socket, opts) {
|
||||
opts = opts || {};
|
||||
var handleRequest = opts.handleRequest;
|
||||
if (typeof handleRequest !== 'function') {
|
||||
handleRequest = function(request) {
|
||||
request.respond(404);
|
||||
};
|
||||
}
|
||||
this.sendRequest = function(options) {
|
||||
return new OutgoingWebSocketRequest(options, socket);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue