Esempio n. 1
0
int Check_Timer()
{
    int hasTimer = 0;
    
    //Check module timer here and trigger timeout ones
    LinkedObj *headPos = HttpGlobals::s_ModuleTimerList.head();
    ModuleTimer *pNext = NULL;
    while(1)
    {
        pNext = (ModuleTimer *)(headPos->next());
        if (pNext)
            hasTimer = 1;
        
        if (pNext && pNext->m_tmExpire <= DateTime::s_curTime)
        {
            pNext->m_TimerCb(pNext->m_pTimerCbParam);
            headPos->removeNext();
            delete pNext;
        }
        else
            break;
    }
    
    
    return hasTimer;
}
Esempio n. 2
0
int RewriteRule::parse( char * &pRule, const RewriteMapList * pMaps )
{
    char * pCur;
    char * pLineEnd;
    LinkedObj * pLast = m_conds.head();
    assert( pLast->next() == NULL );
    while( *pRule )
    {
        while( isspace( *pRule ) )
            ++pRule;
        if ( !*pRule )
            break;
        pCur = pRule;
        pLineEnd = strchr( pCur, '\n' );
        if ( !pLineEnd )
        {
            pLineEnd = pCur + strlen( pCur );
            pRule = pLineEnd;
        }
        else
        {
            pRule = pLineEnd + 1;
            *pLineEnd = 0;
        }
        s_pCurLine = pCur;
        if ( *pCur != '#' )
        {
            if (( strncasecmp( pCur, "RewriteCond", 11 ) == 0 )&&
                ( isspace( *(pCur + 11)) ))
            {
                RewriteCond * pCond = new RewriteCond();
                if ( !pCond )
                {
                    ERR_NO_MEM( "new RewriteCond()" );
                    return -1;
                }
                
                if ( pCond->parse( pCur+12, pLineEnd, pMaps ) )
                {
                    delete pCond;
                    HttpLog::parse_error( s_pCurLine,  "invalid rewrite condition" );
                    return -1;
                }
                pLast->addNext( pCond );
                pLast = pCond;
            }
            else if (( strncasecmp( pCur, "RewriteRule", 11 ) == 0 )&&
                     ( isspace( *(pCur + 11)) ))
            {
                int ret = parseRule( pCur+12, pLineEnd, pMaps );
                pCur = pLineEnd+1;
                return ret;
            }
            else
            {
                HttpLog::parse_error( s_pCurLine,  "invalid rewrite directive " );
                return -1;
            }
        }
    }

    return -1;
}