This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Does HTTP::geturl "cache" a file?

Old posts that have not been replied to for several years.
Locked
T
Taiyaki
Voice
Posts: 15
Joined: Mon Nov 18, 2002 4:39 am

Does HTTP::geturl "cache" a file?

Post by Taiyaki »

I'm wondering if the file grabbed by HTTP::geturl is cached because it doesn't refresh...is there anyway i can make sure the script displays the up-to-date results?

Thanks :D
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The http package does nothing but download a file, using the http protocol.

It a premade method, of downloading, using the many options of the HTTP protocol. It provides easy access to downloaded data, the headers, error codes and more. It provides advanced methods of downloading, so that applications don't block.

As stated, it does nothing more than provide a simple command, through which you can download a document/file via httpd. caching, refresh and any other advanced function, other than the process of downloading, has to be provided seperate by the scripter.

In a nutshell, no, there is no cahching.

On top, if it's not refreshing, it's because you havn't told it to refresh.

Remember, this is not a browser, so it doesn't have to follow the guidlines regarding using the META refresh, or follow redirected pages. The HTTP protocol, only states how this information should be presented, not that a script or program has to strictly follow the re-direct. This would be illegal, as it could lead to applications accessing system that are not permitted by rules or laws.

What script are you using? What is it doing? What isn't it doing? What is it supposed to do?
T
Taiyaki
Voice
Posts: 15
Joined: Mon Nov 18, 2002 4:39 am

Post by Taiyaki »

wow thanks for the hasty reply! :D

so now my script hasn't really changed...it is using this to grab a remote file

Code: Select all

set tok [::http::geturl "http://www.baka-updates.com/updater/newrls.txt"]
set data [::http::data $tok]
this file is always changing and i would like the trigger to display the latest updates. what is happening to me is that i type the trigger, and it displays what i want. then i update the text file, and then i type the trigger again, the script hasn't updated yet.

also i notice that the first time you type the trigger, there is a bit of pause before the output comes (i assume this is from the downloading of the file) but then when you type the trigger again the output comes out faster.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

We would need to see more of the script.

There has been a few posts regarding this, most seperate, and all showing snippets.

You havn't told us exactly what you are now using in the script.

If you are using the code I have shown, that does timed downloads, rather than downloading when the trigger is typed, then yes, it would be cached.

Caching is better, when you fidn that you are getting delay. It will cache the copy of the file on timed intervals, replacing what it allready has stored. This can simply be output fromt eh cache then. In my example, it updated the cache once every 10 mins.

There is another issue that could cause this. A transparrent proxy server could be in operation, in which case, the bot has no cjoice but to download the proxy servers cache copy.

You may find helps a log, if you paste the code in use. We can't see if script cacheing is in operation, or there could be another cause.
T
Taiyaki
Voice
Posts: 15
Joined: Mon Nov 18, 2002 4:39 am

Post by Taiyaki »

hmm...well i'm using another method, which just uses the basic HTTP package stuff...(ie. geturl, data, etc.)

it works fine, but there's just a delay when the remote file is updated to when the bot finally picks that up...as you said there's no cache, so i guess it's not a problem then.

oh yeah, one more question here:

how do i make the bot break the code if it takes too long to retrieve the info?
like if the HTTP:geturl command takes more than 10 seconds then have it send a NOTICE to $nick saying "server undermaintenence" or something and then have the script stop running.

thanks :D
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Please read the Tcl manual, as I am not the "Speaking Man page" !

My guess is you havn't even considdered looking at the documenation.

There are items within the command, that provide you with this ability.

Please see the Tcl manual
T
Taiyaki
Voice
Posts: 15
Joined: Mon Nov 18, 2002 4:39 am

Post by Taiyaki »

heh, that's true. thanks so much for your help! :D
Locked