Tcl Library Source Code

Check-in [f5d6a5e51b]
Login

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

Overview
Comment:Fix mime failing tests. Add GPL license.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | mime | INCOMPATIBLE_LICENSE
Files: files | file ages | folders
SHA3-256: f5d6a5e51b7d8607aa02a93c3cd2d71c274bc816cee3e4deb58d190f0cfeeb67
User & Date: pooryorick 2024-10-31 12:59:55.486
Context
2024-11-21
09:38
shun COPYING. Re-licensing existing code is not allowed. Closing this branch, assuming you no longer want to continue with it. Feel free to re-open, if you like. Closed-Leaf check-in: 51bb6cedcd user: jan.nijtmans tags: pyk
2024-11-04
23:42
Merge "mime" and "aes" branches into new "pyk" branch. check-in: 0b0d3c2be7 user: pooryorick tags: pyk, INCOMPATIBLE_LICENSE
2024-10-31
12:59
Fix mime failing tests. Add GPL license. Closed-Leaf check-in: f5d6a5e51b user: pooryorick tags: mime, INCOMPATIBLE_LICENSE
2024-10-17
22:03
Merge trunk and resolve conflicts. Some mime tests fail. check-in: aed2b8c04b user: pooryorick tags: mime
Changes
Unified Diff Ignore Whitespace Patch
Deleted COPYING.
Changes to modules/mime/mime.tcl.
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
27
28
29
30
31
32
33
34
35
# mime.tcl - MIME body parts
#
# (c) 1999-2000 Marshall T. Rose
# (c) 2000      Brent Welch
# (c) 2000      Sandeep Tamhankar
# (c) 2000      Dan Kuchler
# (c) 2000-2001 Eric Melski
# (c) 2001      Jeff Hobbs
# (c) 2001-2008 Andreas Kupries
# (c) 2002-2003 David Welton
# (c) 2003-2008 Pat Thoyts
# (c) 2005      Benjamin Riefenstahl
# (c) 2013-2021 Poor Yorick
#
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.











#
# Influenced by Borenstein's/Rose's safe-tcl (circa 1993) and Darren New's
# unpublished package of 1999.
#

# new string features and inline scan are used, requiring 8.3.
package require Tcl 8.5 9

# Fix for 00d04c4f12l, base64 transchan over a refchan: segmentation fault,
# requires 8.6.9
package require Tcl 8.6.9

package require {mime qp}
package require namespacex
package require tcl::chan::cat
package provide mime 3.0.0 
package require tcl::chan::memchan
package require tcl::chan::string
<
<










<
<



>
>
>
>
>
>
>
>
>
>
>



<






|









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
27

28
29
30
31
32
33
34
35
36
37
38
39
40
41


# (c) 1999-2000 Marshall T. Rose
# (c) 2000      Brent Welch
# (c) 2000      Sandeep Tamhankar
# (c) 2000      Dan Kuchler
# (c) 2000-2001 Eric Melski
# (c) 2001      Jeff Hobbs
# (c) 2001-2008 Andreas Kupries
# (c) 2002-2003 David Welton
# (c) 2003-2008 Pat Thoyts
# (c) 2005      Benjamin Riefenstahl


#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

# Copyright (c) 2018-2024 Poor Yorick
#
# You may distribute and/or modify this program under the terms of the GNU
# Affero General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# See the file "COPYING" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

# mime.tcl - MIME body parts
#
# Influenced by Borenstein's/Rose's safe-tcl (circa 1993) and Darren New's
# unpublished package of 1999.


# new string features and inline scan are used, requiring 8.3.
package require Tcl 8.5 9

# Fix for 00d04c4f12l, base64 transchan over a refchan: segmentation fault,
# requires 8.6.9
package require Tcl 8.6.9-

package require {mime qp}
package require namespacex
package require tcl::chan::cat
package provide mime 3.0.0 
package require tcl::chan::memchan
package require tcl::chan::string
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    # Warning!
    ##
    # These are a fragile emulations of the more general calling
    # sequence that appears to work with this code here.
    ##
    # The `__ignored__` arguments are expected to be `--` options on
    # the caller's side. (See the uses in `copymessageaux`,
    # `buildmessageaux`, `parsepart`, and `getbody`).

    package require base64 2.0
    set ::major [lindex [split [package require md5] .] 0]

    # Create these commands in the mime namespace so that they
    # won't collide with things at the global namespace level








|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
    # Warning!
    ##
    # These are a fragile emulations of the more general calling
    # sequence that appears to work with this code here.
    ##
    # The `__ignored__` arguments are expected to be `--` options on
    # the caller's side. (See the uses in `copymessageaux`,
    # `serialize`, `parsepart`, and `getbody`).

    package require base64 2.0
    set ::major [lindex [split [package require md5] .] 0]

    # Create these commands in the mime namespace so that they
    # won't collide with things at the global namespace level

340
341
342
343
344
345
346





347
348



349
350
351
352
353
354
355
    if {[info exists fd]} {
	error [list {a channel is already present}]
    }

    if {[$chan configure -encoding] ne {binary}} {
	$chan configure -translation auto
    }





    set fd $chan
    incr channels($fd)



    return
}


# ::mime::addr_next --
#
#       Locate the next address in a mime token.







>
>
>
>
>

|
>
>
>







346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
    if {[info exists fd]} {
	error [list {a channel is already present}]
    }

    if {[$chan configure -encoding] ne {binary}} {
	$chan configure -translation auto
    }
    if {[set current [$chan tell]] < 0} {
	set chan [makeseekable $chan]
    }
    incr channels($chan)
    dropchan $token
    set fd $chan
    if {!$state(closechan)} {
	error [
	    list {need permission to close the channel in to make it seekable}]
    }
    return
}


# ::mime::addr_next --
#
#       Locate the next address in a mime token.
932
933
934
935
936
937
938

