diff --git a/db/knex_migrations/2025-02-15-2312-add-wstest.js b/db/knex_migrations/2025-02-15-2312-add-wstest.js index 36f81acfa..437368780 100644 --- a/db/knex_migrations/2025-02-15-2312-add-wstest.js +++ b/db/knex_migrations/2025-02-15-2312-add-wstest.js @@ -2,14 +2,14 @@ exports.up = function (knex) { return knex.schema .alterTable("monitor", function (table) { - table.boolean("ws_ignore_headers").notNullable().defaultTo(false); - table.string("subprotocol", 255).notNullable().defaultTo(""); + table.boolean("ws_ignore_sec_websocket_accept_header").notNullable().defaultTo(false); + table.string("ws_subprotocol", 255).notNullable().defaultTo(""); }); }; exports.down = function (knex) { return knex.schema.alterTable("monitor", function (table) { - table.dropColumn("ws_ignore_headers"); - table.dropColumn("subprotocol"); + table.dropColumn("ws_ignore_sec_websocket_accept_header"); + table.dropColumn("ws_subprotocol"); }); }; diff --git a/server/model/monitor.js b/server/model/monitor.js index e5f2f4499..b984a9c8c 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -96,8 +96,8 @@ class Monitor extends BeanModel { parent: this.parent, childrenIDs: preloadData.childrenIDs.get(this.id) || [], url: this.url, - wsIgnoreHeaders: this.getWsIgnoreHeaders(), - subprotocol: this.subprotocol, + wsIgnoreSecWebsocketAcceptHeader: this.getWsIgnoreSecWebsocketAcceptHeader(), + wsSubprotocol: this.wsSubprotocol, method: this.method, hostname: this.hostname, port: this.port, @@ -261,8 +261,8 @@ class Monitor extends BeanModel { * Parse to boolean * @returns {boolean} Should WS headers be ignored? */ - getWsIgnoreHeaders() { - return Boolean(this.wsIgnoreHeaders); + getWsIgnoreSecWebsocketAcceptHeader() { + return Boolean(this.wsIgnoreSecWebsocketAcceptHeader); } /** diff --git a/server/monitor-types/websocket-upgrade.js b/server/monitor-types/websocket-upgrade.js index 8b2b64be3..e85c4baa7 100644 --- a/server/monitor-types/websocket-upgrade.js +++ b/server/monitor-types/websocket-upgrade.js @@ -23,7 +23,7 @@ class WebSocketMonitorType extends MonitorType { return new Promise((resolve) => { let ws; //If user selected a subprotocol, sets Sec-WebSocket-Protocol header. Subprotocol Identifier column: https://www.iana.org/assignments/websocket/websocket.xml#subprotocol-name - ws = monitor.subprotocol === "" ? new WebSocket(monitor.url) : new WebSocket(monitor.url, monitor.subprotocol); + ws = monitor.wsSubprotocol === "" ? new WebSocket(monitor.url) : new WebSocket(monitor.url, monitor.wsSubprotocol); ws.addEventListener("open", (event) => { // Immediately close the connection @@ -32,7 +32,7 @@ class WebSocketMonitorType extends MonitorType { ws.onerror = (error) => { // Give user the choice to ignore Sec-WebSocket-Accept header - if (monitor.wsIgnoreHeaders && error.message === "Invalid Sec-WebSocket-Accept header") { + if (monitor.wsIgnoreSecWebsocketAcceptHeader && error.message === "Invalid Sec-WebSocket-Accept header") { resolve([ "101 - OK", 1000 ]); } // Upgrade failed, return message to user diff --git a/server/server.js b/server/server.js index 2d5a911e0..78a7fba37 100644 --- a/server/server.js +++ b/server/server.js @@ -790,8 +790,8 @@ let needSetup = false; bean.parent = monitor.parent; bean.type = monitor.type; bean.url = monitor.url; - bean.wsIgnoreHeaders = monitor.wsIgnoreHeaders; - bean.subprotocol = monitor.subprotocol; + bean.wsIgnoreSecWebsocketAcceptHeader = monitor.wsIgnoreSecWebsocketAcceptHeader; + bean.wsSubprotocol = monitor.wsSubprotocol; bean.method = monitor.method; bean.body = monitor.body; bean.headers = monitor.headers; diff --git a/src/lang/en.json b/src/lang/en.json index 22d5ac2e2..b91eb6aff 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -86,39 +86,39 @@ "ignoreTLSError": "Ignore TLS/SSL errors for HTTPS websites", "ignoreTLSErrorGeneral": "Ignore TLS/SSL error for connection", "upsideDownModeDescription": "Flip the status upside down. If the service is reachable, it is DOWN.", - "wsIgnoreHeadersDescription": "The websocket upgrade succeeds, but the server does not reply with Sec-WebSocket-Accept header.", - "Ignore Sec-WebSocket-Accept header": "Ignore Sec-WebSocket-Accept header", - "wamp": "WAMP (The WebSocket Application Messaging Protocol)", - "sip": "WebSocket Transport for SIP (Session Initiation Protocol)", - "notificationchannel-netapi-rest.openmobilealliance.org": "OMA RESTful Network API for Notification Channel", - "wpcp": "Web Process Control Protocol (WPCP)", - "amqp": "Advanced Message Queuing Protocol (AMQP) 1.0+", - "jsflow": "jsFlow pubsub/queue protocol", - "rwpcp": "Reverse Web Process Control Protocol (RWPCP)", - "xmpp": "WebSocket Transport for the Extensible Messaging and Presence Protocol (XMPP)", - "ship": "SHIP - Smart Home IP", - "mielecloudconnect": "Miele Cloud Connect Protocol", - "v10.pcp.sap.com": "Push Channel Protocol", - "msrp": "WebSocket Transport for MSRP (Message Session Relay Protocol)", - "bfcp": "WebSocket Transport for BFCP (Binary Floor Control Protocol)", - "sldp.softvelum.com": "Softvelum Low Delay Protocol", - "opcua+uacp": "OPC UA Connection Protocol", - "opcua+uajson": "OPC UA JSON Encoding", - "v1.swindon-lattice+json": "Swindon Web Server Protocol (JSON encoding)", - "v1.usp": "USP (Broadband Forum User Services Platform)", - "coap": "Constrained Application Protocol (CoAP)", - "webrtc.softvelum.com": "Softvelum WebSocket signaling protocol", - "cobra.v2.json": "Cobra Real Time Messaging Protocol", - "drp": "Declarative Resource Protocol", - "hub.bsc.bacnet.org": "BACnet Secure Connect Hub Connection", - "dc.bsc.bacnet.org": "BACnet Secure Connect Direct Connection", - "jmap": "WebSocket Transport for JMAP (JSON Meta Application Protocol)", - "t140": "ITU-T T.140 Real-Time Text", - "done": "Done.best IoT Protocol", - "collection-update": "The Collection Update Websocket Subprotocol", - "text.ircv3.net": "Text IRC Protocol", - "binary.ircv3.net": "Binary IRC Protocol", - "v3.penguin-stats.live+proto": "Penguin Statistics Live Protocol v3 (Protobuf encoding)", + "ignoreSecWebsocketAcceptHeaderDescription": "Allows the server to not reply with Sec-WebSocket-Accept header, if the websocket upgrade succeeds.", + "Ignore Sec-WebSocket-Accept header": "Ignore {0} header", + "WebSocket Application Messaging Protocol": "WAMP (The WebSocket Application Messaging Protocol)", + "Session Initiation Protocol": "WebSocket Transport for SIP (Session Initiation Protocol)", + "Network API for Notification Channel": "OMA RESTful Network API for Notification Channel", + "Web Process Control Protocol": "Web Process Control Protocol (WPCP)", + "Advanced Message Queuing Protocol": "Advanced Message Queuing Protocol (AMQP) 1.0+", + "jsflow": "jsFlow pubsub/queue Protocol", + "Reverse Web Process Control": "Reverse Web Process Control Protocol (RWPCP)", + "Extensible Messaging and Presence Protocol": "WebSocket Transport for the Extensible Messaging and Presence Protocol (XMPP)", + "Smart Home IP": "SHIP - Smart Home IP", + "Miele Cloud Connect Protocol": "Miele Cloud Connect Protocol", + "Push Channel Protocol": "Push Channel Protocol", + "Message Session Relay Protocol": "WebSocket Transport for MSRP (Message Session Relay Protocol)", + "Binary Floor Control Protocol": "WebSocket Transport for BFCP (Binary Floor Control Protocol)", + "Softvelum Low Delay Protocol": "Softvelum Low Delay Protocol", + "OPC UA Connection Protocol": "OPC UA Connection Protocol", + "OPC UA JSON Encoding": "OPC UA JSON Encoding", + "Swindon Web Server Protocol": "Swindon Web Server Protocol (JSON encoding)", + "Broadband Forum User Services Platform": "USP (Broadband Forum User Services Platform)", + "Constrained Application Protocol": "Constrained Application Protocol (CoAP)", + "Softvelum WebSocket signaling protocol": "Softvelum WebSocket Signaling Protocol", + "Cobra Real Time Messaging Protocol": "Cobra Real Time Messaging Protocol", + "Declarative Resource Protocol": "Declarative Resource Protocol", + "BACnet Secure Connect Hub Connection": "BACnet Secure Connect Hub Connection", + "BACnet Secure Connect Direct Connection": "BACnet Secure Connect Direct Connection", + "WebSocket Transport for JMAP": "WebSocket Transport for JMAP (JSON Meta Application Protocol)", + "ITU-T T.140 Real-Time Text": "ITU-T T.140 Real-Time Text", + "Done.best IoT Protocol": "Done.best IoT Protocol", + "Collection Update": "The Collection Update Websocket Subprotocol", + "Text IRC Protocol": "Text IRC Protocol", + "Binary IRC Protocol": "Binary IRC Protocol", + "Penguin Statistics Live Protocol v3": "Penguin Statistics Live Protocol v3 (Protobuf encoding)", "maxRedirectDescription": "Maximum number of redirects to follow. Set to 0 to disable redirects.", "Upside Down Mode": "Upside Down Mode", "Max. Redirects": "Max. Redirects", diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index aa686850b..27832d0a6 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -122,15 +122,15 @@ - +
Sec-Websocket-Accept
+