f



http::geturl returns "data error" with tcl 8.6

I have troubles using the http::geturl with 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
% 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
%


Why am I getting this "data error" back ?
0
thepapounia
12/10/2014 1:37:55 PM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

13 Replies
735 Views

Similar Articles

[PageSpeed] 6

What specific Tcl 8.6 version ([info patchlevel]) ? 8.6.2 had some issues with channel I/O
0
palmtcl
12/10/2014 1:47:25 PM
On 10/12/2014 13:47, palmtcl wrote:
> What specific Tcl 8.6 version ([info patchlevel]) ? 8.6.2 had some
> issues with channel I/O

I can reproduce the error here in 8.6.3 (built from fossil yesterday):

% package require http
2.8.8
% set t [http::geturl http://rest.db.ripe.net/search]
data error
% set errorInfo
data error
     while executing
"http::geturl http://rest.db.ripe.net/search"
% set errorCode
NONE
% info pa
8.6.3

A grep over the Tcl sources suggests that that error comes from zlib. 
Looking at the headers, it seems like http 2.8.8 advertises that it can 
handle deflate,gzip,compress results, but seems to not handle this. The 
following is a workaround:

% package require http
2.8.8
% http::geturl http://rest.db.ripe.net/search \
     -headers [list Accept-Encoding ""]
::http::1

If you can verify that the server is sending back valid compressed 
content with the default Accept-Encoding header, then can you please 
raise a bug for this?

Hope that helps.

-- Neil
0
Neil
12/10/2014 2:11:52 PM
On 10/12/2014 14:11, Neil Madden wrote:
 > On 10/12/2014 13:47, palmtcl wrote:
[snip]
> If you can verify that the server is sending back valid compressed
> content with the default Accept-Encoding header, then can you please
> raise a bug for this?

Sorry, that was meant for the OP not palmtcl!

0
Neil
12/10/2014 2:14:45 PM
Le mercredi 10 d=E9cembre 2014 14:47:29 UTC+1, palmtcl a =E9crit=A0:
> What specific Tcl 8.6 version ([info patchlevel]) ? 8.6.2 had some issues=
 with channel I/O

% info patchlevel
8.6.1
0
thepapounia
12/10/2014 2:19:38 PM
 The 
> following is a workaround:
> 
> % package require http
> 2.8.8
> % http::geturl http://rest.db.ripe.net/search \
>      -headers [list Accept-Encoding ""]
> ::http::1

I think as a workaround I'll stick with TCL 8.5 because I don't know how to pass this workaround to the rest::simple call.

> 
> If you can verify that the server is sending back valid compressed 
> content with the default Accept-Encoding header, then can you please 
> raise a bug for this?
> 

I don't know how to do that, maybe someone else can do it ?

> Hope that helps.
> 
> -- Neil

Thank you very much.
0
thepapounia
12/10/2014 2:26:11 PM
thepapounia@gmail.com wrote:
> I have troubles using the http::geturl with 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
> % 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
> %


> Why am I getting this "data error" back ?

No idea, you've given us no information with which to form any opinion
as to why.

Plus, I get this with 8.6.1 on Linux:

  % set tcl_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
  couldn't open socket: network is unreachable

0
Rich
12/11/2014 12:38:10 AM
Am 11.12.2014 01:38, schrieb Rich:
> thepapounia@gmail.com wrote:
>> I have troubles using the http::geturl with 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
>> % 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
>> %
>
>
>> Why am I getting this "data error" back ?
>
> No idea, you've given us no information with which to form any opinion
> as to why.
>
> Plus, I get this with 8.6.1 on Linux:
>
>    % set tcl_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
>    couldn't open socket: network is unreachable
>
me@home > wget  http://rest.db.ripe.net/search
--2014-12-11 09:38:32--  http://rest.db.ripe.net/search
Aufl�sen des Hostnamen �rest.db.ripe.net (rest.db.ripe.net)�... 
193.0.6.142, 2001:67c:2e8:22::c100:68e
Verbindungsaufbau zu rest.db.ripe.net 
(rest.db.ripe.net)|193.0.6.142|:80... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 400 Bad Request
2014-12-11 09:38:32 FEHLER 400: Bad Request.

0
Uwe
12/11/2014 8:43:45 AM
On 10/12/2014 14:26, thepapounia@gmail.com wrote:
>   The
>> following is a workaround:
>>
>> % package require http
>> 2.8.8
>> % http::geturl http://rest.db.ripe.net/search \
>>       -headers [list Accept-Encoding ""]
>> ::http::1
>
> I think as a workaround I'll stick with TCL 8.5 because I don't know how to pass this workaround to the rest::simple call.

The following appears to work, although the rest(n) manpage doesn't 
render well from my console, so I'm not entirely sure if this is the 
correct syntax:

% rest::simple http://rest.db.ripe.net/search {}
data error

% rest::simple http://rest.db.ripe.net/search {} {
     headers {Accept-Encoding ""}
}
HTTP 400

