~ubuntu-branches/ubuntu/precise/maas/precise-security

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/querystring-parse-simple/querystring-parse-simple.js

Tags: 1.2+bzr1373+dfsg-0ubuntu1~12.04.4
* SECURITY UPDATE: failure to authenticate downloaded content (LP: #1039513)
  - debian/patches/CVE-2013-1058.patch: Authenticate downloaded files with
    GnuPG and MD5SUM files. Thanks to Julian Edwards.
  - CVE-2013-1058
* SECURITY UPDATE: configuration options may be loaded from current working
  directory (LP: #1158425)
  - debian/patches/CVE-2013-1057-1-2.patch: Do not load configuration
    options from the current working directory. Thanks to Julian Edwards.
  - CVE-2013-1057

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('querystring-parse-simple', function(Y) {
8
 
 
9
 
// @TODO this looks like we are requiring the user to extract the querystring
10
 
// portion of the url, which isn't good.  The majority use case will be to
11
 
// extract querystring from the document configured for this YUI instance.
12
 
// This should be the default if qs is not supplied.
13
 
 
14
 
/*global Y */
15
 
/**
16
 
 * <p>Provides Y.QueryString.stringify method for converting objects to Query Strings.
17
 
 * This is a simpler implementation than the full querystring-stringify.</p>
18
 
 * <p>Because some things may require basic query string escaping functionality,
19
 
 * this module provides the bare minimum functionality (decoding a hash of simple values),
20
 
 * without the additional support for arrays, objects, and so on.</p>
21
 
 * <p>This provides a friendly way to deserialize basic query strings, without necessitating
22
 
 * a lot of code for simple use-cases.</p>
23
 
 *
24
 
 * @module querystring
25
 
 * @submodule querystring-parse-simple
26
 
 * @for QueryString
27
 
 * @static
28
 
 */
29
 
 
30
 
var QueryString = Y.namespace("QueryString");
31
 
 
32
 
/**
33
 
 * Provides Y.QueryString.parse method to accept Query Strings and return native
34
 
 * JavaScript objects.
35
 
 *
36
 
 * @module querystring
37
 
 * @submodule querystring-parse
38
 
 * @for QueryString
39
 
 * @method parse
40
 
 * @param qs {String} Querystring to be parsed into an object.
41
 
 * @param sep {String} (optional) Character that should join param k=v pairs together. Default: "&"
42
 
 * @param eq  {String} (optional) Character that should join keys to their values. Default: "="
43
 
 * @public
44
 
 * @static
45
 
 */
46
 
QueryString.parse = function (qs, sep, eq) {
47
 
    sep = sep || "&";
48
 
    eq = eq || "=";
49
 
    for (
50
 
        var obj = {},
51
 
            i = 0,
52
 
            pieces = qs.split(sep),
53
 
            l = pieces.length,
54
 
            tuple;
55
 
        i < l;
56
 
        i ++
57
 
    ) {
58
 
        tuple = pieces[i].split(eq);
59
 
        if (tuple.length > 0) {
60
 
            obj[QueryString.unescape(tuple.shift())] = QueryString.unescape(tuple.join(eq));
61
 
        }
62
 
    }
63
 
    return obj;
64
 
};
65
 
 
66
 
/**
67
 
 * Provides Y.QueryString.unescape method to be able to override default decoding
68
 
 * method.  This is important in cases where non-standard delimiters are used, if
69
 
 * the delimiters would not normally be handled properly by the builtin
70
 
 * (en|de)codeURIComponent functions.
71
 
 * Default: replace "+" with " ", and then decodeURIComponent behavior.
72
 
 * @module querystring
73
 
 * @submodule querystring-parse
74
 
 * @for QueryString
75
 
 * @method unescape
76
 
 * @param s {String} String to be decoded.
77
 
 * @public
78
 
 * @static
79
 
 **/
80
 
QueryString.unescape = function (s) {
81
 
    return decodeURIComponent(s.replace(/\+/g, ' '));
82
 
};
83
 
 
84
 
 
85
 
}, '3.4.1' ,{requires:['yui-base']});