Esempio n. 1
0
static void escape(MprTestGroup *gp)
{
    /*  
        URI unsafe chars are:
            0x00-0x1F, 0x7F, 0x80-0xFF, <>'"#%{}|\^~[]
            Space, \t, \r, \n
            Reserved chars with special meaning are:
                ;/?:@=& 
            FUTURE -- should we not allow "'~"
            FUTURE -- shold we not allow ";?" but allow "/?:@=&"
     */
    assert(okEscapeUri(gp, " \t\r\n\x01\x7f\xff?<>\"#%{}|\\^[]?;", 
        "+%09%0D%0A%01%7F%FF%3F%3C%3E%22%23%25%7B%7D%7C%5C%5E%5B%5D%3F%3B", MPR_ENCODE_URI_COMPONENT));
    assert(okEscapeUri(gp, " \t\r\n\x01\x7f\xff?<>\"#%{}|\\^[]?;", 
        "%20%09%0D%0A%01%7F%FF?%3C%3E%22#%25%7B%7D%7C%5C%5E[]?;", MPR_ENCODE_URI));
   
    assert(okEscapeCmd(gp, "&;`'\"|*?~<>^()[]{}$\\\n", 
        "\\&\\;\\`\\\'\\\"\\|\\*\\\?\\~\\<\\>\\^\\(\\)\\[\\]\\{\\}\\$\\\\\\\n"));
    assert(okEscapeHtml(gp, "<>&", "&lt;&gt;&amp;"));
    assert(okEscapeHtml(gp, "#()", "#()"));
}
Esempio n. 2
0
static void escape(MprTestGroup *gp)
{
    /*  
     *  URI unsafe chars are:
     *      0x00-0x1F, 0x7F, 0x80-0xFF, <>'"#%{}|\^~[]
     *      Space, \t, \r, \n
     *      Reserved chars with special meaning are:
     *          ;/?:@=& 
     */
    assert(okEscapeUri(gp, " \t\r\n\x01\x7f\xff?<>\"#%{}|\\^[]?;", 
        "+%09%0d%0a%01%7f%ff%3f%3c%3e%22%23%25%7b%7d%7c%5c%5e%5b%5d%3f%3b"));
    assert(okEscapeCmd(gp, "&;`'\"|*?~<>^()[]{}$\\\n", 
        "\\&\\;\\`\\\'\\\"\\|\\*\\\?\\~\\<\\>\\^\\(\\)\\[\\]\\{\\}\\$\\\\\\\n"));
    assert(okEscapeHtml(gp, "<>&", "&lt;&gt;&amp;"));
    assert(okEscapeHtml(gp, "#()", "&#35;&#40;&#41;"));
}