Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

URL handling

 [1/3] from: hallvard::ystad::helpinhand::com at: 17-Aug-2003 0:13


Hi list, I was looking for a URL handler script. Didn't find any. (Didn't someone write a rebol web browser??) So I had to make one of my own: http://folk.uio.no/hallvary/rebol/url-handler.r Use it like this:
>> site: make url-handler [url: http://folk.uio.no/hallvary/rebol/] >> site/init
== http://folk.uio.no/hallvary/rebol/
>> site/move-to "url-handler.r"
== http://folk.uio.no/hallvary/rebol/url-handler.r And at any time:
>> site/url
== http://folk.uio.no/hallvary/rebol/url-handler.r Hope this can be useful for someone. Comments are welcome. Hallvard

 [2/3] from: AJMartin:orcon at: 17-Aug-2003 12:29


Hallvard wrote:
> I was looking for a URL handler script. Didn't find any. (Didn't someone
write a rebol web browser??) So I had to make one of my own: http://folk.uio.no/hallvary/rebol/url-handler.r Uhm, what does a URL handler do? Andrew J Martin Out of the loop... ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/

 [3/3] from: hallvard:ystad:helpinhand at: 17-Aug-2003 20:49


Dixit A J Martin (02.29 17.08.2003):
>Hallvard wrote: >> I was looking for a URL handler script. Didn't find any. (Didn't someone >write a rebol web browser??) So I had to make one of my own: >http://folk.uio.no/hallvary/rebol/url-handler.r > >Uhm, what does a URL handler do?
Oh, well, maybe that wasn't all that obvious. You give a URL as input to the script, and initialize the object. The handler then knows the different parts of the object: protocol (http), host (www.rebol.com), path (/docs), query-part (what=something), section (#sect1). By using 'move-to, you tell the script something has changed, and the object remembers the new settings. I needed such an object because I was irritated by this (cut from console session):
>> http://www.rebol.com = http://www.rebol.com/
== false So, in my script, the above two URLs are parsed into being alike:
>> site1: make url-handler [url: http://www.rebol.com] >> site1/init
== http://www.rebol.com/
>> site2: make url-handler [url: http://www.rebol.com/] >> site2/init
== http://www.rebol.com/ I still don't know how to tell if "last" is a file or a folder in the following URL: http://www.example.com/last so I don't know whether or not to put a slash at the end (can anyone help me?), but for many other cases, the script works perfectly well. Thanks for your attention Hallvard