On Thu, 9 Mar 2000, Jacqueline Landman Gay wrote:

> Scott Raney wrote:
> 
> > It maybe a bit terse for your tastes, but this exact behavior is
> > documented on the "load" command page in the Reference.
> 
> No, it isn't. This is the only pertinent statement I could find on the
> "load" command:
> 
> >> This command downloads the file specified by <url> into a local cache.
> >> The file can then be used in a url expression, or with the go, play,
> >> or set commands.
> 
> After that there is a statement about how you don't have to load a file
> to get it, that you can check its status while loading, and then a
> suggestion to unload when you are done. No behaviors are explained.
> There is a brief reference to "load" in the concepts stack, where it
> mentions that a url can be a container. Here are the things I needed to know:
> 
>   Why is a url placed in the cachedURLs whether it was actually
> downloaded or not, and whether the file exists or not?

Because the engine can't tell this: the HTTP server sends some data
and the engine caches that.  It's up to the developer to determine
whether or not that data is the data they wanted.

>   Why does "URLStatus" only give information about what is in the cache?
> The cache is wrong sometimes. Shouldn't it be tracking the download? If
> not, what's it for?

The cache isn't ever "wrong", nor is the urlStatus: it just says
whether something has completed downloading, not whether what was
downloaded is what you're waiting for.

>   How can I find out whether the download actually was successful?
>
> None of this was addressed.

Because this is an HTTP protocol issue, not a "load" command issue or
a "urlStatus" issue.  We could have documented HTTP too, but that's
not really our job.

> > What you may
> > be lacking is an understanding of the HTTP protocol, which
> > unfortunately you really have to have if you're going to do much work
> > in this area.
> 
> Probably. I don't really want to do much in this area though; actually,
> all I want to do is see if there is an online connection. I asked about
> that a while back and the answer was that you can't find out, except
> maybe to check for a known file on the remote server. But the url is
> cached whether it is there or not, whether it downloads or not, and
> there are lots of different error messages I might get, depending on
> what happens. I'd hate to have to learn http protocol, open sockets,
> download files and check their contents, just to find out if a user has
> a connection open.

This seems like a roundabout way of detecting a connection, and
unreliable at that (you can't tell if there is no connection or just
no route to whatever site you're trying to download from or maybe a
firewall stopping you from connecting to that site).  There must be
some better way to do this, if in fact it's even necessary.  What use
is knowing whether or not a "connection is open" if you're not
actually going to do something that requires transfering data?

> Pierre's solution may work. Meanwhile, I have stumbled across this:
> while checking the URLStatus, you can also check "the result". If the
> URLStatus contains an error, and the user is not connected, the result
> contains "Can't open endpoint".
> 
> Here is an outline of what I have so far:
> 
> on loadURL theUrl
>   put "" into theStatus
>   load url theUrl
>   repeat until theStatus = "cached"
>     put urlStatus(theUrl) into theStatus
>     switch
>     case (theStatus is in "error,timeout,not found")
>       GET THE RESULT -- contains "Can't open endpoint" if not online
>       exit repeat
>       break
>     case (theStatus contains "loading")
>       -- other stuff here
>       break
>     default
>       -- other stuff
>     end switch
>   end repeat
>   -- more stuff; handle errors
> end loadURL
> 
> I don't know if this is bullet-proof. Is it?

Not for just testing whether there is a connection.  You'd be better
off using raw sockets for this, or even better, something like using
shell() to run ping or traceroute.
  Regards,
    Scott (who will be glad when the day comes when primitive
           dialup-based Internet connections go the way of "party
           line" phone systems...)

> -- 
> Jacqueline Landman Gay        |             [EMAIL PROTECTED]
> HyperActive Software          |                   [EMAIL PROTECTED]
> Custom hypermedia solutions   |         http://www.hyperactivesw.com
> 612.724.1596                  |                   612.724.1562 - fax
> 
> Archives: http://www.mail-archive.com/metacard%40lists.best.com/
> Info: http://www.xworlds.com/metacard/mailinglist.htm
> Please send bug reports to <[EMAIL PROTECTED]>, not this list.
> 

********************************************************
Scott Raney  [EMAIL PROTECTED]  http://www.metacard.com
MetaCard: You know, there's an easier way to do that...


Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to