Re: css image url's and :img problem

2007-11-18 Thread Clifford Heath
On 19/11/2007, at 1:33 PM, pedro mg wrote:
> On Sun, 2007-11-18 at 18:23 +0100, Magnus Holm wrote:
>> Can you access the image at (localhost:3301)/static/img01.gif through
>> your browser?
>
> I get an error message:
>
> Couldn't load image 'img01.gif'
> Unrecognized image file format

When you get that, do a File->Save and see whether the file you save is
identical to the source file.

You aren't running on Windows are you? The newline handling might
be corrupting your files...

Clifford Heath.


___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


X-Sendfile, static files, windows

2007-10-19 Thread Clifford Heath
Jeremy,

I found your old message with this title. I struck the same thing,
where the current drive wasn't the same as the drive I wanted to
serve (some) files from. So here's the patch to add to

lib/mongrel/handlers.rb contains class DirHandler. I added two
things, first to initialize:

 def initialize(path, listing_allowed=true, index_html="index.html")
   @abs = path == "/"   # Absolute paths are allowed
   @path = File.expand_path(path)
   ...

next to method can_serve, which should start with this:

 def can_serve(path_info)
   req_path = HttpRequest.unescape(path_info)
   # Add path prefix, except to absolute Windows paths:
   req_path = File.join(@path,req_path) if ([EMAIL PROTECTED] || req_path 
=~ % 
r{\a[A-Z]:[/^\\]}i)
   # Expand it to an absolute path:
   req_path = File.expand_path req_path

   if File.exist? req_path


Essentially this says if absolute paths are allowed and path_info has
a drive letter, don't add the initial path.

This should get into an official mongrel release sometime...

Clifford Heath, Data Constellation.
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list