]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix for MDXMLINT-7 from Simon P. Ditner . Added config option disable-100-continue...
authorMichael Jerris <mike@jerris.com>
Thu, 10 May 2007 19:11:00 +0000 (19:11 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 10 May 2007 19:11:00 +0000 (19:11 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5131 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/xml_curl.conf.xml
src/mod/xml_int/mod_xml_curl/mod_xml_curl.c

index d70d8bc3e1e10f5230763d5dffd7fe0893ce0886..7240ea43b8dabf3c4fcffb6a6933329e938987ba 100644 (file)
@@ -8,6 +8,8 @@
       <param name="gateway-url" value="http://www.mydomain.com/test.cgi" bindings="dialplan"/>
       <!-- set this to provide authentication credentials to the server -->
       <!--<param name="gateway-credentials" value="muser:mypass"/>-->
+      <!-- set to true to disable Expect: 100-continue lighttpd requires this setting -->
+      <!--<param name="disable-100-continue" value="true"/>-->
     </binding>
   </bindings>
 </configuration>
index b10ff2ccc44779b9dd328aa93a4444a232f90d07..3d52ccbe39618297a06195bbccba41f7b043dec0 100644 (file)
@@ -37,6 +37,7 @@ struct xml_binding {
        char *url;
        char *bindings;
        char *cred;
+       int disable100continue;
 };
 
 typedef struct xml_binding xml_binding_t;
@@ -68,6 +69,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
        char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
        xml_binding_t *binding = (xml_binding_t *) user_data;
        char *file_url;
+       struct curl_slist *slist = NULL;
 
        if (!binding) {
                return NULL;
@@ -115,6 +117,12 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
                curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, file_callback);
                curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);
                curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0");
+\r
+               if (binding->disable100continue) {\r
+                       slist = curl_slist_append(slist,"Expect:"); \r
+                       curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist); \r
+               }
+
                curl_easy_perform(curl_handle);
                curl_easy_cleanup(curl_handle);
                close(config_data.fd);
@@ -169,6 +177,7 @@ static switch_status_t do_config(void)
                char *url = NULL;
                char *bind_cred = NULL;
                char *bind_mask = NULL;
+               int disable100continue = 0;
 
                for (param = switch_xml_child(binding_tag, "param"); param; param = param->next) {
                        char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -180,6 +189,8 @@ static switch_status_t do_config(void)
                                }
                        } else if (!strcasecmp(var, "gateway-credentials")) {
                                bind_cred = val;
+                       } else if (!strcasecmp(var, "disable-100-continue ") && switch_true(val)) {
+                               disable100continue = 1;
                        }
                }
 
@@ -203,6 +214,8 @@ static switch_status_t do_config(void)
                        binding->cred = strdup(bind_cred);
                }
 
+               binding->disable100continue = disable100continue;
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
                                                  switch_strlen_zero(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all");
                switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding->bindings), binding);