Пример #1
0
/*  
    Loadable module initialization
 */
PUBLIC int maCgiHandlerInit(Http *http, MprModule *module)
{
    HttpStage   *handler, *connector;

    if ((handler = httpCreateHandler("cgiHandler", module)) == 0) {
        return MPR_ERR_CANT_CREATE;
    }
    http->cgiHandler = handler;
    handler->close = closeCgi; 
    handler->outgoingService = cgiToBrowserService;
    handler->incoming = browserToCgiData; 
    handler->open = openCgi; 
    handler->start = startCgi; 

    if ((connector = httpCreateConnector("cgiConnector", module)) == 0) {
        return MPR_ERR_CANT_CREATE;
    }
    http->cgiConnector = connector;
    connector->outgoingService = browserToCgiService;
    connector->incoming = cgiToBrowserData; 

    /*
        Add configuration file directives
     */
    maAddDirective("Action", actionDirective);
    maAddDirective("ScriptAlias", scriptAliasDirective);
    maAddDirective("CgiEscape", cgiEscapeDirective);
    maAddDirective("CgiPrefix", cgiPrefixDirective);
    return 0;
}
Пример #2
0
/*  
    Initialize the net connector
 */
int httpOpenNetConnector(Http *http)
{
    HttpStage     *stage;

    mprLog(5, "Open net connector");
    if ((stage = httpCreateConnector(http, "netConnector", HTTP_STAGE_ALL, NULL)) == 0) {
        return MPR_ERR_CANT_CREATE;
    }
    stage->close = netClose;
    stage->outgoingService = netOutgoingService;
    http->netConnector = stage;
    return 0;
}
Пример #3
0
PUBLIC int httpOpenSendConnector()
{
    HttpStage     *stage;

    if ((stage = httpCreateConnector("sendConnector", NULL)) == 0) {
        return MPR_ERR_CANT_CREATE;
    }
    stage->open = httpSendOpen;
    stage->close = sendClose;
    stage->outgoingService = httpSendOutgoingService;
    HTTP->sendConnector = stage;
    return 0;
}