Alexandru,
On Sunday, June 24, 2018 at 7:17:18 PM UTC+5:30, Alexandru wrote:
> Thanks for debugging. I tested again with zip conperssion turned off for the specific file type and see no effect. Firefoc can download the file correctly so it must be Tcl or Twapi.
Again, I see no indication that twapi is involved in the issue you are having. But just to verify, I wrote the script below to do a raw http request (ie. without using the http package). The entire file was downloaded without errors with a 200 OK status code. Note that neither the http package, not Tcl's zip facilities are used.
The script (run in wish/tkcon):
proc httpreq {host relpath} {
global count
set count 0
destroy .l
pack [ttk::label .l -textvariable ::count]
set fd [file tempfile outfile]
puts "Writing to $outfile"
fconfigure $fd -translation binary
set so [twapi::tls_socket $host 443]
fconfigure $so -translation {binary crlf}
puts $so "GET $relpath HTTP/1.1"
puts $so "Host: $host"
puts $so "Connection: close"
puts $so ""
flush $so
set blksize 16384
while {1} {
set data [read $so $blksize]
set len [string length $data]
if {$len} {
puts -nonewline $fd $data
flush $fd
incr count $len
update ; # Update label display
}
if {$len < $blksize} break
}
close $fd
close $so
puts "Wrote $count bytes to $outfile."
}
Sample session:
% httpreq
meshparts.de /download/test.bin
Writing to D:/temp/TCL8883.TMP
Wrote 1609433451 bytes to D:/temp/TCL8883.TMP.
% set fd [open D:/temp/TCL8883.TMP]
% gets $fd
HTTP/1.1 200 OK
At this point, I would say your 504 error comes either from a bug in the http package, or your not setting the request headers appropriately (maybe you can compare with what firefox is sending). Either way, unless there is some evidence twapi is at fault (noting again, it does not involved in the HTTP protocol or content at all other than transporting it), I won't pursue this matter further.
/Ashok