[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
Fri Oct 1 14:39:46 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
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:                       SWP-2294 
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-10-01 14:39 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 ")
====================================================================== 

---------------------------------------------------------------------- 
 (0127598) lmadsen (administrator) - 2010-10-01 14:39
 https://issues.asterisk.org/view.php?id=18037#c127598 
---------------------------------------------------------------------- 
Do you still want to consider this as something to include, or are you
happy with the way you've solved the problem?

John, Russell, and myself don't quite understand what this is trying to
do. Perhaps we need a "dumbed down" example :D 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-10-01 14:39 lmadsen        Note Added: 0127598                          
======================================================================




More information about the asterisk-bugs mailing list