| View previous topic :: View next topic |
| Author |
Message |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Fri Mar 20, 2009 7:24 am Post subject: http package and FreeBSD |
|
|
I wrote a script using http package that works fine with Eggdrop on what I suppose could be called normal linux distros. Several examples would have me conclude that with Eggdrop on FreeBSD it does not function.
The act of trying to grab the url is caught and outputs an error, typically by the following statement :-
| Code: |
if {![catch {set data [::http::geturl $url -timeout 15000]}]} {
pDealWithData
} else {putserv "PRIVMSG $chan :error in grabbing url"}
|
Just to prove http is present, it does not fail at the statement :-
| Code: |
package require http
|
Are there known issues with FreeBSD/http? _________________ I must have had nothing to do |
|
| Back to top |
|
 |
scotteh Halfop
Joined: 29 Jan 2006 Posts: 50
|
Posted: Fri Mar 20, 2009 12:38 pm Post subject: |
|
|
What version of the package is getting loaded? Could be loading 1.0.
Try using: | Code: | | package require http 2 |
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri Mar 20, 2009 1:18 pm Post subject: |
|
|
May I suggest a different approach to that code?
| Code: | if {![catch {::http::geturl $url -timeout 15000} data]} {
pDealWithData
} else {
putserv "PRIVMSG $chan :Error in grabbing url: $data"
} |
Doing it this way, leaves us with the output from ::http::geturl in data if the request is successful, and the error message in data if we're not. Also, saves us from cluttering the code with unneeded nested function calls. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Fri Mar 20, 2009 1:18 pm Post subject: |
|
|
OK nml375, point taken.
For the moment though I'm looking for the FreeBSD issue, if there is one.
scotteh, norm is 2.5.x but on one of the FreeBSD installations I noticed it was 2.7.x _________________ I must have had nothing to do |
|
| Back to top |
|
 |
dj-zath Op
Joined: 15 Nov 2008 Posts: 134
|
Posted: Mon Mar 23, 2009 11:51 am Post subject: |
|
|
I'm also using FreeBSD.. and I, too, am having problems with the http package.. actually opening/closing connections in general..
oh BOY!
NML: I figured out whats causing the INDEFINATE freeze in eggdrop.. the freaking handshaking! I currently took your code examples and , "piece-by-piece".. I have tested each section.. and found that if its currently connected, then disconnects.. it NEVER finishes the closure!
oops, sorry.. this is meant for the other thread...
DjZ
 |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Mar 23, 2009 12:20 pm Post subject: |
|
|
Arfer:
Just saying that the error message you get from the http:geturl would be very helpful tracking down where things go wrong.. be it tcl, the http-package, freebsd, or just random errors. At least it gives a hint where to look. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Mar 24, 2009 6:05 am Post subject: |
|
|
OK, you are correct, I'll mod the script as you suggested and try to find the last person to report an error. I don't have a FreeBSD shell. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Mar 24, 2009 2:30 pm Post subject: |
|
|
Also, if you'd like even further debugging info, make use of the ::errorInfo and ::errorCode variables.
A quick sample that logs additional data if debug is set:
| Code: | if {![catch {::http::geturl $url -timeout 15000} data]} {
pDealWithData
} else {
putserv "PRIVMSG $chan :Error in grabbing url: $data"
if {[info exists ::debug]} {
putlog "Error while reading $url: $data"
putlog " error code: $::errorCode"
putlog " stack trace: $::errorInfo"
}
} |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|