mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 01:35:46 +08:00
Bug fix and cosmetics
Fix: UserAgentServiceConnector return null if the destination is under TLS/SSL. Refractor: DataSnapshot to use http> UnSecureInstance as @UbitUmarov recommaded. Personally, i prefer it to be under HTTPS as well.
This commit is contained in:
@@ -316,22 +316,32 @@ namespace OpenSim.Services.HypergridService
|
||||
if (parts.Length != 2)
|
||||
return;
|
||||
|
||||
string uriStr = "http://" + parts[1];
|
||||
try
|
||||
{
|
||||
new Uri(uriStr);
|
||||
}
|
||||
catch (UriFormatException)
|
||||
string uriStr = "http://" + parts[1].ToLower();
|
||||
string SSLuriStr = "https://" + parts[1].ToLower();
|
||||
if(!Uri.TryCreate(uriStr, UriKind.Absolute, out _))
|
||||
{
|
||||
m_log.DebugFormat("[HGFRIENDS SERVICE]: Malformed address {0}", parts[1].ToLower());
|
||||
return;
|
||||
}
|
||||
|
||||
UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
|
||||
UserAgentServiceConnector uasConn = new(uriStr);
|
||||
// If fail to connect with http... try with https...
|
||||
if (uasConn is null)
|
||||
{
|
||||
uasConn = new UserAgentServiceConnector(SSLuriStr);
|
||||
if (uasConn is null)
|
||||
{
|
||||
m_log.DebugFormat("[HGFRIENDS SERVICE]: UserAgentServiceConnector failed to connect to {0}", parts[1].ToLower());
|
||||
return;
|
||||
}
|
||||
uriStr = SSLuriStr;
|
||||
}
|
||||
|
||||
Dictionary<string, object> servers = uasConn.GetServerURLs(fromID);
|
||||
if (!servers.ContainsKey("FriendsServerURI"))
|
||||
if (!servers.TryGetValue("FriendsServerURI", out object friendsServerURI))
|
||||
return;
|
||||
|
||||
HGFriendsServicesConnector friendsConn = new HGFriendsServicesConnector(servers["FriendsServerURI"].ToString());
|
||||
HGFriendsServicesConnector friendsConn = new(friendsServerURI.ToString());
|
||||
if (!friendsConn.ValidateFriendshipOffered(fromID, toID))
|
||||
{
|
||||
m_log.WarnFormat("[HGFRIENDS SERVICE]: Friendship request from {0} to {1} is invalid. Impersonations?", fromID, toID);
|
||||
|
||||
Reference in New Issue
Block a user