示例#1
0
static int uploader_handler(request_rec *r)
{
    UploaderConfig *config;

    if (strcmp(r->handler, HANDLER_NAME)) {
        return DECLINED;
    }

    if (UNLIKELY(!ap_is_initial_req(r))) {
        return DECLINED;
    }

    config = uploader_get_dir_config(r);

    if (UNLIKELY(!config->is_active())) {
        return DECLINED;
    }

    try {
        if (UNLIKELY(config->is_debug_mode)) {
            config->update_template();
        }

        return uploader_command_handler<ApacheResponse>(r, config,
                                                        r->path_info);
    } catch(const char *message) {
        logger.error(__FILE__, __LINE__, r, "Exception: %s", message);

        return HTTP_INTERNAL_SERVER_ERROR;
    }
}
示例#2
0
static int uploader_handler(request_rec *r)
{
    UploaderConfig *config;

    if (UNLIKELY(!ap_is_initial_req(r))) {
        return DECLINED;
    }

    config = uploader_get_dir_config(r);

    if (UNLIKELY(!config->is_active())) {
        return DECLINED;
    }

    TemporaryPool temp_pool;
    ApacheResponse::Handle r_wrapper(temp_pool.get(), r);
    try {
        return uploader_command_handler<ApacheResponse>(&r_wrapper, config,
                                                        r->path_info);
    } catch(const char *message) {
        logger.error(__FILE__, __LINE__, &r_wrapper, "Exception: %s", message);

        return HTTP_INTERNAL_SERVER_ERROR;
    }
}