Esempio n. 1
0
 public static bool OnNavigating(NavigatingEventArgs e)
 {
     return webServer.OnNavigating(e);
 }
Esempio n. 2
0
        public bool OnNavigating(NavigatingEventArgs e)
        {
            if (e.Uri.Authority != proxyUri.Authority && (e.Uri.Scheme == "http" || e.Uri.Scheme == "https"))
            {
                e.TargetUri = new Uri(BuildCurrentProxyUri(baseUri, e.Uri.AbsoluteUri));
                return true;
            }

            if (e.Uri != null && e.Uri.Scheme == "https" && e.Uri.Authority == proxyUri.Authority)
            {
                var mappedUri = new UriBuilder(e.Uri);
                mappedUri.Port = proxyUri.Port;
                mappedUri.Scheme = proxyUri.Scheme;
                var queryString = mappedUri.Query.Trim('?');

                if (!queryString.Contains(WatBrowserTargetHostQueryStringParameter + "=https"))
                {
                    mappedUri.Query = queryString.Replace(WatBrowserTargetHostQueryStringParameter + "=http", WatBrowserTargetHostQueryStringParameter + "=https");
                }

                e.TargetUri = mappedUri.Uri;
                return true;
            }

            e.TargetUri = e.Uri;
            return false;
        }
Esempio n. 3
0
        private void WebView_OnNavigationStarting(WebView sender, WebViewNavigationStartingEventArgs e)
        {
            if (config.WhiteList != null && config.Mode == DefenseMode.WhiteListOnly)
            {
                var root = SuperCacheManager.ResolveTargetUri(e.Uri.ToString()).Authority;

                if (config.WhiteList.Count(u => string.Compare(root, u, StringComparison.CurrentCultureIgnoreCase) == 0) == 0)
                {
                    e.Cancel = true;
                    Navigate(new Uri("http://www.catuhe.com/msdn/notAllowedSite/"));
                    return;
                }
            }

            var args = new NavigatingEventArgs(e.Uri.ToString());
            if (SuperCacheManager.OnNavigating(args))
            {
                e.Cancel = true;
                Navigate(args.TargetUri);
            }
        }