Topic - regexp metachars in urls
Topic - regexp metachars in urls Topic - regexp metachars in urls
from forum General Support
 forum index   my profile   search 
 new topic  post reply 
moderators: pjr tab
regexp metachars in urls
Joined: 25-May-2007
Posts: 30
Posted: 17-January-2008 01:37
I have a url with a $ in it, such as

http://1060.org/forum/index/8?test=ab$9asd

When I try to hit it it appears to not even make it into my module, but instead the rewrite engine pukes on it as it attempts to find submatch 9 to expend the $9 above.  I'm not sure that it is in fact legal to use "$" in a uri  (rfc 2396 3.3 says they're ok as part of a path component);  notwithstanding such illegality is there any way that I could successfully handle these requests?
Limitation
Joined: 7-February-2005
Posts: 249
Location: Uncharted territory
Posted: 17-January-2008 09:16
Hi Jeff,

this is a limitation of the escaping of rewrite rules within modules. As such if you can avoid using $ then you'll make your life easier. If you really need to use $ then you can always ensure that requests don't pass through any rewrite rules and go directly to an accessor that will process the request.

In the future we should probably consider a more complex escaping pattern in rewrites to avoid/reduce changes of conflict.

Cheers,
Tony
nope, its a bug
Joined: 25-May-2007
Posts: 30
Posted: 17-January-2008 18:28
Seemed like a rather odd limitation, so I dug in and I'm pretty sure its a bug.

The problem is that to implement the undocumented encoding replacement behavior ($e1) the rule implementation creates replacement strings out of the input strings instead of using the specified replacement string directly.  The effect is not only to raise an error when a $ is in a url, but it incorrectly rewrites it without raising any error if the string happens to contain $0 or $1. 

I've filed bug #141 for this.
 new topic  post reply  To find out about new replies to this post as they occur
please subscribe to one of these feeds:
AtomRSS moderate 
© 2003-2006, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.