From: Chris Rienzo Date: Wed, 22 May 2019 20:43:56 +0000 (+0000) Subject: FS-11858 [mod_hiredis] allow using single-quote when setting key to a value that... X-Git-Tag: v1.10.0~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e73f319aec9120a96da5f001373352852ba76db2;p=thirdparty%2Ffreeswitch.git FS-11858 [mod_hiredis] allow using single-quote when setting key to a value that has spaces --- diff --git a/src/mod/applications/mod_hiredis/hiredis_profile.c b/src/mod/applications/mod_hiredis/hiredis_profile.c index a5fbec1da8..ef42d22a91 100644 --- a/src/mod/applications/mod_hiredis/hiredis_profile.c +++ b/src/mod/applications/mod_hiredis/hiredis_profile.c @@ -304,7 +304,12 @@ static switch_status_t hiredis_context_execute_requests(hiredis_context_t *conte /* eval needs special formatting to work properly */ redisAppendCommand(context->context, "eval %s %d %s", cur_request->request, cur_request->num_keys, cur_request->keys ? cur_request->keys : ""); } else { - redisAppendCommand(context->context, cur_request->request); + if (cur_request->argc == 0) { + cur_request->argc = switch_separate_string(cur_request->request, ' ', cur_request->argv, MOD_HIREDIS_MAX_ARGS); + } + if (cur_request->argc > 0) { + redisAppendCommandArgv(context->context, cur_request->argc, (const char **)cur_request->argv, NULL); + } } } diff --git a/src/mod/applications/mod_hiredis/mod_hiredis.h b/src/mod/applications/mod_hiredis/mod_hiredis.h index faf8fb7a77..b60fb530f9 100644 --- a/src/mod/applications/mod_hiredis/mod_hiredis.h +++ b/src/mod/applications/mod_hiredis/mod_hiredis.h @@ -5,6 +5,8 @@ #include #include +#define MOD_HIREDIS_MAX_ARGS 64 + typedef struct mod_hiredis_global_s { switch_memory_pool_t *pool; switch_hash_t *profiles; @@ -25,6 +27,8 @@ typedef struct hiredis_request_s { switch_mutex_t *mutex; switch_thread_cond_t *cond; struct hiredis_request_s *next; + size_t argc; + char *argv[MOD_HIREDIS_MAX_ARGS]; } hiredis_request_t; typedef struct mod_hiredis_context_s {