Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-09-07
06:47 • Deleted ticket [219399ffff]: Incoming text encoded gzip not being read in binary... artifact: 2e5b5052d1 user: hobbs
2001-08-21
06:56 • Ticket [219399ffff]: 1 change artifact: 3f9fe488e5 user: hobbs
2001-02-05
03:56 • Ticket [219399ffff]: 1 change artifact: ca55f29caf user: dkf
2001-01-25
17:06 • Ticket [219399ffff]: 1 change artifact: da3a4be8a5 user: dkf
2000-10-26
05:12 • New ticket [219399ffff]. artifact: 3c2dee93b1 user: nobody

Incoming text encoded gzip not being read in binary mode

Deleted219399ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 25 years ago
Descriptionplain2000-10-26 05:12:26
OriginalBugID: 6255 Bug
Version: 8.3
SubmitDate: '2000-09-12'
LastModified: '2000-10-25'
Severity: CRIT
Status: UnAssn
Submitter: techsupp
OS: Solaris
OSVersion: Solaris 8
Machine: Ultra 1
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:

George Orwell


Extensions:

none


CustomShell:

none


Comments:

I'm using a fairly recent release:


        tclsh

        % package require http

        2.2


    Incoming gzip is totally failing because <CR>s are turning into <NL>s.


ReproducibleScript:

package require http

set headers [list Accept "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*" \

    Accept-Encoding gzip  \

    Accept-Language en    \

    Accept-Charset "iso-8859-1,*,utf-8" ]


set token [http::geturl http://www.netaddress.com/  -headers $headers]

upvar #0 $token state

set fd [open temp.body.gz w]

fconfigure $fd -translation binary

puts -nonewline $fd $state(body)

close $fd


ObservedBehavior:

Incoming HTTP says text/html encoded gzip.


#    HTTP: HTTP/1.1 200 OK

#    HTTP: Date: Mon, 11 Sep 2000 16:07:40 GMT

#    HTTP: Server: Apache/1.2.5

#    HTTP: Content-Length: 2518

#    HTTP: Content-encoding: gzip

#    HTTP: Keep-Alive: timeout=1, max=99

#    HTTP: Connection: Keep-Alive

#    HTTP: Content-Type: text/html


In the http package (package require http), there appears

to be an error:


            if {![regexp -nocase ^text $state(type)]} {

                # Turn off conversions for non-text data

                fconfigure $s -translation binary


This is not being triggered, because $state(type) is 'text/html'.


DesiredBehavior:

It is not picking up on the text/html being encoded:


    $state(meta) ...Content-encoding gzip...


Patch:

This crude edit means I can now gunzip the data without

failing due to a CRC error:


    if {![regexp -nocase ^text $state(type)]  \

    ||   [regexp -nocase gzip  $state(meta)]} {


PatchFiles:

package require http
dkf Ticket [219399ffff]: 1 change [History diff]2001-01-25 17:06:46
dkf Ticket [219399ffff]: 1 change [History diff]2001-02-05 03:56:12
hobbs Ticket [219399ffff]: 1 change [History diff]2001-08-21 06:56:27
hobbsplain2001-09-07 06:47:35
Logged In: YES 
user_id=72656

fixed in core-8-3-1-branch and 8.4a4cvs so that encoding is 
detected, and a just-in-case (CYA) -binary flag was added.
Log in (anonymous is fine) to add a comment.