Dixit "patrick" <[EMAIL PROTECTED]> (Tue, 7 Oct 
2003 10:07:02 +0200):
>
>Thanks Anton
>
>finally I will use 'parse to get the domain URL.

Parse is excellent for the job.

Now, if I may, I'd like to brag about my script again 
(http://folk.uio.no/hallvary/rebol/url-handler.r): it 
handles both relative and absolute URLs, and serves you 
the portion you need. You just 'do the script, and it then 
works like this:

site: url-handler http://www.rebol.com
print site/url ; == http://www.rebol.com/
site/move-to "docs.html"
site/move-to 
"http://www.rebol.com/docs/core23/rebolcore-1.html";
site/move-to "#sect1"
print site/protocol ; == "http://";
print site/host ; == "www.rebol.com"
print site/path ; == "/docs/core23/rebolcore-1.html"
print site/query-part ; == ""
print site/section ; == "#sect1"

I think I have a newer version than the one on my site 
right now, but I won't be able to update it before this 
evening.

Thanks for reading,
HY


>
>>> u: http://www.rebol.net/cookbook/index.html
>>> parse u [thru "http://"; to "/" stop: to end (print 
>>>copy/part u (index?
>stop) - 1 )]
>http://www.rebol.net
>== true
>
>I thought I read somewhere of some undocumented 
>properties for URL (like
>/user and /host for email).
>
>Regards
>Patrick
>----- Original Message -----
>From: Anton Rolls <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Tuesday, October 07, 2003 4:38 AM
>Subject: [REBOL] Re: url domain
>
>
>>
>> These are relative links.
>> So it looks, at least for this webserver, that
>> a relative link that begins with a slash means go
>> to the root first.
>> The resulting absolute links are:
>>
>> 1. http://www.rebol.net/cookbook/recipes/0032.html
>> 2. http://www.rebol.net/graphics/doc-bar.gif
>>
>> What you want is some sort of "clean-url" function,
>> similar to clean-path.
>> This function will know to go to the root directory
>> when it see a leading slash, and try to resolve
>> parent directory ../ markers too.
>>
>> I believe you can't rely on this behaviour on all
>> web servers, though. If you are implementing your
>> own web server, then you will be the one deciding how it
>> works (!), or if you know the behaviour for a
>> particular site like rebol.net then it's ok.
>>
>> To get the domain from an absolute url, try:
>>
>> third parse url "/"
>>
>> Anton.
>>
>> > Hi List,
>> >
>> > Parsing an HTML page 
>>(http://www.rebol.net/cookbook/index.html) I
>> > have found two kinds of link.
>> >
>> > 1. HREF="recipes/0032.html"
>> > 2. IMG SRC="/graphics/doc-bar.gif"
>> >
>> > The first one refers to the current folder
>> > "http://www.rebol.net/cookbook/"; .
>> > The second one to the current domain 
>>"http://www.rebol.net/"; .
>> >
>> > Hence my question, is there an easy way to get the 
>>domain from an url?
>> >
>> > Regards
>> > Patrick
>>
>> --
>> To unsubscribe from this list, just send an email to
>> [EMAIL PROTECTED] with unsubscribe as the subject.
>>
>
>-- 
>To unsubscribe from this list, just send an email to
>[EMAIL PROTECTED] with unsubscribe as the subject.
>

Pr�tera censeo Carthaginem esse delendam
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to