File: load_cookies.tcl

package info (click to toggle)
libapache2-mod-rivet 3.1.1-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 5,716 kB
  • sloc: xml: 8,442; tcl: 7,199; ansic: 6,727; sh: 4,983; makefile: 261; sql: 91; lisp: 78
file content (26 lines) | stat: -rw-r--r-- 573 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
###
##
## load_cookies - Read the cookies out of the web environment HTTP_COOKIE
## variable, parse it, and store them as key-value pairs into the named
## array.
##
## $Id$
##
###

namespace eval ::rivet {

    proc load_cookies {{arrayName cookies}} {
        upvar 1 $arrayName cookies

        set HTTP_COOKIE [env HTTP_COOKIE]

        foreach pair [split $HTTP_COOKIE ";"] {
            set pair [split [string trim $pair] "="]
            set key [lindex $pair 0]
            set value [lindex $pair 1]
            set cookies($key) [list $value]
        }
    }

}