Tcl Library Source Code

Check-in [b2ae85b606]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:mime - Tkt [57909d2e1c] - Issue introduced with commit [913f7d92c5c35342]. Conversion of superfluous nested `expr` command forgot to convert braces to proper parens. This was able to break \r detection at the end of a line. - Further properly indented some of the code around this. - Lastly removed superflous reboxing of `mime::initializeaux` in `mime::initialize`. The command got boxed followed by immediate unboxing, making the whole thing superflous. Version bump 1.6.1 - (B) mime - (T) mime
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b2ae85b6066e8fb96a48ef0bf467ed5b7f1e2d41c61da1a2c2a8673bca5b17ad
User & Date: aku 2019-04-12 21:59:30
References
2019-06-19
23:45 Ticket [a16b109597] Error in mime.tcl status still Closed with 3 other changes artifact: 5823c66ea9 user: aku
2019-04-12
22:00 Closed ticket [57909d2e1c]: Error opening MIMEs with CRLF line ends in Linux plus 5 other changes artifact: 7b2d3842bb user: aku
Context
2019-04-13
03:36
struct / struct::graph - Tkt [5edaf187fa] - Reworked the internal `CheckE` validation command for node filtering to treat words with a leading dash after -in, etc. as node names instead of invalid options, until a valid option is seen again, or the end of the command is reached, whichever comes first. This behaviour is now documented. Version bump 2.4.2 - (B) struct::graph - (T) struct::graph - (D) struct::graph check-in: bb9e30207b user: aku tags: trunk
2019-04-12
21:59
mime - Tkt [57909d2e1c] - Issue introduced with commit [913f7d92c5c35342]. Conversion of superfluous nested `expr` command forgot to convert braces to proper parens. This was able to break \r detection at the end of a line. - Further properly indented some of the code around this. - Lastly removed superflous reboxing of `mime::initializeaux` in `mime::initialize`. The command got boxed followed by immediate unboxing, making the whole thing superflous. Version bump 1.6.1 - (B) mime - (T) mime check-in: b2ae85b606 user: aku tags: trunk
06:49
Doctools: - Markdown: Fix indentation for examples formatted as block quotes. Replace leading whitespace with non-breaking spaces. Note: Works only for leading whitespace. Non-breaking inner spaces seem to cause trouble, i.e. are not recognized and not formatted. - Latex: changed to use `alltt` as the environment for examples. This allows markup the same as doctools does for example_begin/end. Refixed handling of continuation lines to use the proper latex macro for the character. Regenerated package docs (version bump & fixes making changes) Version bump - doctools 1.5.4 B (latex, markdown) T (latex, markdown) check-in: 97fc04ebd2 user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to embedded/md/tcllib/files/modules/mime/mime.md.

