<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Hi</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
I used the mod_http_cache modul in order to manage a cache of audio files. I have a new profile in the http_cache.conf.xml:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
<profiles>
<div class="ContentPasted0 elementToProof"> <profile name="swift"></div>
<div class="ContentPasted0"> <default></div>
<div class="ContentPasted0 elementToProof"> <header name="Authorization">Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJjb3Vu...g</header></div>
<div class="ContentPasted0 elementToProof"> </default></div>
<div class="ContentPasted0 elementToProof"> </profile></div>
<div class="ContentPasted0 elementToProof"> </profiles><br>
</div>
<div class="ContentPasted0 elementToProof"><br>
</div>
<div class="ContentPasted0 elementToProof">In fs_cli when I call </div>
<div class="ContentPasted0 elementToProof"><br>
</div>
<div class="ContentPasted0 elementToProof">http_get {profile=swift]http://xx.xx.xx.xx:pppp/audio.mp3 (xx.xx.xx.xx ip and pppp the port of our swift web server)</div>
<div class="ContentPasted0 elementToProof"><br>
</div>
<div class="ContentPasted0 elementToProof">The profile "swift" is well used in order to add the header Authorization into the GET HTTP request, and the audio file is well added to the cache.</div>
<div class="ContentPasted0 elementToProof">But if I used the http_prefetch the command failed:</div>
<div class="ContentPasted0 elementToProof"><br>
</div>
<div class="ContentPasted0 elementToProof ContentPasted1">freeswitch@fs1> http_prefetch {profile=swift}http://xx.xx.xx.xx:pppp/acdc.mp3
<div class="ContentPasted1 elementToProof">+OK</div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1 elementToProof">2023-03-01 09:38:34.351425 99.70% [DEBUG] mod_http_cache.c:659 Locked cache</div>
<div class="ContentPasted1 elementToProof">2023-03-01 09:38:34.351425 99.70% [INFO] mod_http_cache.c:751 Cache MISS: size = 15 (70 MB), hit ratio = 4/20</div>
<div class="ContentPasted1 elementToProof">2023-03-01 09:38:34.351425 99.70% [DEBUG] mod_http_cache.c:816 Adding {profile=swift}http://xx.xx.xx.xx:pppp/audio.mp3(/var/cache/freeswitch/15/2a01eb-0e9a-4988-a7e3-40c80c1c9c52.mp3) to cache index 15</div>
<div class="ContentPasted1 elementToProof">2023-03-01 09:38:34.351425 99.70% [DEBUG] mod_http_cache.c:670 Unlocked cache</div>
<div class="ContentPasted1 elementToProof">2023-03-01 09:38:34.351425 99.70% [DEBUG] mod_http_cache.c:1126 opening /var/cache/freeswitch/15/2a01eb-0e9a-4988-a7e3-40c80c1c9c52.mp3 for URL cache</div>
<div class="ContentPasted1 elementToProof">2023-03-01 09:38:34.351425 99.70% [ERR] mod_http_cache.c:1187
<b>Received curl error 3 HTTP error code 0 trying to fetch {profile=swift}http://<span style="background-color:rgb(255, 255, 255);display:inline !important">xx.xx.xx.xx:pppp</span>/audio.mp3</b></div>
<div class="ContentPasted1 elementToProof">2023-03-01 09:38:34.351425 99.70% [DEBUG] mod_http_cache.c:659 Locked cache</div>
<div class="ContentPasted1 elementToProof">2023-03-01 09:38:34.351425 99.70% [INFO] mod_http_cache.c:773 Failed to download URL {profile=swift}http://<span style="background-color:rgb(255, 255, 255);display:inline !important" class="ContentPasted6">xx.xx.xx.xx:pppp</span>/audio.mp3</div>
<div class="ContentPasted1 elementToProof">2023-03-01 09:38:34.351425 99.70% [DEBUG] mod_http_cache.c:670 Unlocked cache</div>
<br>
</div>
<div class="ContentPasted0 elementToProof ContentPasted1"><br>
</div>
<div class="ContentPasted0 elementToProof ContentPasted1">When I read the mod_http_cache.c source code in the http_cache_prefetch function it seems that the parameter prefetch is added to the command</div>
<div class="ContentPasted0 elementToProof ContentPasted1">without checking if other parameters are added:</div>
<div class="ContentPasted0 elementToProof ContentPasted1 ContentPasted2">url = switch_mprintf("{prefetch=true}%s", cmd);<br>
</div>
<div class="ContentPasted0 elementToProof ContentPasted1 ContentPasted2"><br>
</div>
<div class="ContentPasted0 elementToProof ContentPasted1 ContentPasted2 ContentPasted3 ContentPasted4">
this result of a bad url: <span style="background-color:rgb(255, 255, 255);display:inline !important" class="ContentPasted5">{prefetch=true}</span>{profile=swift}http://xx.xx.xx.xx:pppp/audio.mp3, and maybe this is why curl return an error.</div>
<div class="ContentPasted0 elementToProof ContentPasted1 ContentPasted2 ContentPasted3 ContentPasted4">
<br>
</div>
<div class="ContentPasted0 elementToProof ContentPasted1 ContentPasted2 ContentPasted3 ContentPasted4">
How can i use http_prefetch with a profile?</div>
<div class="ContentPasted0 elementToProof ContentPasted1 ContentPasted2 ContentPasted3 ContentPasted4">
Thanks Eric.</div>
<div class="ContentPasted0 elementToProof"><br>
</div>
<br>
</div>
</body>
</html>