示例#1
0
static int config_timeout(h2o_configurator_command_t *cmd, yoml_t *node, uint64_t *slot)
{
    unsigned timeout_in_secs;

    if (h2o_configurator_scanf(cmd, node, "%u", &timeout_in_secs) != 0)
        return -1;

    *slot = timeout_in_secs * 1000;
    return 0;
}
示例#2
0
static int on_config_http2_idle_timeout(h2o_configurator_command_t *cmd, h2o_configurator_context_t *ctx, yoml_t *node)
{
    unsigned timeout_in_secs;

    if (h2o_configurator_scanf(cmd, node, "%u", &timeout_in_secs) != 0)
        return -1;

    ctx->globalconf->http2.idle_timeout = timeout_in_secs * 1000;
    return 0;
}
示例#3
0
文件: redirect.c 项目: Daiki0525/h2o
static int on_config(h2o_configurator_command_t *cmd, h2o_configurator_context_t *ctx, yoml_t *node)
{
    const char *dest;
    int status = 302; /* default is temporary redirect */
    yoml_t *t;

    switch (node->type) {
    case YOML_TYPE_SCALAR:
        dest = node->data.scalar;
        break;
    case YOML_TYPE_MAPPING:
        if ((t = yoml_get(node, "url")) == NULL) {
            h2o_configurator_errprintf(cmd, node, "mandatory property `url` is missing");
            return -1;
        }
        if (t->type != YOML_TYPE_SCALAR) {
            h2o_configurator_errprintf(cmd, t, "property `url` must be a string");
            return -1;
        }
        dest = t->data.scalar;
        if ((t = yoml_get(node, "status")) == NULL) {
            h2o_configurator_errprintf(cmd, node, "mandatory property `status` is missing");
            return -1;
        }
        if (h2o_configurator_scanf(cmd, t, "%d", &status) != 0)
            return -1;
        if (!(300 <= status && status <= 399)) {
            h2o_configurator_errprintf(cmd, t, "value of property `status` should be within 300 to 399");
            return -1;
        }
        break;
    default:
        h2o_configurator_errprintf(cmd, node, "value must be a string or a mapping");
        return -1;
    }

    h2o_redirect_register(ctx->pathconf, status, dest);

    return 0;
}
示例#4
0
文件: fastcgi.c 项目: shitfSign/h2o
static int on_config_timeout_keepalive(h2o_configurator_command_t *cmd, h2o_configurator_context_t *ctx, yoml_t *node)
{
    struct fastcgi_configurator_t *self = (void *)cmd->configurator;
    return h2o_configurator_scanf(cmd, node, "%" PRIu64, &self->vars->keepalive_timeout);
}
示例#5
0
static int on_config_http2_max_concurrent_requests_per_connection(h2o_configurator_command_t *cmd, h2o_configurator_context_t *ctx,
                                                                  yoml_t *node)
{
    return h2o_configurator_scanf(cmd, node, "%zu", &ctx->globalconf->http2.max_concurrent_requests_per_connection);
}
示例#6
0
static int on_config_max_delegations(h2o_configurator_command_t *cmd, h2o_configurator_context_t *ctx, yoml_t *node)
{
    return h2o_configurator_scanf(cmd, node, "%u", &ctx->globalconf->max_delegations);
}
示例#7
0
static int on_config_limit_request_body(h2o_configurator_command_t *cmd, h2o_configurator_context_t *ctx, yoml_t *node)
{
    return h2o_configurator_scanf(cmd, node, "%zu", &ctx->globalconf->max_request_entity_size);
}