./ path and Rebol cgi

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
ehrichweiss
-


Joined: 16 Dec 2004
Posts: 5

PostPosted: Mon Jan 17, 2005 4:05 am    Post subject: ./ path and Rebol cgi Reply with quote

Hi,

I'm using Rebol to preprocess some of my pages and my new html editor apparently uses "./" which works fine when I load the page directly but for some reason when the script gets ahold of it, it can no longer find "./images" but it finds "/images" just fine. Anyone have any ideas what might cause this or what remedies I might take to correct it? I have already put a processor that replaces the "./" with "/" but I'd like a less makeshift solution.
Back to top View user's profile Send private message
admin
Site Admin


Joined: 03 Mar 2002
Posts: 1295

PostPosted: Mon Jan 17, 2005 2:32 pm    Post subject: Re: ./ path and Rebol cgi Reply with quote

We will assume that your Ruby file is http://site/dir1/dir2/test.rb .
If the HTML generated by test.rb reference an image as ./images/logo.jpg , the browser which processes this HTML code will translate this to the full URL http://site/dir1/dir2/./images/logo.jpg which is equivalent to http://site/dir1/dir2/images/logo.jpg because ./images/logo.jog is a relative path (relative to the current directory.)
But if it finds /images/logo.jpg it will request http://site/images/logo.jpg because /images/logo.jpg is an absolute path (it starts with /).

If our answer doesn't help, please send your Ruby source code to support@aprelium.com .
Back to top View user's profile Send private message
ehrichweiss
-


Joined: 16 Dec 2004
Posts: 5

PostPosted: Mon Jan 17, 2005 6:10 pm    Post subject: Re: ./ path and Rebol cgi Reply with quote

Not Ruby, Rebol. I don't know much, if anything, about Ruby yet but it will be next on my list.

My rebol script is in /cgi-bin and that SEEMS to be where it's looking for the images because when I put them there to test...they appeared. I unfortunately can't let my source out cause it's doing some proprietary work but here's the gist of it: all of my pages are controlled and fetched by my handler.cgi via something like http://www.mysite.com/cgi-bin/handler.cgi?filename=pagetofetch.html . The handler loads the file, looks for tags in the source and processes them if necessary then sends the data to the browser. Simple as that.

I wrote a quick fix in the preprocessor that searches the html for "./" references and replaces them with "/" which works but I'm trying to discover whether there's another way without having to piece it together like that.
Back to top View user's profile Send private message
ehrichweiss
-


Joined: 16 Dec 2004
Posts: 5

PostPosted: Mon Jan 17, 2005 6:12 pm    Post subject: Re: ./ path and Rebol cgi Reply with quote

P.S. Thanx for any help. I really appreciate it....and LOVE Abyss.
Back to top View user's profile Send private message
admin
Site Admin


Joined: 03 Mar 2002
Posts: 1295

PostPosted: Tue Jan 18, 2005 12:55 pm    Post subject: Re: ./ path and Rebol cgi Reply with quote

Sorry for the mistake, but the same information apply whether it is Ruby or Rebol.

Anyway, you said that if you put the images inside /cgi-bin they are displayed correctly. The idea would be to add an alias mapping the virtual path /cgi-bin/images to the real path of your /images directory.
Back to top View user's profile Send private message
ehrichweiss
-


Joined: 16 Dec 2004
Posts: 5

PostPosted: Tue Jan 18, 2005 6:25 pm    Post subject: Reply with quote

Worked like a charm!! Thanks a lot.
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group