>>
>> If you can verify that the server is sending back valid compressed
>> content with the default Accept-Encoding header, then can you please
>> raise a bug for this?
>>
>
> I don't know how to do that, maybe someone else can do it ?

Go to http://core.tcl.tk/tcl/reportlist login as anonymous (or create an 
account) then click "New ticket" and fill in the details.

I will investigate and raise a bug for this on this occassion.

-- Neil

0
Neil
12/11/2014 9:42:58 AM
> Go to http://core.tcl.tk/tcl/reportlist login as anonymous (or create an 
> account) then click "New ticket" and fill in the details.
> 
I just created a ticket now.

Thanks a lot for your support.
0
thepapounia
12/11/2014 10:12:24 AM
On 11/12/2014 10:12, thepapounia@gmail.com wrote:
>
>> Go to http://core.tcl.tk/tcl/reportlist login as anonymous (or create an
>> account) then click "New ticket" and fill in the details.
>>
> I just created a ticket now.
>
> Thanks a lot for your support.

Great, thank you for contributing back to the community! Raising bug 
reports is much appreciated.

-- Neil

0
Neil
12/11/2014 10:31:15 AM
In comp.lang.tcl, Uwe Klein wrote:

>>> With 8.6 it doesn't:
>>
>>> % puts $tcl_version
>>> 8.6
>>> % 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

Yes, I tried this as well:

#v+
% set tcl_patchLevel
8.6.3
% package require http
2.8.8
% http::geturl http://www.hp.com/index.html
::http::1
% http::geturl http://rest.db.ripe.net/search
data error
%
#v-

But I also tried the same addresse with Lynx:

 lynx http://rest.db.ripe.net/search

....which returned:

 "Alert!: HTTP/1.1 400 Bad Request"


Then I tried it again with Links:

 links http://rest.db.ripe.net/search

....which returned:

"Unknown type - Content type is application/xml. Do you want to save or
display this file?"

After I chose "(D)isplay" indeed XML contents showed up.


Then the problem is, should http::geturl work for just any contents - or it
can have some problems in selected cases, as e.g. Lynx has.
-- 
Z.
0
empty
12/11/2014 4:21:30 PM
empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.neither-this.com> wrote:
> Yes, I tried this as well:

> #v+
> % set tcl_patchLevel
> 8.6.3
> % package require http
> 2.8.8
> % http::geturl http://www.hp.com/index.html
> ::http::1
> % http::geturl http://rest.db.ripe.net/search
> data error
> %
> #v-

> But I also tried the same addresse with Lynx:
>  lynx http://rest.db.ripe.net/search
> ...which returned:
>  "Alert!: HTTP/1.1 400 Bad Request"


> Then I tried it again with Links:
>  links http://rest.db.ripe.net/search
> ...which returned:
> "Unknown type - Content type is application/xml. Do you want to save or
> display this file?"

> After I chose "(D)isplay" indeed XML contents showed up.


> Then the problem is, should http::geturl work for just any contents -
> or it can have some problems in selected cases, as e.g. Lynx has.

I would suggest the answer is "yes".  http::geturl is effectively
"transport", and so should simply "transport" whatever the server
serves up to the Tcl code calling http::geturl.  The decision on how to
interpret application/xml vs application/pdf vs text/plain should be
left up to the caller of http::geturl.

The one place where it (geturl) should "interpret" anything is in 8.6,
if the server supplies gzip/zlib encoded data, geturl should likely
decompress the data transparently and return the decompressed data
(which is what the server mime-type should state the content of the
compressed stream is anyway).

0
Rich
12/12/2014 12:48:02 AM
On 10/12/2014 13:37, thepapounia@gmail.com wrote:
> I have troubles using the http::geturl with RIPE's REST API.
[...]
> Why am I getting this "data error" back ?

