Return-Path: Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: (qmail 26102 invoked from network); 31 Jul 2010 11:52:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 31 Jul 2010 11:52:36 -0000 Received: (qmail 60434 invoked by uid 500); 31 Jul 2010 11:52:35 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 60119 invoked by uid 500); 31 Jul 2010 11:52:31 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 60111 invoked by uid 99); 31 Jul 2010 11:52:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Jul 2010 11:52:30 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bimargulies@gmail.com designates 74.125.82.169 as permitted sender) Received: from [74.125.82.169] (HELO mail-wy0-f169.google.com) (74.125.82.169) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Jul 2010 11:52:22 +0000 Received: by wyg36 with SMTP id 36so2158765wyg.0 for ; Sat, 31 Jul 2010 04:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=QB53J6HfvKhVo9EMciu/cL6VNWFaQmOwMXt4EiQGZqk=; b=D9I1uFLK7QNMgi7iqq2u0nCyV7Yjvh/AaUmaRxCPtPTqEA5jCcYh+/VlMRFVfttAvj yWqHJwWuHcdZE8mHzq7y4J1av7qw8B31s1KmQsDKDVdJXwttPOUV6PV9zppTzm1lQyjw 7ta8r5aOqHm5D9mtBXoTHveE4iDJxeY9KRtCM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=V/E4pFjwuzGa5Gki9iZACgwgt6dWTCuywQS+tC/eTGFsNiUGjk8rWB12wKXNR7stiX B28MeJ5JzmaP93vR2YeHM964mTZL9Qeork+E/r8Dj/hFWQAdlLrjcQx7JCESssaNtgxP U6VhPz4/GaomvqxnY7sMF4V/wsjFS0rz36urU= MIME-Version: 1.0 Received: by 10.216.27.130 with SMTP id e2mr695289wea.66.1280577121509; Sat, 31 Jul 2010 04:52:01 -0700 (PDT) Received: by 10.216.155.17 with HTTP; Sat, 31 Jul 2010 04:52:01 -0700 (PDT) In-Reply-To: <4C538151.7020102@gmail.com> References: <20100730160740.AA5DA23889DA@eris.apache.org> <4C538151.7020102@gmail.com> Date: Sat, 31 Jul 2010 07:52:01 -0400 Message-ID: Subject: Re: Need for normalization? (Re: svn commit: r980880 - in /cxf/trunk/tools/common/src) From: Benson Margulies To: dev@cxf.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org To chime in: it's a really, really, bad idea for non-file URLs, as it can violate stringprep. For file URLs, it is an attempt to deal, with non-NFC (or NFKC) strings in the URL failing to match the file system. However, file system normalization is platform-dependendent. Linux does none at all, for example. So it's not safe in general. On Fri, Jul 30, 2010 at 9:50 PM, Glen Mazza wrote: > May I ask why this normalization is helpful (instead of just using the > intended file path to being with)? > Does this affect just internal CXF use or external usage by users of CXF? > =C2=A0If the latter, the potential problem I see is that not all URI's ar= e file > paths and, even if they were, I'm not sure that you can safely normalize = in > a platform-independent manner. > > Glen > > ema@apache.org wrote: >> >> Author: ema >> Date: Fri Jul 30 16:07:40 2010 >> New Revision: 980880 >> >> URL: http://svn.apache.org/viewvc?rev=3D980880&view=3Drev >> Log: >> [CXF-2918]:normalize the url like file:/home/cxf/org/apache/../../cxf in >> URIParserUtil.getAbsoluteURL() >> >> Modified: >> >> =C2=A0cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/URI= ParserUtil.java >> >> =C2=A0cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/util/URI= ParserUtilTest.java >> >> Modified: >> cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/URIParser= Util.java >> URL: >> http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/ap= ache/cxf/tools/util/URIParserUtil.java?rev=3D980880&r1=3D980879&r2=3D980880= &view=3Ddiff >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- >> cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/URIParser= Util.java >> (original) >> +++ >> cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/URIParser= Util.java >> Fri Jul 30 16:07:40 2010 >> @@ -248,18 +248,15 @@ public final class URIParserUtil { >> =C2=A0 =C2=A0 } >> =C2=A0 =C2=A0 public static String normalize(final String uri) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 URL url =3D null; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0String result =3D null; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 try { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 url =3D new URL(uri); >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return escapeChars(url.toStri= ng().replace("\\", "/")); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0result =3D >> escapeChars(url.toURI().normalize().toString().replace("\\", "/")); >> > > >