You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2016/08/18 08:01:05 UTC

[Bug 60013] New: Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

            Bug ID: 60013
           Summary: Non-ASCII characters in querystring get mangled after
                    URL Rewrite using RewriteValve
           Product: Tomcat 8
           Version: 8.0.35
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: santhanapreethi28@gmail.com

I have RewriteValve configured for the ROOT context which is the only context
in my deployment setup. 

I have many RewriteRules like 

RewriteRule ^/abc/(.*)$ /xyz.do?param=$1 [L]

where a part of the URL gets rewritten as querystring 

when I access the URL with non-ASCII characters like
http://www.example.com/abc/在线测试

The page does not load. Checking the rewrite and access logs I found 

Rewrite Log

Rewrote /abc/在线测试 as /xyz.do?param=在线测试 with rule pattern ^/abc/(.*)$

Access log

/xyz.do?param=????

This issue only happens when a part of the URL gets rewritten as the
querystring. Checking the source code of the RewriteValve 

chunk.append(URLEncoder.DEFAULT.encode(urlString));

I found the querystring is not encoded. Is this the cause of the problem?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #22 from Mark Thomas <ma...@apache.org> ---
I've reworked this in trunk/9.0.x. Please test and provide feedback. Assuming
there are no issues, I'll back-port this for the next set of releases.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #14 from Mark Thomas <ma...@apache.org> ---
This has been fixed in the following branches:
- 9.0.x for 9.0.0.M10 onwards
- 8.5.x for 8.5.5 onwards
- 8.0.x for 8.0.37 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

Tiago Oliveira <ti...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tiagojco@gmail.com

--- Comment #37 from Tiago Oliveira <ti...@gmail.com> ---
Created attachment 34281
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34281&action=edit
fix for failure case (QSA)

Mark,

this is a small fix for the test "failure case for QSA (attachment 34247)"
provided by Santhana Preethi (comment 35)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #31 from Santhana Preethi <sa...@gmail.com> ---
There seems to be a double encoding issue in QSA append. I added a test case
with L and QSA flag which failed. 
Looks like the original query string as well as the part of the request URI
which got rewritten as querystring are getting encoded. This needs to be
handled in the isQsappend code block.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #28 from Santhana Preethi <sa...@gmail.com> ---
I think the rewritten URL should be encoded(similar to mod_rewrite approach).
In the fix provided in 8.0.37 release, the request-uri and querystring are
encoded after rewrite. Handling redirect in a similar fashion will solve this
problem. 

Please update any progress in the RewriteValve.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

Christopher Schultz <ch...@christopherschultz.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WORKSFORME                  |---
             Status|RESOLVED                    |REOPENED

--- Comment #6 from Christopher Schultz <ch...@christopherschultz.net> ---
Re-opening due to additional information being provided by the reporter.

Preethi, would it be possible for you to write a test case for this?
Configuration + sample output, expected output versus actual output?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #13 from Mark Thomas <ma...@apache.org> ---
Progress is being made.

The test cases uncovered some inconsistencies in handling of encoded
urlPatterns obtained from web.xml. These have been fixed in trunk (r1758423).

I have added the test cases (some clean-up and a few fixes such as setting the
response body to UTF-8) and fixed the remaining issues with the rewrite valve
in trunk (r1758425).

There are a few more related edge cases I want to test. Once that is complete
I'll look at back-porting these changes to 8.5.x and 8.0.x.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #21 from Mark Thomas <ma...@apache.org> ---
After further investigation, httpd won't handle some of these cases either.
Given that the intention is to mimic, as far as possible, httpd functionality
then I am currently leaning towards a solution that does that. That does mean
some of the current tests cases will need adjustment else they will start
failing.

I will take another look at working with the undecoded URI but that presents
its own set of problems.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #3 from santhanapreethi28@gmail.com ---
I configured UTF-8 everywhere as mentioned in
https://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q1 

1. I set URIEncoding="UTF-8" and useBodyEncodingForURI="true" for the
connectors in server.xml 
2. configured org.apache.catalina.filters.SetCharacterEncodingFilter at the top
in web.xml 
3. Explicitly set strict servlet compliance to false using setenv.sh 
4. Ensured that no other valves like Request Dumper Valve in
http://www.mail-archive.com/users@tomcat.apache.org/msg21117.html was
configured.

Still the rewritten querystring was getting mangled. 
Also when there is a redirect like 

RewriteRule ^/abc/(.*)$ /xyz/$1 [R]

In access log
"GET /xyz/????.xml HTTP/1.1"

the non-ASCII characters in the request URI is also getting mangled like this

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEEDINFO

