Tk Library Source Code

View Ticket
Login
Ticket UUID: 3483716
Title: transfer encoding ignored for message/*
Type: Bug Version: None
Submitter: cnassau Created on: 2012-02-03 10:21:10
Subsystem: mime Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2012-02-24 00:37:05
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2012-02-23 17:37:05
Description:
The handling of message/* types in ::mime::parsepart currently ignores the Content-Transfer-Encoding (tcllib 1.13 / mime 1.5.4) .

Example

Content-Type: message/delivery-status; name="deliverystatus.txt"
Content-Disposition: attachment; filename="deliverystatus.txt"; size=138;
creation-date="Thu, 02 Feb 2012 13:50:05 GMT";
modification-date="Thu, 02 Feb 2012 13:50:05 GMT"
Content-Description: deliverystatus.txt
Content-Transfer-Encoding: base64

T3JpZ2luYWwtUmVjaXBpZW50OiA8L2ZheD1ibHViYkBndW1taS5ib290PgpBY3Rpb246IGZhaWxl
ZApEaWFnbm9zdGljLUNvZGU6IHNtdHA7IDU1MCAjNS4xLjAgQWRkcmVzcyByZWplY3RlZC4KUmVt
b3RlLU1UQTogNTMuMjQuMjgyLjE1MA==


The attached patch fixes this problem for base64 encoded messages.
User Comments: andreas_kupries added on 2012-02-24 00:37:05:

allow_comments - 1

andreas_kupries added on 2012-02-24 00:37:04:
Thank you very much. The test has been added now. Confirmed that with your patch disabled an error is thrown, and with it the data is properly decoded.

I agree regarding the reasoning about accepting the base64 encoded form.

cnassau added on 2012-02-23 16:13:42:
Here is a test that verifies that the base64-encoded "message/*" is parsed. Previously that code raised an error.

test mime-12.0 {Bug 3483716} {
    set token [mime::initialize -string {Content-Type: message/delivery-status; name="deliverystatus.txt"
Content-Disposition: attachment; filename="deliverystatus.txt"; size=138;
creation-date="Thu, 02 Feb 2012 13:50:05 GMT";
modification-date="Thu, 02 Feb 2012 13:50:05 GMT"
Content-Description: deliverystatus.txt
Content-Transfer-Encoding: base64

T3JpZ2luYWwtUmVjaXBpZW50OiA8L2ZheD1ibHViYkBndW1taS5ib290PgpBY3Rpb246IGZhaWxl
ZApEaWFnbm9zdGljLUNvZGU6IHNtdHA7IDU1MCAjNS4xLjAgQWRkcmVzcyByZWplY3RlZC4KUmVt
b3RlLU1UQTogNTMuMjQuMjgyLjE1MA==
}]
    set parts [mime::getproperty $token parts]
    mime::getheader [lindex $parts end] Remote-MTA
} 53.24.282.150

Side note: I believe the test message does not follow the respective RFC 1894 because that states that 7bit encoding "MUST" be used for message/delivery-status types. The base64-encoded version that broke the previous package was observed in the wild, however, so it seems wise to accept it noentheless.

andreas_kupries added on 2012-02-23 01:54:34:
Accepted, and committed to CVS head.

However, please provide me with a small script demonstrating the before/after behaviour, so that I can extend the testsuite

Side note: In the future, please provide patches in the 'uified diff' format (generated by 'diff -u'). This easier to read, and easier to apply.

cnassau added on 2012-02-03 17:21:16:

File Added - 434791: patch

Attachments: