Overview
| Artifact ID: | b721650e2eaf42befb2413b9313ddf1ff50a3903 |
|---|---|
| Ticket: | 9172a66e4078f9a70d9ad439f38d99a2ca2cddb0
HTTP 1.1 chunk support incompatible with -channel option |
| User & Date: | ferrieux on 2015-08-18 15:20:51 |
Changes
- icomment:
The issue is that when upgrading, the Tcl HTTP client selected protocol version 1.1, which allowed the server to use chunked encoding transfer. Those 400^M and 5000^M are chunk length prefixes. Unfortunately, the chunk support in the HTTP package does not extend to "-channel" mode; in this case the channel receives the chunked-encoded flow unmodified. As a workaround, avoid the -channel option; sure, the body will flow into RAM instead, but will be correctly 'de-chunked': % set token [::http::geturl {http://skyview.gsfc.nasa.gov/cgi-bin/pskcall?VCOORD=ETA%20Carinae&SURVEY=DSS&SCOORD=Equatorial&SFACTR=Default&PIXELX=300&PIXELY=300}] ::http::1 % set x [http::data ::http::1];set y [string length $x] 374400 % string range $x 0 20 SIMPLE = % (note also above that I didn't use -query, meaning a POST, since your primary example in a browser is a GET) Also note that when saving to a binary file you might want to [fconfigure -translation binary] to avoid unwanted translations. Wrapping it up: package require http set token [::http::geturl {http://skyview.gsfc.nasa.gov/cgi-bin/pskcall?VCOORD=ETA%20Carinae&SURVEY=DSS&SCOORD=Equatorial&SFACTR=Default&PIXELX=300&PIXELY=300}] set skyviewout [open “test.fits” w] fconfigure $skyviewout -translation binary puts -nonewline $skyviewout [http::data $token] - login: "ferrieux"
- mimetype: "text/plain"