Tcl Library Source Code

Changes On Branch bug-3601995-ncgi
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch bug-3601995-ncgi Excluding Merge-Ins

This is equivalent to a diff from ca44329bef to b6632970f6

2013-01-30
23:28
Added more utilities to support class variables, class methods, and singleton classes. Packed version bumped to 1.1 for all these new features. check-in: 4eec538864 user: andreask tags: trunk
20:11
Merged ncgi fixes (bug 3601995 branch) into release. Updated README. check-in: 66adc26a8b user: andreask tags: tcllib-1-15-rc
20:07
[Bug 3601995]: Accepted [decode] changes by <[email protected]>. Fixed both missing acceptance of various utf-8 sequences, and missing rejection of various bad sequences. Test cases added. Bumped to version 1.4.1. Closed-Leaf check-in: b6632970f6 user: andreask tags: bug-3601995-ncgi
2013-01-29
18:40
Proposed fix to the decode regexes to cover missing characters, and exclude illegal sequences. check-in: 59ab122987 user: andreask tags: bug-3601995-ncgi
2013-01-28
23:18
Merged trunk into release work, new zipfile de- and encoder packages. Updated README. check-in: 8472e0d257 user: andreask tags: tcllib-1-15-rc
23:14
New module for zipfile de- and encoding. Plus support new package in fileutil. check-in: ca44329bef user: andreask tags: trunk
2013-01-21
21:56
Regenerated the certificates here again, 10 years at 1024 bit. The issue with [7b80198969] seems to have been that I extended the Root cert validity to 100 years, and that screwed something up. With the root certs now back to 10 years (+10 days) validity, things are fine. I suspect that I may have run into the Y2038 problem in either Tcl and/or openssl. check-in: 8252e19883 user: andreask tags: trunk

Changes to modules/ncgi/ChangeLog.









1
2
3
4
5
6
7








2012-05-03  Andreas Kupries  <[email protected]>

	* ncgi.tcl: Applied Richard Hipp's patch to extend handling of
	* pkgIndex.tcl: utf characters in [decode]. Extended testsuite.
	* ncgi.man: Used the opportunity to bump the minimum required
	* ncgi.test: Tcl runtime up to 8.4. Bumped package version up
	  to 1.4 to reflect this latter change.
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2013-01-30  Andreas Kupries  <[email protected]>

	* ncgi.man: [Bug 3601995]: Accepted [decode] changes by
	* ncgi.tcl: <[email protected]>. Fixed both missing
	* ncgi.test: acceptance of various ut-8 sequences, and missing
	* pkgIndex.tcl: rejection of bad sequences. Test cases
	  added. Bumped to version 1.4.1.

2012-05-03  Andreas Kupries  <[email protected]>

	* ncgi.tcl: Applied Richard Hipp's patch to extend handling of
	* pkgIndex.tcl: utf characters in [decode]. Extended testsuite.
	* ncgi.man: Used the opportunity to bump the minimum required
	* ncgi.test: Tcl runtime up to 8.4. Bumped package version up
	  to 1.4 to reflect this latter change.

Changes to modules/ncgi/ncgi.man.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[manpage_begin ncgi n 1.4]
[comment {-*- tcl -*- doctools manpage}]
[moddesc   {CGI Support}]
[titledesc {Procedures to manipulate CGI values.}]
[category  {CGI programming}]
[require Tcl 8.2]
[require ncgi [opt 1.4]]
[description]
[para]

The [package ncgi] package provides commands that manipulate CGI
values.  These are values that come from Web forms and are processed
either by CGI scripts or web pages with embedded Tcl code.  Use the
[package ncgi] package to query these values, set and get cookies, and
|




|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
[manpage_begin ncgi n 1.4.1]
[comment {-*- tcl -*- doctools manpage}]
[moddesc   {CGI Support}]
[titledesc {Procedures to manipulate CGI values.}]
[category  {CGI programming}]
[require Tcl 8.4]
[require ncgi [opt 1.4.1]]
[description]
[para]

The [package ncgi] package provides commands that manipulate CGI
values.  These are values that come from Web forms and are processed
either by CGI scripts or web pages with embedded Tcl code.  Use the
[package ncgi] package to query these values, set and get cookies, and

Changes to modules/ncgi/ncgi.tcl.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# repeated.  The names and values are encoded, and this module takes care
# of decoding them.

# We use newer string routines
package require Tcl 8.4
package require fileutil ; # Required by importFile.

package provide ncgi 1.4

namespace eval ::ncgi {

