Adds ast_escape_encoded utility to properly handle escaping of quoted field before uri.

This commit backports a feature in trunk affecting initreqprep so that display name won't
be encoded improperly. Also includes unit tests for the ast_escape_quoted function.
This patch gives 1.8 a much improved outlook in countries which don't use standard
ASCII characters.

(closes issue ASTERISK-16949)
Reported by: Örn Arnarson
Review: https://reviewboard.asterisk.org/r/1235/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@322585 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2011-06-09 14:06:42 +00:00
parent e0b2c103f6
commit 5f46b994f4
4 changed files with 95 additions and 1 deletions

View File

@@ -273,6 +273,19 @@ char *ast_uri_encode(const char *string, char *outbuf, int buflen, int do_specia
*/
void ast_uri_decode(char *s);
/*!
* \brief Escape characters found in a quoted string.
*
* \note This function escapes quoted characters based on the 'qdtext' set of
* allowed characters from RFC 3261 section 25.1.
*
* \param string string to be escaped
* \param outbuf resulting escaped string
* \param buflen size of output buffer
* \return a pointer to the escaped string
*/
char *ast_escape_quoted(const char *string, char *outbuf, int buflen);
static force_inline void ast_slinear_saturated_add(short *input, short *value)
{
int res;