Exemple #1
0
static int addIconDirective(MaState *state, cchar *key, cchar *value)
{
    if (!maTokenize(state, value, "%S %W", &path, &dir->extList)) {
        return MPR_ERR_BAD_SYNTAX;
    }
    return 0;
}
Exemple #2
0
/*  
    IndexIgnore pat ... 
 */
static int indexIgnoreDirective(MaState *state, cchar *key, cchar *value)
{
    if (!maTokenize(state, value, "%W", &dir->ignoreList)) {
        return MPR_ERR_BAD_SYNTAX;
    }
    return 0;
}
Exemple #3
0
static int cgiPrefixDirective(MaState *state, cchar *key, cchar *value)
{
    cchar   *prefix;

    if (!maTokenize(state, value, "%S", &prefix)) {
        return MPR_ERR_BAD_SYNTAX;
    }
    httpSetRouteEnvPrefix(state->route, prefix);
    return 0;
}
Exemple #4
0
static int cgiEscapeDirective(MaState *state, cchar *key, cchar *value)
{
    bool    on;

    if (!maTokenize(state, value, "%B", &on)) {
        return MPR_ERR_BAD_SYNTAX;
    }
    httpSetRouteEnvEscape(state->route, on);
    return 0;
}
Exemple #5
0
static int actionDirective(MaState *state, cchar *key, cchar *value)
{
    char    *mimeType, *program;

    if (!maTokenize(state, value, "%S %S", &mimeType, &program)) {
        return MPR_ERR_BAD_SYNTAX;
    }
    mprSetMimeProgram(state->route->mimeTypes, mimeType, program);
    return 0;
}
Exemple #6
0
static int scriptAliasDirective(MaState *state, cchar *key, cchar *value)
{
    HttpRoute   *route;
    char        *prefix, *path;

    if (!maTokenize(state, value, "%S %S", &prefix, &path)) {
        return MPR_ERR_BAD_SYNTAX;
    }
    route = httpCreateAliasRoute(state->route, prefix, path, 0);
    httpSetRouteHandler(route, "cgiHandler");
    httpSetRoutePattern(route, sfmt("^%s(.*)$", prefix), 0);
    httpSetRouteTarget(route, "run", "$1");
    httpFinalizeRoute(route);
    return 0;
}
Exemple #7
0
static int proxyDirective(MaState *state, cchar *key, cchar *value)
{
#if UNUSED
    HttpRoute   *route;

    /*
        Syntax: Proxy URI_PATH URI [key=value]...
        Example:
        Proxy /prefix http://ipaddr:port/uri timeout=NN keepalive=NN min=NN max=NN buffer=NN rewrite=headers,body
     */
    if (maTokenize(state, value, "...", &mimeType, &program) < 0) {
        return MPR_ERR_BAD_SYNTAX;
    }
#endif
    return 0;
}
Exemple #8
0
/*  
    IndexOrder ascending|descending name|date|size 
 */
static int indexOrderDirective(MaState *state, cchar *key, cchar *value)
{
    Dir     *dir;
    char    *option;

    dir = getDirObj(state);

    if (!maTokenize(state, value, "%S %S", &option, &dir->sortField)) {
        return MPR_ERR_BAD_SYNTAX;
    }
    dir->sortField = 0;
    if (scaselessmatch(option, "ascending")) {
        dir->sortOrder = 1;
    } else {
        dir->sortOrder = -1;
    }
    if (dir->sortField) {
        dir->sortField = sclone(dir->sortField);
    }
    return 0;
}