Files
jambonz-infrastructure/packer/jambonz-feature-server/aws/files/mod_httapi.c.patch
Dave Horton 32f8b0a4be Feature/debian bookworm (#80)
updates to latest freeswitch (1.10.10), includes latest drachtio-freeswitch-modules with some fixes, updates to lws 4.3.2 (which has MIT License), and some fixes for debian bookworm though not working yet
2023-09-25 14:24:41 -04:00

57 lines
2.3 KiB
Diff

--- mod_httapi.c 2023-08-23 17:17:49.626199388 +0000
+++ mod_httapi.c.new 2023-08-23 18:04:06.972949593 +0000
@@ -2477,6 +2477,13 @@
char *ua = NULL;
const char *profile_name = NULL;
int tries = 10;
+ int awsSignedUrl = strstr(url, "X-Amz-Signature") != NULL &&
+ strstr(url, "X-Amz-Algorithm") != NULL &&
+ strstr(url, "X-Amz-Credential") != NULL &&
+ strstr(url, "X-Amz-Date") != NULL &&
+ strstr(url, "X-Amz-Expires") != NULL &&
+ strstr(url, "X-Amz-SignedHeaders") != NULL;
+
if (context->url_params) {
profile_name = switch_event_get_header(context->url_params, "profile_name");
@@ -2619,7 +2626,7 @@
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) client);
} else {
switch_curl_easy_setopt(curl_handle, CURLOPT_HEADER, 1);
- switch_curl_easy_setopt(curl_handle, CURLOPT_NOBODY, 1);
+ if (!awsSignedUrl) switch_curl_easy_setopt(curl_handle, CURLOPT_NOBODY, 1);
/* Prevent writing the data (headers in this case) to stdout */
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, dummy_save_file_callback);
@@ -2789,6 +2796,12 @@
char *metadata;
const char *ext = NULL;
const char *err_msg = NULL;
+ int awsSignedUrl = strstr(url, "X-Amz-Signature") != NULL &&
+ strstr(url, "X-Amz-Algorithm") != NULL &&
+ strstr(url, "X-Amz-Credential") != NULL &&
+ strstr(url, "X-Amz-Date") != NULL &&
+ strstr(url, "X-Amz-Expires") != NULL &&
+ strstr(url, "X-Amz-SignedHeaders") != NULL;
load_cache_data(context, url);
@@ -2837,7 +2850,7 @@
if (!unreachable && !zstr(context->metadata)) {
metadata = switch_core_sprintf(context->pool, "%s:%s:%s:%s:%s",
- url,
+ awsSignedUrl ? context->cache_file : url,
switch_event_get_header_nil(headers, "last-modified"),
switch_event_get_header_nil(headers, "etag"),
switch_event_get_header_nil(headers, "content-length"),
@@ -2861,7 +2874,7 @@
metadata = switch_core_sprintf(context->pool, "%s:%s:%s:%s:%s",
- url,
+ awsSignedUrl ? context->cache_file : url,
switch_event_get_header_nil(headers, "last-modified"),
switch_event_get_header_nil(headers, "etag"),
switch_event_get_header_nil(headers, "content-length"),