Description: |
(text/x-fossil-wiki)
When a web site doesn't provide a content type, RFC 2616 specifies: "If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream". The http package does not follow this directive and treats all data with an unknown content type as text. This is an unfortunate choice, because once converted to text (translating \r\n to \n), information has been lost that can't be recovered. Reporting text as binary data on the other hand can easily be corrected.
As an example, a popular Dutch web site produces a png image without providing a content-type header: https://image.buienradar.nl/2.0/image/sprite/RadarMapRainNL. See also the attached script.
The only work-around is to add the -binary option to http::geturl. But that treats any response as binary, even when a site does provide a content-type header.
|