Skip to content
Snippets Groups Projects
  • Matthew Nicholson's avatar
    e706b570
    According to section 19.1.2 of RFC 3261: · e706b570
    Matthew Nicholson authored
      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
    e706b570
    History
    According to section 19.1.2 of RFC 3261:
    Matthew Nicholson authored
      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