Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8DD4F200D24 for ; Tue, 24 Oct 2017 21:19:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8C7CB160BDB; Tue, 24 Oct 2017 19:19:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D386F1609C8 for ; Tue, 24 Oct 2017 21:19:09 +0200 (CEST) Received: (qmail 99338 invoked by uid 500); 24 Oct 2017 19:19:04 -0000 Mailing-List: contact dev-help@knox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@knox.apache.org Delivered-To: mailing list dev@knox.apache.org Received: (qmail 99148 invoked by uid 99); 24 Oct 2017 19:19:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Oct 2017 19:19:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 1E839C2466 for ; Tue, 24 Oct 2017 19:19:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id IK-LsKDkMUFH for ; Tue, 24 Oct 2017 19:19:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 6F1FA5FB40 for ; Tue, 24 Oct 2017 19:19:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A73F6E00C9 for ; Tue, 24 Oct 2017 19:19:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 6467C212F5 for ; Tue, 24 Oct 2017 19:19:00 +0000 (UTC) Date: Tue, 24 Oct 2017 19:19:00 +0000 (UTC) From: "Larry McCay (JIRA)" To: dev@knox.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (KNOX-912) introduce a rule "decode" attribute to overwrite encoding behavior MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 24 Oct 2017 19:19:10 -0000 [ https://issues.apache.org/jira/browse/KNOX-912?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Larry McCay updated KNOX-912: ----------------------------- Fix Version/s: (was: 0.14.0) 0.15.0 > introduce a rule "decode" attribute to overwrite encoding behavior > ------------------------------------------------------------------ > > Key: KNOX-912 > URL: https://issues.apache.org/jira/browse/KNOX-912 > Project: Apache Knox > Issue Type: Improvement > Components: Server > Affects Versions: 0.13.0 > Environment: all > Reporter: Jeffrey E Rodriguez > Assignee: Jeffrey E Rodriguez > Fix For: 0.15.0 > > > KNOX-791 - which tries to address the escaping issues have caused some is= sues in some cases where we need to decode "&" to "&" like in outp= ut rewrites of query parameters > An improvement proposal to introduce a rule decode attribute to set deco= ding behavior.=20 > Default is no decoding.=20 > This allows to turn this =E2=80=9Con=E2=80=9D for a specific rule. > Before KNOX-791 "&" used to be decoded to "&" during html parsing= . > The issue is that in OUT rewrite rule we will not able to match the query= string. > Example: > given html > test > rule: > {code:xml} > > > > {code} > This rule above will not work since the =E2=80=9C& amp;=E2=80=9C will= not be matched. > The proposed change is: > {code:xml} > > > > {code} > This will overwrite the default behavior and decode the the & > The following test illustrates the issue of what we would like > to solve. > {code:title=3DtestAmpRewrite.java|borderStyle=3Dsolid} > @Test > public void testAmpRewrite() throws Exception { > URI goodUri, badUri, outputUri; > Matcher matcher; > Matcher.Match match; > Template input, pattern, template; > badUri =3D new URI( > "http://foo:99/test/&q=3Dbar"); // we should be able to match > goodUri =3D new URI( > "http://foo:99/test/?q=3Dbar"); > input =3D Parser.parseLiteral(goodUri.toString()); > pattern =3D Parser.parseTemplate("{scheme}://{host}:{port}/test/?{*}"= ); > template =3D Parser.parseTemplate("http://newtest/test/?{*}?{scheme}?= {host}?{port}"); > // Match query string > String expectedUri =3D "http://newtest/test/?scheme=3Dhttp&host=3Dfoo= &port=3D99&q=3Dbar"; > matcher =3D new Matcher(); > matcher.add(pattern, null); > match =3D matcher.match(input); > assertNotNull( match ); > outputUri =3D Expander.expand(template, match.getParams(), null); > assertEquals("Not matched", expectedUri, outputUri.toString()); > // no match of query string ? > input =3D Parser.parseLiteral(badUri.toString());=20 > match =3D matcher.match(input); > assertNull( match); > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)