提交 750b1dd8 authored 作者: Travis Cross's avatar Travis Cross

Allow streaming binary data from mod_memcache

Previously data returned from `memcache get` would be truncated at the
first NULL byte.

By using raw_write_function here to stream the returned memcache
value, we allow mod_memcache to be used for audio and other arbitrary
binary data.

Dave has a format module planned that relies on this.

Thanks-to: Dave Olszewski <dolszewski@marchex.com>

FS-7114 #resolve
上级 ffef746d
...@@ -283,7 +283,7 @@ SWITCH_STANDARD_API(memcache_function) ...@@ -283,7 +283,7 @@ SWITCH_STANDARD_API(memcache_function)
val = memcached_get(memcached, key, strlen(key), &string_length, &flags, &rc); val = memcached_get(memcached, key, strlen(key), &string_length, &flags, &rc);
if (rc == MEMCACHED_SUCCESS) { if (rc == MEMCACHED_SUCCESS) {
stream->write_function(stream, "%.*s", (int) string_length, val); stream->raw_write_function(stream, (uint8_t*)val, (int)string_length);
} else { } else {
switch_safe_free(val); switch_safe_free(val);
switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error); switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论