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
205205#else
206206 ss<<" ws://" ;
207207#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 ();
210214 }
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;
214218 }
219+ ss<<" &t=" <<time (NULL )<<queryString;
215220 lib::error_code ec;
216221 client_type::connection_ptr con = m_client.get_connection (ss.str (), ec);
217222 if (ec) {
You can’t perform that action at this time.
0 commit comments