Skip to content

Commit

Permalink
Transitioning Unity's usage of WebRequests's PopualtePrefixList to no…
Browse files Browse the repository at this point in the history
… longer rely on the machine config when populating the prefixlist and instead directly initializing with prefix elements and associated types when on Android.
  • Loading branch information
UnityAlex committed Aug 29, 2024
1 parent 4c8cd20 commit b0fc719
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mcs/class/referencesource/System/net/System/Net/WebRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,24 @@ static ArrayList PopulatePrefixList ()
res.Add(new WebRequestPrefixElement("https", http));
res.Add(new WebRequestPrefixElement("file", new FileWebRequestCreator ()));
res.Add(new WebRequestPrefixElement("ftp", new FtpWebRequestCreator ()));
#elif UNITY
if (Console.IsRunningOnAndroid)
{
IWebRequestCreate http = new HttpRequestCreator ();
res.Add(new WebRequestPrefixElement("http", http));
res.Add(new WebRequestPrefixElement("https", http));
res.Add(new WebRequestPrefixElement("file", new FileWebRequestCreator ()));
res.Add(new WebRequestPrefixElement("ftp", new FtpWebRequestCreator ()));
}
else
{
object cfg = ConfigurationManager.GetSection ("system.net/webRequestModules");
WebRequestModulesSection s = cfg as WebRequestModulesSection;
if (s != null) {
foreach (WebRequestModuleElement el in s.WebRequestModules)
res.Add (new WebRequestPrefixElement(el.Prefix, el.Type));
}
}
#else
object cfg = ConfigurationManager.GetSection ("system.net/webRequestModules");
WebRequestModulesSection s = cfg as WebRequestModulesSection;
Expand Down

0 comments on commit b0fc719

Please sign in to comment.