    # "query" holds the raw query (i.e., form) data
    # This is treated as a cache, too, so you can call ncgi::query more than
    # once








|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# repeated.  The names and values are encoded, and this module takes care
# of decoding them.

# We use newer string routines
package require Tcl 8.4
package require fileutil ; # Required by importFile.

package provide ncgi 1.4.1

namespace eval ::ncgi {

    # "query" holds the raw query (i.e., form) data
    # This is treated as a cache, too, so you can call ncgi::query more than
    # once

265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281

proc ncgi::decode {str} {
    # rewrite "+" back to space
    # protect \ from quoting another '\'
    set str [string map [list + { } "\\" "\\\\" \[ \\\[ \] \\\]] $str]

    # prepare to process all %-escapes
    regsub -all -- {%([A-Fa-f][A-Fa-f0-9])%([A-Fa-f][A-Fa-f0-9])%([A-Fa-f][A-Fa-f0-9])} \
	$str {[encoding convertfrom utf-8 [DecodeHex \1\2\3]]} str
    regsub -all -- {%([A-Fa-f][A-Fa-f0-9])%([A-Fa-f][A-Fa-f0-9])} \
	$str {[encoding convertfrom utf-8 [DecodeHex \1\2]]} str
    regsub -all -- {%([0-7][A-Fa-f0-9])} $str {\\u00\1} str

    # process \u unicode mapped chars
    return [subst -novar $str]
}








|

|







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281

proc ncgi::decode {str} {
    # rewrite "+" back to space
    # protect \ from quoting another '\'
    set str [string map [list + { } "\\" "\\\\" \[ \\\[ \] \\\]] $str]

    # prepare to process all %-escapes
    regsub -all -- {%([Ee][A-Fa-f0-9])%([89ABab][A-Fa-f0-9])%([89ABab][A-Fa-f0-9])} \
	$str {[encoding convertfrom utf-8 [DecodeHex \1\2\3]]} str
    regsub -all -- {%([CDcd][A-Fa-f0-9])%([89ABab][A-Fa-f0-9])}                     \
	$str {[encoding convertfrom utf-8 [DecodeHex \1\2]]} str
    regsub -all -- {%([0-7][A-Fa-f0-9])} $str {\\u00\1} str

    # process \u unicode mapped chars
    return [subst -novar $str]
}

Changes to modules/ncgi/ncgi.test.

124
125
126
127
128
129
130
















131
132
133
134
135
136
137
    ncgi::decode {aik%C5%ABloa}
} "aik\u016Bloa" ; # u+macron

test ncgi-3.6 {ncgi::decode} {
    ncgi::decode {paran%C3%A1}
} "paran\u00E1" ; # a+acute

















test ncgi-4.1 {ncgi::encode} {
    ncgi::encode abcdef0123
} abcdef0123

test ncgi-4.2 {ncgi::encode} {
    ncgi::encode "\[abc\]def\$0123\\x"
} {%5Babc%5Ddef%240123%5Cx}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
    ncgi::decode {aik%C5%ABloa}
} "aik\u016Bloa" ; # u+macron

test ncgi-3.6 {ncgi::decode} {
    ncgi::decode {paran%C3%A1}
} "paran\u00E1" ; # a+acute

test ncgi-3.7 {ncgi::decode, bug 3601995} {
    ncgi::decode {%C4%85}
} "\u0105" ; # a+ogonek

test ncgi-3.8 {ncgi::decode, bug 3601995} {
    ncgi::decode {%E2%80%A0}
} "\u2020" ; # dagger

test ncgi-3.9 {ncgi::decode, bug 3601995} {
    ncgi::decode {%E2%A0%90}
} "\u2810" ; # a braille pattern

test ncgi-3.10 {ncgi::decode, bug 3601995} {
    ncgi::decode {%E2%B1}
} "%E2%B1" ; # missing byte trailing %A0, do not accept/decode, pass through.

test ncgi-4.1 {ncgi::encode} {
    ncgi::encode abcdef0123
} abcdef0123

test ncgi-4.2 {ncgi::encode} {
    ncgi::encode "\[abc\]def\$0123\\x"
} {%5Babc%5Ddef%240123%5Cx}

Changes to modules/ncgi/pkgIndex.tcl.

1
2
if {![package vsatisfies [package provide Tcl] 8.4]} {return}
package ifneeded ncgi 1.4 [list source [file join $dir ncgi.tcl]]

|
1
2
if {![package vsatisfies [package provide Tcl] 8.4]} {return}
package ifneeded ncgi 1.4.1 [list source [file join $dir ncgi.tcl]]