! MouseHole 1.2 is out

Daniel Sheppard daniels at pronto.com.au
Thu Sep 29 02:08:56 EDT 2005


/foo//bar may be equivalent to /foo/bar (I think that's just a
convention though, not the http spec), but there should be a definite
difference between /foo%2F%2Fbar and /foo%2Fbar 

But it appears that the bug is in Net::HTTP, not mousehole - the extra
backslash has already be stripped before mousehole gets its paws on
things.

I'll take the ProxyLike route.

-----Original Message-----
From: mousehole-scripters-bounces at rubyforge.org
[mailto:mousehole-scripters-bounces at rubyforge.org] On Behalf Of Kevin
Ballard
Sent: Thursday, 29 September 2005 4:02 PM
To: mousehole-scripters at rubyforge.org
Subject: Re: ! MouseHole 1.2 is out

I believe it's because /foo//bar and /foo/bar are equivalent URLs, and
so stripping double-slashes everywhere makes the comparison work better.

If you want to include a URL in the mount, look at what ProxyLike does.
It registers http: and then just takes the path and pretends it starts
with //.

On Sep 29, 2005, at 1:59 AM, Daniel Sheppard wrote:

> There's a bug with the paths. In the scripted_mounts method:
>
>      path_parts = request.path_info.split( '/' ).reject { |x| 
> x.to_s.strip.size == 0 }
>      mount = path_parts.shift.to_s.strip
>      each_fresh_script do |path, script|
>          if mount =~ /^\/*#{ script.mount }$/
>              script.do_mount( path_parts.join( '/' ), request, 
> response
> )
>              no_cache response
>              return
>          end
>      end
>
> Why is the reject { |x| x.to_s.strip.size == 0 } there? It has the 
> consequence that any double forward slash is stripped from the path 
> (so that urls cannot be included in the url for a mount). I take it 
> that it's there to filter out localhost:37004//cmd/ ? Would the 
> following
> suffice:
>
>      path_parts = request.path_info.split( '/' )
>      begin
>          mount = path_parts.shift
>      end until mount.to_s.strip.size > 0 || path_parts.empty?

--
Kevin Ballard
kevin at sb.org
http://www.tildesoft.com
http://kevin.sb.org



#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################



More information about the Mousehole-scripters mailing list