afterHost() публичный Метод

public afterHost ( ) : string
Результат string
Пример #1
0
 // 패턴 체크 실행
 void checkUrlType(HostCheck patternCheck, Session oSession)
 {
     if (oSession.HTTPMethodIs("CONNECT")) {
         oSession.hostname = patternCheck.afterHost();
     } else {
         oSession.fullUrl = patternCheck.afterUrl(oSession.fullUrl);
     }
 }
Пример #2
0
        // 패턴 체크 실행
        bool checkUrlType(HostCheck patternCheck, Session oSession)
        {
            if (oSession.HTTPMethodIs("CONNECT")) {
                oSession.hostname = patternCheck.afterHost();

            } else {

                if (patternCheck.isStatus()) {
                    int code = patternCheck.getStatusCode();

                    sendResponse(oSession, code, "text/html", new byte[0]);

                    return false;
                }

                if (patternCheck.isFolder() || patternCheck.isFile()) {
                    string url = oSession.fullUrl;
                    int idx = url.LastIndexOf(patternCheck.Before);

                    FileInfo file;
                    string target;

                    if (patternCheck.isFolder()) {

                        string first = url.Substring(0, idx);
                        string second = patternCheck.Before;
                        string last = url.Replace(first, "").Replace(second, "");

                        log(first + " : " + second + " : " + last);

                        if (string.IsNullOrEmpty(last) || last.Equals("/")) {
                            last = "/index.html";
                        }

                        if (last[0] != '/') {  last = "/" + last; }

                        target = patternCheck.After + last;
                    } else {
                        target = patternCheck.After;
                    }

                    file = new FileInfo(target);

                    if (file.Exists) {
                        string content_type = MimeType.Get(file.Extension);
                        byte[] data = File.ReadAllBytes(file.FullName);

                        sendResponse(oSession, 200, content_type, data);

                        return false;

                    }

                } else {
                    oSession.fullUrl = patternCheck.afterUrl(oSession.fullUrl);

                }

            }

            return true;
        }