[commit] r5131 - in freeswitch/trunk: conf src/mod/xml_int/mod_xml_curl
Author: mikej Date: Thu May 10 15:11:00 2007 New Revision: 5131 Modified: freeswitch/trunk/conf/xml_curl.conf.xml freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c Log: fix for MDXMLINT-7 from Simon P. Ditner . Added config option disable-100-continue to disable the Expect: 100-continue HTTP 1.1 header so that it will work with lighthttpd. Modified: freeswitch/trunk/conf/xml_curl.conf.xml ============================================================================== --- freeswitch/trunk/conf/xml_curl.conf.xml (original) +++ freeswitch/trunk/conf/xml_curl.conf.xml Thu May 10 15:11:00 2007 @@ -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> Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c ============================================================================== --- freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c (original) +++ freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c Thu May 10 15:11:00 2007 @@ -37,6 +37,7 @@ char *url; char *bindings; char *cred; + int disable100continue; }; typedef struct xml_binding xml_binding_t; @@ -68,6 +69,7 @@ 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 @@ 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"); + + if (binding->disable100continue) { + slist = curl_slist_append(slist,"Expect:"); + curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist); + } + curl_easy_perform(curl_handle); curl_easy_cleanup(curl_handle); close(config_data.fd); @@ -169,6 +177,7 @@ 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 @@ } } 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 @@ 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);
participants (1)
-
Freeswitch SVN