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

[REBOL] Re: path-thru patch can return a directory

From: oliva:david:seznam:cz at: 4-Aug-2002 16:14

Hello Anton, Sunday, July 7, 2002, 1:23:51 PM, you wrote: A> ; patch path-thru so it can return a directory A> path-thru: func [url /local purl][ A> if file? url [return url] A> if not all [purl: decode-url url purl/host] [return none] A> rejoin [view-root/public slash purl/host slash any [purl/path ""] any A> [purl/target ""]] A> ] A> Here's the original source for comparison: A> path-thru: func [url /local purl][ A> if file? url [return url] A> if not all [purl: decode-url url purl/target purl/host] [return none] A> rejoin [view-root/public slash purl/host slash any [purl/path ""] A> purl/target] A> ] A> In the following examples, the original path-thru returns none. A> Kind of irritating. The patched version returns what I would A> expect. A> path-thru http://somewhere.com ; no path and no target A> path-thru http://somewhere.com/adir/ ; no target A> Anton. I agree and add this improvement: path-thru: func [url /local purl][ if file? url [return url] if not all [purl: decode-url url purl/host] [return none] rejoin [ view-root/public slash purl/host either none? purl/port-id [""][join "%3A" purl/port-id] slash any [purl/path ""] any [purl/target ""] ] ] so now it's posible to do:
>> path-thru http://127.0.0.1:81/
== %/d/view/public/127.0.0.1%3A81/
>> read path-thru http://127.0.0.1:81/
== [%index.r]
>> read path-thru http://127.0.0.1/
== [%INDEX.R %INST.R %RBOX.R %RBOX2.R %img/ %index.html] I think that it is bug in Rebol when without this fix i get page from http://127.0.0.1/index.r instead of http://127.0.0.1:81/index.r using read-thru http://127.0.0.1:81/index.r The question is, how to handle files that are received using: read-thru http://127.0.0.1/ Another problem is that it's not possible to do:
>> read %/d/view/public/127.0.0.1%3A81/
** Access Error: Cannot open /d/view/public/127.0.0.1:81/ ** Near: read %/d/view/public/127.0.0.1:81/