cherokee / webserver

Cherokee Web Server
GNU General Public License v2.0
563 stars 104 forks source link

Invalid result of redirection #415

Closed danielniccoli closed 11 years ago

danielniccoli commented 11 years ago

Original author: pig...@gmail.com (March 16, 2009 21:57:58)

What steps will reproduce the problem?

  1. regex rule: "^\/dynamic\/(.+)$" or "^/dynamic/(.+)$"
  2. substitution: "/cherokee_bzr/pages/stream_file?query=$1"
  3. Url for test "http://new.cherokee-project.pl/dynamic/b:main/r:jedrzej_nowak-20090312000637-r16wxfkkg4z0og9d/id:admin_advanced0.png-20090311183858-94tsuj23p6ka79pr-6"

What is the expected output? What do you see instead?

I expected: "query=b:main/r:jedrzej_nowak-20090312000637-r16wxfkkg4z0og9d/id:admin_advanced0.png-20090311183858-94tsuj23p6ka79pr-6" but I got: "query=" only...

What version of the product are you using? On what operating system?

Latest SVN for now

Please provide any additional information below.

http://regextester.com - after entering that values I got expected result in query string.

http://wklej.to/EesD/text - CHEROKEE_TRACE=redir output for second rule ( on first it's the same I think )

And the weird is that:

  1. regex: ^\/pages\/(.+)$
  2. substitution: /cherokee_bzr/pages/single?query=$1 works fine...

Original issue: http://code.google.com/p/cherokee/issues/detail?id=401

danielniccoli commented 11 years ago

From alobbs on March 17, 2009 17:21:04

The configuration:

vserver!10!rule!700!handler = redir vserver!10!rule!700!handler!rewrite!1!show = 1 vserver!10!rule!700!handler!rewrite!1!substring = /cherokee_bzr/pages/stream_file?query=$1 vserver!10!rule!700!match = request vserver!10!rule!700!match!final = 1

vserver!10!rule!700!match!request = ^\/dynamic\/(.+)$

This is what I get:

GET /dynamic/b:main/r:jedrzej_nowak-20090312000637-r16wxfkkg4z0og9d/id:admin_advanced0.png- 20090311183858-94tsuj23p6ka79pr-6 HTTP/1.1

< HTTP/1.1 301 Moved Permanently < Connection: close < Date: Tue, 17 Mar 2009 17:17:45 GMT < Server: Cherokee/0.99.4b2973 (UNIX) < Location: /cherokee_bzr/pages/stream_file?query=b:main/r:jedrzej_nowak-20090312000637- r16wxfkkg4z0og9d/id:admin_advanced0.png-20090311183858-94tsuj23p6ka79pr-6

<

danielniccoli commented 11 years ago

From pig...@gmail.com on March 18, 2009 11:08:50 It looks like invalid config generated by admin was the reason of that problems.

There was "...!match!match!final = on" instread of "...!match!final = 1"

Duplicated string "!match" ;)

So now everything works fine.