summaryrefslogtreecommitdiff
path: root/Runtime/Managed/CrossDomainPolicyParser/Mono.Forks/UnityExtra.cs
blob: f085b167502544f554ebf93c29e3906cefa1f7bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using MonoForks.System.Net;
using MonoForks.System;

namespace MonoForks.System.Windows.Interop
{
	public class PluginHost
	{
		static public Uri SourceUri
		{
			get
			{
				return new Uri(UnityEngine.UnityCrossDomainHelper.GetWebSecurityHostUri());
			}
		}
		static public Uri RootUri
		{
			get
			{
				return new Uri(GetRoot(SourceUri));
			}
		}

		private static string GetRoot(Uri uri)
		{
			if ((uri.Scheme == "http" && uri.Port == 80) || (uri.Scheme == "https" && uri.Port == 443) || (uri.Port == -1))
				return String.Format("{0}://{1}", uri.Scheme, uri.DnsSafeHost);
			else
				return String.Format("{0}://{1}:{2}", uri.Scheme, uri.DnsSafeHost, uri.Port);
		}

	}
}

namespace MonoForks.System.Net
{
	internal class WebRequest
	{
		public WebRequest(MonoForks.System.Uri requesturi, Dictionary<string,string> headers)
		{
			this.RequestUri = requesturi;
			this.Headers = headers;
		}
		public MonoForks.System.Uri RequestUri { get; set; } 
		public Dictionary<string,string> Headers { get; set; } 
	}
}