コード例 #1
0
ファイル: UrlEncoder.cs プロジェクト: aliasadidev/AntiXss
 /// <summary>
 /// Initializes the HTML safe list.
 /// </summary>
 private static void InitializeSafeList()
 {
     SyncLock.EnterWriteLock();
     try
     {
         if (characterValues == null)
         {
             characterValues = SafeList.Generate(0xFF, SafeList.PercentThenHexValueGenerator);
             SafeList.PunchSafeList(ref characterValues, UrlSafeList());
         }
     }
     finally
     {
         SyncLock.ExitWriteLock();
     }
 }
コード例 #2
0
        /// <summary>
        /// Initializes the LDAP DN safe lists.
        /// </summary>
        /// <returns>The DN safe list.</returns>
        private static char[][] InitialiseDistinguishedNameSafeList()
        {
            char[][] result = SafeList.Generate(255, SafeList.HashThenHexValueGenerator);
            SafeList.PunchSafeList(ref result, DistinguishedNameSafeList());

            // Now mark up the specially listed characters from http://www.ietf.org/rfc/rfc2253.txt
            EscapeDistinguisedNameCharacter(ref result, ',');
            EscapeDistinguisedNameCharacter(ref result, '+');
            EscapeDistinguisedNameCharacter(ref result, '"');
            EscapeDistinguisedNameCharacter(ref result, '\\');
            EscapeDistinguisedNameCharacter(ref result, '<');
            EscapeDistinguisedNameCharacter(ref result, '>');
            EscapeDistinguisedNameCharacter(ref result, ';');

            return(result);
        }
コード例 #3
0
 /// <summary>
 /// Initializes the Url Path safe list.
 /// </summary>
 /// <returns>A list of characters and their encoded values for URL encoding.</returns>
 private static char[][] InitialisePathSafeList()
 {
     char[][] result = SafeList.Generate(255, SafeList.PercentThenHexValueGenerator);
     SafeList.PunchSafeList(ref result, UrlPathSafeList());
     return(result);
 }
コード例 #4
0
 /// <summary>
 /// Initializes the CSS safe list.
 /// </summary>
 /// <returns>
 /// The CSS safe list.
 /// </returns>
 private static char[][] InitialiseSafeList()
 {
     char[][] result = SafeList.Generate(0xFF, SafeList.SlashThenSixDigitHexValueGenerator);
     SafeList.PunchSafeList(ref result, CssSafeList());
     return(result);
 }
コード例 #5
0
 /// <summary>
 /// Initializes the LDAP filter safe list.
 /// </summary>
 /// <returns>The LDAP filter safe list.</returns>
 private static char[][] InitialiseFilterSafeList()
 {
     char[][] result = SafeList.Generate(255, SafeList.SlashThenHexValueGenerator);
     SafeList.PunchSafeList(ref result, FilterEncodingSafeList());
     return(result);
 }