Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d1ada38c9d9292565223d0c5887633bd0ff1b2da27088bd6f163329757be0ddf
Ticket: a13b9d0ce1083eb302a9ad1ce88e7351c928fdd6
The http package uses wrong mapping for content-encoding
User & Date: sbron on 2020-07-24 16:13:23
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    When a web site returns a resource with "Content-Encoding: deflate", the data should be compressed according to RFC 1951 and then wrapped according to RFC 1950. The proper way to decode such a resource in Tcl is using the zlib <b>decompress</b> method, not zlib inflate. The zlib inflate method expects raw compressed data. Apparently this was also implemented incorrectly in IE, resulting in some web sites, which were only tested with IE, to deliver the wrong data format. To deal with this situation, most other browsers were changed to accept both. Either Tcl should also accept both, or the correct data format. Not only the misguided Microsoft interpretation.
    
    A Content-Encoding value of "compress" specifies the data was encoded the way the unix "compress" command does. The zlib library does not support this format. As it is an outdated format anyway, I think the http package should simply not advertise its support in the Accept-Encoding header.
    
    Unfortunately I have been unsuccessful in finding a web site that returns deflated data. Probably due to the Microsoft blunder, the deflate method is considered tainted and sites don't use it much anymore. I have created a php script on my own web site that will use either gzip or deflate encoding depending on the received Accept-Encoding header (using the PHP function ob_gzhandler, which presumably produces the correct output). Forcing the Accept-Encoding header to "deflate" causes http::geturl to throw a "data error":
    
    <verbatim>
    package require http 2.9.1
    set url http://www.tclcode.com/bugs/deflate.php
    set tok [http::geturl $url -headers {Accept-Encoding deflate}]
    puts [http::data $tok]
    http::cleanup $tok
    </verbatim>
    
  5. foundin changed to: "2.9.1"
  6. is_private changed to: "0"
  7. login: "sbron"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "8475f421649231f1e116ac602bea4537d2b027b4"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "sbron"
  14. subsystem changed to: "29. http Package"
  15. title changed to:
    The http package uses wrong mapping for content-encoding
    
  16. type changed to: "Bug"