Overview
| Artifact ID: | 09db90cdff543f59d26433c1c4ca625be69879a4 |
|---|---|
| Ticket: | 838e99a76dd54f1961b8b5c4bdb3da114bf5b6f8
treat application/xml as text |
| User & Date: | gahr on 2016-09-24 19:00:46 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
The http package converts the body of the response to the charset specified in the response headers only if content-type matches text*. This patch proposes to treat application/xml in the same way. The rationale is that xml is encoded in utf-8 by default and carries human readable information. Currently, anybody receiving */xml should decode the stream himself, as suggested in [1733261fffffffffffff]. I find this counterintuitive. A real-world use case for this is WebDAV, which has deprecated the use of text/xml in favour of application/xml, see rfc 4918 ยง8.2 [http://www.webdav.org/specs/rfc4918.html#rfc.section.8.2] I propose the following patch. Index: library/http/http.tcl ================================================================== --- library/http/http.tcl +++ library/http/http.tcl @@ -1045,11 +1045,15 @@ # We have to use binary translation to count bytes properly. fconfigure $sock -translation binary if { - $state(-binary) || ![string match -nocase text* $state(type)] + $state(-binary) || + ( + ![string match -nocase text* $state(type)] && + ![string match -nocase application/xml* $state(type)] + ) } { # Turn off conversions for non-text data set state(binary) 1 } if {[info exists state(-channel)]} { - foundin changed to: "8.6.6"
- is_private changed to: "0"
- login: "gahr"
- priority changed to: "5 Medium"
- private_contact changed to: "438e59f1f1c891b29d2528ed82d1e629cecc6336"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "gahr"
- subsystem changed to: "29. http Package"
- title changed to: "treat application/xml as text"
- type changed to: "Bug"