]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add some more mime types for wav and mp3
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 15 Mar 2013 20:24:55 +0000 (15:24 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Sat, 16 Mar 2013 01:34:24 +0000 (20:34 -0500)
src/include/switch_utils.h
src/mod/applications/mod_httapi/mod_httapi.c
src/switch_utils.c

index 89b60ed82d3d1082911d616dc0332fa433705b25..f3e5d33a18f40e4e8daae25d68055ca2abeca867 100644 (file)
@@ -898,6 +898,7 @@ SWITCH_DECLARE(const char *) switch_cut_path(const char *in);
 
 SWITCH_DECLARE(char *) switch_string_replace(const char *string, const char *search, const char *replace);
 SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t string_len, const char *search, size_t search_len);
+SWITCH_DECLARE(int) switch_strcasecmp_any(const char *str, ...);
 
 /*!
   \brief Quote shell argument
index fd84b8e86bf28830c2d9d4894be787bcb38daa8b..9026333004fda6588270ea745f9fefec3c07c55c 100644 (file)
@@ -2601,9 +2601,10 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
                
                if ((!context->url_params || !switch_event_get_header(context->url_params, "ext")) 
                        && headers && (ct = switch_event_get_header(headers, "content-type"))) {
-                       if (!strcasecmp(ct, "audio/mpeg")) {
+                       if (switch_strcasecmp_any(ct, "audio/mpeg", "audio/x-mpeg", "audio/mp3", "audio/x-mp3", "audio/mpeg3", 
+                                                                          "audio/x-mpeg3", "audio/mpg", "audio/x-mpg", "audio/x-mpegaudio")) {
                                newext = "mp3";
-                       } else if (!strcasecmp(ct, "audio/wav")) {
+                       } else if (switch_strcasecmp_any(ct, "audio/wav", "audio/x-wave", "audio/wav")) {
                                newext = "wav";
                        }
                }
index 3051f156cf7e79285147cd39e2435edbb9d6284f..efbc3354867749e2652627a05419e4e8c85490ae 100644 (file)
@@ -122,6 +122,26 @@ SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame)
        return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_DECLARE(int) switch_strcasecmp_any(const char *str, ...)
+{
+       va_list ap;
+       const char *next_str = 0;
+       int r = 0;
+
+       va_start(ap, str);
+
+       while ((next_str = va_arg(ap, const char *))) {
+               if (!strcasecmp(str, next_str)) {
+                       r = 1;
+                       break;
+               }
+       }
+       
+       va_end(ap);
+
+       return r;
+}
+
 
 SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param, switch_memory_pool_t *pool)
 {