Core: Websocket SNI fix for secure sockets.

This commit is contained in:
ismail-yilmaz 2026-03-27 08:32:05 +03:00
parent c41a6445a1
commit 565ece4b3b
3 changed files with 10 additions and 1 deletions

View file

@ -715,6 +715,8 @@ class WebSocket {
public:
WebSocket& NonBlocking(bool b = true) { socket->Timeout(b ? 0 : Null); return *this; }
WebSocket& SSLServerNameIndication(const String& name) { socket->SSLServerNameIndication(name); return *this; }
WebSocket& Headers(const String& h) { request_headers = h; return *this; }
WebSocket& ClearHeaders() { return Headers(Null); }
WebSocket& AddHeaders(const String& h) { request_headers.Cat(h); return *this; }

View file

@ -104,7 +104,7 @@ bool WebSocket::Connect(const String& uri_, const String& host_, bool ssl_, int
uri = uri_;
host = host_;
ssl = ssl_;
if(socket->IsBlocking()) {
if(!addrinfo.Execute(host, port)) {
Error("Not found");

View file

@ -24,6 +24,13 @@ topic "WebSocket";
is blocking mode.&]
[s3;%% &]
[s4; &]
[s5;:Upp`:`:WebSocket`:`:SSLServerNameIndication`(const String`&`): WebSocket[@(0.0.255) `&
] [* SSLServerNameIndication]([@(0.0.255) const] String[@(0.0.255) `&]
[*@3 name])&]
[s2;%% Sets [^https`:`/`/cs`.wikipedia`.org`/wiki`/Server`_Name`_Indication^ SNI]
for SSL connection.&]
[s3; &]
[s4; &]
[s5;:Upp`:`:WebSocket`:`:Headers`(const Upp`:`:String`&`): [_^Upp`:`:WebSocket^ WebSock
et][@(0.0.255) `&]_[* Headers]([@(0.0.255) const]_[_^Upp`:`:String^ String][@(0.0.255) `&]_
[*@3 h])&]