Beispiel #1
0
        // HOST, URL, REAL 타입체크
        void checkHost(Session oSession)
        {
            HostCheck patternCheck = PLinkCore.PLink.host.checkPattern(oSession.fullUrl);

            // 패턴 체크를 하고
            if (patternCheck != null && patternCheck.Checked)
            {
                // 패턴이 체크 되어 있으면 , fullUrl 을 바꾸고
                bool isCheck = checkUrlType(patternCheck, oSession);

                if (!isCheck)
                {
                    return;
                }
                //return;
            }

            HostCheck check = PLinkCore.PLink.host.checkUrl(oSession.hostname, oSession.PathAndQuery);

            if (check == null)
            {
                return;
            }
            if (!check.Checked)
            {
                return;
            }

            // Host, Real 적용
            if (check.isHost() || check.isReal())
            {
                if (oSession.HTTPMethodIs("CONNECT"))
                {
                    oSession.hostname = check.afterHost();
                }
                else
                {
                    oSession.bypassGateway     = true;
                    oSession["x-overrideHost"] = check.After;
                }
            }
            // URL, PATTERN 적용
            else if (check.isUrl() || check.isPattern())
            {
                if (oSession.HTTPMethodIs("CONNECT"))
                {
                    oSession.hostname = check.afterHost();
                }
                else
                {
                    // 캐쉬된 정책 적용
                    string redirect = check.getHostItem().Redirect;
                    if (!string.IsNullOrEmpty(redirect))
                    {
                        check.After = redirect;
                    }
                    oSession.fullUrl = check.afterUrl(oSession.fullUrl);
                }
            }
        }