--- Comment #7 from Mark Thomas <ma...@apache.org> ---
Unless a test case that demonstrates this issue is forthcoming, this will get
resolved as WORKSFORME again.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #36 from Santhana Preethi <sa...@gmail.com> ---
Any update in QSA issue?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #35 from Santhana Preethi <sa...@gmail.com> ---
Created attachment 34247
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34247&action=edit
failure case for QSA

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #19 from santhanapreethi28@gmail.com ---
Created attachment 34209
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34209&action=edit
testNonAsciiQueryStringAndRedirectPath failure trace

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #5 from santhanapreethi28@gmail.com ---
I tested by encoding the querystring in the RewriteValve

if (queryString != null) 
{  
     request.getCoyoteRequest().queryString().setString(null);
     chunk = request.getCoyoteRequest().queryString().getCharChunk();
     chunk.recycle();
     //chunk.append(queryString);
     // encode queryString 
     chunk.append(URLEncoder.DEFAULT.encode(queryString));
     request.getCoyoteRequest().queryString().toChars();
}

I found that = and & in the querystring also was getting encoded 
I had to decode the encoded = and & to get it to work as expected.

     String encQueryString = URLEncoder.DEFAULT.encode(queryString);
     encQueryString = encQueryString.replaceAll("%3D","=");
     encQueryString = encQueryString.replaceAll("%26","&");
     chunk.append(encQueryString);

After making these changes the URL rewriting was working fine 

Access log 

/xyz.do?param=%E5%9C%A8%E7%BA%BF%E6%B5%8B%E8%AF%95

I wrote a test jsp and request.getParameter was working fine and retrieved the
non-ASCII data with both GET and POST methods 

Because the rewritten and done flags are set in case of redirect, the issue
still remain when there is a redirect.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #20 from Mark Thomas <ma...@apache.org> ---
I've done some further digging and adding support for the 'B' flag looks like a
better way to solve this since that is more closely aligned with httpd. Need to
see if that is possible.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #15 from santhanapreethi28@gmail.com ---
I am testing the RewriteValve in the trunk after the issue fix. QueryStrings in
the case of redirect are still not encoded.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #18 from santhanapreethi28@gmail.com ---
Created attachment 34208
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34208&action=edit
testNonAsciiQueryString failure trace

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #4 from santhanapreethi28@gmail.com ---
I tested by encoding the querystring in the RewriteValve