939
940
941
942
943
944
945
    upvar 0 $token state
    upvar 0 state(bodychandecoded) bodychandecoded
    $_ parsepart
    if {[info exists state(parts)]} {
	error [list {not a leaf part} $token]
    }
    if {$state(canonicalP)} { 

	$state(fd) seek 0 
	return $state(fd)
    } else {
	if {![info exists bodychandecoded]} {
	    set bodychandecoded [[::tcllib::chan::base new [
		info cmdcount]_bodydecoded] .init [file tempfile]]
	    $bodychandecoded configure -translation binary







>







946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
    upvar 0 $token state
    upvar 0 state(bodychandecoded) bodychandecoded
    $_ parsepart
    if {[info exists state(parts)]} {
	error [list {not a leaf part} $token]
    }
    if {$state(canonicalP)} { 
	#{to do} {shouldn't this also get decoded?}
	$state(fd) seek 0 
	return $state(fd)
    } else {
	if {![info exists bodychandecoded]} {
	    set bodychandecoded [[::tcllib::chan::base new [
		info cmdcount]_bodydecoded] .init [file tempfile]]
	    $bodychandecoded configure -translation binary
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
    set asciiP 1
    set lineP 1
    if {[info exists state(parts)]} {
	return [set state(encoding) {}]
    }

    if {[set current [$chan tell]] < 0} {
	makeseekable $token
	set current [$chan tell]
    }
    set chanconfig [$chan configure]
    try {
	set buf {}
	set dataend 0
	while {[set data [$chan read 8192]] ne {} || $buf ne {}} {







|







1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
    set asciiP 1
    set lineP 1
    if {[info exists state(parts)]} {
	return [set state(encoding) {}]
    }

    if {[set current [$chan tell]] < 0} {
	set chan [makeseekable $chan]
	set current [$chan tell]
    }
    set chanconfig [$chan configure]
    try {
	set buf {}
	set dataend 0
	while {[set data [$chan read 8192]] ne {} || $buf ne {}} {
1498
1499
1500
1501
1502
1503
1504





1505

1506
1507
1508
1509
1510
1511
1512
		if {!$childpart(addmessageid)} {
		    header::unset $part message-id
		}
	    }
	}
	set id [::sha2::sha256 -hex $ids]
    } else {





	set chan [$_ body decoded]

	set config [$chan configure]
	if {[dict exists $config -chan]} {
	    dict unset config -chan
	}
	try {
	    $chan seek 0
	    set id [::sha2::sha256 -hex -channel [$chan configure -chan]]







>
>
>
>
>
|
>







1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
		if {!$childpart(addmessageid)} {
		    header::unset $part message-id
		}
	    }
	}
	set id [::sha2::sha256 -hex $ids]
    } else {
	if {[info exists bodychan]} {
	    #use the transfer-encoded form of the body to generate the id so that
	    #each different encoding gets its own id
	    set chan $state(bodychan)
	} else {
	    set chan $state(fd)
	}
	set config [$chan configure]
	if {[dict exists $config -chan]} {
	    dict unset config -chan
	}
	try {
	    $chan seek 0
	    set id [::sha2::sha256 -hex -channel [$chan configure -chan]]
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535

proc ::mime::dropchan token {
    variable channels
    upvar 0 $token state
    upvar 0 state(fd) fd

    if {[info exists fd]} {
	if {[incr channels($fd) -1] == 0} {
	    unset channels($fd)
	    if {$state(closechan)} {
		$fd close
	    }
	}
	unset state(fd)
    }







|







1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556

proc ::mime::dropchan token {
    variable channels
    upvar 0 $token state
    upvar 0 state(fd) fd

    if {[info exists fd]} {
	if {[incr channels($fd) -1] <= 0} {
	    unset channels($fd)
	    if {$state(closechan)} {
		$fd close
	    }
	}
	unset state(fd)
    }
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
    #set unique [uniqueID]
    if {![header::exists $token content-id] && $state(addcontentid)} {
	header::setinternal $token Content-ID [contentid $_]
    }
    set sha [::sha2::SHA256Init]
    foreach {key val} [lsort -stride 2 [$_ header get]] {
	lassign $val value params
	::sha2::SHA256Update $sha $key$value
	foreach {pkey pval} $params {
	    ::sha2::SHA256Update $sha $pkey$pval
	}
    }
    set hash [::sha2::SHA256Final $sha]
    binary scan $hash H* hex
    return $hex@|
}








|

|







1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
    #set unique [uniqueID]
    if {![header::exists $token content-id] && $state(addcontentid)} {
	header::setinternal $token Content-ID [contentid $_]
    }
    set sha [::sha2::SHA256Init]
    foreach {key val} [lsort -stride 2 [$_ header get]] {
	lassign $val value params
	::sha2::SHA256Update $sha [::encoding convertto utf-8 $key$value]
	foreach {pkey pval} $params {
	    ::sha2::SHA256Update $sha [::encoding convertto utf-8 $pkey$pval]
	}
    }
    set hash [::sha2::SHA256Final $sha]
    binary scan $hash H* hex
    return $hex@|
}

1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
	foreach part $state(parts) {
	    incr size [getsize $part]
	}
    } else {
	set size 0
	if {$state(canonicalP)} {
	    if {[set current [$inputchan tell]] < 0} {
		makeseekable $token
	    }
	    set current [$inputchan tell]
	    $inputchan seek 0 end
	    set size [$inputchan tell]
	    $inputchan seek $current
	} else {
	    set size $state(size)







|







1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
	foreach part $state(parts) {
	    incr size [getsize $part]
	}
    } else {
	set size 0
	if {$state(canonicalP)} {
	    if {[set current [$inputchan tell]] < 0} {
		set inputchan [makeseekable $inputchan]
	    }
	    set current [$inputchan tell]
	    $inputchan seek 0 end
	    set size [$inputchan tell]
	    $inputchan seek $current
	} else {
	    set size $state(size)
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
#
#    the public interface for initializeaux

proc ::mime::.new args {
    variable mime
    if {[llength $args] % 2} {
	set args [lassign $args[set args {}] name]
    } elseif {[llength $args]} {
	error [list {wrong # args}]
    } else {
	set name {}
    }
    set mimeid [incr mime(uid)]
    set token [namespace current]::$mimeid
    if {$name eq {}} {
	set name $token







<
<







2488
2489
2490
2491
2492
2493
2494


2495
2496
2497
2498
2499
2500
2501
#
#    the public interface for initializeaux

proc ::mime::.new args {
    variable mime
    if {[llength $args] % 2} {
	set args [lassign $args[set args {}] name]


    } else {
	set name {}
    }
    set mimeid [incr mime(uid)]
    set token [namespace current]::$mimeid
    if {$name eq {}} {
	set name $token
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
        return -options $eopts $result
    }
    return $name
}

# ::mime::initializeaux --
#
#    Creates a MIME part, and returnes the MIME token for that part.
#
# Arguments:
#    args   Args can be any one of the following:
#                  ?-canonical type/subtype
#                  ?-params    {?key value? ...}
#                  ?-encoding value?
#                  ?-headers   {?key value? ...}







|







2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
        return -options $eopts $result
    }
    return $name
}

# ::mime::initializeaux --
#
#    Creates a MIME part and returns the MIME token for that part.
#
# Arguments:
#    args   Args can be any one of the following:
#                  ?-canonical type/subtype
#                  ?-params    {?key value? ...}
#                  ?-encoding value?
#                  ?-headers   {?key value? ...}
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838

2839

2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
    if {[info exists headers]} {
        error "-header requires -canonical"
    }

}


proc mime::makeseekable token {
    upvar 0 $token state
    upvar 0 state(bodychan) bodychan state(fd) inputchan 

    set chan2 [::tcllib::chan::base [info cmdcount]_chan [file tempfile]]

    chan configure $chan2 -translation binary
    chan copy $inputchan $chan2
    incr size [tell $chan2]
    seek $chan2 0
    close $inputchan
    set inputchan [::tcllib::chan::base [info cmdcount]_chan $chan2]
    return
}


# ::mime::mapencoding --
#
#    mime::mapencodings maps tcl encodings onto the proper names for their
#    MIME charset type.  This is only done for encodings whose charset types







|
|
|
>
|
>
|
|
|
|
|
<
|







2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865

2866
2867
2868
2869
2870
2871
2872
2873
    if {[info exists headers]} {
        error "-header requires -canonical"
    }

}


proc mime::makeseekable chan {
    if {[set current [$chan tell]] >= 0} {
        return $chan
    }
    set chan2 [::tcllib::chan::base new [info cmdcount]_chan]
    $chan2 .init [file tempfile] 
    $chan2 configure -translation binary
    $chan copy [$chan2 configure -chan]
    incr size [$chan2 tell]
    $chan2 seek 0
    $chan close

    return $chan2
}


# ::mime::mapencoding --
#
#    mime::mapencodings maps tcl encodings onto the proper names for their
#    MIME charset type.  This is only done for encodings whose charset types
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
    if {[dict exists $params charset]} {
	set charset [reversemapencoding [dict get $params charset]]
	if {$charset eq {}} {
		upvar 0 state(warnings) warnings
		lappend warnings [list {unknown charset} [
		dict get $params charset] {using binary translation instead}]
	    # but still do line automatic translation
	    $fd configure -encoding binary -translation auto
	} else {
	    $fd configure -encoding [reversemapencoding [dict get $params charset]]
	}
    }
    $bodychan configure -translation binary

    if {[info exists state(boundary)]} {







|







2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
    if {[dict exists $params charset]} {
	set charset [reversemapencoding [dict get $params charset]]
	if {$charset eq {}} {
		upvar 0 state(warnings) warnings
		lappend warnings [list {unknown charset} [
		dict get $params charset] {using binary translation instead}]
	    # but still do line automatic translation
	    $fd configure -encoding iso8859-1 -translation auto
	} else {
	    $fd configure -encoding [reversemapencoding [dict get $params charset]]
	}
    }
    $bodychan configure -translation binary

    if {[info exists state(boundary)]} {
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996

2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
		    $child header setinternal Content-Type application/octet-stream
		    break
	    } elseif {[llength $state(parts)] || [string first --$boundary $line] == 0} {
		    # either just saw the first boundary or saw a boundary between parts

		    # do not brace this expression 
		    if $iseof {
			# either saw the closing boundary or reached the end of the file
			break
		    } elseif {[string first --$boundary-- $line] >= 0} {

			set state(sawclosing) 1
			break
		    } else {
			#mimegets returned 0 because it found a border

			set child [.new {} -chan $fd \
			    -root $state(root) -boundary $boundary -usemem $usemem]
			$child parsepart
			lappend state(parts) $child
			lappend state(dynamic) $child
			upvar 0 $child childstate
			set state(sawclosing) $childstate(sawclosing)
			if {$childstate(eof)} break
		    }
	    } else {
		# Accumulate data in case the terminating boundary occurs starting
		# boundary was found, so that a part can be generated from data
		# seen so far.
		if $iseof {
		    $bodychan puts -nonewline $line
		} else {
		    $bodychan puts $line
		}
		set size [expr {$size + [
		    string length $line] + 1}]







|


>















|
|
|







3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
		    $child header setinternal Content-Type application/octet-stream
		    break
	    } elseif {[llength $state(parts)] || [string first --$boundary $line] == 0} {
		    # either just saw the first boundary or saw a boundary between parts

		    # do not brace this expression 
		    if $iseof {
			# reached the end of the file
			break
		    } elseif {[string first --$boundary-- $line] >= 0} {
			# saw the closing boundary
			set state(sawclosing) 1
			break
		    } else {
			#mimegets returned 0 because it found a border

			set child [.new {} -chan $fd \
			    -root $state(root) -boundary $boundary -usemem $usemem]
			$child parsepart
			lappend state(parts) $child
			lappend state(dynamic) $child
			upvar 0 $child childstate
			set state(sawclosing) $childstate(sawclosing)
			if {$childstate(eof)} break
		    }
	    } else {
		# Accumulate data in case the terminating boundary occurs
		# before starting boundary was found, so that a part can be
		# generated from data seen so far.
		if $iseof {
		    $bodychan puts -nonewline $line
		} else {
		    $bodychan puts $line
		}
		set size [expr {$size + [
		    string length $line] + 1}]
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
    } else {
	$channel puts {}
	if {$state(canonicalP)} {
	    set transforms [setencoding $token $channel]
	    $state(fd) seek 0
	    $state(fd) copy [$channel configure -chan]
	    while {[incr transforms -1] >= 0} {
		$channel $channel
	    }
	} else {
	    $state(bodychan) seek 0
	    $state(bodychan) copy [$channel configure -chan]
	}
    }








|







3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
    } else {
	$channel puts {}
	if {$state(canonicalP)} {
	    set transforms [setencoding $token $channel]
	    $state(fd) seek 0
	    $state(fd) copy [$channel configure -chan]
	    while {[incr transforms -1] >= 0} {
		$channel pop
	    }
	} else {
	    $state(bodychan) seek 0
	    $state(bodychan) copy [$channel configure -chan]
	}
    }

Changes to modules/mime/mime.test.
1
2
3
4
5
6
7
8
9
10









11
12
13
14
15
16
17
18
19
20
21
22
23
24
# mime.test - Test suite for TclMIME                     -*- tcl -*-
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 2000 by Ajuba Solutions, 2023 AK
# Copyright (c) 2018 Poor Yorick
# All rights reserved.










# -------------------------------------------------------------------------

source [file join [
	file dirname [file dirname [file join [pwd] [info script]]]
] devtools testutilities.tcl]

testsNeedTcl     8.6.9
testsNeedTcltest 2.0

support {
    # This code loads md5x, i.e. md5 v2. Proper testing should do one
    # run using md5 v1, aka md5.tcl as well.
    use md5/md5x.tcl md5








<


>
>
>
>
>
>
>
>
>






|







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
27
28
29
30
31
32
# mime.test - Test suite for TclMIME                     -*- tcl -*-
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 2000 by Ajuba Solutions, 2023 AK

# All rights reserved.

# Copyright (c) 2018-2024 Poor Yorick
#
# You may distribute and/or modify this program under the terms of the GNU
# Affero General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# See the file "COPYING" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

# -------------------------------------------------------------------------

source [file join [
	file dirname [file dirname [file join [pwd] [info script]]]
] devtools testutilities.tcl]

testsNeedTcl     9.0-
testsNeedTcltest 2.0

support {
    # This code loads md5x, i.e. md5 v2. Proper testing should do one
    # run using md5 v1, aka md5.tcl as well.
    use md5/md5x.tcl md5

40
41
42
43
44
45
46
47








48







49
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65


proc channamescmp names {
    expr {[llength $names] == [llength [chan names]]}
}


proc cleanly script {








    set ns [info cmdcount]







    namespace eval $ns {
	namespace path [namespace parent]
    }
    catch {namespace eval $ns $script} cres copts
    foreach name [info vars ${ns}::*] {
	set val [set $name]
	if {[namespace which $val] ne {} && [string match ::mime* $val]} {
	    rename $val {}
	}
    }

    namespace delete $ns
    return -options $copts $cres
}


proc setup1 {} {
    uplevel 1 {







|
>
>
>
>
>
>
>
>

>
>
>
>
>
>
>



<
<
<
<
<
|
<
>







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74





75

76
77
78
79
80
81
82
83


proc channamescmp names {
    expr {[llength $names] == [llength [chan names]]}
}


proc cleanly args {
    if {![llength $args]} {
	error [list {wrong # args}]
    }
    set script [lindex $args end]
    set args [lrange $args[set args {}] 0 end-1]
    if {[llength $args] % 2} {
	error [list {wrong # args}]
    }
    set ns [info cmdcount]
    set names {}
    set values {}
    while {[llength $args]} {
	set args [lassign $args[set args {}] name value]
	lappend names $name
	lappend values $value
    }
    namespace eval $ns {
	namespace path [namespace parent]
    }







    catch {apply [list $names $script $ns] {*}$values} cres copts
    namespace delete $ns
    return -options $copts $cres
}


proc setup1 {} {
    uplevel 1 {
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
msg1}

    set tok [.new {} -string $msg1]
    catch {[$tok body raw] read} err1
    catch {$tok serialize} err1a
    list $err1 $err1a
}} "msg1 {MIME-Version: 2.0\r
Message-ID: <d956986793d51d614044c01a7e7650665330a4a170d071aff1de6dceda8c8b0d@|>\r
Content-ID: <289e5175e02c788c2d442cfe81d6be0533d8c13e253ef763fda45d37accfe4d4@|>\r
Content-Type: text/plain\r
\r
msg1}"


test mime-3.5 {Try to parse a MIME message with no newline between headers and data} {cleanly {
    set msg2 {MIME-Version: 1.0







|
|







269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
msg1}

    set tok [.new {} -string $msg1]
    catch {[$tok body raw] read} err1
    catch {$tok serialize} err1a
    list $err1 $err1a
}} "msg1 {MIME-Version: 2.0\r
Message-ID: <7938b12d5fca6dac4d93058a53bd042eb6489fe781dc7c1d9e4d3fb2a0298568@|>\r
Content-ID: <6d940d16b5e44281d818537093e2d718cf63b738bd80db235246918456966ad1@|>\r
Content-Type: text/plain\r
\r
msg1}"


test mime-3.5 {Try to parse a MIME message with no newline between headers and data} {cleanly {
    set msg2 {MIME-Version: 1.0
279
280
281
282
283
284
285
286
287
288
289
290
291
292

293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308

309
310
311
312
313
314
315
316
317

318
319
320
321
322
323
324
325
326
327
328


329
330
331
332
333
334
335

foo}
    .new mime1 -string $msg3
    catch {[mime1 body raw] read} err3
    catch {mime1 serialize} err3a copts
    list $err3 $err3a
}} "foo {MIME-Version: 1.0\r
Message-ID: <fb8bfc091f5ff55264834b7ea21278fbcb7bf875b20ddeae2f5e4eb662de2129@|>\r
Content-ID: <2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae@|>\r
Content-Type: text/plain\r
\r
foo}"



foreach name {file chan} {
    test mime-3.7.$name {Test mime with a bad email [SF Bug 631314 ]} {cleanly {
	with.$name [localPath test-assets badmail1.txt] {
	    set res {}
	    lappend res [llength [$tok property parts]]
	    set ctok [lindex [$tok property parts] 0]
	    lappend res [dictsort [$tok property]]
	    lappend res [dictsort [$ctok property]]
	    $tok .destroy
	    string map [list $ctok CHILD] $res
	}
    }} {1 {content multipart/mixed encoding {} params {boundary ----------CSFNU9QKPGZL79} parts CHILD size 0} {content application/octet-stream encoding {} params {} size 0}}
}

foreach name {file chan} {


    test mime-3.8.1.$name {Test mime with another bad email [SF Bug 631314 ]} -body {cleanly {
	with.$name [localPath test-assets badmail2.txt] {
	    set ctok [lindex [$tok property parts] 0]
	}
    }} -returnCodes 1 -result {end-of-string encountered while parsing multipart/form-data}
}

foreach name {file chan} {


    test mime-3.8.2.$name {Test mime with another bad email [SF Bug 631314 ]} {cleanly {
	with.$name [localPath test-assets badmail2.txt] -relax finalboundary {
	    set res {}
	    set ctok [lindex [$tok property parts] 0]
	    lappend res [dictsort [$tok property]]
	    lappend res [dictsort [$ctok property]]
	    $tok .destroy
	    string map [list $ctok CHILD] $res
	}
    }} {{content multipart/related encoding {} params {boundary ----=_NextPart_000_0000_2CBA2CBA.150C56D2} parts CHILD size 879} {content text/html encoding base64 params {} size 879}}
}




test mime-3.9 {Parse a MIME message with a charset encoded body and use [body decoded] to get it back} {cleanly {
    set msg {MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1

Fran\xE7ois







|
|





>
|
|
|
|
|
|
|
|
|
|
|
|
|

<

>
|
|
|
|
|
|

<

>
|
|
|
|
|
|
|
|
|
|
|
>
>







297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325

326
327
328
329
330
331
332
333
334

335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356

foo}
    .new mime1 -string $msg3
    catch {[mime1 body raw] read} err3
    catch {mime1 serialize} err3a copts
    list $err3 $err3a
}} "foo {MIME-Version: 1.0\r
Message-ID: <022a8d8e0087a026961cc81f97548a5961bc4bafad4c5d9619dc36553ee49064@|>\r
Content-ID: <ff40a450d9fe90ddc6b0398c197809bf1c75166c9e18ad928c717927e96ba83f@|>\r
Content-Type: text/plain\r
\r
foo}"


cleanly {
    foreach name {file chan} {
	test mime-3.7.$name {Test mime with a bad email [SF Bug 631314 ]} [list cleanly name $name {
	    with.$name [localPath test-assets badmail1.txt] {
		set res {}
		lappend res [llength [$tok property parts]]
		set ctok [lindex [$tok property parts] 0]
		lappend res [dictsort [$tok property]]
		lappend res [dictsort [$ctok property]]
		$tok .destroy
		string map [list $ctok CHILD] $res
	    }
	}] {1 {content multipart/mixed encoding {} params {boundary ----------CSFNU9QKPGZL79} parts CHILD size 0} {content application/octet-stream encoding {} params {} size 0}}
    }



    foreach name {file chan} {
	test mime-3.8.1.$name {Test mime with another bad email [SF Bug 631314 ]} -body [list cleanly name $name {
	    with.$name [localPath test-assets badmail2.txt] {
		set ctok [lindex [$tok property parts] 0]
	    }
	}] -returnCodes 1 -result {end-of-string encountered while parsing multipart/form-data}
    }



    foreach name {file chan} {
	test mime-3.8.2.$name {Test mime with another bad email [SF Bug 631314 ]} [list cleanly name $name {
	    with.$name [localPath test-assets badmail2.txt] -relax finalboundary {
		set res {}
		set ctok [lindex [$tok property parts] 0]
		lappend res [dictsort [$tok property]]
		lappend res [dictsort [$ctok property]]
		$tok .destroy
		string map [list $ctok CHILD] $res
	    }
	}] {{content multipart/related encoding {} params {boundary ----=_NextPart_000_0000_2CBA2CBA.150C56D2} parts CHILD size 879} {content text/html encoding base64 params {} size 879}}
    }
}



test mime-3.9 {Parse a MIME message with a charset encoded body and use [body decoded] to get it back} {cleanly {
    set msg {MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1

Fran\xE7ois
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384

This is a message in the scribble charset that tcl does not recognise.}
    set tok [.new {} -string $msg]
    lappend res [$tok header get content-type]
    lappend res [[$tok body decoded] configure -encoding]
    catch {[$tok body decoded] read} errmsg
    lappend res $errmsg
}} {{text/plain {charset SCRIBBLE}} binary {This is a message in the scribble charset that tcl does not recognise.}}



test mime-4.1 {Test qp::encode with a > 76 character string containing special chars.} {cleanly {
    set str1 "foo!\"\t barbaz \$ ` \{ # jack and jill went up a hill to fetch a pail of water. Jack fell down and said !\"\#\$@\[\\\]^`\{\|\}\~  \nJill said, \"Oh my\""
    qp encode $str1
}} "foo=21=22\t barbaz =24 =60 =7B =23 jack and jill went up a hill to fetch a=\n pail of water. Jack fell down and said =21=22=23=24=40=5B=5C=5D=5E=60=7B=\n=7C=7D=7E =20\nJill said, =22Oh my=22"








|
<







390
391
392
393
394
395
396
397

398
399
400
401
402
403
404

This is a message in the scribble charset that tcl does not recognise.}
    set tok [.new {} -string $msg]
    lappend res [$tok header get content-type]
    lappend res [[$tok body decoded] configure -encoding]
    catch {[$tok body decoded] read} errmsg
    lappend res $errmsg
}} {{text/plain {charset SCRIBBLE}} iso8859-1 {This is a message in the scribble charset that tcl does not recognise.}}



test mime-4.1 {Test qp::encode with a > 76 character string containing special chars.} {cleanly {
    set str1 "foo!\"\t barbaz \$ ` \{ # jack and jill went up a hill to fetch a pail of water. Jack fell down and said !\"\#\$@\[\\\]^`\{\|\}\~  \nJill said, \"Oh my\""
    qp encode $str1
}} "foo=21=22\t barbaz =24 =60 =7B =23 jack and jill went up a hill to fetch a=\n pail of water. Jack fell down and said =21=22=23=24=40=5B=5C=5D=5E=60=7B=\n=7C=7D=7E =20\nJill said, =22Oh my=22"

500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523

524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552

test mime-5.9 {Test word_encode with quoted-printable method and multibyte character} {cleanly {
    word_encode euc-jp quoted-printable "Following me is a multibyte character \xA4\xCF"
}} =?EUC-JP?Q?Following_me_is_a_multibyte_character_=A4=CF?=

set n 10
while {$n < 14} {
    test mime-5.$n {Test word_encode with quoted-printable method and multibyte character across encoded word boundary} {cleanly {
	word_encode euc-jp quoted-printable "Following me is a multibyte character \xA4\xCF" -maxlength [expr 42 + $n]
    }} "=?EUC-JP?Q?Following_me_is_a_multibyte_character_?=
 =?EUC-JP?Q?=A4=CF?="
    incr n
}


test mime-5.14 {Test word_encode with quoted-printable method and multibyte character (triple)} {cleanly {
    word_encode utf-8 quoted-printable "Here is a triple byte encoded character \xE3\x81\xAF"
}} =?UTF-8?Q?Here_is_a_triple_byte_encoded_character_=E3=81=AF?=

set n 15
while {$n < 23} {
    test mime-5.$n {Test word_encode with quoted-printable method and triple byte character across encoded word boundary} {cleanly {
	word_encode utf-8 quoted-printable "Here is a triple byte encoded character \xE3\x81\xAF" -maxlength [expr 38 + $n]
    }} =?UTF-8?Q?Here_is_a_triple_byte_encoded_character_?=

    incr n
}

while {$n < 25} {
    test mime-5.$n {Test word_encode with quoted-printable method and triple byte character across encoded word boundary} {cleanly {
	word_encode utf-8 quoted-printable "Here is a triple byte encoded character \xE3\x81\xAF" -maxlength [expr 38 + $n]
    }} =?UTF-8?Q?Here_is_a_triple_byte_encoded_character_=E3=81=AF?=
    incr n
}

while {$n < 29} {
    test mime-5.$n {Test word_encode with base64 method across encoded word boundaries} {cleanly {
	word_encode euc-jp base64 "There is a multibyte character \xA4\xCF" -maxlength [expr 28 + $n]
    }} "=?EUC-JP?B?VGhlcmUgaXMgYSBtdWx0aWJ5dGUgY2hhcmFjdGVy?=
 =?EUC-JP?B?IKTP?="
    incr n
}

while {$n < 33} {
    test mime-5.$n {Test word_encode with base64 method and triple byte character across encoded word boundary} {cleanly {
	word_encode utf-8 base64 "Here is a multibyte character \xE3\x81\xAF" -maxlength [expr 23 + $n]
    }} "=?UTF-8?B?SGVyZSBpcyBhIG11bHRpYnl0ZSBjaGFyYWN0ZXIg?=
 =?UTF-8?B?44Gv?="
    incr n
}


test mime-5.33 {Test word_encode with quoted-printable method and -maxlength set to same length as will the result} {cleanly {
    word_encode iso8859-1 quoted-printable 123 -maxlength 20







|

|











|

|
>




|

|




|

|





|

|







520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573

test mime-5.9 {Test word_encode with quoted-printable method and multibyte character} {cleanly {
    word_encode euc-jp quoted-printable "Following me is a multibyte character \xA4\xCF"
}} =?EUC-JP?Q?Following_me_is_a_multibyte_character_=A4=CF?=

set n 10
while {$n < 14} {
    test mime-5.$n {Test word_encode with quoted-printable method and multibyte character across encoded word boundary} [list cleanly n $n {
	word_encode euc-jp quoted-printable "Following me is a multibyte character \xA4\xCF" -maxlength [expr 42 + $n]
    }] "=?EUC-JP?Q?Following_me_is_a_multibyte_character_?=
 =?EUC-JP?Q?=A4=CF?="
    incr n
}


test mime-5.14 {Test word_encode with quoted-printable method and multibyte character (triple)} {cleanly {
    word_encode utf-8 quoted-printable "Here is a triple byte encoded character \xE3\x81\xAF"
}} =?UTF-8?Q?Here_is_a_triple_byte_encoded_character_=E3=81=AF?=

set n 15
while {$n < 23} {
    test mime-5.$n {Test word_encode with quoted-printable method and triple byte character across encoded word boundary} [list cleanly n $n {
	word_encode utf-8 quoted-printable "Here is a triple byte encoded character \xE3\x81\xAF" -maxlength [expr 38 + $n]
    }] "=?UTF-8?Q?Here_is_a_triple_byte_encoded_character_?=
 =?UTF-8?Q?=E3=81=AF?="
    incr n
}

while {$n < 25} {
    test mime-5.$n {Test word_encode with quoted-printable method and triple byte character across encoded word boundary} [list cleanly n $n {
	word_encode utf-8 quoted-printable "Here is a triple byte encoded character \xE3\x81\xAF" -maxlength [expr 38 + $n]
    }] =?UTF-8?Q?Here_is_a_triple_byte_encoded_character_=E3=81=AF?=
    incr n
}

while {$n < 29} {
    test mime-5.$n {Test word_encode with base64 method across encoded word boundaries} [list cleanly n $n {
	word_encode euc-jp base64 "There is a multibyte character \xA4\xCF" -maxlength [expr 28 + $n]
    }] "=?EUC-JP?B?VGhlcmUgaXMgYSBtdWx0aWJ5dGUgY2hhcmFjdGVy?=
 =?EUC-JP?B?IKTP?="
    incr n
}

while {$n < 33} {
    test mime-5.$n {Test word_encode with base64 method and triple byte character across encoded word boundary} [list cleanly n $n {
	word_encode utf-8 base64 "Here is a multibyte character \xE3\x81\xAF" -maxlength [expr 23 + $n]
    }] "=?UTF-8?B?SGVyZSBpcyBhIG11bHRpYnl0ZSBjaGFyYWN0ZXIg?=
 =?UTF-8?B?44Gv?="
    incr n
}


test mime-5.33 {Test word_encode with quoted-printable method and -maxlength set to same length as will the result} {cleanly {
    word_encode iso8859-1 quoted-printable 123 -maxlength 20
660
661
662
663
664
665
666
667


668
669
670
671
672
673
674
675

676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692

693
694


695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714

715
716
717
718
719
720
721
    11 {(=?ISO-8859-1?Q?a?=x=?ISO-8859-2?Q?_b?=)}
    {(ax b)}
    12 {a         b         c}
    {a         b         c}
    13 {} 
    {}
} {
    test mime-6.$n {Test field_decode (from RFC 2047, part 8)} {cleanly {


	field_decode $encoded
    }} $expected ; # {}
}

foreach {bug n encoded expected} {
    764702 1 {(=?utf-8?Q?H=C3=BCrz?=)} {(Hürz)}
} {
    test mime-7.$n "Test field_decode (from SF Tcllib bug $bug)" {cleanly {

	field_decode $encoded
    }} $expected ; # {}
}


test mime-8.1 {Test reversemapencoding+mapencoding with preferred name} {cleanly {
    set charset [reversemapencoding US-ASCII]
    mapencoding $charset
}} US-ASCII


test mime-8.2 {Test reversemapencoding+mapencoding with alias} {cleanly {
    set charset [reversemapencoding UTF8]
    mapencoding $charset
}} UTF-8



foreach name {file chan} {
    test mime-9.0.$name {Test chunk handling of serialize and helpers} {cleanly {


	set in [makeFile [set data [string repeat [string repeat {123456789 } 10]\n 350]] input.txt]
	set mi [makeFile {} mime.txt]

	with.$name $in -canonical text/plain {
	    [::tcllib::chan::base new chan1] .init [open $mi w]
	    chan1 configure -translation binary
	    $tok serialize -chan chan1 
	    chan1 close

	    with.$name $mi {
		set newdata [[$tok body raw] read]
		set res [string compare $data $newdata]

		removeFile input.txt
		removeFile mime.txt
		unset data newdata tok in mi
		set res
	    }
	}
    }} 0

}

set ::env(TZ) UTC0
set epoch [clock scan 2000-01-01]
foreach {n stamp date} {
    1     86340 {Sat, 01 Jan 2000 23:59:00 +0000}
    2   5176620 {Tue, 29 Feb 2000 21:57:00 +0000}







|
>
>

|





|
>
|
|















>
|
|
>
>
|
|

|
|
|
|
|

|
|
|

|
|
|
|
|
|
|
>







681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
    11 {(=?ISO-8859-1?Q?a?=x=?ISO-8859-2?Q?_b?=)}
    {(ax b)}
    12 {a         b         c}
    {a         b         c}
    13 {} 
    {}
} {
    test mime-6.$n {Test field_decode (from RFC 2047, part 8)} [
	list cleanly n $n encoded $encoded expected $expected {

	field_decode $encoded
    }] $expected
}

foreach {bug n encoded expected} {
    764702 1 {(=?utf-8?Q?H=C3=BCrz?=)} {(Hürz)}
} {
    test mime-7.$n "Test field_decode (from SF Tcllib bug $bug)" [
	list cleanly encoded $encoded {
	    field_decode $encoded
	}] $expected
}


test mime-8.1 {Test reversemapencoding+mapencoding with preferred name} {cleanly {
    set charset [reversemapencoding US-ASCII]
    mapencoding $charset
}} US-ASCII


test mime-8.2 {Test reversemapencoding+mapencoding with alias} {cleanly {
    set charset [reversemapencoding UTF8]
    mapencoding $charset
}} UTF-8


cleanly {
    foreach name {file chan} {
	test mime-9.0.$name {Test chunk handling of serialize and helpers} [
	    list cleanly name $name {

	    set in [makeFile [set data [string repeat [string repeat {123456789 } 10]\n 350]] input.txt]
	    set mi [makeFile {} mime.txt]

	    with.$name $in -canonical text/plain {
		[::tcllib::chan::base new chan1] .init [open $mi w]
		chan1 configure -translation binary
		$tok serialize -chan chan1 
		chan1 close

		with.$name $mi {
		    set newdata [[$tok body raw] read]
		    set res [string compare $data $newdata]

		    removeFile input.txt
		    removeFile mime.txt
		    unset data newdata tok in mi
		    set res
		}
	    }
	}] 0
    }
}

set ::env(TZ) UTC0
set epoch [clock scan 2000-01-01]
foreach {n stamp date} {
    1     86340 {Sat, 01 Jan 2000 23:59:00 +0000}
    2   5176620 {Tue, 29 Feb 2000 21:57:00 +0000}
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
    chan1 configure -translation binary
    $attachment serialize -chan chan1 -level 1
    chan1 close

    set data [viewFile $out]
    file delete $in $out
    set data
}} {Message-ID: <f60c78370648168a30158b8cda876db2f875d1531e86e5594c5a108dcf5209db@|>
Content-ID: <93755e1312eacd488b6170673caa5e7a9a9445ce82ff11c934055bd1f907b229@|>
Content-Type: application/octet-stream
	; name=a0036.dss
Content-Disposition: attachment
	; filename=a0036.dss
Content-Transfer-Encoding: base64

BGRzcwEAAQABAAAAYQAAAAAAAAAAAAAAAAAAACQAAAD+//7/+/8wNzA2MTYwODE1MjQwNzA2







|
|







800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
    chan1 configure -translation binary
    $attachment serialize -chan chan1 -level 1
    chan1 close

    set data [viewFile $out]
    file delete $in $out
    set data
}} {Message-ID: <f0349bb839fb06cd4d858de88c094b8922a43956a8c0c1a192fb9a2863ad96a5@|>
Content-ID: <2d33a7fd638536de66c1ae9fce46cb98e4356a363e593148a130e45c390313ca@|>
Content-Type: application/octet-stream
	; name=a0036.dss
Content-Disposition: attachment
	; filename=a0036.dss
Content-Transfer-Encoding: base64

BGRzcwEAAQABAAAAYQAAAAAAAAAAAAAAAAAAACQAAAD+//7/+/8wNzA2MTYwODE1MjQwNzA2
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
    set tok [.new {} -string $msg]
    [$tok body raw] read 
} "so plain\n"

# -------------------------------------------------------------------------

test mime-14.0 {ticket 5f455d6343} -setup {
    set part  [mime::initialize \
		   -canonical application/x-simile \
		   -header [list "Content-Description" "Run Status"] \
		   -encoding base64 -string "This is a test"]
    set whole [mime::initialize -canonical multipart/mixed -parts [list $part]]

    set saved checkmime.msg
    set stm [open $saved w]
    mime::copymessage $whole $stm
    close $stm

} -body {
    set stm [open $saved r]
    set str [read $stm]
    close $stm
    set restore [mime::initialize -string $str]
} -cleanup {
    mime::finalize $restore
    unset part whole saved stm str
} -match glob -result "::mime::*"

# -------------------------------------------------------------------------

test mime-14.0 {cleanly {
	hostname argument to parseaddress
}} {
	set parsed [parseaddress hostname fakedomain.fake {Here <h>}] 
    list [llength $parsed] [lindex $parsed 0]
} [list 1 [list address [email protected] comment {} domain {} error {} \
	friendly Here group {} local h memberP 0 phrase Here \
	proper {Here <[email protected]>} route {}]]



test mime-14.1 {cleanly {
	special characters in local part
}} {
	set parsed [parseaddress hostname fakedomain.fake foo<>[email protected]]
    list [llength $parsed] [lindex $parsed 0]
} [list 1 [list address {} comment {} domain {} \
	error {expecting mailbox in local-part (found >)} friendly foo group {} \
	local {} memberP 0 phrase foo proper {foo <>} route {}]]

test mime-14.2 {cleanly {
	special characters in local part
}} {
	set parsed [parseaddress hostname fakedomain.fake {"foobar"@grill.com}]
    list [llength $parsed] [lindex $parsed 0]
} [list 1 [
    list address {"foobar"@grill.com} comment {} domain grill.com error {} \
    friendly foobar group {} local {"foobar"} memberP 0 phrase {} \
    proper {"foobar"@grill.com} route {}]]


# -------------------------------------------------------------------------








<
|
|
|
|



|

<




|

|





|










|








|

|
|

|







849
850
851
852
853
854
855

856
857
858
859
860
861
862
863
864

865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
    set tok [.new {} -string $msg]
    [$tok body raw] read 
} "so plain\n"

# -------------------------------------------------------------------------

test mime-14.0 {ticket 5f455d6343} -setup {

    set part  [.new -canonical application/x-simile \
	-headers [list "Content-Description" "Run Status"] \
	-encoding base64 -string "This is a test"]
    set whole [.new -canonical multipart/mixed -parts [list $part]]

    set saved checkmime.msg
    set stm [open $saved w]
    mime::serialize $whole -chan $stm
    close $stm

} -body {
    set stm [open $saved r]
    set str [read $stm]
    close $stm
    set restore [.new -string $str]
} -cleanup {
    $restore .destroy
    unset part whole saved stm str
} -match glob -result "::mime::*"

# -------------------------------------------------------------------------

test mime-14.1 {cleanly {
	hostname argument to parseaddress
}} {
	set parsed [parseaddress hostname fakedomain.fake {Here <h>}] 
    list [llength $parsed] [lindex $parsed 0]
} [list 1 [list address [email protected] comment {} domain {} error {} \
	friendly Here group {} local h memberP 0 phrase Here \
	proper {Here <[email protected]>} route {}]]



test mime-14.2 {cleanly {
	special characters in local part
}} {
	set parsed [parseaddress hostname fakedomain.fake foo<>[email protected]]
    list [llength $parsed] [lindex $parsed 0]
} [list 1 [list address {} comment {} domain {} \
	error {expecting mailbox in local-part (found >)} friendly foo group {} \
	local {} memberP 0 phrase foo proper {foo <>} route {}]]

test mime-14.3 {
	special characters in local part
} {cleanly {
    set parsed [parseaddress hostname fakedomain.fake {"foobar"@grill.com}]
    list [llength $parsed] [lindex $parsed 0]
}} [list 1 [
    list address {"foobar"@grill.com} comment {} domain grill.com error {} \
    friendly foobar group {} local {"foobar"} memberP 0 phrase {} \
    proper {"foobar"@grill.com} route {}]]


# -------------------------------------------------------------------------

914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
    $tok header get
} [list Content-Type {text/plain {}} Content-Disposition [
    list attachment [list param1 {a parameter value} \
	param2 {another parameter value}]]]


set char [encoding convertfrom utf-8 \xE3\x81\xAF]
test mime-16.1 {cleanly {
}} {
    set res {}
    set mime [.new {} -canonical text/plain -string {dawg one}]
    $mime header set Content-Disposition attachment [list param1 $char]
    set msg [$mime serialize]
    lappend res $msg
    set mime2 [.new {} -string $msg]
    lappend res [$mime2 header get]
    return $res

} [list "MIME-Version: 1.0\r
Message-ID: <c7aa6d4b48aa9fcfe18d9c24adf71de96efbaaf2e261eb1de738ef45f453d1a4@|>\r
Content-ID: <086570e97284c5bc5145f32689a5342363b10b64963446293b83930fa8a9fa45@|>\r
Content-Type: text/plain\r
Content-Disposition: attachment\r
	; param1*0*=utf-8''%E3%81%AF\r
\r
dawg one" \
[list Content-ID {<086570e97284c5bc5145f32689a5342363b10b64963446293b83930fa8a9fa45@|> {}} Content-Type {text/plain {}} \
    Message-ID {<c7aa6d4b48aa9fcfe18d9c24adf71de96efbaaf2e261eb1de738ef45f453d1a4@|> {}} \
    Content-Disposition [list attachment [list param1 $char]]]

]


# -------------------------------------------------------------------------








|
<










|







|







940
941
942
943
944
945
946
947

948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
    $tok header get
} [list Content-Type {text/plain {}} Content-Disposition [
    list attachment [list param1 {a parameter value} \
	param2 {another parameter value}]]]


set char [encoding convertfrom utf-8 \xE3\x81\xAF]
test mime-16.1 {} {

    set res {}
    set mime [.new {} -canonical text/plain -string {dawg one}]
    $mime header set Content-Disposition attachment [list param1 $char]
    set msg [$mime serialize]
    lappend res $msg
    set mime2 [.new {} -string $msg]
    lappend res [$mime2 header get]
    return $res

} [list "MIME-Version: 1.0\r
Message-ID: <056eb988475329e0d14defde74ba007f9b56e6f0d3a04ad773528dec1336ff26@|>\r
Content-ID: <086570e97284c5bc5145f32689a5342363b10b64963446293b83930fa8a9fa45@|>\r
Content-Type: text/plain\r
Content-Disposition: attachment\r
	; param1*0*=utf-8''%E3%81%AF\r
\r
dawg one" \
[list Content-ID {<086570e97284c5bc5145f32689a5342363b10b64963446293b83930fa8a9fa45@|> {}} Content-Type {text/plain {}} \
    Message-ID {<056eb988475329e0d14defde74ba007f9b56e6f0d3a04ad773528dec1336ff26@|> {}} \
    Content-Disposition [list attachment [list param1 $char]]]

]


# -------------------------------------------------------------------------

1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
} {
    set mime [.new {} -spec http -string {}]
    $mime serialize
} "\r
"


test mime-19.1 {
	cookie serialization
} {
	set mime [.new {} -spec http -string {}]
	$mime cookie set one two
	set res [$mime serialize]
	$mime .destroy
	return $res







|







1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
} {
    set mime [.new {} -spec http -string {}]
    $mime serialize
} "\r
"


test {mime cookie serialization} {
	cookie serialization
} {
	set mime [.new {} -spec http -string {}]
	$mime cookie set one two
	set res [$mime serialize]
	$mime .destroy
	return $res
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070




1071
1072
1073
\t; HttpOnly\r
\r
"



testsuiteCleanup
set [namespace current]::done 1
return
}

after 0 [list ::coroutine [info cmdcount]_main [namespace which main]]




vwait [namespace current]::done
return








<



|
>
>
>
>

|

1084
1085
1086
1087
1088
1089
1090

1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
\t; HttpOnly\r
\r
"



testsuiteCleanup

return
}

after 0 [list ::coroutine [info cmdcount]_main ::apply [list {} {
    variable done
    catch main cres copts
    set done [list $copts $cres]
} [namespace current]]]
vwait [namespace current]::done
return -options {*}$done

Changes to modules/mime/pkgIndex.tcl.
1
2
3
4
5
if {![package vsatisfies [package provide Tcl] 8.6.9]} return
package ifneeded smtp 1.5.2 [list source [file join $dir smtp.tcl]]

package ifneeded mime 3.0.0 [list source [file join $dir mime.tcl]]
package ifneeded {mime qp} 1.7 [list source [file join $dir qp.tcl]]
|




1
2
3
4
5
if {![package vsatisfies [package provide Tcl] 8.6.9 9]} return
package ifneeded smtp 1.5.2 [list source [file join $dir smtp.tcl]]

package ifneeded mime 3.0.0 [list source [file join $dir mime.tcl]]
package ifneeded {mime qp} 1.7 [list source [file join $dir qp.tcl]]
Changes to modules/ncgi/ncgi.tcl.
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
27
28
29
30
31
32
33
34
# ncgi.tcl
#
# Basic support for CGI programs
#
# Copyright (c) 2000 Ajuba Solutions.
# Copyright (c) 2012 Richard Hipp, Andreas Kupries
# Copyright (c) 2013-2014 Andreas Kupries
# Copyright (c) 2018 Poor Yorick 
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.










# Please note that Don Libes' has a "cgi.tcl" that implements version 1.0
# of the cgi package.  That implementation provides a bunch of cgi_ procedures
# (it doesn't use the ::cgi:: namespace) and has a wealth of procedures for
# generating HTML.  In contrast, the package provided here is primarly
# concerned with processing input to CGI programs.

# Note, I use the term "query data" to refer to the data that is passed in
# to a CGI program.  Typically this comes from a Form in an HTML browser.
# The query data is composed of names and values, and the names can be
# repeated.  The names and values are encoded, and this module takes care
# of decoding them.

# We use newer string routines
package require Tcl 8.6
package require {chan base}
package require fileutil ; # Required by importFile.
package require mime 3.0-
package require uri

package provide ncgi 1.5.0








<




>
>
>
>
>
>
>
>














|







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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# ncgi.tcl
#
# Basic support for CGI programs
#
# Copyright (c) 2000 Ajuba Solutions.
# Copyright (c) 2012 Richard Hipp, Andreas Kupries
# Copyright (c) 2013-2014 Andreas Kupries

#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

# Copyright (c) 2018-2024 Poor Yorick
#
# You may distribute and/or modify this program under the terms of the GNU
# Affero General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# See the file "COPYING" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

# Please note that Don Libes' has a "cgi.tcl" that implements version 1.0
# of the cgi package.  That implementation provides a bunch of cgi_ procedures
# (it doesn't use the ::cgi:: namespace) and has a wealth of procedures for
# generating HTML.  In contrast, the package provided here is primarly
# concerned with processing input to CGI programs.

# Note, I use the term "query data" to refer to the data that is passed in
# to a CGI program.  Typically this comes from a Form in an HTML browser.
# The query data is composed of names and values, and the names can be
# repeated.  The names and values are encoded, and this module takes care
# of decoding them.

# We use newer string routines
package require Tcl 8.6-
package require {chan base}
package require fileutil ; # Required by importFile.
package require mime 3.0-
package require uri

package provide ncgi 1.5.0

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189


190
191
192
193
194
195
196
197
198
199
#	Decodes data in www-url-encoded format.
#
# Arguments:
#	An encoded value.
#
# Results:
#	The decoded value.
proc ::ncgi::DecodeHex {hex} {
    return [binary decode hex $hex]
}

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 -nocase -- {%([E][A-F0-9])%([89AB][A-F0-9])%([89AB][A-F0-9])} \
	$str {[encoding convertfrom utf-8 [DecodeHex \1\2\3]]} str
    regsub -all -nocase -- {%([CDcd][A-F0-9])%([89AB][A-F0-9])} \
	$str {[encoding convertfrom utf-8 [DecodeHex \1\2]]} str
    regsub -all -nocase -- {%([A-F0-9][A-F0-9])} $str {\\u00\1} str

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








|









>
>


|







180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#	Decodes data in www-url-encoded format.
#
# Arguments:
#	An encoded value.
#
# Results:
#	The decoded value.
proc ::ncgi::DecodeHex hex {
    return [binary decode hex $hex]
}

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 -nocase -- {%([E][A-F0-9])%([89AB][A-F0-9])%([89AB][A-F0-9])%([89AB][A-F0-9])} \
	$str {[encoding convertfrom utf-8 [DecodeHex \1\2\3]]} str
    regsub -all -nocase -- {%([E][A-F0-9])%([89AB][A-F0-9])%([89AB][A-F0-9])} \
	$str {[encoding convertfrom utf-8 [DecodeHex \1\2\3]]} str
    regsub -all -nocase -- {%([CD][A-F0-9])%([89AB][A-F0-9])} \
	$str {[encoding convertfrom utf-8 [DecodeHex \1\2]]} str
    regsub -all -nocase -- {%([A-F0-9][A-F0-9])} $str {\\u00\1} str

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

636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
# Results:
#	The raw query data.

proc ::ncgi::query_string token {
    namespace upvar $token env env querystring querystring

    if {[info exists querystring]} {
	# This ensures you can call ncgi::query more than once,
	# and that you can use it with ncgi::reset
	return $querystring
    }

    set querystring {}
    if {[info exists env(QUERY_STRING)]} {
	set querystring $env(QUERY_STRING)
    }







|
<







645
646
647
648
649
650
651
652

653
654
655
656
657
658
659
# Results:
#	The raw query data.

proc ::ncgi::query_string token {
    namespace upvar $token env env querystring querystring

    if {[info exists querystring]} {
	# This ensures you can call ncgi::query more than once.

	return $querystring
    }

    set querystring {}
    if {[info exists env(QUERY_STRING)]} {
	set querystring $env(QUERY_STRING)
    }
Changes to modules/ncgi/ncgi.test.
1
2
3
4
5
6
7
8
9









10
11
12
13
14
15
16
# -*- tcl -*-
# Tests for the cgi module.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1998-2000 by Ajuba Solutions










# -------------------------------------------------------------------------

source [file join [
	file dirname [file dirname [file join [pwd] [info script]]]
] devtools testutilities.tcl]

testsNeedTcl     8.5









>
>
>
>
>
>
>
>
>







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
# -*- tcl -*-
# Tests for the cgi module.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1998-2000 by Ajuba Solutions

# Copyright (c) 2018-2024 Poor Yorick
#
# You may distribute and/or modify this program under the terms of the GNU
# Affero General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# See the file "COPYING" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

# -------------------------------------------------------------------------

source [file join [
	file dirname [file dirname [file join [pwd] [info script]]]
] devtools testutilities.tcl]

testsNeedTcl     8.5
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219


	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









|
|
|







212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228


	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, tkt [1f900bdf6b]} {
	    ncgi::decode {%E2%B1}
	} "\u00e2\u00b1" ;# Changed with branch `ncgi-1f900bdf6b`, tkt [1f900bdf6b]


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


Changes to modules/pop3/pop3.test.
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
# -*- tcl -*-
# pop3.test:  tests for the pop3 client.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 2002-2006 by Andreas Kupries <[email protected]>
# All rights reserved.

# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.5
testsNeedTcltest 1.0

tcltest::testConstraint hastls [expr {![catch {package require tls}]}]

support {
    #use           snit/snit.tcl snit ;# comm futures, not used, still a dependency
    #use           comm/comm.tcl comm
    use           log/log.tcl   log












|
<
|


|







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
# -*- tcl -*-
# pop3.test:  tests for the pop3 client.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 2002-2006 by Andreas Kupries <[email protected]>
# All rights reserved.

# -------------------------------------------------------------------------

source [file join [file dirname [file dirname [

    file join [pwd] [info script]]]] devtools testutilities.tcl]

testsNeedTcl     8.5
testsNeedTcltest 2.0

tcltest::testConstraint hastls [expr {![catch {package require tls}]}]

support {
    #use           snit/snit.tcl snit ;# comm futures, not used, still a dependency
    #use           comm/comm.tcl comm
    use           log/log.tcl   log
Changes to modules/pop3d/pop3d.tcl.
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
	# construction in memory (depending on source of token).

	log::log debug "pop3d $name Transfer $msgid /full"

	# We do "."-stuffing here. This is not in the scope of the
	# MIME library we use, but a transport dependent thing.

	set msg [string trimright [string map [list "\n." "\n.."] \
				       [mime::buildmessage $token]] \n]
	log::log debug "($msg)"
	puts $sock $msg
	puts $sock .

    } else {
	# As long as FR #531541 is not implemented we have to build
	# the entire message in memory and then cut it down to the
	# requested size. If limit was greater than the number of
	# lines in the message we will get the terminating "."
	# too. Using regsub we make sure that it is not present and
	# reattach during the transfer. Otherwise we would have to use
	# a regexp/if combo to decide wether to attach the terminator
	# not.

	set msg [split [mime::buildmessage $token] \n]
	set i 0
	incr limit -1
	while {[lindex $msg $i] != {}} {
	    incr i
	    incr limit
	}
	# i now refers to the line separating header and body







|
|














|







1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
	# construction in memory (depending on source of token).

	log::log debug "pop3d $name Transfer $msgid /full"

	# We do "."-stuffing here. This is not in the scope of the
	# MIME library we use, but a transport dependent thing.

	set msg [string trimright [string map [list "\n." "\n.."] [
	    mime::serialize $token]] \n]
	log::log debug "($msg)"
	puts $sock $msg
	puts $sock .

    } else {
	# As long as FR #531541 is not implemented we have to build
	# the entire message in memory and then cut it down to the
	# requested size. If limit was greater than the number of
	# lines in the message we will get the terminating "."
	# too. Using regsub we make sure that it is not present and
	# reattach during the transfer. Otherwise we would have to use
	# a regexp/if combo to decide wether to attach the terminator
	# not.

	set msg [split [mime::serialize $token] \n]
	set i 0
	incr limit -1
	while {[lindex $msg $i] != {}} {
	    incr i
	    incr limit
	}
	# i now refers to the line separating header and body
Changes to modules/pop3d/pop3d.test.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) 2002-2014 by Andreas Kupries <[email protected]>
# All rights reserved.
#
# RCS: @(#) $Id: pop3d.test,v 1.24 2011/11/14 22:33:48 andreas_kupries Exp $

# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.5 ;# Required by mime.tcl
testsNeedTcltest 1.0

support {
    #use           comm/comm.tcl  comm
    useTcllibFile devtools/coserv.tcl ; # loads comm too
    useTcllibFile devtools/dialog.tcl
    use           md5/md5x.tcl   md5
    use           mime/mime.tcl  mime







|
<
|


|







8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) 2002-2014 by Andreas Kupries <[email protected]>
# All rights reserved.
#
# RCS: @(#) $Id: pop3d.test,v 1.24 2011/11/14 22:33:48 andreas_kupries Exp $

# -------------------------------------------------------------------------

source [file join [file dirname [file dirname [

    file join [pwd] [info script]]]] devtools testutilities.tcl]

testsNeedTcl     8.5 ;# Required by mime.tcl
testsNeedTcltest 2.0

support {
    #use           comm/comm.tcl  comm
    useTcllibFile devtools/coserv.tcl ; # loads comm too
    useTcllibFile devtools/dialog.tcl
    use           md5/md5x.tcl   md5
    use           mime/mime.tcl  mime
Changes to modules/pop3d/pop3d_dbox.tcl.
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
    } {
	return -code error "id \"$msgId\" out of range"
    }
    incr msgId -1

    set mailfile [lindex $state($dir) $msgId]

    set token [::mime::initialize -file $mailfile]
    return $token
}

###########################
###########################
# Internal helper commands.








|







433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
    } {
	return -code error "id \"$msgId\" out of range"
    }
    incr msgId -1

    set mailfile [lindex $state($dir) $msgId]

    set token [::mime::.new -file $mailfile]
    return $token
}

###########################
###########################
# Internal helper commands.

Changes to modules/pop3d/pop3d_dbox.test.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.5 ;# Required by mime.tcl
testsNeedTcltest 1.0

support {
    use md5/md5x.tcl  md5
    use mime/mime.tcl mime
}
testing {
    useLocal pop3d_dbox.tcl pop3d::dbox







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.5 ;# Required by mime.tcl
testsNeedTcltest 2.0

support {
    use md5/md5x.tcl  md5
    use mime/mime.tcl mime
}
testing {
    useLocal pop3d_dbox.tcl pop3d::dbox