コード例 #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 プロジェクト: fengyingzhuo/appweb
/*  
    Loadable module initialization
 */
PUBLIC int maCgiHandlerInit(Http *http, MprModule *module)
{
    HttpStage   *handler, *connector;
    MaAppweb    *appweb;

    if ((handler = httpCreateHandler(http, "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(http, "cgiConnector", module)) == 0) {
        return MPR_ERR_CANT_CREATE;
    }
    http->cgiConnector = connector;
    connector->outgoingService = browserToCgiService;
    connector->incoming = cgiToBrowserData; 

    /*
        Add configuration file directives
     */
    appweb = httpGetContext(http);
    maAddDirective(appweb, "Action", actionDirective);
    maAddDirective(appweb, "ScriptAlias", scriptAliasDirective);
    maAddDirective(appweb, "CgiEscape", cgiEscapeDirective);
    maAddDirective(appweb, "CgiPrefix", cgiPrefixDirective);
    return 0;
}
コード例 #3
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;
}
コード例 #4
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;
}
コード例 #5
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;
}