File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -205,13 +205,18 @@ namespace sio
205
205
#else
206
206
ss<<" ws://" ;
207
207
#endif
208
- if (m_sid.size ()==0 ) {
209
- ss<<uo.get_host ()<<" :" <<uo.get_port ()<<" /socket.io/?EIO=4&transport=websocket&t=" <<time (NULL )<<queryString;
208
+ const std::string host (uo.get_host ());
209
+ // As per RFC2732, literal IPv6 address should be enclosed in "[" and "]".
210
+ if (host.find (' :' )!=std::string::npos){
211
+ ss<<" [" <<uo.get_host ()<<" ]" ;
212
+ } else {
213
+ ss<<uo.get_host ();
210
214
}
211
- else
212
- {
213
- ss<<uo. get_host ()<< " : " <<uo. get_port ()<< " /socket.io/?EIO=4&transport=websocket& sid=" <<m_sid<< " &t= " << time ( NULL )<<queryString ;
215
+ ss<< " : " <<uo. get_port ()<< " /socket.io/?EIO=4&transport=websocket " ;
216
+ if (m_sid. size ()> 0 ) {
217
+ ss<<" & sid=" <<m_sid;
214
218
}
219
+ ss<<" &t=" <<time (NULL )<<queryString;
215
220
lib::error_code ec;
216
221
client_type::connection_ptr con = m_client.get_connection (ss.str (), ec);
217
222
if (ec) {
You can’t perform that action at this time.
0 commit comments