Пример #1
0
        public bool PathMatches(string p)
        {
            int    slash = p.LastIndexOf('/');
            string orig  = p;

            if (slash != -1)
            {
                p = p.Substring(slash);
            }

            for (int j = files.Length; j > 0;)
            {
                j--;
                FileMatchingInfo fm = files [j];

                if (fm.MatchExact != null)
                {
                    return(fm.MatchExact.Length == p.Length && StrUtils.EndsWith(p, fm.MatchExact));
                }

                if (fm.EndsWith != null)
                {
                    return(StrUtils.EndsWith(p, fm.EndsWith));
                }

                if (fm.MatchExpr == "*")
                {
                    return(true);
                }

                /* convert to regexp */
                return(fm.RegExp.IsMatch(orig));
            }
            return(false);
        }
Пример #2
0
        public bool PathMatches(string p)
        {
            string []           paths = OriginalPath.Split(',');
            FileMatchingInfo [] files = new FileMatchingInfo [paths.Length];

            int i = 0;

            foreach (string s in paths)
            {
                files [i++] = new FileMatchingInfo(s);
            }

            int    slash = p.LastIndexOf('/');
            string orig  = p;

            if (slash != -1)
            {
                p = p.Substring(slash);
            }

            for (int j = files.Length; j > 0;)
            {
                j--;
                FileMatchingInfo fm = files [j];

                if (fm.MatchExact != null)
                {
                    return(fm.MatchExact.Length == orig.Length && StrUtils.EndsWith(orig, fm.MatchExact, true));
                }

                if (fm.EndsWith != null)
                {
                    return(StrUtils.EndsWith(p, fm.EndsWith, true));
                }

                if (fm.MatchExpr == "*")
                {
                    return(true);
                }

                /* convert to regexp */
                return(fm.RegExp.IsMatch(orig));
            }
            return(false);
        }
Пример #3
0
        public HttpHandler(string verb, string path, string typename, Type t)
        {
            OriginalVerb = verb;
            OriginalPath = path;

            if (verb != "*")
            {
                Verbs = verb.Split(',');
            }
            string [] paths = path.Split(',');
            files = new FileMatchingInfo [paths.Length];

            int i = 0;

            foreach (string s in paths)
            {
                files [i++] = new FileMatchingInfo(s);
            }

            this.TypeName = typename;
            type          = t;
        }
		public bool PathMatches (string p)
		{
			string [] paths = OriginalPath.Split (',');
			FileMatchingInfo [] files = new FileMatchingInfo [paths.Length];

			int i = 0;
			foreach (string s in paths)
				files [i++] = new FileMatchingInfo (s);
			
			int slash = p.LastIndexOf ('/');
			string orig = p;
			if (slash != -1)
				p = p.Substring (slash);

			for (int j = files.Length; j > 0; ){
				j--;
				FileMatchingInfo fm = files [j];

				if (fm.MatchExact != null)
					return fm.MatchExact.Length == orig.Length && StrUtils.EndsWith (orig, fm.MatchExact, true);
					
				if (fm.EndsWith != null)
					return StrUtils.EndsWith (p, fm.EndsWith, true);

				if (fm.MatchExpr == "*")
					return true;

				/* convert to regexp */
				return fm.RegExp.IsMatch (orig);
			}
			return false;
		}
Пример #5
0
		public HttpHandler (string verb, string path, string typename, Type t)
		{
			OriginalVerb = verb;
			OriginalPath = path;
			
			if (verb != "*")
				Verbs = verb.Split (',');
			string [] paths = path.Split (',');
			files = new FileMatchingInfo [paths.Length];

			int i = 0;
			foreach (string s in paths)
				files [i++] = new FileMatchingInfo (s);
			
			this.TypeName = typename;
			type = t;
		}