if (queryString != null) 
{  
     request.getCoyoteRequest().queryString().setString(null);
     chunk = request.getCoyoteRequest().queryString().getCharChunk();
     chunk.recycle();
     //chunk.append(queryString);

     chunk.append(URLEncoder.DEFAULT.encode(queryString));
     request.getCoyoteRequest().queryString().toChars();
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #30 from Santhana Preethi <sa...@gmail.com> ---
Thanks for the update. The concerns when R flag is used with NE and B flag are
valid. At a glance, the current fix seems to be fine. I will test the latest
changes and get back to you.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
             Status|RESOLVED                    |REOPENED

--- Comment #17 from Mark Thomas <ma...@apache.org> ---
Thanks for the additional tests.

There isn't going to be a perfect fix without some potentially invasive changes
to the RedirectValve. The problem is that encoding is not always the inverse of
decoding. The Valve would have to be re-factored to work with undecoded URIs.

An imperfect fix that ignored some edge cases should be fairly simple.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #27 from Mark Thomas <ma...@apache.org> ---
I think I have a better understanding of what is going on.

Both Tomcat and httpd decode and normalize the URI before rewriting. The
problem occurs later.

Consider the following rule:

RewriteRule /a/(.*) /b?$1

With httpd the query string is as follows:

/a/id=%61 -> id=a
/a/id=%3d -> id==
/a/id=%3f -> id=?
/b?id=%61 -> id=%61
/b?id=%3d -> id=%3d
/b?id=%3f -> id=%3f

Note how the query string varies depending on whether the request goes through
the rewrite rule or not. The problem isn't limited to the query string but it
does illustrates the problem. Note also that an application isn't going to be
able to unambiguously parse some of those re-written query strings and that
using the [B] flag won't help in this since it will incorrectly encode the
first '='.

In Tomcat the problem is more immediately apparent because the query string has
to be presented in encoded form.

I think we can get closer to the httpd behaviour but there are always going to
be edge cases we won't be able to fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #40 from Mark Thomas <ma...@apache.org> ---
This has been fixed in the following branches:
- 9.0.x for 9.0.0.M11 onwards
- 8.5.x for 8.5.6 onwards
- 8.0.x for 8.0.38 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WORKSFORME
             Status|NEW                         |RESOLVED

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
I've added a test case and as far as I can tell, Tomcat is doing the right
thing here. I need need to be very careful to ensure that everything was
configured to use UTF-8. Until I did that, I saw all sorts of test failures.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #33 from Mark Thomas <ma...@apache.org> ---
It appears that httpd (at least as provided by 2.4.7 in Ubuntu 14.04.5 which I
am using to test) sometimes double encodes when QSA is used as well.

I've reworked the QSA handling, added your test case, fixed another test case
that was broken by this fix and made sure your name is in the changelog.

Thanks for sticking with this. Let us know how you get on. I'd like to get this
all sported out in time for the next release scheduled for the end of the
month.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #32 from Santhana Preethi <sa...@gmail.com> ---
Created attachment 34226
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34226&action=edit
QueryString Append Failure

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #24 from santhanapreethi28@gmail.com ---
Created attachment 34220
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34220&action=edit
B flag failure cases

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #29 from Mark Thomas <ma...@apache.org> ---
Those most recent tests aren't consistent with httpd's behaviour.

Both Tomcat and httpd process rewrites in very similar ways (to a point).

The original query string is retain in encoded form.
The path URI is processed in decoded and normalized form.
Any query string generated by the rewrite is in decoded form (note this differs
from the original).
Before any rewrite, any decoded elements are encoded.

The NE flag disables the encoding of decoded elements on rewrite.

The B flag encodes back references.

It is therefore possible for unwanted double encoding to occur when B and R are
combined.

It is also possible for UTF-8 bytes to appear directly in the location header
when R is combined with NE.

I'm fairly confident of the latest code but I'll leave it a little while before
back-porting to give you a chance to test it and provide feedback.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #8 from santhanapreethi28@gmail.com ---
Created attachment 34176
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34176&action=edit
Test case for non-ascii characters in querystring and with redirect flag

Added testcases using TestRewriteValve.java for non-ascii querystring and
non-ascii in request uri(for redirect case).

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #1 from santhanapreethi28@gmail.com ---
Using java 1.7.0_76
RewriteValve is configured at the context level.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #9 from santhanapreethi28@gmail.com ---
Created attachment 34177
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34177&action=edit
Non-Ascii QueryString failure trace

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #26 from Mark Thomas <ma...@apache.org> ---
Let me do some more investigation.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

santhanapreethi28@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |santhanapreethi28@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #25 from santhanapreethi28@gmail.com ---
I don't think using B flag for URLs with non-ASCII characters is the right
approach. I am using httpd mod_rewrite for URL rewrite now and so far there
have been no issues in non-ASCII characters getting rewritten as querystring.

Supporting B flag will not solve the issue in the URLs in the attached
testcases as &,= will also get encoded.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #39 from Santhana Preethi <sa...@gmail.com> ---
Thanks for the fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #12 from Mark Thomas <ma...@apache.org> ---
Thanks for the test cases. They really do make bug reports a lot easier to work
with. I'll start looking at them today.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by Mark Thomas <ma...@apache.org>.
On 11/03/2022 07:19, bugzilla@apache.org wrote:
> https://bz.apache.org/bugzilla/show_bug.cgi?id=60013
> 
> --- Comment #41 from kiran <ki...@gmail.com> ---

Sigh.

Another idiot who doesn't realise that all links from our BZ are no-follow.

Account disabled, spam deleted.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #41 from kiran <ki...@gmail.com> ---
Thanks for fixing the issue regards Non-ASCII characters in the query string
getting mangled after URL Rewrite using RewriteValve.
https://certivatic.com/iso-9001-certification-in-philippines/

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #11 from santhanapreethi28@gmail.com ---
Added testcase for the mentioned cases

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #38 from Mark Thomas <ma...@apache.org> ---
Comment on attachment 34281
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34281
fix for failure case (QSA)

Thanks variation of the patch applied.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #10 from santhanapreethi28@gmail.com ---
Created attachment 34178
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34178&action=edit
Non-Ascii Redirect failure trace

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #34 from Santhana Preethi <sa...@gmail.com> ---
Thanks for the update. I am testing the latest changes. So far I found a
failure when there is a rule with QSA but no querystring is supplied. It is
probably due to the absence of null check in QSA handling code.

I will let you know after testing more thoroughly.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #23 from santhanapreethi28@gmail.com ---
Thanks for the update. Testing the changes in trunk I found some failure cases.
Attached the testcase

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

--- Comment #16 from santhanapreethi28@gmail.com ---
Created attachment 34205
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34205&action=edit
Testcase for Redirect with QueryStrings

Both cases testNonAsciiQueryString and testNonAsciiQueryStringAndRedirectPath
fail when a redirect flag is added.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org