Index: trip-planner-front/node_modules/ws/lib/websocket.js
===================================================================
--- trip-planner-front/node_modules/ws/lib/websocket.js	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner-front/node_modules/ws/lib/websocket.js	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -2,14 +2,12 @@
 
 const EventEmitter = require('events');
-const crypto = require('crypto');
 const https = require('https');
 const http = require('http');
 const net = require('net');
 const tls = require('tls');
-const url = require('url');
+const { randomBytes, createHash } = require('crypto');
+const { URL } = require('url');
 
 const PerMessageDeflate = require('./permessage-deflate');
-const EventTarget = require('./event-target');
-const extension = require('./extension');
 const Receiver = require('./receiver');
 const Sender = require('./sender');
@@ -22,4 +20,7 @@
   NOOP
 } = require('./constants');
+const { addEventListener, removeEventListener } = require('./event-target');
+const { format, parse } = require('./extension');
+const { toBuffer } = require('./buffer-util');
 
 const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
@@ -36,21 +37,20 @@
    * Create a new `WebSocket`.
    *
-   * @param {(String|url.Url|url.URL)} address The URL to which to connect
-   * @param {(String|String[])} protocols The subprotocols
-   * @param {Object} options Connection options
+   * @param {(String|url.URL)} address The URL to which to connect
+   * @param {(String|String[])} [protocols] The subprotocols
+   * @param {Object} [options] Connection options
    */
   constructor(address, protocols, options) {
     super();
 
-    this.readyState = WebSocket.CONNECTING;
-    this.protocol = '';
-
     this._binaryType = BINARY_TYPES[0];
+    this._closeCode = 1006;
     this._closeFrameReceived = false;
     this._closeFrameSent = false;
     this._closeMessage = '';
     this._closeTimer = null;
-    this._closeCode = 1006;
     this._extensions = {};
+    this._protocol = '';
+    this._readyState = WebSocket.CONNECTING;
     this._receiver = null;
     this._sender = null;
@@ -58,4 +58,5 @@
 
     if (address !== null) {
+      this._bufferedAmount = 0;
       this._isServer = false;
       this._redirects = 0;
@@ -74,17 +75,4 @@
   }
 
-  get CONNECTING() {
-    return WebSocket.CONNECTING;
-  }
-  get CLOSING() {
-    return WebSocket.CLOSING;
-  }
-  get CLOSED() {
-    return WebSocket.CLOSED;
-  }
-  get OPEN() {
-    return WebSocket.OPEN;
-  }
-
   /**
    * This deviates from the WHATWG interface since ws doesn't support the
@@ -113,10 +101,7 @@
    */
   get bufferedAmount() {
-    if (!this._socket) return 0;
-
-    //
-    // `socket.bufferSize` is `undefined` if the socket is closed.
-    //
-    return (this._socket.bufferSize || 0) + this._sender._bufferedBytes;
+    if (!this._socket) return this._bufferedAmount;
+
+    return this._socket._writableState.length + this._sender._bufferedBytes;
   }
 
@@ -126,4 +111,25 @@
   get extensions() {
     return Object.keys(this._extensions).join();
+  }
+
+  /**
+   * @type {String}
+   */
+  get protocol() {
+    return this._protocol;
+  }
+
+  /**
+   * @type {Number}
+   */
+  get readyState() {
+    return this._readyState;
+  }
+
+  /**
+   * @type {String}
+   */
+  get url() {
+    return this._url;
   }
 
@@ -133,11 +139,12 @@
    * @param {net.Socket} socket The network socket between the server and client
    * @param {Buffer} head The first packet of the upgraded stream
-   * @param {Number} maxPayload The maximum allowed message size
+   * @param {Number} [maxPayload=0] The maximum allowed message size
    * @private
    */
   setSocket(socket, head, maxPayload) {
     const receiver = new Receiver(
-      this._binaryType,
+      this.binaryType,
       this._extensions,
+      this._isServer,
       maxPayload
     );
@@ -167,5 +174,5 @@
     socket.on('error', socketOnError);
 
-    this.readyState = WebSocket.OPEN;
+    this._readyState = WebSocket.OPEN;
     this.emit('open');
   }
@@ -177,7 +184,6 @@
    */
   emitClose() {
-    this.readyState = WebSocket.CLOSED;
-
     if (!this._socket) {
+      this._readyState = WebSocket.CLOSED;
       this.emit('close', this._closeCode, this._closeMessage);
       return;
@@ -189,4 +195,5 @@
 
     this._receiver.removeAllListeners();
+    this._readyState = WebSocket.CLOSED;
     this.emit('close', this._closeCode, this._closeMessage);
   }
@@ -207,6 +214,6 @@
    *              +---+
    *
-   * @param {Number} code Status code explaining why the connection is closing
-   * @param {String} data A string explaining why the connection is closing
+   * @param {Number} [code] Status code explaining why the connection is closing
+   * @param {String} [data] A string explaining why the connection is closing
    * @public
    */
@@ -223,5 +230,5 @@
     }
 
-    this.readyState = WebSocket.CLOSING;
+    this._readyState = WebSocket.CLOSING;
     this._sender.close(code, data, !this._isServer, (err) => {
       //
@@ -247,10 +254,14 @@
    * Send a ping.
    *
-   * @param {*} data The data to send
-   * @param {Boolean} mask Indicates whether or not to mask `data`
-   * @param {Function} cb Callback which is executed when the ping is sent
+   * @param {*} [data] The data to send
+   * @param {Boolean} [mask] Indicates whether or not to mask `data`
+   * @param {Function} [cb] Callback which is executed when the ping is sent
    * @public
    */
   ping(data, mask, cb) {
+    if (this.readyState === WebSocket.CONNECTING) {
+      throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
+    }
+
     if (typeof data === 'function') {
       cb = data;
@@ -261,15 +272,11 @@
     }
 
+    if (typeof data === 'number') data = data.toString();
+
     if (this.readyState !== WebSocket.OPEN) {
-      const err = new Error(
-        `WebSocket is not open: readyState ${this.readyState} ` +
-          `(${readyStates[this.readyState]})`
-      );
-
-      if (cb) return cb(err);
-      throw err;
-    }
-
-    if (typeof data === 'number') data = data.toString();
+      sendAfterClose(this, data, cb);
+      return;
+    }
+
     if (mask === undefined) mask = !this._isServer;
     this._sender.ping(data || EMPTY_BUFFER, mask, cb);
@@ -279,10 +286,14 @@
    * Send a pong.
    *
-   * @param {*} data The data to send
-   * @param {Boolean} mask Indicates whether or not to mask `data`
-   * @param {Function} cb Callback which is executed when the pong is sent
+   * @param {*} [data] The data to send
+   * @param {Boolean} [mask] Indicates whether or not to mask `data`
+   * @param {Function} [cb] Callback which is executed when the pong is sent
    * @public
    */
   pong(data, mask, cb) {
+    if (this.readyState === WebSocket.CONNECTING) {
+      throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
+    }
+
     if (typeof data === 'function') {
       cb = data;
@@ -293,15 +304,11 @@
     }
 
+    if (typeof data === 'number') data = data.toString();
+
     if (this.readyState !== WebSocket.OPEN) {
-      const err = new Error(
-        `WebSocket is not open: readyState ${this.readyState} ` +
-          `(${readyStates[this.readyState]})`
-      );
-
-      if (cb) return cb(err);
-      throw err;
-    }
-
-    if (typeof data === 'number') data = data.toString();
+      sendAfterClose(this, data, cb);
+      return;
+    }
+
     if (mask === undefined) mask = !this._isServer;
     this._sender.pong(data || EMPTY_BUFFER, mask, cb);
@@ -312,13 +319,20 @@
    *
    * @param {*} data The message to send
-   * @param {Object} options Options object
-   * @param {Boolean} options.compress Specifies whether or not to compress `data`
-   * @param {Boolean} options.binary Specifies whether `data` is binary or text
-   * @param {Boolean} options.fin Specifies whether the fragment is the last one
-   * @param {Boolean} options.mask Specifies whether or not to mask `data`
-   * @param {Function} cb Callback which is executed when data is written out
+   * @param {Object} [options] Options object
+   * @param {Boolean} [options.compress] Specifies whether or not to compress
+   *     `data`
+   * @param {Boolean} [options.binary] Specifies whether `data` is binary or
+   *     text
+   * @param {Boolean} [options.fin=true] Specifies whether the fragment is the
+   *     last one
+   * @param {Boolean} [options.mask] Specifies whether or not to mask `data`
+   * @param {Function} [cb] Callback which is executed when data is written out
    * @public
    */
   send(data, options, cb) {
+    if (this.readyState === WebSocket.CONNECTING) {
+      throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
+    }
+
     if (typeof options === 'function') {
       cb = options;
@@ -326,25 +340,18 @@
     }
 
+    if (typeof data === 'number') data = data.toString();
+
     if (this.readyState !== WebSocket.OPEN) {
-      const err = new Error(
-        `WebSocket is not open: readyState ${this.readyState} ` +
-          `(${readyStates[this.readyState]})`
-      );
-
-      if (cb) return cb(err);
-      throw err;
-    }
-
-    if (typeof data === 'number') data = data.toString();
-
-    const opts = Object.assign(
-      {
-        binary: typeof data !== 'string',
-        mask: !this._isServer,
-        compress: true,
-        fin: true
-      },
-      options
-    );
+      sendAfterClose(this, data, cb);
+      return;
+    }
+
+    const opts = {
+      binary: typeof data !== 'string',
+      mask: !this._isServer,
+      compress: true,
+      fin: true,
+      ...options
+    };
 
     if (!this._extensions[PerMessageDeflate.extensionName]) {
@@ -368,5 +375,5 @@
 
     if (this._socket) {
-      this.readyState = WebSocket.CLOSING;
+      this._readyState = WebSocket.CLOSING;
       this._socket.destroy();
     }
@@ -375,5 +382,19 @@
 
 readyStates.forEach((readyState, i) => {
-  WebSocket[readyState] = i;
+  const descriptor = { enumerable: true, value: i };
+
+  Object.defineProperty(WebSocket.prototype, readyState, descriptor);
+  Object.defineProperty(WebSocket, readyState, descriptor);
+});
+
+[
+  'binaryType',
+  'bufferedAmount',
+  'extensions',
+  'protocol',
+  'readyState',
+  'url'
+].forEach((property) => {
+  Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
 });
 
@@ -384,4 +405,6 @@
 ['open', 'error', 'close', 'message'].forEach((method) => {
   Object.defineProperty(WebSocket.prototype, `on${method}`, {
+    configurable: true,
+    enumerable: true,
     /**
      * Return the listener of the event.
@@ -392,5 +415,5 @@
     get() {
       const listeners = this.listeners(method);
-      for (var i = 0; i < listeners.length; i++) {
+      for (let i = 0; i < listeners.length; i++) {
         if (listeners[i]._listener) return listeners[i]._listener;
       }
@@ -406,5 +429,5 @@
     set(listener) {
       const listeners = this.listeners(method);
-      for (var i = 0; i < listeners.length; i++) {
+      for (let i = 0; i < listeners.length; i++) {
         //
         // Remove only the listeners added via `addEventListener`.
@@ -417,6 +440,6 @@
 });
 
-WebSocket.prototype.addEventListener = EventTarget.addEventListener;
-WebSocket.prototype.removeEventListener = EventTarget.removeEventListener;
+WebSocket.prototype.addEventListener = addEventListener;
+WebSocket.prototype.removeEventListener = removeEventListener;
 
 module.exports = WebSocket;
@@ -426,43 +449,41 @@
  *
  * @param {WebSocket} websocket The client to initialize
- * @param {(String|url.Url|url.URL)} address The URL to which to connect
- * @param {String} protocols The subprotocols
- * @param {Object} options Connection options
- * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable
+ * @param {(String|url.URL)} address The URL to which to connect
+ * @param {String} [protocols] The subprotocols
+ * @param {Object} [options] Connection options
+ * @param {(Boolean|Object)} [options.perMessageDeflate=true] Enable/disable
  *     permessage-deflate
- * @param {Number} options.handshakeTimeout Timeout in milliseconds for the
+ * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
  *     handshake request
- * @param {Number} options.protocolVersion Value of the `Sec-WebSocket-Version`
- *     header
- * @param {String} options.origin Value of the `Origin` or
+ * @param {Number} [options.protocolVersion=13] Value of the
+ *     `Sec-WebSocket-Version` header
+ * @param {String} [options.origin] Value of the `Origin` or
  *     `Sec-WebSocket-Origin` header
- * @param {Number} options.maxPayload The maximum allowed message size
- * @param {Boolean} options.followRedirects Whether or not to follow redirects
- * @param {Number} options.maxRedirects The maximum number of redirects allowed
+ * @param {Number} [options.maxPayload=104857600] The maximum allowed message
+ *     size
+ * @param {Boolean} [options.followRedirects=false] Whether or not to follow
+ *     redirects
+ * @param {Number} [options.maxRedirects=10] The maximum number of redirects
+ *     allowed
  * @private
  */
 function initAsClient(websocket, address, protocols, options) {
-  const opts = Object.assign(
-    {
-      protocolVersion: protocolVersions[1],
-      maxPayload: 100 * 1024 * 1024,
-      perMessageDeflate: true,
-      followRedirects: false,
-      maxRedirects: 10
-    },
-    options,
-    {
-      createConnection: undefined,
-      socketPath: undefined,
-      hostname: undefined,
-      protocol: undefined,
-      timeout: undefined,
-      method: undefined,
-      auth: undefined,
-      host: undefined,
-      path: undefined,
-      port: undefined
-    }
-  );
+  const opts = {
+    protocolVersion: protocolVersions[1],
+    maxPayload: 100 * 1024 * 1024,
+    perMessageDeflate: true,
+    followRedirects: false,
+    maxRedirects: 10,
+    ...options,
+    createConnection: undefined,
+    socketPath: undefined,
+    hostname: undefined,
+    protocol: undefined,
+    timeout: undefined,
+    method: undefined,
+    host: undefined,
+    path: undefined,
+    port: undefined
+  };
 
   if (!protocolVersions.includes(opts.protocolVersion)) {
@@ -473,15 +494,12 @@
   }
 
-  var parsedUrl;
-
-  if (typeof address === 'object' && address.href !== undefined) {
+  let parsedUrl;
+
+  if (address instanceof URL) {
     parsedUrl = address;
-    websocket.url = address.href;
+    websocket._url = address.href;
   } else {
-    //
-    // The WHATWG URL constructor is not available on Node.js < 6.13.0
-    //
-    parsedUrl = url.URL ? new url.URL(address) : url.parse(address);
-    websocket.url = address;
+    parsedUrl = new URL(address);
+    websocket._url = address;
   }
 
@@ -495,10 +513,7 @@
     parsedUrl.protocol === 'wss:' || parsedUrl.protocol === 'https:';
   const defaultPort = isSecure ? 443 : 80;
-  const key = crypto.randomBytes(16).toString('base64');
+  const key = randomBytes(16).toString('base64');
   const get = isSecure ? https.get : http.get;
-  const path = parsedUrl.search
-    ? `${parsedUrl.pathname || '/'}${parsedUrl.search}`
-    : parsedUrl.pathname || '/';
-  var perMessageDeflate;
+  let perMessageDeflate;
 
   opts.createConnection = isSecure ? tlsConnect : netConnect;
@@ -508,14 +523,12 @@
     ? parsedUrl.hostname.slice(1, -1)
     : parsedUrl.hostname;
-  opts.headers = Object.assign(
-    {
-      'Sec-WebSocket-Version': opts.protocolVersion,
-      'Sec-WebSocket-Key': key,
-      Connection: 'Upgrade',
-      Upgrade: 'websocket'
-    },
-    opts.headers
-  );
-  opts.path = path;
+  opts.headers = {
+    'Sec-WebSocket-Version': opts.protocolVersion,
+    'Sec-WebSocket-Key': key,
+    Connection: 'Upgrade',
+    Upgrade: 'websocket',
+    ...opts.headers
+  };
+  opts.path = parsedUrl.pathname + parsedUrl.search;
   opts.timeout = opts.handshakeTimeout;
 
@@ -526,5 +539,5 @@
       opts.maxPayload
     );
-    opts.headers['Sec-WebSocket-Extensions'] = extension.format({
+    opts.headers['Sec-WebSocket-Extensions'] = format({
       [PerMessageDeflate.extensionName]: perMessageDeflate.offer()
     });
@@ -540,12 +553,10 @@
     }
   }
-  if (parsedUrl.auth) {
-    opts.auth = parsedUrl.auth;
-  } else if (parsedUrl.username || parsedUrl.password) {
+  if (parsedUrl.username || parsedUrl.password) {
     opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
   }
 
   if (isUnixSocket) {
-    const parts = path.split(':');
+    const parts = opts.path.split(':');
 
     opts.socketPath = parts[0];
@@ -553,5 +564,5 @@
   }
 
-  var req = (websocket._req = get(opts));
+  let req = (websocket._req = get(opts));
 
   if (opts.timeout) {
@@ -562,8 +573,8 @@
 
   req.on('error', (err) => {
-    if (websocket._req.aborted) return;
+    if (req === null || req.aborted) return;
 
     req = websocket._req = null;
-    websocket.readyState = WebSocket.CLOSING;
+    websocket._readyState = WebSocket.CLOSING;
     websocket.emit('error', err);
     websocket.emitClose();
@@ -587,7 +598,5 @@
       req.abort();
 
-      const addr = url.URL
-        ? new url.URL(location, address)
-        : url.resolve(address, location);
+      const addr = new URL(location, address);
 
       initAsClient(websocket, addr, protocols, options);
@@ -612,6 +621,5 @@
     req = websocket._req = null;
 
-    const digest = crypto
-      .createHash('sha1')
+    const digest = createHash('sha1')
       .update(key + GUID)
       .digest('base64');
@@ -624,5 +632,5 @@
     const serverProt = res.headers['sec-websocket-protocol'];
     const protList = (protocols || '').split(/, */);
-    var protError;
+    let protError;
 
     if (!protocols && serverProt) {
@@ -639,17 +647,14 @@
     }
 
-    if (serverProt) websocket.protocol = serverProt;
+    if (serverProt) websocket._protocol = serverProt;
 
     if (perMessageDeflate) {
       try {
-        const extensions = extension.parse(
-          res.headers['sec-websocket-extensions']
-        );
+        const extensions = parse(res.headers['sec-websocket-extensions']);
 
         if (extensions[PerMessageDeflate.extensionName]) {
           perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
-          websocket._extensions[
-            PerMessageDeflate.extensionName
-          ] = perMessageDeflate;
+          websocket._extensions[PerMessageDeflate.extensionName] =
+            perMessageDeflate;
         }
       } catch (err) {
@@ -675,11 +680,5 @@
  */
 function netConnect(options) {
-  //
-  // Override `options.path` only if `options` is a copy of the original options
-  // object. This is always true on Node.js >= 8 but not on Node.js 6 where
-  // `options.socketPath` might be `undefined` even if the `socketPath` option
-  // was originally set.
-  //
-  if (options.protocolVersion) options.path = options.socketPath;
+  options.path = options.socketPath;
   return net.connect(options);
 }
@@ -694,5 +693,9 @@
 function tlsConnect(options) {
   options.path = undefined;
-  options.servername = options.servername || options.host;
+
+  if (!options.servername && options.servername !== '') {
+    options.servername = net.isIP(options.host) ? '' : options.host;
+  }
+
   return tls.connect(options);
 }
@@ -708,5 +711,5 @@
  */
 function abortHandshake(websocket, stream, message) {
-  websocket.readyState = WebSocket.CLOSING;
+  websocket._readyState = WebSocket.CLOSING;
 
   const err = new Error(message);
@@ -715,4 +718,14 @@
   if (stream.setHeader) {
     stream.abort();
+
+    if (stream.socket && !stream.socket.destroyed) {
+      //
+      // On Node.js >= 14.3.0 `request.abort()` does not destroy the socket if
+      // called after the request completed. See
+      // https://github.com/websockets/ws/issues/1869.
+      //
+      stream.socket.destroy();
+    }
+
     stream.once('abort', websocket.emitClose.bind(websocket));
     websocket.emit('error', err);
@@ -725,4 +738,36 @@
 
 /**
+ * Handle cases where the `ping()`, `pong()`, or `send()` methods are called
+ * when the `readyState` attribute is `CLOSING` or `CLOSED`.
+ *
+ * @param {WebSocket} websocket The WebSocket instance
+ * @param {*} [data] The data to send
+ * @param {Function} [cb] Callback
+ * @private
+ */
+function sendAfterClose(websocket, data, cb) {
+  if (data) {
+    const length = toBuffer(data).length;
+
+    //
+    // The `_bufferedAmount` property is used only when the peer is a client and
+    // the opening handshake fails. Under these circumstances, in fact, the
+    // `setSocket()` method is not called, so the `_socket` and `_sender`
+    // properties are set to `null`.
+    //
+    if (websocket._socket) websocket._sender._bufferedBytes += length;
+    else websocket._bufferedAmount += length;
+  }
+
+  if (cb) {
+    const err = new Error(
+      `WebSocket is not open: readyState ${websocket.readyState} ` +
+        `(${readyStates[websocket.readyState]})`
+    );
+    cb(err);
+  }
+}
+
+/**
  * The listener of the `Receiver` `'conclude'` event.
  *
@@ -765,5 +810,5 @@
   websocket._socket.removeListener('data', socketOnData);
 
-  websocket.readyState = WebSocket.CLOSING;
+  websocket._readyState = WebSocket.CLOSING;
   websocket._closeCode = err[kStatusCode];
   websocket.emit('error', err);
@@ -824,5 +869,5 @@
   this.removeListener('end', socketOnEnd);
 
-  websocket.readyState = WebSocket.CLOSING;
+  websocket._readyState = WebSocket.CLOSING;
 
   //
@@ -875,5 +920,5 @@
   const websocket = this[kWebSocket];
 
-  websocket.readyState = WebSocket.CLOSING;
+  websocket._readyState = WebSocket.CLOSING;
   websocket._receiver.end();
   this.end();
@@ -891,5 +936,7 @@
   this.on('error', NOOP);
 
-  websocket.readyState = WebSocket.CLOSING;
-  this.destroy();
-}
+  if (websocket) {
+    websocket._readyState = WebSocket.CLOSING;
+    this.destroy();
+  }
+}
