From 9b1d58653ce0f225ecc16da7f45ee3c104ff27c2 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 3 Jun 2017 01:01:08 +0300 Subject: [PATCH] FS-10365 [mod_http_cache] Add mod_http_cache to the windows build. --- Freeswitch.2015.sln | 17 +- src/mod/applications/mod_http_cache/azure.c | 4 + .../mod_http_cache/mod_http_cache.c | 43 ++++- .../mod_http_cache/mod_http_cache.vcxproj | 152 ++++++++++++++++++ 4 files changed, 213 insertions(+), 3 deletions(-) create mode 100644 src/mod/applications/mod_http_cache/mod_http_cache.vcxproj diff --git a/Freeswitch.2015.sln b/Freeswitch.2015.sln index 0c8d3a1946..40fbd26688 100644 --- a/Freeswitch.2015.sln +++ b/Freeswitch.2015.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Codecs", "Codecs", "{F881ADA2-2F1A-4046-9FEB-191D9422D781}" EndProject @@ -649,6 +649,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download libx264", "libs\wi EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download tiff", "libs\win32\Download tiff.2015.vcxproj", "{583D8CEA-4171-4493-9025-B63265F408D8}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_http_cache", "src\mod\applications\mod_http_cache\mod_http_cache.vcxproj", "{87933C2D-0159-46F7-B326-E1B6E982C21E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2903,6 +2905,18 @@ Global {583D8CEA-4171-4493-9025-B63265F408D8}.Release|Win32.ActiveCfg = Release|Win32 {583D8CEA-4171-4493-9025-B63265F408D8}.Release|Win32.Build.0 = Release|Win32 {583D8CEA-4171-4493-9025-B63265F408D8}.Release|x64.ActiveCfg = Release|Win32 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.All|Win32.ActiveCfg = Release|Win32 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.All|Win32.Build.0 = Release|Win32 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.All|x64.ActiveCfg = Release|x64 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.All|x64.Build.0 = Release|x64 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.Debug|Win32.ActiveCfg = Debug|Win32 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.Debug|Win32.Build.0 = Debug|Win32 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.Debug|x64.ActiveCfg = Debug|x64 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.Debug|x64.Build.0 = Debug|x64 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.Release|Win32.ActiveCfg = Release|Win32 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.Release|Win32.Build.0 = Release|Win32 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.Release|x64.ActiveCfg = Release|x64 + {87933C2D-0159-46F7-B326-E1B6E982C21E}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3134,5 +3148,6 @@ Global {20179127-853B-4FE9-B7C0-9E817E6A3A72} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {6D1BC01C-3F97-4C08-8A45-69C9B94281AA} = {C120A020-773F-4EA3-923F-B67AF28B750D} {583D8CEA-4171-4493-9025-B63265F408D8} = {C120A020-773F-4EA3-923F-B67AF28B750D} + {87933C2D-0159-46F7-B326-E1B6E982C21E} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} EndGlobalSection EndGlobal diff --git a/src/mod/applications/mod_http_cache/azure.c b/src/mod/applications/mod_http_cache/azure.c index 61a2b2fd95..f1e4cf8925 100644 --- a/src/mod/applications/mod_http_cache/azure.c +++ b/src/mod/applications/mod_http_cache/azure.c @@ -49,6 +49,10 @@ struct curl_memory_read { }; typedef struct curl_memory_read curl_memory_read_t; +#if defined(_WIN32) || defined(_WIN64) +# define strtok_r strtok_s +#endif + /** * Convert query string parameters into string to be appended to * Azure authentication header diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index e84074dd93..2af2cd1770 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -39,6 +39,45 @@ #include +#ifdef WIN32 +#include +typedef SSIZE_T ssize_t; + +#include +#include + +char *strcasestr(const char *str, const char *pattern) { + size_t i; + + if (!*pattern) + return (char*)str; + + for (; *str; str++) { + if (toupper(*str) == toupper(*pattern)) { + for (i = 1;; i++) { + if (!pattern[i]) + return (char*)str; + if (toupper(str[i]) != toupper(pattern[i])) + break; + } + } + } + return NULL; +} + +char *strndup(const char *s, size_t n) +{ + char *p; + + p = (char *)malloc(n + 1); + if (p == NULL) + return NULL; + memcpy(p, s, n); + p[n] = '\0'; + return p; +} +#endif + /* 253 max domain size + '/' + NUL byte */ #define DOMAIN_BUF_SIZE 255 @@ -1496,10 +1535,10 @@ static switch_status_t do_config(url_cache_t *cache) /* set default config */ max_urls = 4000; default_max_age_sec = 86400; - cache->location = SWITCH_PREFIX_DIR "/http_cache"; + cache->location = switch_core_sprintf(cache->pool, "%s%s", SWITCH_GLOBAL_dirs.base_dir, "/http_cache"); cache->prefetch_queue_size = 100; cache->prefetch_thread_count = 8; - cache->ssl_cacert = SWITCH_PREFIX_DIR "/conf/cacert.pem"; + cache->ssl_cacert = switch_core_sprintf(cache->pool, "%s%s", SWITCH_GLOBAL_dirs.certs_dir, "/cacert.pem"); cache->ssl_verifyhost = 1; cache->ssl_verifypeer = 1; cache->enable_file_formats = 0; diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.vcxproj b/src/mod/applications/mod_http_cache/mod_http_cache.vcxproj new file mode 100644 index 0000000000..1e00d0e35f --- /dev/null +++ b/src/mod/applications/mod_http_cache/mod_http_cache.vcxproj @@ -0,0 +1,152 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_http_cache + mod_http_cache + Win32Proj + {87933C2D-0159-46F7-B326-E1B6E982C21E} + + + + DynamicLibrary + MultiByte + v140 + + + DynamicLibrary + MultiByte + v140 + + + DynamicLibrary + MultiByte + v140 + + + DynamicLibrary + MultiByte + v140 + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + $(SolutionDir)\src\include;$(SolutionDir)libs\curl-7.35.0\include;%(AdditionalIncludeDirectories) + + + + + false + + + + + + + X64 + + + $(SolutionDir)\src\include;$(SolutionDir)\libs\curl-7.35.0\include;%(AdditionalIncludeDirectories) + + + + + false + + + MachineX64 + + + + + $(SolutionDir)\src\include;$(SolutionDir)\libs\curl-7.35.0\include;%(AdditionalIncludeDirectories) + + + + + false + + + + + + + X64 + + + $(SolutionDir)\src\include;$(SolutionDir)\libs\curl-7.35.0\include;%(AdditionalIncludeDirectories) + + + + + false + + + MachineX64 + + + + + + + + + + + {87ee9da4-de1e-4448-8324-183c98dca588} + + + {d331904d-a00a-4694-a5a3-fcff64ab5dbe} + + + {b4b62169-5ad4-4559-8707-3d933ac5db39} + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + false + + + + + + \ No newline at end of file