summaryrefslogtreecommitdiff
path: root/channels/sip/reqresp_parser.c
diff options
context:
space:
mode:
authorMatthew Nicholson <mnicholson@digium.com>2011-01-24 18:59:22 +0000
committerMatthew Nicholson <mnicholson@digium.com>2011-01-24 18:59:22 +0000
commite706b5706e1ed503569c28c7a374a31063bf4244 (patch)
tree9e6c6ce3c4de14d886a8c131a7621a792d457728 /channels/sip/reqresp_parser.c
parent54f6c31a27319d768da73afa966423e1083bb486 (diff)
According to section 19.1.2 of RFC 3261:
For each component, the set of valid BNF expansions defines exactly which characters may appear unescaped. All other characters MUST be escaped. This patch modifies ast_uri_encode() to encode strings in line with this recommendation. This patch also adds an ast_escape_quoted() function which escapes '"' and '\' characters in quoted strings in accordance with section 25.1 of RFC 3261. The ast_uri_encode() function has also been modified to take an ast_flags struct describing the set of rules it should use when escaping characters to allow for it to escape SIP URIs in addition to HTTP URIs and other types of URIs or variations of those two URI types in the future. The ast_uri_decode() function has also been modified to accept an ast_flags struct describing the set of rules to use when decoding to enable decoding '+' as ' ' in legacy http URLs. The unit tests for these functions have also been updated. ABE-2705 Review: https://reviewboard.asterisk.org/r/1081/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@303509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sip/reqresp_parser.c')
-rw-r--r--channels/sip/reqresp_parser.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/channels/sip/reqresp_parser.c b/channels/sip/reqresp_parser.c
index 4534bd7f8..aaf1f56c7 100644
--- a/channels/sip/reqresp_parser.c
+++ b/channels/sip/reqresp_parser.c
@@ -852,7 +852,7 @@ int get_name_and_number(const char *hdr, char **name, char **number)
/* number is not option, and must be present at this point */
*number = ast_strdup(tmp_number);
- ast_uri_decode(*number);
+ ast_uri_decode(*number, ast_uri_sip_user);
/* name is optional and may not be present at this point */
if (!ast_strlen_zero(tmp_name)) {
@@ -2044,8 +2044,8 @@ int sip_uri_cmp(const char *input1, const char *input2)
uri1 = ast_strdupa(input1);
uri2 = ast_strdupa(input2);
- ast_uri_decode(uri1);
- ast_uri_decode(uri2);
+ ast_uri_decode(uri1, ast_uri_sip_user);
+ ast_uri_decode(uri2, ast_uri_sip_user);
uri_scheme1 = strsep(&uri1, ":");
uri_scheme2 = strsep(&uri2, ":");