Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-09-09
15:42 • Closed ticket [3009322fff]: Test for non-text data prevents transliteration of R... artifact: b63e2277d4 user: kjnash
2010-05-31
09:01 • Ticket [3009322fff]: 4 changes artifact: e22763235e user: coldstore
01:57 • New ticket [3009322fff]. artifact: 89910ba5fc user: jda3000

Test for non-text data prevents transliteration of RSS chars

Closed / Fixed3009322fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 4 years ago
Descriptionplain2010-05-31 01:57:19
The test for text vs binary content that takes place in http:Event near the comment "# Turn off conversions for non-text data" only checks for content types that start with "text"  like "text/xml" or "text/html" many sites use "application/rss+xml" or the like to describe the content of the response if it is an rss feed.

Perhaps the test should allow for this.

Here is the test as written:

            if {
                $state(-binary) || ![string match -nocase text* $state(type)]
            } then {
                # Turn off conversions for non-text data
                set state(binary) 1
            }

Here is a work-around that satisfied me:

if {![string match -nocase application/rss* $state(type)] &&  ![string match -nocase application/xml* $state(type)] } {set state(binary) 1}

That is, I added a test for rss and xml  before setting the state(binary) flag to 1.
coldstoreplain2010-05-31 09:01:45
The HTTP spec doesn't really countenance either test.  IIRC, it should be possible to determine the encoding type of the request from TE, content-encoding or similar fields.  One can't rely upon the content-type to determine the transport encoding.
kjnashplain2022-09-09 15:42:13
This bug was fixed in commit [07c269e62a] of 2016-10-08 which introduced the improved test command http::IsBinaryContentType.
Log in (anonymous is fine) to add a comment.