Exemplo n.º 1
0
int SSIEngine::processSet(HttpSession *pSession, SSIComponent *pComponent)
{
    SubstItem *pItem = (SubstItem *)pComponent->getFirstAttr();
    const AutoStr2 *pVarName;
    char achBuf1[8192];
    char *p;
    int len;
    int attr;
    while (pItem)
    {

        attr = pItem->getSubType();
        if (attr == SSI_SET_VAR)
        {
            pVarName = pItem->getStr();
            pItem = (SubstItem *) pItem->next();
            if (!pItem)
                break;
            if (pItem->getSubType() != SSI_SET_VALUE)
                continue;
            p = achBuf1;
            len = 8192;
            len = RequestVars::appendSubst(pItem, pSession, p, len, 0,
                                           pSession->getReq()->getSSIRuntime()->getRegexResult(),
                                           pSession->getReq()->getSSIRuntime()
                                           ->getConfig()->getTimeFmt()->c_str());
            RequestVars::setEnv(pSession, pVarName->c_str(), pVarName->len(), achBuf1,
                                p - achBuf1);
        }

        pItem = (SubstItem *) pItem->next();
    }
    return 0;
}
Exemplo n.º 2
0
int SSIEngine::updateSSIConfig( HttpSession *pSession, SSIComponent * pComponent, 
                            SSIRuntime * pRuntime )
{
    SubstItem *pItem = (SubstItem *)pComponent->getFirstAttr();
    char achBuf[4096];
    char * p;
    int len;
    int attr;
    while( pItem )
    {
        attr = pItem->getSubType();
        p = achBuf;
        len = 4096;
        switch( attr )
        {
        case SSI_ECHOMSG:
        case SSI_ERRMSG:
        case SSI_TIMEFMT:
            RequestVars::appendSubst( pItem, pSession, p, len, 0, NULL );
            if ( attr == SSI_ERRMSG )
                pRuntime->getConfig()->setErrMsg( achBuf, p - achBuf );
            else if ( attr == SSI_ECHOMSG )
                pRuntime->getConfig()->setEchoMsg( achBuf, p - achBuf );
            else 
                pRuntime->getConfig()->setTimeFmt( achBuf, p - achBuf );
            break;
        case SSI_SIZEFMT:
            if ( pItem->getType() == REF_STRING )
            {
                const AutoStr2 * pStr = pItem->getStr();
                if (( pStr )&&( pStr->c_str() ))
                {
                    pRuntime->getConfig()->setSizeFmt( pStr->c_str(), pStr->len() );
                }
            }
            break;

        }
    
        pItem = (SubstItem *) pItem->next();
    }
    return 0;
}