<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/11519" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2007-12-14T23:47:43-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/11519</id>

		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2007-12-14T23:47:43-04:00</updated>

		<published>2007-12-14T23:47:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79344#p79344</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79344#p79344"/>
		<title type="html"><![CDATA[TCL HTTP: can't read &quot;state(after)&quot;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79344#p79344"><![CDATA[
I use only one script that grabs data from the web (and causes this annoyance), the OV2 version of B0unTy's iMDB.tcl.<br><br>It uses:<div class="codebox"><p>Code: </p><pre><code>::http::Finish $page</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Fri Dec 14, 2007 11:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2007-12-14T20:46:00-04:00</updated>

		<published>2007-12-14T20:46:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79342#p79342</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79342#p79342"/>
		<title type="html"><![CDATA[TCL HTTP: can't read &quot;state(after)&quot;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79342#p79342"><![CDATA[
<blockquote class="uncited"><div>no nice way imho, they could first check if exists state(after) to prevent occurance of unneccessary TCL errors. </div></blockquote>Testing this theory it seems to work...<br><br>lines 165,166 change to:<div class="codebox"><p>Code: </p><pre><code>    if {[info exists state(sock)]} { catch {close $state(sock)} }    if {[info exists state(after)]} { catch {after cancel $state(after)} }</code></pre></div>lines 197,198 change to:<div class="codebox"><p>Code: </p><pre><code>    if {[info exists state(sock)]} { catch {fileevent $state(sock) readable {}} }    if {[info exists state(sock)]} { catch {fileevent $state(sock) writable {}} }</code></pre></div>Using HTTP 2.4.2 and changing the lines above it seems to solve the problem. Running various http queries and a quick .set errrorInfo afterwards yields the following...<blockquote class="uncited"><div>&lt;speechles&gt; !g google<br>&lt;sp33chy&gt; 1,460,000,000 Results | Google @ <a href="http://www.google.com/" class="postlink">http://www.google.com/</a> | Google Maps @ <a href="http://maps.google.com/" class="postlink">http://maps.google.com/</a> | Google Video @ <a href="http://video.google.com/" class="postlink">http://video.google.com/</a> | Google Groups @ <a href="http://groups.google.com/" class="postlink">http://groups.google.com/</a><br>*meanwhile on the partyline directly after*<br>&lt;speechles&gt; .set errorInfo<br>&lt;sp33chy&gt; Currently: couldn't create error file for command: no such file or directory<br>&lt;sp33chy&gt; Currently: while executing<br>&lt;sp33chy&gt; Currently: "exec chmod 700 $nb_dir"<br><br>&lt;speechles&gt; !w .jasd asd<br>&lt;sp33chy&gt; Socket Error accessing 'jasd.wikipedia.org' .. Does it exist?<br>*meanwhile on the partyline directly after*<br>&lt;speechles&gt; .set errorInfo<br>&lt;sp33chy&gt; Currently: couldn't open socket: host is unreachable<br>&lt;sp33chy&gt; Currently: while executing<br>&lt;sp33chy&gt; Currently: "::http::geturl $query -timeout [expr 1000 * 5]"</div></blockquote>Notice the top error message which is usually a state(after) error is instead an error message reporting no error found to report, so this does work as a fix. If someone can shed some light if this is indeed an http package bug it would be wonderful. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Fri Dec 14, 2007 8:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Zircon]]></name></author>
		<updated>2007-12-13T04:12:47-04:00</updated>

		<published>2007-12-13T04:12:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79297#p79297</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79297#p79297"/>
		<title type="html"><![CDATA[TCL HTTP: can't read &quot;state(after)&quot;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79297#p79297"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>&lt;Anti-Flood&gt; [03:06] #Owner# set errorInfo&lt;Anti-Flood&gt; Currently: can't read "state(after)": no such element in array&lt;Anti-Flood&gt; Currently:     while executing&lt;Anti-Flood&gt; Currently: "after cancel $state(after)"</code></pre></div>   i always was trying  to identify the script causing this error. So finally i understand it s related to the HTTP. Indeed, i use many scripts that deals with HTTP.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8115">Zircon</a> — Thu Dec 13, 2007 4:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-12-13T02:34:53-04:00</updated>

		<published>2007-12-13T02:34:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79294#p79294</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79294#p79294"/>
		<title type="html"><![CDATA[TCL HTTP: can't read &quot;state(after)&quot;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79294#p79294"><![CDATA[
I've only seen that error when calling  ::http::cleanup  directly after an error test, like in:<br><div class="codebox"><p>Code: </p><pre><code>catch {set page [::http::geturl $movieurl -timeout $::movietimeout]} errorif {[string match -nocase "*couldn't open socket*" $error]} {puthelp "PRIVMSG $chan :Error: couldn't connect to filmspot.com..Try again later."      ::http::cleanup $pagereturn}if { [::http::status $page] == "timeout" } {puthelp "PRIVMSG $chan :Error: Connection to filmspot.com timed out..Try again later."      ::http::cleanup $pagereturn}set html [::http::data $page]</code></pre></div>That's how I used to do my web procs. Now I just leave off the http::cleanup call. <br><br>I posted about the same error messages before, and was informed that http::cleanup is on a timer anyway, so calling it directly was unneeded.  Haven't seen that error in the scripts I fixed that don't call http::cleanup (except at the end, after getting data.)<br><br>IOW, my newer scripts take the form:<div class="codebox"><p>Code: </p><pre><code>catch {set page [::http::geturl $movieurl -timeout $::movietimeout]} errorif {[string match -nocase "*couldn't open socket*" $error]} {puthelp "PRIVMSG $chan :Error: couldn't connect to filmspot.com..Try again later."return}if { [::http::status $page] == "timeout" } {puthelp "PRIVMSG $chan :Error: Connection to filmspot.com timed out..Try again later."return}set html [::http::data $page]::http::cleanup $page</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Thu Dec 13, 2007 2:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2007-12-12T18:39:34-04:00</updated>

		<published>2007-12-12T18:39:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79288#p79288</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79288#p79288"/>
		<title type="html"><![CDATA[TCL HTTP: can't read &quot;state(after)&quot;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79288#p79288"><![CDATA[
I gather nothing further has been done to fix this (not that I'm surprised)?<br><br>De Kus: Did you lodge a <a href="http://www.eggheads.org/mailman/listinfo/bugs" class="postlink">bug</a> report?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Wed Dec 12, 2007 6:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2006-03-15T09:10:35-04:00</updated>

		<published>2006-03-15T09:10:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=61079#p61079</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=61079#p61079"/>
		<title type="html"><![CDATA[TCL HTTP: can't read &quot;state(after)&quot;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=61079#p61079"><![CDATA[
I wonder if I do something wrong. Full error:<div class="codebox"><p>Code: </p><pre><code>[-RO^Bot-] [12:58:59] #De_Kus# set errorInfo[-RO^Bot-] Currently: can't read "state(after)": no such element in array[-RO^Bot-] Currently:     while executing[-RO^Bot-] Currently: "after cancel $state(after)"</code></pre></div>This occurs with most (all?) asyncron HTTP requests I use in eggdrop. The general problem is obvious: after using ::http::cleanup $token, $state(after) has already been removed before its called by HTTP. But what else should I do? Do you believe using utimer 1 with that command would be a solution or rather a workaround? Is that an error of the HTTP package and should be reported to tcl.tk?<br><br>If greped this part of the script:<div class="codebox"><p>Code: </p><pre><code>[-RO^Bot-] [14:02:58] tcl: evaluate (.tcl): exec grep after /usr/local/lib/tcl8.4/http2.5/http.tcl[-RO^Bot-] Tcl:     catch {after cancel $state(after)}</code></pre></div>no nice way imho, they could first check if exists state(after) to prevent occurance of unneccessary TCL errors.<br>This occurs at least till HTTP 2.5.2 from TCL 8.4.12.<br><br>Edit: not even after 60000 for http::cleanup or a set state(after) "" after the cleanup helps...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Wed Mar 15, 2006 9:10 am</p><hr />
]]></content>
	</entry>
	</feed>
