Overview
| Artifact ID: | a9b7cac4062f4c29718e9d8c05eaf9766fb30bb190b85a4ae18c1b2c6d71a81b |
|---|---|
| Ticket: | fb642c54bc58b31daafba9ae495ded4b0417d9bc
Incorrect download of compressed encoded data |
| User & Date: | gerhardr on 2018-03-25 13:12:25 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
Some compressd files are not completely downloaded. Test script (requires wget to compare the http downloaded file): ----------------------------------------------------- package require http # # 1st part from Tcl 8.6 manpage example # proc httpcopy { url file {chunk 4096} } { set out [open $file w] set token [::http::geturl $url -channel $out \ -progress httpCopyProgress -blocksize $chunk] close $out # This ends the line started by httpCopyProgress puts stderr "" upvar #0 $token state set max 0 foreach {name value} $state(meta) { if {[string length $name] > $max} { set max [string length $name] } if {[regexp -nocase ^location$ $name]} { # Handle URL redirects puts stderr "Location:$value" return [httpcopy [string trim $value] $file $chunk] } } incr max foreach {name value} $state(meta) { puts [format "%-*s %s" $max $name: $value] } return $token } proc httpCopyProgress {args} { puts -nonewline stderr . flush stderr } # # === Here starts my additional testing code === # if {[llength $argv]} { set url [lindex $argv 0] } else { set url "http://someonewhocares.org/hosts/hosts" } set org "outfile1.txt" set out "outfile2.txt" puts "Loading file $org from $url using wget" catch {exec wget $url -O $org} puts "Loading file $out from $url via httpcopy" httpcopy $url $out puts "HTTP file copy size is [file size $out], wget filesize is [file size $org]" ----------------------------------------------------- Output example $ tclsh test_download.tcl Loading file outfile1.txt from http://someonewhocares.org/hosts/hosts using wget Loading file outfile2.txt from http://someonewhocares.org/hosts/hosts via httpcopy ....... Date: Fri, 23 Mar 2018 21:23:21 GMT Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/1.0.1e-fips content-disposition: attachment: filename=hosts cache-control: public, max-age=86400 Last-Modified: Thu, 22 Mar 2018 08:13:42 GMT Vary: Accept-Encoding Content-Encoding: gzip Connection: close Transfer-Encoding: chunked Content-Type: text/plain HTTP file copy size is 342964, wget filesize is 416015 - foundin changed to: "8.6.6"
- is_private changed to: "0"
- login: "gerhardr"
- priority changed to: "5 Medium"
- private_contact changed to: "9b076687903aba8f5254d84cbc9577f25d0fbe8c"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "gerhardr"
- subsystem changed to: "29. http Package"
- title changed to: "Incorrect download of compressed encoded data"
- type changed to: "Bug"