Exemplo n.º 1
0
Arquivo: imapurl.cpp Projeto: aox/aox
EString ImapUrlParser::xchars( bool b )
{
    EString s;

    char c = nextChar();
    while ( c != '\0' ) {
        if ( unreserved( c ) || ( c == '&' || c == '=' || c == '~' ) ||
             ( b && ( c == ':' || c == '@' || c == '/' ) ) )
        {
            // Nasty hack: we won't eat the beginning of "/;UID".
            if ( b && c == '/' && str[pos()+1] == ';' )
                break;

            s.append( c );
            step();
        }
        else if ( c == '%' && escape( &c ) ) {
            s.append( c );
        }
        else {
            break;
        }

        c = nextChar();
    }

    return s;
}
Exemplo n.º 2
0
//static
std::string LLURI::escape(const std::string& str)
{
	static std::string default_allowed = unreserved();
	static bool initialized = false;
	if(!initialized)
	{
		std::sort(default_allowed.begin(), default_allowed.end());
		initialized = true;
	}
	return escape(str, default_allowed, true);
}