[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
Tue Feb 8 14:04:38 CST 2011


The following issue has been CLOSED 
====================================================================== 
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:                     closed
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:              
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             2010-09-23 10:18 CDT
Last Modified:              2011-02-08 14:04 CST
====================================================================== 
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 ")
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
parent of           0018046 [patch] func_curl CURLOPT lacks a query...
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-02-08 14:04 lmadsen        Status                   ready for testing =>
closed
======================================================================




More information about the asterisk-bugs mailing list