Skip to content

The Sec-WebSocket-Key of WebSocket is always the same one #2993

@edc629

Description

@edc629

I try to create multiple WebSocket clients to connect to the server, and I've got the same Sec-WebSocket-Key from every client, so I found the source code, and I think it may need to execute Random::seed() first, right ??

std::string WebSocket::createKey()
{
	Poco::Random rnd;
        rnd.seed(); // <-- here ?
	std::ostringstream ostr;
	Poco::Base64Encoder base64(ostr);
	Poco::BinaryWriter writer(base64);
	writer << rnd.next() << rnd.next() << rnd.next() << rnd.next();
	base64.close();
	return ostr.str();
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions