[REBOL] Re: Comparing local and remote files
From: chalz:earthlink at: 18-Dec-2002 3:03
Mind, I'm far from an authority on this matter, but I think I might know
what's up.
I can sum it up right here:
>> exists? ftp://usr:[pwd--www--chalz--net]/www/cgi-bin/test.r
== true
>> exists? http://www.chalz.net/cgi-bin/test.r
connecting to: www.chalz.net
== false
>>
The problem is it's a script. It gets evaluated, so while the URL does
exist, you will never receive the file. What you receive is some HTML content,
and it is variable. The file does not get read directly, only executed.
You'll have to either execute your compare code from the remote host, and
instead treat your local machine as remote, or settle for an FTP connection.
For instance, if I try, with my web site:
>> exists? http://www.chalz.net/cgi-bin/roll
connecting to: www.chalz.net
== true
>> probe info? http://www.chalz.net/cgi-bin/roll
connecting to: www.chalz.net
make object! [
size: 0
date: none
type: 'file
]
>> probe info? ftp://usr:[pwd--www--chalz--net]/www/cgi-bin/roll
make object! [
size: 2117
date: 26-Nov-2002/12:39
type: 'file
]
>>
Bingo. Since it's in cgi-bin, it won't return the contents of the file,
only the evaluated result. I tried it with a test file, which printed "hello
world". I set it up as readable and executable, exists? http://... sees it,
but info? returns a dead object. I make it non-executable, and exists?
http://... no longer sees it.
Hope this helps :)
--Charles