Skip to content

It is not possible to pass a custom Sec-WebSocket-Key field in headers #2048

Closed
@bahamut657

Description

@bahamut657

Is there an existing issue for this?

  • I've searched for any related issues and avoided creating a duplicate issue.

Description

Passing a custom Sec-WebSocket-Key field is not considered.
It seems to calculate each time a new key even if provided.

ws version

8.5.0

Node.js Version

16.15.0

System

System:
OS: Linux 5.17 Arch Linux
CPU: (4) x64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
Memory: 5.69 GB / 11.61 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 16.15.0 - /usr/bin/node
npm: 8.5.5 - /usr/bin/npm
Managers:
pip3: 21.0 - /usr/bin/pip3
RubyGems: 3.3.8 - /usr/bin/gem
Utilities:
CMake: 3.23.1 - /usr/bin/cmake
Make: 4.3 - /usr/bin/make
GCC: 11.2.0 - /usr/bin/gcc
Git: 2.36.1 - /usr/bin/git
Clang: 13.0.1 - /usr/bin/clang
Ninja: 1.10.2 - /usr/bin/ninja
Subversion: 1.14.1 - /usr/bin/svn
FFmpeg: 5.0 - /usr/bin/ffmpeg
Servers:
Apache: 2.4.53 - /usr/bin/apachectl
Virtualization:
Docker: 20.10.15 - /usr/bin/docker
VirtualBox: 6.1.34 - /usr/bin/vboxmanage
SDKs:
Android SDK:
API Levels: 23, 30, 31
Build Tools: 29.0.1, 29.0.2, 32.0.0
System Images: android-23 | Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
IDEs:
Nano: 6.3 - /usr/bin/nano
Sublime Text: 2 - /usr/bin/subl
VSCode: 1.63.2 - /usr/bin/code
Vim: 8.2 - /usr/bin/vim
Languages:
Bash: 5.1.16 - /usr/bin/bash
Go: 1.18.1 - /usr/bin/go
Perl: 5.34.1 - /usr/bin/perl
PHP: 8.1.5 - /usr/bin/php
Protoc: 3.20.1 - /usr/bin/protoc
Python: 3.10.4 - /usr/bin/python
Python3: 3.10.4 - /usr/bin/python3
Ruby: 3.0.4 - /usr/bin/ruby
Databases:
MySQL: 10.7.3 (MariaDB) - /usr/bin/mysql
PostgreSQL: 14.2 - /usr/bin/postgres
SQLite: 3.38.4 - /usr/bin/sqlite3
Browsers:
Brave Browser: 97.1.34.80
Chromium: 101.0.4951.54
Firefox: 100.0

Expected result

If the key Sec-WebSocket-Key is provided in headers' parameters, use that key to perform subsequent messages validation

Actual result

A new key is generated on each connection

Attachments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions