Example #1
0
int SSIEngine::startExecute( HttpSession *pSession, 
                             SSIScript * pScript )
{
    if ( !pScript )
        return SC_500;
    SSIRuntime * pRuntime = pSession->getReq()->getSSIRuntime();
    if ( !pRuntime )
    {
        char ct[]= "text/html";
        HttpReq * pReq = pSession->getReq();
        pRuntime = new SSIRuntime();
        if (!pRuntime )
            return SC_500;
        pRuntime->init();
        pRuntime->initConfig( pReq->getSSIConfig() );
        pReq->setSSIRuntime( pRuntime );
        pSession->getResp()->reset();
        //pSession->getResp()->prepareHeaders( pReq );
        //pSession->setupChunkOS( 0 );
        HttpCgiTool::processContentType( pReq, pSession->getResp(), 
                      ct , 9 );
//        pSession->setupRespCache();
        if ( pReq->isXbitHackFull() )
        {
            pSession->getResp()->appendLastMod( pReq->getLastMod() );
        }
        int status = pReq->getStatusCode();
        if (( status >= SC_300 )&&( status < SC_400 ))
        {
            if ( pReq->getLocation() != NULL )
            {
                pSession->addLocationHeader();
            }
        }
        pSession->setupGzipFilter();
        pReq->andGzip( ~GZIP_ENABLED );  //disable GZIP
    }
    if ( pRuntime->push( pScript ) == -1 )
        return SC_500;
    pSession->getReq()->backupPathInfo();
    pScript->resetRuntime();
    return resumeExecute( pSession );
}