tihomir at nexios.cc Guest
|
Posted: Thu Jan 12, 2023 8:37 am Post subject: [Freeswitch-users] mod_http_cache in version 1.10.8 is not w |
|
|
Hi Gregor,
I would start here
static char *cached_url_filename_create(url_cache_t *cache, const char *url, char **extension)
{
char *filename;
char *dirname;
char uuid_dir[3] = { 0 };
switch_uuid_t uuid;
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 };
const char *found_extension = NULL;
size_t found_extension_len = 0;
find_extension(url, &found_extension, &found_extension_len);
/* filename is constructed from UUID and is stored in cache dir (first 2 characters of UUID) */
switch_uuid_get(&uuid);
switch_uuid_format(uuid_str, &uuid);
snprintf(uuid_dir, sizeof(uuid_dir), "%.2s", uuid_str);
dirname = switch_mprintf("%s%s%s", cache->location, SWITCH_PATH_SEPARATOR, uuid_dir);
/* create sub-directory if it doesn't exist */
switch_dir_make_recursive(dirname, SWITCH_DEFAULT_DIR_PERMS, cache->pool);
if (!zstr(found_extension) && found_extension_len > 0) {
char *found_extension_dup = strndup(found_extension, found_extension_len);
filename = switch_mprintf("%s%s%s.%s", dirname, SWITCH_PATH_SEPARATOR, &uuid_str[2], found_extension_dup);
if (extension) {
*extension = found_extension_dup;
} else {
free(found_extension_dup);
}
} else {
filename = switch_mprintf("%s%s%s", dirname, SWITCH_PATH_SEPARATOR, &uuid_str[2]);
if (extension) {
*extension = NULL;
}
}
free(dirname);
return filename;
}
Put some logging, recompile and see how the file path and name is built up.
This created a file name with 0000000000000000000000
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }
my guess:
switch_uuid_get(&uuid); didn't return a valid UUID
or
switch_uuid_format(uuid_str, &uuid); messed something out..
anyhow.. put logging there, recompile and see what you get.
Tihomir Culjaga
Business Development
& Presales Manager
[/url] [url=https://www.linkedin.com/company/nexioscc/] [/url]
M
[url=tel:+385916331550]385 (0)91 633 1550
E
tihomir@nexios.cc (tihomir@nexios.cc)
W
www.nexios.cc
From: FreeSWITCH-users [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Gregor Nanger
Sent: 12. siječnja 2023. 9:32
To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org>
Subject: Re: [Freeswitch-users] mod_http_cache in version 1.10.8 is not working
Am I the only one that has this issue?
Br, Gregor
On Wed, 11 Jan 2023, 00:41 Gregor Nanger, <gregor@infomedia.si (gregor@infomedia.si)> wrote:
Quote: |
Caching files stopped working after upgrade.
First file that is in playback is saved as: storage/http_file_cache/00000000000000000000000000000000.wav
And after that all files are played as this cache. Basically it doesn't cache files anymore and always pulls this one from cache.
This is the log when it is first cached:
EXECUTE [depth=0] sofia/external/041600611@91.199.161.142 (041600611@91.199.161.142) playback(http://wav.files.com/109da642-87ed-4596-8b82-ddefd379c3bb.wav)
2023-01-10 23:59:45.823739 97.05% [DEBUG] mod_httapi.c:2665 caching: url:http://wav.files.com/109da642-87ed-4596-8b82-ddefd379c3bb.wav to C:/Program Files/FreeSWITCH/storage/http_file_cache/00000000000000000000000000000000.wav (344649 bytes)
It looks like it doesn't pass file name down to http_cache or it is passed as 00000...
I checked source code of this module and there is some md5 functions that hash name. Could this function returns 00000000... as name? We are using FS on windows, but version 1.10.7 works ok.
BR, Greg
|
|
|