コード例 #1
0
ファイル: dirHandler.c プロジェクト: yodamaster/appweb
/*
    Loadable module initialization
 */
PUBLIC int maOpenDirHandler(Http *http)
{
    HttpStage   *handler;
    MaAppweb    *appweb;
    Dir         *dir;

    if ((handler = httpCreateHandler(http, "dirHandler", NULL)) == 0) {
        return MPR_ERR_CANT_CREATE;
    }
    if ((handler->stageData = dir = mprAllocObj(Dir, manageDir)) == 0) {
        return MPR_ERR_MEMORY;
    }
    handler->start = startDir; 
    http->dirHandler = handler;
    dir->sortOrder = 1;

    /*
        Declare configuration file directives
     */
    appweb = httpGetContext(http);
    maAddDirective(appweb, "IndexOrder", indexOrderDirective);
    maAddDirective(appweb, "indexOptions", indexOptionsDirective);
    maAddDirective(appweb, "Options", optionsDirective);
    return 0;
}
コード例 #2
0
ファイル: cgiHandler.c プロジェクト: TryndamereStark/appweb
/*  
    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;
}
コード例 #3
0
ファイル: dirHandler.c プロジェクト: varphone/appweb-4
/*
    Dynamic module initialization
 */
int maOpenDirHandler(Http *http)
{
    HttpStage   *handler;
    MaAppweb    *appweb;
    Dir         *dir;

    if ((handler = httpCreateHandler(http, "dirHandler", HTTP_STAGE_GET | HTTP_STAGE_HEAD, NULL)) == 0) {
        return MPR_ERR_CANT_CREATE;
    }
    if ((handler->stageData = dir = mprAllocObj(Dir, manageDir)) == 0) {
        return MPR_ERR_MEMORY;
    }
    handler->match = maMatchDir;
    handler->process = processDir;
    http->dirHandler = handler;
    dir->sortOrder = 1;

    appweb = httpGetContext(http);
    maAddDirective(appweb, "IndexOrder", indexOrderDirective);
    maAddDirective(appweb, "indexOptions", indexOptionsDirective);
    maAddDirective(appweb, "Options", optionsDirective);
    return 0;
}
コード例 #4
0
ファイル: simpleModule.c プロジェクト: monmarzia/appweb-4
/*
    Module load initialization. This is called when the module is first loaded.
 */
int maSimpleModuleInit(Http *http, MprModule *mp)
{
    HttpStage   *stage;
    MaAppweb    *appweb;

    /*
        Create a stage so we can process configuration file data
     */
    if ((stage = httpCreateStage(http, "simpleModule", HTTP_STAGE_MODULE, mp)) == 0) {
        return MPR_ERR_CANT_CREATE;
    }
    appweb = httpGetContext(http);
    maAddDirective(appweb, "CustomConfigKey", customConfigKey);
    return 0;
}
コード例 #5
0
ファイル: simpleModule.c プロジェクト: jinchangxu/appweb
/*
    Module load initialization. This is called when the module is first loaded.
 */
int maSimpleModuleInit(Http *http, MprModule *mp)
{
    HttpStage   *stage;

    /*
        Create a stage so we can process configuration file data
     */
    if ((stage = httpCreateStage("simpleModule", HTTP_STAGE_MODULE, mp)) == 0) {
        return MPR_ERR_CANT_CREATE;
    }
    /*
        Create an appweb.conf custom directive
     */
    maAddDirective("CustomConfig", customConfig);
    return 0;
}
コード例 #6
0
ファイル: proxyHandler.c プロジェクト: cwhis/appweb
PUBLIC int maProxyHandlerInit(Http *http, MprModule *module)
{
    HttpStage   *handler;
    MaAppweb    *appweb;

    if ((handler = httpCreateHandler(http, module->name, 0, module)) == 0) {
        return MPR_ERR_CANT_CREATE;
    }
    handler->open = openProxy; 
    handler->close = closeProxy; 
    handler->incomingData = incomingProxyData; 
    handler->outgoingService = outgoingProxyService;
    handler->start = startProxy; 
    handler->ready = readyProxy; 
    handler->process = processProxy; 

    appweb = httpGetContext(http);
    maAddDirective(appweb, "Proxy", proxyDirective);
    return 0;
}