Exemple #1
0
int main() 
{
	char url[MAX_URL_LENGTH];
	char buff[200];
	char* dom;
	char ch;
	int cnt = 0;
	while(isalpha(ch = getchar()))
	{
		buff[cnt++] = ch;
	}
	buff[cnt]='\0';
	checkScheme(buff, ch);
	checkDomain(buff, ch);

	return 0;
}
Exemple #2
0
EmailValidator::State EmailValidator::validate(QString &str, int &pos2)const {
	if(str.isEmpty())
		return set("Empty email");
	int pos = 0;
	const int indexA = str.indexOf('@');
	if(-1 == indexA) {
		return set(tr("No '@' character"));
	}
	if(str.count('@') != 1)
		return set(tr("More than one '@' characters"));
	QString local = str.left(indexA);
	QString domain = str.mid(indexA + 1);
	auto ret = checkLocal(local, pos);
	if(ret!=Acceptable)
		return ret;
	ret = checkDomain(domain, pos);
	if(ret != Acceptable) {
		pos += local.length() + 1;
		return ret;
	}
	return Acceptable;
}
Exemple #3
0
    void Discovery::failed()
    {
        setError( i18n( "Could not find a usable proxy configuration script" ) );

        // If this is the first DNS query, initialize our host name or abort
        // on failure. Otherwise abort if the current domain (which was already
        // queried for a host called "wpad" contains a SOA record)
        bool firstQuery = m_hostname.isEmpty();
        if ( ( firstQuery && !initHostName() ) ||
             ( !firstQuery && !checkDomain() ) )
        {
            emit result( false );
            return;
        }

        int dot = m_hostname.find( '.' );
        if ( dot >= 0 )
        {
            m_hostname.remove( 0, dot + 1 ); // remove one domain level
            download( KURL( "http://wpad." + m_hostname + "./wpad.dat" ) );
        }
        else emit result( false );
    }