Ticket #116 (closed defect: fixed)

Opened 23 months ago

Last modified 14 months ago

Different levels of escaping for PATH_INFO on different servers

Reported by: whateley Owned by: why
Priority: major Milestone: Camping 1.6
Component: bin/camping Version:
Keywords: Cc: whateley@…

Description

Camping is inconsistent in what it puts in the PATH_INFO variable when responding to a URL containing Unicode characters.

For example, "/tag/μformats":

When running under Mongrel, @env.PATH_INFO is "/tag/%CE%BCformats".

When running under WEBrick or FastCGI, @env.PATH_INFO is "/tag/\316\274formats".

Change History

Changed 20 months ago by why

  • status changed from new to assigned

I agree. Also, lighttpd should escape spaces as %20 rather than a plus sign.

Changed 14 months ago by zimbatm

This patch normalizes the PATH_INFO. Is it what you want ? Or should the adapter be responsible of the work ?

Index: lib/camping-unabridged.rb
===================================================================
--- lib/camping-unabridged.rb   (revision 226)
+++ lib/camping-unabridged.rb   (working copy)
@@ -652,6 +652,7 @@
     #
     def run(r=$stdin,e=ENV)
       X.M
+      e['PATH_INFO'] &&= un(e['PATH_INFO'])
       k,a=X.D un("/#{e['PATH_INFO']}".gsub(/\/+/,'/'))
       k.new(r,e,(m=e['REQUEST_METHOD']||"GET")).Y.service(*a)
     rescue=>x

Changed 14 months ago by zimbatm

  • milestone set to Camping 1.6

Changed 14 months ago by zimbatm

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in [231] with a shorter solution than in the previously shown patch.

Note: See TracTickets for help on using tickets.