I've tracked this down. With 8.6, it's saying that it can get back data
in various compressed forms, notably 'deflate' (an algorithm/format
supported by Tcl 8.6's [zlib] command) and that server picks that
format. Except it *actually* sends the data in another format,
'compress' (which is the raw compression format, and yes, [zlib] also
supports that). Since it's *LYING* in its metadata, Tcl tries the wrong
code to undo the compression, and that makes everything blow up. (It'd
work fine if the metadata and the data matched up right; I've verified
that by hand.)

Apparently, this is a well-known issue with compression and HTTP. It's
not really our fault. But we've got to deal with the consequences, and
we currently fail in that respect, spectacularly.

So congratulations, you found a bug in the http package. Not quite sure
how we'll fix it yet. :-)

Donal.
-- 
Donal Fellows — Tcl user, Tcl maintainer, TIP editor.
0
Donal
5/13/2015 11:26:10 PM
Reply:

Similar Artilces:

8.6 "hang" in http::geturl (vs. 8.5)
I've got a script that I've used for years. Recently I upgraded my ActiveState Tcl to 8.6.4.1 (from 8.5, most recent). I run the script daily. I've now noticed that sometimes it "hangs"; the cursor just spins if I click on the window and the title bar says "Not Responding". When I click on the 'X', windoze tells me that the app is not responding & gives me the usual options which include terminating wish. I run the script again and it works. The point of "hang" is during a http::geturl The url is http://www.gocomics.com/<...

What is "error 8"
I set up an external serial modem using the Red Hat GUI networking tool as a generic modem device. However, when I hit the "Activate" button, I get the message, "Failed to activate device with error 8." Where can I find what "error 8" means? Thanks. No one responded, but for the benefit of any other newbies who encounter this problem, here is the solution: I looked in the System Log and saw that the modem did not find a dial tone. I plugged in a phone line, and the "Activate" command worked fine. (I had not realized that "Act...

"::tcl::tm::UnknownHandler ::tclPkgUnknown msgcat 1.4" caused by replacing Tcl 8.4.1 with 8.5.7
In the blog http://planet.larrythecow.org/archives/2009-07-26.html "The Twouble with Tcl" Iain Buchanan shows that redefining OPEN proc leads to the errors similar to what I am getting - when I replaced Tcl 8.4.1 with Tcl 8.5.7. In my case I don't know the exact root cause though ... Any ideas how I should proceed with debugging this issue ? Thanks, Alex tclsh c:/Tornado/host/resource/hutils/tcl/makeSymTbl.tcl ppc tmp.o symTbl.c invalid command name "::tcl::tm::UnknownHandler" while executing "::tcl::tm::UnknownHandler ::tclPkgUnknown msg...

Error with "package require" in Tcl 8.5a1
Hello All, I downloaded the latest sources for Tcl, thread, Tk, and Tile.... After compiling each, running tests, then installing.... whenever I do a package require I get a bunch of errors. See below: D:\>tclsh85t % package require Tk 8.5 error reading package index file D:/Tcl/lib/dde1.2/pkgIndex.tcl: too many nested evaluations (infinite loop?) error reading package index file D:/Tcl/lib/dde1.3/pkgIndex.tcl: too many nested evaluations (infinite loop?) error reading package index file D:/Tcl/lib/expect/pkgIndex.tcl: too many nested evaluations (infinite loop?) error reading package inde...

tcl http with HTTP-EQUIV="Refresh"
does anyone know whether any hidden or slightly obscure feature in the http package allows callback or other eventy processing of html pages using the HTTP-EQUIV="Refresh" feature? I've got a pesky little html scraper problem where the target page is an auto-refresher, and am wondering whether any support for this was included in the http client package... off to frolic in the tcl source now... de -- .............................................................................. :De Clarke, Software Engineer UCO/Lick Observatory, UCSC: :Mail: de@ucolick....

is the value of "clock scan today" correct (tcl 8.6)
Hi, I was surprised that the clock value of "now" and "today" are equal: % expr {[clock scan now] == [clock scan today]} 1 I expected the "today"s value to be: % clock format [clock scan today] Mon Jan 21 18:52:47 CET 2013 % clock format [clock scan {last day + 24 hours}] Mon Jan 21 00:00:00 CET 2013 Why behaves the clock value "today" this way? Is it a bug or intention? Best regards, Martin BTW: where is the word "this" for free form times/dates valid? At 2013-01-21 12:53PM, "MartinLe...

TCL 8.5.6 invalid command name "clock"
Hello, I running a c++ application with an Tcl 8.5.5. interpreter. Now I try to update TCL to version 8.5.6. While running the application with TCL 8.5.6 I get the following error: invalid command name "clock" while executing "clock seconds" Is there something I might have overseen, or is this a bug in version 8.5.6. Thank you for help in advance. Kind Regards sindbad0815@googlemail.com wrote: > I running a c++ application with an Tcl 8.5.5. interpreter. Now I try > to > update TCL to version 8.5.6. While running the application with TCL > 8.5.6 I ge...

ruby 1.8.0: Error on "%02d" % "08" or "%02d" % "09"
Hi, I'm using ruby 1.8.0 (Win native and cygwin version). These two commands "%02d" % "08" "%02d" % "09" result in the error `%': invalid value for Integer: "08" (ArgumentError) For other numbers/strings (including "8" and "9", but also "01".."07", it appears to work as expected -- i.e., as I would expect it. The problem, I want to solve: Turn strings like "1", "3", "04", "03" into a canonical 2-digit string with zeros in front. Should I use a di...

tcl 8.5.2 gives error on runtime arg "-c"
Hi. I'm getting this error when launching a tcl script from a shell with "-c some_argument" with tcl 8.5.2 Application initialization failed: bad window path name "some_argument" I've searched the manpage and several documentation sources and have not found any restrictions over supplying runtime flag/arguments. Is this a bug or a hidden feature? dewuf wrote: > Hi. I'm getting this error when launching a tcl script from a shell > with "-c some_argument" with tcl 8.5.2 > > Application initialization failed: bad window path name > &...

""""""""""""""""""""""ADD ME""""""""""""""""""""
Hi , Hope you are doing great. Please let me take this opportunity to introduce myself, Iam Karthik working with BhanInfo Inc, a NY based company. We have consultants on our bench on various technologies, my request is to add me to your distribution list and kindly do send me the requirements. i have the below list available 1. Mainframe 2. Java 3.. Financial Analyst 4. Data Architect If there is any vendor ship agreement which has to be signed then I would like to take an opportunity to represent my company and expect your cooperation... We look forward to build a ve...

Problem with TDBC in Tcl 8.6.0: version conflict for package "TclOO"
Hi, I've got a problem with Tcl 8.6.0. I tried to run my tcls-script, but received the following error: version conflict for package "TclOO": have 0.7, need 1.0.1 while executing "load c:/tcl_x86/lib/teapot/package/win32-ix86/lib/tdbc_mysql1.0.0/tdbcmysql100.dll tdbcmysql" ("package ifneeded tdbc::mysql 1.0.0" script) invoked from within "package require tdbc::mysql " (file "myscript.tcl" line 4) Looks like the problem is in tdbc. I have already tried to install another version of tdbc, but it didn't help. T...

"""""""""ADD ME""""""""""
Hi , Hope you are doing great. Please let me take this opportunity to introduce myself, Iam Karthik working with BhanInfoi Inc, a NY based company. We have consultants on our bench on various technologies, my request is to add me to your distribution list and kindly do send me the requirements. i have the below list available 1. Mainframe 2. Java 3.. Financial Analyst 4. Data Architect If there is any vendor ship agreement which has to be signed then I would like to take an opportunity to represent my company and expect your cooperation... ...

3 problems with "A small editor in 8.5.0" ( http://wiki.tcl.tk/20542)
I'm using Tcl/Tk 8.6.4 under WinXP Pro. Problem 1. I don't see any where to specify desired font. There is a code fragment saying ----------- proc textfenster {mframe {master {}}} { if {$master eq {}} { text [set mframe].t -bg white -xscrollcommand [ ---------------------------- which I edited to be ----------- proc textfenster {mframe {master {}}} { if {$master eq {}} { text [set mframe].t -font "Courier 20" -bg white -xscrollcommand [ ---------------------------- It made no difference. Problem 2. Although moving the butto...

[ info exists varName ] returns "" on Tcl 8.4.4 ... we're losing our sanity here
Hello, We're using "Tcl 8.4.4.0 Solaris/SPARC" .... pretty darned old version, I know ... but we have no choice as our program doesn't work well with newer versions. Anyway, we keep getting an error that we all used to think was simply impossible ... namely [ info exists ] not returning zero or non-zero but simply returning an empty string: can't use empty string as operand of "!" while executing "if { ! [ info exists ::varName ] } { return }" (procedure "debugOut" line 3) invoked from within "debugOut -g 9 "Ente...

Web resources about - http::geturl returns "data error" with tcl 8.6 - comp.lang.tcl

Resources last updated: 1/26/2016 5:50:10 AM