return 0;
}
+SWITCH_DECLARE(char *) switch_url_encode_opt(const char *url, char *buf, size_t len, switch_bool_t double_encode);
SWITCH_DECLARE(char *) switch_url_encode(const char *url, char *buf, size_t len);
SWITCH_DECLARE(char *) switch_url_decode(char *s);
SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
memset(xml_text_escaped, 0, need_bytes);
if (globals.encode == ENCODING_DEFAULT) {
headers = switch_curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
- switch_url_encode(xml_text, xml_text_escaped, need_bytes);
+ switch_url_encode_opt(xml_text, xml_text_escaped, need_bytes, SWITCH_TRUE);
} else {
headers = switch_curl_slist_append(headers, "Content-Type: application/x-www-form-base64-encoded");
switch_b64_encode((unsigned char *) xml_text, need_bytes / 3, (unsigned char *) xml_text_escaped, need_bytes);
return nsds;
}
-SWITCH_DECLARE(char *) switch_url_encode(const char *url, char *buf, size_t len)
+SWITCH_DECLARE(char *) switch_url_encode_opt(const char *url, char *buf, size_t len, switch_bool_t double_encode)
{
const char *p, *e = end_of_p(url);
size_t x = 0;
break;
}
- if (*p == '%' && e-p > 1) {
+ if (!double_encode && *p == '%' && e-p > 1) {
if (strchr(hex, *(p+1)) && strchr(hex, *(p+2))) {
ok = 1;
}
return buf;
}
+SWITCH_DECLARE(char *) switch_url_encode(const char *url, char *buf, size_t len)
+{
+ return switch_url_encode_opt(url, buf, len, SWITCH_FALSE);
+}
+
SWITCH_DECLARE(char *) switch_url_decode(char *s)
{
char *o;