1
2
3
4
5
6
7
8
9
10
11
12
..
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
[//000000001]: # (mime \- Mime)
[//000000002]: # (Generated from file 'mime\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (Copyright © 1999\-2000 Marshall T\. Rose)
[//000000004]: # (mime\(n\) 1\.6 tcllib "Mime")

<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
href="../../../toc.md">Table Of Contents</a> &#124; <a
href="../../../../index.md">Keyword Index</a> &#124; <a
href="../../../../toc0.md">Categories</a> &#124; <a
href="../../../../toc1.md">Modules</a> &#124; <a
href="../../../../toc2.md">Applications</a> ] <hr>
................................................................................
  - [Category](#category)

  - [Copyright](#copyright)

# <a name='synopsis'></a>SYNOPSIS

package require Tcl 8\.5  
package require mime ?1\.6?  

[__::mime::initialize__ ?__\-canonical__ *type/subtype* ?__\-param__ \{*key value*\}\.\.\.? ?__\-encoding__ *value*? ?__\-header__ \{*key value*\}\.\.\.?? \(__\-file__ *name* &#124; __\-string__ *value* &#124; __\-parts__ \{*token1* \.\.\. *tokenN*\}\)](#1)  
[__::mime::finalize__ *token* ?__\-subordinates__ __all__ &#124; __dynamic__ &#124; __none__?](#2)  
[__::mime::getproperty__ *token* ?*property* &#124; __\-names__?](#3)  
[__::mime::getheader__ *token* ?*key* &#124; __\-names__?](#4)  
[__::mime::setheader__ *token* *key value* ?__\-mode__ __write__ &#124; __append__ &#124; __delete__?](#5)  
[__::mime::getbody__ *token* ?__\-decode__? ?__\-command__ *callback* ?__\-blocksize__ *octets*??](#6)  



|







 







|







1
2
3
4
5
6
7
8
9
10
11
12
..
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
[//000000001]: # (mime \- Mime)
[//000000002]: # (Generated from file 'mime\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (Copyright &copy; 1999\-2000 Marshall T\. Rose)
[//000000004]: # (mime\(n\) 1\.6\.1 tcllib "Mime")

<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
href="../../../toc.md">Table Of Contents</a> &#124; <a
href="../../../../index.md">Keyword Index</a> &#124; <a
href="../../../../toc0.md">Categories</a> &#124; <a
href="../../../../toc1.md">Modules</a> &#124; <a
href="../../../../toc2.md">Applications</a> ] <hr>
................................................................................
  - [Category](#category)

  - [Copyright](#copyright)

# <a name='synopsis'></a>SYNOPSIS

package require Tcl 8\.5  
package require mime ?1\.6\.1?  

[__::mime::initialize__ ?__\-canonical__ *type/subtype* ?__\-param__ \{*key value*\}\.\.\.? ?__\-encoding__ *value*? ?__\-header__ \{*key value*\}\.\.\.?? \(__\-file__ *name* &#124; __\-string__ *value* &#124; __\-parts__ \{*token1* \.\.\. *tokenN*\}\)](#1)  
[__::mime::finalize__ *token* ?__\-subordinates__ __all__ &#124; __dynamic__ &#124; __none__?](#2)  
[__::mime::getproperty__ *token* ?*property* &#124; __\-names__?](#3)  
[__::mime::getheader__ *token* ?*key* &#124; __\-names__?](#4)  
[__::mime::setheader__ *token* *key value* ?__\-mode__ __write__ &#124; __append__ &#124; __delete__?](#5)  
[__::mime::getbody__ *token* ?__\-decode__? ?__\-command__ *callback* ?__\-blocksize__ *octets*??](#6)  

Changes to idoc/man/files/modules/mime/mime.n.

1
2
3
4
5
6
7
8
9
10
11
12
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
'\"
'\" Generated from file 'mime\&.man' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 1999-2000 Marshall T\&. Rose
'\"
.TH "mime" n 1\&.6 tcllib "Mime"
.\" The -*- nroff -*- definitions below are for supplemental macros used
.\" in Tcl/Tk manual entries.
.\"
.\" .AP type name in/out ?indent?
.\"	Start paragraph describing an argument to a library procedure.
.\"	type is type of argument (int, etc.), in/out is either "in", "out",
.\"	or "in/out" to describe whether procedure reads or modifies arg,
................................................................................
..
.BS
.SH NAME
mime \- Manipulation of MIME body parts
.SH SYNOPSIS
package require \fBTcl  8\&.5\fR
.sp
package require \fBmime  ?1\&.6?\fR
.sp
\fB::mime::initialize\fR ?\fB-canonical\fR \fItype/subtype\fR ?\fB-param\fR {\fIkey value\fR}\&.\&.\&.? ?\fB-encoding\fR \fIvalue\fR? ?\fB-header\fR {\fIkey value\fR}\&.\&.\&.?? (\fB-file\fR \fIname\fR | \fB-string\fR \fIvalue\fR | \fB-parts\fR {\fItoken1\fR \&.\&.\&. \fItokenN\fR})
.sp
\fB::mime::finalize\fR \fItoken\fR ?\fB-subordinates\fR \fBall\fR | \fBdynamic\fR | \fBnone\fR?
.sp
\fB::mime::getproperty\fR \fItoken\fR ?\fIproperty\fR | \fB-names\fR?
.sp



|







 







|







1
2
3
4
5
6
7
8
9
10
11
12
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
'\"
'\" Generated from file 'mime\&.man' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 1999-2000 Marshall T\&. Rose
'\"
.TH "mime" n 1\&.6\&.1 tcllib "Mime"
.\" The -*- nroff -*- definitions below are for supplemental macros used
.\" in Tcl/Tk manual entries.
.\"
.\" .AP type name in/out ?indent?
.\"	Start paragraph describing an argument to a library procedure.
.\"	type is type of argument (int, etc.), in/out is either "in", "out",
.\"	or "in/out" to describe whether procedure reads or modifies arg,
................................................................................
..
.BS
.SH NAME
mime \- Manipulation of MIME body parts
.SH SYNOPSIS
package require \fBTcl  8\&.5\fR
.sp
package require \fBmime  ?1\&.6\&.1?\fR
.sp
\fB::mime::initialize\fR ?\fB-canonical\fR \fItype/subtype\fR ?\fB-param\fR {\fIkey value\fR}\&.\&.\&.? ?\fB-encoding\fR \fIvalue\fR? ?\fB-header\fR {\fIkey value\fR}\&.\&.\&.?? (\fB-file\fR \fIname\fR | \fB-string\fR \fIvalue\fR | \fB-parts\fR {\fItoken1\fR \&.\&.\&. \fItokenN\fR})
.sp
\fB::mime::finalize\fR \fItoken\fR ?\fB-subordinates\fR \fBall\fR | \fBdynamic\fR | \fBnone\fR?
.sp
\fB::mime::getproperty\fR \fItoken\fR ?\fIproperty\fR | \fB-names\fR?
.sp

Changes to idoc/www/tcllib/files/modules/mime/mime.html.

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
 ] <hr>
<div class="doctools">
<h1 class="doctools_title">mime(n) 1.6 tcllib &quot;Mime&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>mime - Manipulation of MIME body parts</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
................................................................................
<li class="doctools_section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">mime <span class="opt">?1.6?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::mime::initialize</b> <span class="opt">?<b class="option">-canonical</b> <i class="arg">type/subtype</i> <span class="opt">?<b class="option">-param</b> {<i class="arg">key value</i>}...?</span> <span class="opt">?<b class="option">-encoding</b> <i class="arg">value</i>?</span> <span class="opt">?<b class="option">-header</b> {<i class="arg">key value</i>}...?</span>?</span> (<b class="option">-file</b> <i class="arg">name</i> | <b class="option">-string</b> <i class="arg">value</i> | <b class="option">-parts</b> {<i class="arg">token1</i> ... <i class="arg">tokenN</i>})</a></li>
<li><a href="#2"><b class="cmd">::mime::finalize</b> <i class="arg">token</i> <span class="opt">?<b class="option">-subordinates</b> <b class="const">all</b> | <b class="const">dynamic</b> | <b class="const">none</b>?</span></a></li>
<li><a href="#3"><b class="cmd">::mime::getproperty</b> <i class="arg">token</i> <span class="opt">?<i class="arg">property</i> | <b class="option">-names</b>?</span></a></li>
<li><a href="#4"><b class="cmd">::mime::getheader</b> <i class="arg">token</i> <span class="opt">?<i class="arg">key</i> | <b class="option">-names</b>?</span></a></li>
<li><a href="#5"><b class="cmd">::mime::setheader</b> <i class="arg">token</i> <i class="arg">key value</i> <span class="opt">?<b class="option">-mode</b> <b class="const">write</b> | <b class="const">append</b> | <b class="const">delete</b>?</span></a></li>






|







 







|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
 ] <hr>
<div class="doctools">
<h1 class="doctools_title">mime(n) 1.6.1 tcllib &quot;Mime&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>mime - Manipulation of MIME body parts</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
................................................................................
<li class="doctools_section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.5</b></li>
<li>package require <b class="pkgname">mime <span class="opt">?1.6.1?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::mime::initialize</b> <span class="opt">?<b class="option">-canonical</b> <i class="arg">type/subtype</i> <span class="opt">?<b class="option">-param</b> {<i class="arg">key value</i>}...?</span> <span class="opt">?<b class="option">-encoding</b> <i class="arg">value</i>?</span> <span class="opt">?<b class="option">-header</b> {<i class="arg">key value</i>}...?</span>?</span> (<b class="option">-file</b> <i class="arg">name</i> | <b class="option">-string</b> <i class="arg">value</i> | <b class="option">-parts</b> {<i class="arg">token1</i> ... <i class="arg">tokenN</i>})</a></li>
<li><a href="#2"><b class="cmd">::mime::finalize</b> <i class="arg">token</i> <span class="opt">?<b class="option">-subordinates</b> <b class="const">all</b> | <b class="const">dynamic</b> | <b class="const">none</b>?</span></a></li>
<li><a href="#3"><b class="cmd">::mime::getproperty</b> <i class="arg">token</i> <span class="opt">?<i class="arg">property</i> | <b class="option">-names</b>?</span></a></li>
<li><a href="#4"><b class="cmd">::mime::getheader</b> <i class="arg">token</i> <span class="opt">?<i class="arg">key</i> | <b class="option">-names</b>?</span></a></li>
<li><a href="#5"><b class="cmd">::mime::setheader</b> <i class="arg">token</i> <i class="arg">key value</i> <span class="opt">?<b class="option">-mode</b> <b class="const">write</b> | <b class="const">append</b> | <b class="const">delete</b>?</span></a></li>

Changes to modules/mime/mime.man.


1
2
3
4
5
6
7
8
9
..
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin mime n 1.6]
[see_also ftp]
[see_also http]
[see_also pop3]
[see_also smtp]
[keywords email]
[keywords internet]
[keywords mail]
................................................................................
[keywords {rfc 2049}]
[keywords smtp]
[copyright {1999-2000 Marshall T. Rose}]
[moddesc   {Mime}]
[titledesc {Manipulation of MIME body parts}]
[category  {Text processing}]
[require Tcl 8.5]
[require mime [opt 1.6]]
[description]
[para]

The [package mime] library package provides the commands to create and
manipulate MIME body parts.

[list_begin definitions]
>

|







 







|







1
2
3
4
5
6
7
8
9
10
..
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[vset VERSION 1.6.1]
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin mime n [vset VERSION]]
[see_also ftp]
[see_also http]
[see_also pop3]
[see_also smtp]
[keywords email]
[keywords internet]
[keywords mail]
................................................................................
[keywords {rfc 2049}]
[keywords smtp]
[copyright {1999-2000 Marshall T. Rose}]
[moddesc   {Mime}]
[titledesc {Manipulation of MIME body parts}]
[category  {Text processing}]
[require Tcl 8.5]
[require mime [opt [vset VERSION]]]
[description]
[para]

The [package mime] library package provides the commands to create and
manipulate MIME body parts.

[list_begin definitions]

Changes to modules/mime/mime.tcl.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
375
376
377
378
379
380
381

382

383
384
385
386
387
388
389
...
654
655
656
657
658
659
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
# 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

package provide mime 1.6

if {[catch {package require Trf 2.0}]} {

    # Fall-back to tcl-based procedures of base64 and quoted-printable encoders
    # Warning!
    # These are a fragile emulations of the more general calling sequence
    # that appears to work with this code here.
................................................................................
    variable mime

    set token [namespace current]::[incr mime(uid)]
    # FRINK: nocheck
    variable $token
    upvar 0 $token state


    if {[catch {{*}[list mime::initializeaux $token {*}$args]} result eopts]} {

        catch {mime::finalize $token -subordinates dynamic}
        return -options $eopts $result
    }
    return $token
}

# ::mime::initializeaux --
................................................................................
        if {$fileP} {
            if {($pos > $last) || ([set x [gets $state(fd) line]] <= 0)} {
                set blankP 1
            } else {
                incr pos [expr {$x + 1}]
            }
        } else {

        if {$state(lines.current) >= $state(lines.count)} {
            set blankP 1
            set line {}
        } else {
            set line [lindex $state(lines) $state(lines.current)]
            incr state(lines.current)
            set x [string length $line]
            if {$x == 0} {set blankP 1}
        }

        }

         if {(!$blankP) && ([string last \r $line] == {$x - 1})} {
             set line [string range $line 0 [expr {$x - 2}]]
             if {$x == 1} {
                 set blankP 1
             }
         }

        if {(!$blankP) && (([
            string first { } $line] == 0) || ([
            string first \t $line] == 0))} {
            append vline \n $line
            continue
        }






|







 







>
|
>







 







<
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
...
656
657
658
659
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
# 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

package provide mime 1.6.1

if {[catch {package require Trf 2.0}]} {

    # Fall-back to tcl-based procedures of base64 and quoted-printable encoders
    # Warning!
    # These are a fragile emulations of the more general calling sequence
    # that appears to work with this code here.
................................................................................
    variable mime

    set token [namespace current]::[incr mime(uid)]
    # FRINK: nocheck
    variable $token
    upvar 0 $token state

    if {[catch {
	mime::initializeaux $token {*}$args
    } result eopts]} {
        catch {mime::finalize $token -subordinates dynamic}
        return -options $eopts $result
    }
    return $token
}

# ::mime::initializeaux --
................................................................................
        if {$fileP} {
            if {($pos > $last) || ([set x [gets $state(fd) line]] <= 0)} {
                set blankP 1
            } else {
                incr pos [expr {$x + 1}]
            }
        } else {

	    if {$state(lines.current) >= $state(lines.count)} {
		set blankP 1
		set line {}
	    } else {
		set line [lindex $state(lines) $state(lines.current)]
		incr state(lines.current)
		set x [string length $line]
		if {$x == 0} {set blankP 1}
	    }
        }


	if {(!$blankP) && ([string last \r $line] == ($x - 1))} {
	    set line [string range $line 0 [expr {$x - 2}]]
	    if {$x == 1} {
		set blankP 1
	    }
	}

        if {(!$blankP) && (([
            string first { } $line] == 0) || ([
            string first \t $line] == 0))} {
            append vline \n $line
            continue
        }

Changes to modules/mime/mime.test.

22
23
24
25
26
27
28





29
30
31
32
33
34
35
...
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
...
598
599
600
601
602
603
604









605
606
607
608
609
    # 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
}
testing {
    useLocal mime.tcl mime
}






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

namespace import mime::*

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

................................................................................
    list $err3 $err3a
} "foo {MIME-Version: 1.0\r
Content-Type: text/plain\r
\r
foo}"

test mime-3.7 {Test mime with a bad email [SF Bug 631314 ]} {
    set tok [mime::initialize -file \
		 [file join $tcltest::testsDirectory badmail1.txt]]

    set res {}
    set ctok [lindex [mime::getproperty $tok parts] 0]
    lappend res [dictsort [mime::getproperty $tok]]
    lappend res [dictsort [mime::getproperty $ctok]]
    mime::finalize $tok
    string map [list $ctok CHILD] $res
} {{content multipart/mixed encoding {} params {boundary ----------CSFNU9QKPGZL79} parts CHILD size 0} {content application/octet-stream encoding {} params {charset us-ascii} size 0}}

test mime-3.8 {Test mime with another bad email [SF Bug 631314 ]} {
    set tok [mime::initialize -file \
		 [file join $tcltest::testsDirectory badmail2.txt]]
    set res {}
    set ctok [lindex [mime::getproperty $tok parts] 0]
    lappend res [dictsort [mime::getproperty $tok]]
    lappend res [dictsort [mime::getproperty $ctok]]
    mime::finalize $tok
    string map [list $ctok CHILD] $res
} {{content multipart/related encoding {} params {boundary ----=_NextPart_000_0000_2CBA2CBA.150C56D2} parts CHILD size 659} {content application/octet-stream encoding base64 params {} size 659}}
................................................................................
T3JpZ2luYWwtUmVjaXBpZW50OiA8L2ZheD1ibHViYkBndW1taS5ib290PgpBY3Rpb246IGZhaWxl
ZApEaWFnbm9zdGljLUNvZGU6IHNtdHA7IDU1MCAjNS4xLjAgQWRkcmVzcyByZWplY3RlZC4KUmVt
b3RlLU1UQTogNTMuMjQuMjgyLjE1MA==
}]
    set parts [mime::getproperty $token parts]
    mime::getheader [lindex $parts end] Remote-MTA
} 53.24.282.150










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

testsuiteCleanup
return






>
>
>
>
>







 







|
<
<









|
<







 







>
>
>
>
>
>
>
>
>





22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
...
170
171
172
173
174
175
176
177


178
179
180
181
182
183
184
185
186
187

188
189
190
191
192
193
194
...
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
    # 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
}
testing {
    useLocal mime.tcl mime
}

# Shorthand for access to assets.
proc A {path} {
    file join $::tcltest::testsDirectory test-assets $path
}

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

namespace import mime::*

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

................................................................................
    list $err3 $err3a
} "foo {MIME-Version: 1.0\r
Content-Type: text/plain\r
\r
foo}"

test mime-3.7 {Test mime with a bad email [SF Bug 631314 ]} {
    set tok [mime::initialize -file [A badmail1.txt]]


    set res {}
    set ctok [lindex [mime::getproperty $tok parts] 0]
    lappend res [dictsort [mime::getproperty $tok]]
    lappend res [dictsort [mime::getproperty $ctok]]
    mime::finalize $tok
    string map [list $ctok CHILD] $res
} {{content multipart/mixed encoding {} params {boundary ----------CSFNU9QKPGZL79} parts CHILD size 0} {content application/octet-stream encoding {} params {charset us-ascii} size 0}}

test mime-3.8 {Test mime with another bad email [SF Bug 631314 ]} {
    set tok [mime::initialize -file [A badmail2.txt]]

    set res {}
    set ctok [lindex [mime::getproperty $tok parts] 0]
    lappend res [dictsort [mime::getproperty $tok]]
    lappend res [dictsort [mime::getproperty $ctok]]
    mime::finalize $tok
    string map [list $ctok CHILD] $res
} {{content multipart/related encoding {} params {boundary ----=_NextPart_000_0000_2CBA2CBA.150C56D2} parts CHILD size 659} {content application/octet-stream encoding base64 params {} size 659}}
................................................................................
T3JpZ2luYWwtUmVjaXBpZW50OiA8L2ZheD1ibHViYkBndW1taS5ib290PgpBY3Rpb246IGZhaWxl
ZApEaWFnbm9zdGljLUNvZGU6IHNtdHA7IDU1MCAjNS4xLjAgQWRkcmVzcyByZWplY3RlZC4KUmVt
b3RlLU1UQTogNTMuMjQuMjgyLjE1MA==
}]
    set parts [mime::getproperty $token parts]
    mime::getheader [lindex $parts end] Remote-MTA
} 53.24.282.150

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

test mime-12.1 {Fossil ticket 57909d2e1c} -cleanup {
    mime::finalize $token
    unset -nocomplain token
} -body {
    set token [::mime::initialize -file [A mail-57909d2e1c.txt]]
} -result {::mime::*} -match glob

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

testsuiteCleanup
return

Changes to modules/mime/pkgIndex.tcl.

1
2
3
4
if {![package vsatisfies [package provide Tcl] 8.3]} {return}
package ifneeded smtp 1.5 [list source [file join $dir smtp.tcl]]
if {![package vsatisfies [package provide Tcl] 8.5]} {return}
package ifneeded mime 1.6 [list source [file join $dir mime.tcl]]


|
1
2
3
4
if {![package vsatisfies [package provide Tcl] 8.3]} {return}
package ifneeded smtp 1.5 [list source [file join $dir smtp.tcl]]
if {![package vsatisfies [package provide Tcl] 8.5]} {return}
package ifneeded mime 1.6.1 [list source [file join $dir mime.tcl]]

Name change from modules/mime/badmail1.txt to modules/mime/test-assets/badmail1.txt.

Name change from modules/mime/badmail2.txt to modules/mime/test-assets/badmail2.txt.

Added modules/mime/test-assets/mail-57909d2e1c.txt.










































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
42
43
44
45
46
47
48
49
50
51
52
53
MIME-Version: 1.0
Content-ID: <[email protected]>
Content-Type: multipart/mixed;
              boundary="----- =_U9Pw/kikzJT5t8pT5pl5Pw=="

------- =_U9Pw/kikzJT5t8pT5pl5Pw==
MIME-Version: 1.0
Content-ID: <[email protected]>
Content-Disposition: inline; filename="/model.pl"
Content-Description: Simile model
Date-Modified: 2019-04-11 11:01:36 GMT
Authentication-Code: c0c651af192d709b2757cb9ef0d8c19d
Content-Type: application/x-simile
Content-Transfer-Encoding: base64

c291cmNlKHByb2dyYW09J0FNRScsdmVyc2lvbj0gMTAuOSxlZGl0aW9uPWVudGVycHJpc2UsZGF0
KG5vbmUsaW5faGllcmFyY2h5LGRlc3QsMSldXSxbY3VydmU9Wy05LDFdXSkuCg==

------- =_U9Pw/kikzJT5t8pT5pl5Pw==
MIME-Version: 1.0
Content-ID: <[email protected]>
Content-Disposition: attachment; filename="/model.cnv"
Content-Description: Simile canvas description
Date-Modified: 2019-04-11 11:01:36 GMT
Content-Type: application/x-simile
Content-Transfer-Encoding: base64

IyB3cml0dGVuIG9uIFRodSBBcHIgMTEgMTE6MDE6MzYgR01UIDIwMTkKTG9hZE1vZGVsTG9va3Mg
bl90aGlzIHJlYWx3aWR0aCgxMDguMCkgY3VycmVudGx5X2VkaXRhYmxlfSAtdGV4dCBmbG93MwoK


------- =_U9Pw/kikzJT5t8pT5pl5Pw==
MIME-Version: 1.0
Content-ID: <[email protected]>
Content-Disposition: attachment; filename="/model.spj"
Content-Description: Simile package description
Date-Modified: 2019-04-11 11:01:53 GMT
Content-Type: application/x-simile
Content-Transfer-Encoding: base64

Cg==

------- =_U9Pw/kikzJT5t8pT5pl5Pw==
MIME-Version: 1.0
Content-Description: Run Status
Content-ID: <[email protected]>
Content-Type: application/x-simile
Content-Transfer-Encoding: base64

ZXhlY1RpbWUgMTAwLjAgdGltZVVuaXQgdW5pdCBkaXNwbGF5SW50IDEgaW50TWV0aG9kIEV1bGVy
IHBoYXNlTGlzdCAwLjE=

------- =_U9Pw/kikzJT5t8pT5pl5Pw==--