Artifacts Associated With Ticket b9d0434667
Ticket change [871995d7bb] (rid 140919) by Malbrouck on 2014-12-11 10:11:43:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
http::geturl returns "data error" with TCL >8.6 and RIPE's REST API. With TCL 8.5 it works: % puts $tcl_version 8.5 % package require http 2.7.5 % http::geturl http://www.hp.com/index.html ::http::1 % http::geturl http://rest.db.ripe.net/search ::http::2 % With 8.6 it doesn't: % puts $tcl_version 8.6 % info patchlevel 8.6.1 % package require http 2.8.7 % http::geturl http://www.hp.com/index.html ::http::1 % http::geturl http://rest.db.ripe.net/search data error % People reported same problems with TCL 8.6.2 & 8.6.3 in this thread: https://groups.google.com/forum/#!topic/comp.lang.tcl/NiIKhFgEUBY
- foundin initialized to: "8.6"
- is_private initialized to: "0"
- login: "Malbrouck"
- priority initialized to: "5 Medium"
- private_contact initialized to: "5431e0393c2832a930f98fa82da52010fb0ce32d"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "Malbrouck"
- subsystem initialized to: "29. http Package"
- title initialized to: "http::geturl returns "data error" with tcl 8.6"
- type initialized to: "Bug"
Ticket change [c00cee78ee] (rid 140920) by nem on 2014-12-11 10:33:05:
- icomment:
As described in the linked c.l.t thread, the problem appears to be due to the response being compressed. Tcl appears unable to decompress it correctly. A workaround is to disable the Accept-Encoding header: % package require http 2.8.8 % http::geturl http://rest.db.ripe.net/search \ -headers [list Accept-Encoding ""] ::http::1 - login: "nem"
- mimetype: "text/plain"
- username: "Neil Madden"
- icomment:
Ticket change [e58ca1af91] (rid 141699) by dgp on 2015-05-01 14:44:43:
- assignee changed to: "dkf"
- icomment:
Is this really a [zlib] bug then?
- login: "dgp"
- mimetype: "text/plain"
Ticket change [a9ef0b8c22] (rid 141721) by dgp on 2015-05-11 18:34:00:
- icomment:
http://core.tcl.tk/tcl/info/e861cc28b065288e is the checkin that breaks things. Still possible that [zlib] troubles are at the root, but seems more likely this patch just gets some things wrong.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "7 High"
- icomment:
Ticket change [1f8ba3cd0b] (rid 141732) by aspect on 2015-05-13 03:44:48:
- icomment:
The error is definitely in zlib inflate: ====== set s [socket rest.db.ripe.net 80] fconfigure $s -translation crlf -buffering line puts $s "GET /search HTTP/1.1" puts $s "Host: rest.db.ripe.net" puts $s "Accept-Encoding: deflate" puts $s "Connection: close" puts $s "" puts $s "" fconfigure $s -encoding binary -translation binary set bits [read $s] puts "got [string length $bits] bytes" puts [zlib inflate $bits] ====== got 556 bytes data error while executing "zlib inflate $bits" - login: "aspect"
- mimetype: "text/plain"
- icomment:
Ticket change [2212297bee] (rid 141733) by dgp on 2015-05-13 12:24:41:
- icomment: "anyone know what the correct inflated result is?"
- login: "dgp"
- mimetype: "text/plain"
Ticket change [1c1948f2b4] (rid 141734) by dgp on 2015-05-13 15:28:40:
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "8"
- title changed to: "[zlib inflate] failure"
Ticket change [11e0b85b43] (rid 141735) by dkf on 2015-05-13 22:48:20:
- icomment:
I vaguely remember seeing somewhere that compressed HTTP transfers should <i>always</i> be done as <tt>gzip</tt> because of different interpretations of other names in weird ways. <p> That said, your test is completely bogus. You need to strip the headers first! <p> If I do that and then use <code>zlib decompress</code> on the rest (<i>not</i> <code>zlib inflate</code>) then I get what appears to be reasonable content. Which agrees with what my first paragraph says; there's breakage in the way that this part of the HTTP specification is interpreted. <i><b>Interoperable code uses <code>gzip</code>.</b></i>
- login: "dkf"
- mimetype: "text/html"
- username: "dkf"
- icomment:
Ticket change [2387b514bc] (rid 141736) by dkf on 2015-05-13 22:55:22:
- icomment:
For more details about what's going on, see <a href="http://stackoverflow.com/q/388595/301832">this Stack Overflow question</a> and its answers.
- login: "dkf"
- mimetype: "text/html"
- username: "dkf"
- icomment:
Ticket change [de07db7543] (rid 141737) by dkf on 2015-05-13 22:59:13:
- icomment:
BTW, the response you're looking for is: <p> <code><?xml version="1.0" encoding="UTF-8" standalone="yes"?><whois-resources xmlns:xlink="http://www.w3.org/1999/xlink"><link xlink:type="locator" xlink:href="http://rest.db.ripe.net/search/"/><errormessages><errormessage severity="Error" text="Query param 'query-string' cannot be empty"/></errormessages><terms-and-conditions xlink:type="locator" xlink:href="http://www.ripe.net/db/support/db-terms-conditions.pdf"/></whois-resources></code>
- login: "dkf"
- mimetype: "text/html"
- username: "dkf"
- icomment:
Ticket change [f249362fec] (rid 141738) by dgp on 2015-05-13 23:11:13:
- login: "dgp"
- mimetype: "text/plain"
- title changed to:
default settings request unreliable "deflate" compression
Ticket change [40d03eedd2] (rid 141748) by dkf on 2015-05-14 08:13:57:
- closedate changed to: "2457156.84303041"
- closer changed to: "dkf"
- icomment:
Fixed; we now prefer the <tt>gzip</tt> transfer encoding because it's widely known that alternatives are wrong on some servers. It's really not our fault, but we can't help that. The default can be overridden by setting the <tt>Accept-Encoding</tt> header explicitly (using the normal API mechanism for that); there are examples of what to do in Tcl's test suite (<tt>http11.test</tt>).<p>I looked into putting in code that would try to guess from the first few bytes of the stream. We won't be trying to do that! It gets really complicated (in terms of just what to read and when) and just switching to gzip works as well (and it's very widely implemented too). I guess we could have done it with a "do what I mean" decompression method, but that's really horrible.<p>The fix will ship with the next 8.6 patch release. The workaround is to specify <tt>Accept-Encoding</tt> to be something like <tt>identity</tt>, which disables compression and works on 8.5 and 8.6.
- login: "dkf"
- mimetype: "text/html"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dkf"