http 2.7 dependency on zlib breaks in Tcl 8.5
Closed / Wont Fix3165982fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2011-01-26 15:51:26
The http 2.7 package introduced in 8.5.2 has a dependency on the in-core zlib
package which is only present in 8.6. Consequently, any gzip-encoded response
is incorrectly handled.
Here I use 8.5.1:
$ cat <<END | /tmp/tcl8.5.1/bin/tclsh8.5
> puts "Tcl: [package present Tcl]"
> package require http
> puts "HTTP: [package present http]"
> if { [ catch {
> set tok [http::geturl http://centrebet.com/cust \
> -headers {Accept-Encoding gzip}]
> } err] } {
> puts \$err
> } else {
> puts \$tok
> }
> END
Tcl: 8.5.1
HTTP: 2.5.3
::http::1
which doesn't attempt the decompress the body, and http::geturl returns
successfully.
Here I use 8.5.2:
$ cat <<END | /tmp/tcl8.5.2/bin/tclsh8.5
> puts "Tcl: [package present Tcl]"
> package require http
> puts "HTTP: [package present http]"
> if { [ catch {
> set tok [http::geturl http://centrebet.com/cust \
> -headers {Accept-Encoding gzip}]
> } err] } {
> puts \$err
> } else {
> puts \$tok
> }
> END
Tcl: 8.5.2
HTTP: 2.7
invalid command name "zlib"
which calls http::Gunzip to decompress and fails because zlib is not available.
a3a3el Ticket [3165982fff]: 1 change
[History diff]2011-01-26 23:00:56
patthoytsplain2011-01-27 20:27:30
This feature is to enable support of compressed streams when you have a supported zip extension. There is one built into tcl 8.6 but in 8.5 people can load one in and one is included in tclkit. If - and only if - a suitable extension package was loaded the http package will include the Accept-Encoding header to indicate that it can support compressed streams. You have deliberately set this header to indicate you will accept gzip compressed data. In this case you are responsible for decoding it. If you plan on using a different incompatible package to decompress the data then you can replace the Gunzip function with your own once you load the http package. Beware that the http package uses lazy loading so you should actually call the http::geturl function to force loading the procedures before you replace them.
patthoytsplain2011-01-27 20:27:31
allow_comments - 1
Log in (anonymous is fine) to add a comment.