[asterisk-bugs] [Asterisk 0018037]: [patch] func_uri could use a QSFIELD function to parse x-www-form-urlencoded data
Asterisk Bug Tracker
noreply at bugs.digium.com
Thu Sep 23 10:59:11 CDT 2010
The following issue has been UPDATED.
======================================================================
https://issues.asterisk.org/view.php?id=18037
======================================================================
Reported By: wdoekes
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 18037
Category: Functions/func_uri
Reproducibility: always
Severity: feature
Priority: normal
Status: ready for testing
Asterisk Version: 1.6.2.13
JIRA:
Regression: No
Reviewboard Link:
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Request Review:
======================================================================
Date Submitted: 2010-09-23 10:18 CDT
Last Modified: 2010-09-23 10:59 CDT
======================================================================
Summary: [patch] func_uri could use a QSFIELD function to
parse x-www-form-urlencoded data
Description:
Hi,
I've added a QSFIELD function to func_uri.c to get fields from a
querystring. I thought this would be an acceptable way to read an ordered
dictionary gotten through e.g. func_curl.
[Synopsis]
Gets a single field from a application/x-www-form-urlencoded query string.
[Description]
Returns the URI-decoded content from the <index>-th field with name
<field>
from query string found in variable <varname>.
[Syntax]
QSFIELD(varname,field[,index])
Example:
exten =>
_IDX!,n,Set(qsdata=field1=pe%20%25%40%26%3dna&field1=pe+na2&field2=pena3)
exten => _IDX!,n,NoOp(qsdata is ${qsdata})
exten => _IDX!,n,NoOp(qstest ${QSFIELD(qsdata,field1,-1)})
exten => _IDX!,n,NoOp(qstest ${QSFIELD(qsdata,field2,-1)})
exten => _IDX!,n,NoOp(qstest ${QSFIELD(qsdata,field1,0)})
exten => _IDX!,n,NoOp(qstest ${QSFIELD(qsdata,field2,0)})
exten => _IDX!,n,NoOp(qstest ${QSFIELD(qsdata,field1,1)})
exten => _IDX!,n,NoOp(qstest ${QSFIELD(qsdata,field2,1)})
Set("qsdata=field1=pe%20%25%40%26%3dna&field1=pe+na2&field2=pena3")
NoOp("qsdata is field1=pe%20%25%40%26%3dna&field1=pe+na2&field2=pena3")
NoOp("qstest pe na2")
NoOp("qstest pena3")
NoOp("qstest pe %@&=na")
NoOp("qstest pena3")
NoOp("qstest pe na2")
NOTICE[4224]: func_uri.c:243 qsfield: Field field2= not found in query
string from qsdata on requested index
NoOp("qstest ")
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2010-09-23 10:59 lmadsen Description Updated
======================================================================
More information about the asterisk-bugs
mailing list