View | Details | Raw Unified | Return to bug 60013
Collapse All | Expand All

(-)java/org/apache/catalina/valves/rewrite/RewriteValve.java (-1 / +1 lines)
Lines 532-538 Link Here
532
                        chunk = request.getCoyoteRequest().queryString().getCharChunk();
532
                        chunk = request.getCoyoteRequest().queryString().getCharChunk();
533
                        chunk.recycle();
533
                        chunk.recycle();
534
                        chunk.append(ENCODER.encode(queryStringDecoded, uriEncoding));
534
                        chunk.append(ENCODER.encode(queryStringDecoded, uriEncoding));
535
                        if (qsa) {
535
                        if (qsa && originalQueryStringEncoded != null && !originalQueryStringEncoded.isEmpty()) {
536
                            chunk.append('&');
536
                            chunk.append('&');
537
                            chunk.append(originalQueryStringEncoded);
537
                            chunk.append(originalQueryStringEncoded);
538
                        }
538
                        }
(-)java/org/apache/tomcat/util/buf/CharChunk.java (+4 lines)
Lines 323-328 Link Here
323
     * @throws IOException Writing overflow data to the output channel failed
323
     * @throws IOException Writing overflow data to the output channel failed
324
     */
324
     */
325
    public void append(String s) throws IOException {
325
    public void append(String s) throws IOException {
326
        if (s== null) {
327
            return;
328
        }
329
326
        append(s, 0, s.length());
330
        append(s, 0, s.length());
327
    }
331
    }
328
332
(-)test/org/apache/catalina/valves/rewrite/TestRewriteValve.java (-2 / +8 lines)
Lines 484-489 Link Here
484
        doTestRewrite(config, request, expectedURI, expectedQueryString, null);
484
        doTestRewrite(config, request, expectedURI, expectedQueryString, null);
485
    }
485
    }
486
486
487
    @Test
488
    public void testUtf8WithBothQsFlagsLQSA() throws Exception {
489
        // Orig + rewritten QS
490
        doTestRewrite("RewriteRule ^/b/(.*)/(.*) /c/\u00A1$1?$2 [QSA]", "/b/%C2%A1/id=%C2%A1", "/c/%C2%A1%C2%A1",
491
                "id=%C2%A1");
492
    }
487
493
488
    private void doTestRewrite(String config, String request, String expectedURI,
494
    private void doTestRewrite(String config, String request, String expectedURI,
489
            String expectedQueryString, String expectedAttributeValue) throws Exception {
495
            String expectedQueryString, String expectedAttributeValue) throws Exception {
Lines 520-527 Link Here
520
        }
526
        }
521
527
522
        if (expectedAttributeValue != null) {
528
        if (expectedAttributeValue != null) {
523
            String attrbuteValue = requestDesc.getAttribute("X-Test");
529
            String attributeValue = requestDesc.getAttribute("X-Test");
524
            Assert.assertEquals(expectedAttributeValue, attrbuteValue);
530
            Assert.assertEquals(expectedAttributeValue, attributeValue);
525
        }
531
        }
526
    }
532
    }
527
}
533
}

Return to bug 60013