URLEncoding?

Topics: User Forum
Coordinator
Jul 14, 2008 at 5:01 PM
Edited Jul 14, 2008 at 5:03 PM

Evgeniy wrote:

I just downloaded your tool Ionic's Isapi Rewrite Filter from codeplex.com and I think it's great.
However I have a question regarding URLEncoding. It looks like IIRF doesn't support it. Is it true or I just cannot get it work properly?

Thanks and keep up with the good work.

Can you explain what you mean more specifically please? In what way do you need support for "URLEncoding"?

Jul 14, 2008 at 6:18 PM
For example:

if I'd like to check for URL which contains "exe" or "dll" I could write the RegEx "exe|dll", but it will not catch the the URL if it is URLEncoded.

Example:
http://www.test.com/test.exe
http://www.test.com/test.%45x%45

where "E" = %45


Coordinator
Jul 16, 2008 at 4:20 PM
Ahh, yes, I understand. . .   IIRF does not do that today. Let me have a think .   Maybe a new flag is required?  [D] for decode?
Jul 17, 2008 at 12:42 PM
Im experiencing a similar problem when I have search results passed through the url string ie. http://www.domain.com/search/q/this%20is%20my%20search%20question/ and I apply a rewritecond to the url it causes an error as its trying to back reference '%20' which doesnt exist.

A [D] flag would be perfect.
Coordinator
Jul 17, 2008 at 5:09 PM
Question for you.
Is it best addressed with :

  • a flag that we should apply to each RewriteRule directive?
  • a new directive "DecodeUrls" that applies across the entire ini file?
  • A new default behavior, because why would anyone want to handle URLs that were not decoded?

I'm interested in your input on this.

Jul 21, 2008 at 2:02 PM
Indeed, I would expect this to be the default behavior. Otherwise, one would have a valid UrlEncoded link and all rewrite rules will be ignored.
Coordinator
Jul 21, 2008 at 9:10 PM
What if....  I modified the behavior of the filter to first process the request as-is, and then try to url-decode it, and if that results in a different request, process the request again?    and when I say "process the request" I mean, evaluate all the rules against the request.  Would that make sense as a new default behavior? 

In combination with that, I would add a flag that says - "only match this rule against a non-URL-decoded request"  - in other words, a flag that says to use the current behavior.  Or, possibly better, I could introduce a new directive that says "DoNotDecodeUrls", something like that.


Jul 22, 2008 at 1:16 PM
Hi I think the url-decode needs to be performed prior to processing the request as the rules could evaluate but then error on the rewrite if the url-decode isnt performed first.
My example above can match the rewritecond but throw an error when appending the search string:
ie. RewriteCond %{QUERY_STRING} ^/search/(.*)$
    RewriteRule ^/search/q/(.*)$ /search/$1 [I,L]

A "DoNotDecodeUrls" directive would be good as well.