|
2022-09-10
| ||
| 12:04 | • Closed ticket [3165071fff]: http::geturl fails for at least 1 RSS feed plus ... artifact: fa9674f2ce user: kjnash | |
| 11:47 | Add option to detect XML files and their encoding when the server supplies no content-type. Fix for... check-in: d150b47456 user: kjnash tags: http-bugfixes-2022H2 | |
|
2011-03-09
| ||
| 06:09 | • Ticket [3165071fff] http::geturl fails for at least 1 RSS feed status still ... artifact: 983e02d202 user: anonymous | |
| 06:00 | • Ticket [3165071fff]: 4 changes artifact: 0a4ffaf8f5 user: anonymous | |
|
2011-03-07
| ||
| 04:38 | • Ticket [3165071fff]: 4 changes artifact: bc36afa165 user: patthoyts | |
| 04:31 | • Ticket [3165071fff]: 4 changes artifact: f4b524aefa user: patthoyts | |
|
2011-01-25
| ||
| 11:19 | • Add attachment 1295925860.xml to ticket [3165071fff] artifact: 5764f4fdbd user: anonymous | |
| 11:19 | • Ticket [3165071fff] http::geturl fails for at least 1 RSS feed status still ... artifact: 8923f930ae user: anonymous | |
| 11:18 | • Ticket [3165071fff]: 4 changes artifact: afe3289f26 user: anonymous | |
| 11:18 | • Add attachment 1295925929.xml to ticket [3165071fff] artifact: b1e4d86722 user: anonymous | |
| 11:10 | • Ticket [3165071fff] http::geturl fails for at least 1 RSS feed status still ... artifact: a69c8ca9ec user: anonymous | |
| 11:10 | • Add attachment http-tcl-8.6.0.0b4-defect.tcl to ticket [3165071ffffffff... artifact: 456e103336 user: anonymous | |
| 04:10 | • New ticket [3165071fff] http::geturl fails for at least 1 RSS feed. artifact: 7584124d00 user: anonymous | |
http::geturl fails for at least 1 RSS feed
Closed / Fixed3165071fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 4 years ago
Descriptionplain2011-01-25 04:10:04
The following script fails when run on tcl-8.6.0.0b4:
set url {http://www.npr.org/templates/rss/podlayer.php?id=13}
set file "[ clock seconds ].xml"
set out [ open $file w ]
http::geturl $url -channel $out
close $out
set channel [ tDOM::xmlOpenFile $file ]
set doc [ dom parse -channel $channel ]
chan close $channel
The [dom parse ...] fails because the file retrieved by the [http::geturl ...] is missing a chunk of data starting somewhere around line 67.
_____________________________________________________________________________________________
Configuration information:
----------------------------------------
OS: Windows 7 (Version 6.1 (Build 7600))
Tcl: ActiveTcl 8.6.0.0b4
% info tclversion
8.6
% info patchlevel
8.6b1.2
% package require http
2.8.2
% package require tdom
0.8.3
plain2011-01-25 11:10:05
File Added - 399712: http-tcl-8.6.0.0b4-defect.tcl
plain2011-01-25 11:18:43
File Added - 399713: 1295925929.xml
plain2011-01-25 11:19:28
File Added - 399714: 1295925860.xml
patthoytsplain2011-03-07 04:31:12
Your problem is in handling the encoding. You should probably be setting the file to binary otherwise we apply the channel encoding to the data as we write it to the disk file. In this case you likely later expect it to be utf8. However, when we retrieve the resource using the http package we handle the encoding as declared on the remote site. In this case there is no http content-encoding header and its type is text/xml so we are treating the inbound stream as iso8859-1. The file internally declares xml utf-8 but we will never look inside the file. I suggest you use [open $file wb] and see how that works.
patthoytsplain2011-03-07 04:38:16
See also http://diveintomark.org/archives/2004/02/13/xml-media-types and RFC3023. Given no explicit content-encoding header and a type of text/xml we should be (and are) treating the data as iso8859-1.
plain2011-03-09 06:00:47
Thanks for the response. I'll take a look at the specified URLs. One thing that confuses me about this issue is that the application I excerpted the code from has been working fine on Tcl 8.5.6, 8.5.8, & 8.5.9; but when I tried it with an 8.6 beta release, I found that a chunk of data missing near the 67th line in the temp file of captured data. Is the behavior of http::geturl expected to be different in 8.6?
plain2011-03-09 06:09:02
Notes: 1) The attached XML file labeled "valid version of the RSS feed" was generated by running the code on Tcl 8.5.9. 2) The attached XML file labeled "corrupted version of the RSS feed" was generated by running the code on Tcl 8.6.0.0b4 (ActiveTcl version #).
kjnashplain2022-09-10 12:04:28
(1) The encoding issue (when the server does not specify content-type or charset) is a duplicate of bug [2998307] and now has a fix. (2) The URL http://www.npr.org/templates/rss/podlayer.php?id=13 no longer exists, and so it is not possible to reproduce the "missing chunk of text" bug. Perhaps this was a bug in Tcl 8.6.0.0b4 - but it seems to have gone away. Or at least I have never seen it in Tcl 8.6 or 8.7 (i.e. it "works for me").
Log in (anonymous is fine) to add a comment.
Attachments:
- 1295925860.xml [download] added by anonymous on 2011-01-25 11:19:28. [details]
- 1295925929.xml [download] added by anonymous on 2011-01-25 11:18:43. [details]
- http-tcl-8.6.0.0b4-defect.tcl [download] added by anonymous on 2011-01-25 11:10:04. [details]