You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by se...@apache.org on 2009/02/15 17:34:58 UTC
svn commit: r744689 [3/3] - in /httpcomponents/httpclient/trunk:
module-client/src/examples/org/apache/http/examples/client/
module-client/src/examples/org/apache/http/examples/conn/
module-client/src/main/java/org/apache/http/auth/ module-client/src/m...
Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/PublicSuffixFilter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/PublicSuffixFilter.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/PublicSuffixFilter.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/PublicSuffixFilter.java Sun Feb 15 16:34:53 2009
@@ -1,121 +1,121 @@
-/*
- * $HeadURL$
- * $Revision$
- * $Date$
- *
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.http.impl.cookie;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.http.client.utils.Punycode;
-import org.apache.http.cookie.Cookie;
-import org.apache.http.cookie.CookieAttributeHandler;
-import org.apache.http.cookie.CookieOrigin;
-import org.apache.http.cookie.MalformedCookieException;
-import org.apache.http.cookie.SetCookie;
-
-/**
- * Wraps a CookieAttributeHandler and leverages its match method
- * to never match a suffix from a black list. May be used to provide
- * additional security for cross-site attack types by preventing
- * cookies from apparent domains that are not publicly available.
- * An uptodate list of suffixes can be obtained from
- * <a href="http://publicsuffix.org/">publicsuffix.org</a>
- */
-public class PublicSuffixFilter implements CookieAttributeHandler {
- private CookieAttributeHandler wrapped;
- private Set<String> exceptions;
- private Set<String> suffixes;
-
- public PublicSuffixFilter(CookieAttributeHandler wrapped) {
- this.wrapped = wrapped;
- }
-
- /**
- * Sets the suffix blacklist patterns.
- * A pattern can be "com", "*.jp"
- * TODO add support for patterns like "lib.*.us"
- * @param suffixes
- */
- public void setPublicSuffixes(Collection<String> suffixes) {
- this.suffixes = new HashSet<String>(suffixes);
- }
-
- /**
- * Sets the exceptions from the blacklist. Exceptions can not be patterns.
- * TODO add support for patterns
- * @param exceptions
- */
- public void setExceptions(Collection<String> exceptions) {
- this.exceptions = new HashSet<String>(exceptions);
- }
-
- /**
- * Never matches if the cookie's domain is from the blacklist.
- */
- public boolean match(Cookie cookie, CookieOrigin origin) {
- if (isForPublicSuffix(cookie)) return false;
- return wrapped.match(cookie, origin);
- }
-
- public void parse(SetCookie cookie, String value) throws MalformedCookieException {
- wrapped.parse(cookie, value);
- }
-
- public void validate(Cookie cookie, CookieOrigin origin) throws MalformedCookieException {
- wrapped.validate(cookie, origin);
- }
-
- private boolean isForPublicSuffix(Cookie cookie) {
- String domain = cookie.getDomain();
- if (domain.startsWith(".")) domain = domain.substring(1);
- domain = Punycode.toUnicode(domain);
-
- // An exception rule takes priority over any other matching rule.
- if (this.exceptions != null) {
- if (this.exceptions.contains(domain)) return false;
- }
-
-
- if (this.suffixes == null) return false;
-
- do {
- if (this.suffixes.contains(domain)) return true;
- // patterns
- if (domain.startsWith("*.")) domain = domain.substring(2);
- int nextdot = domain.indexOf('.');
- if (nextdot == -1) break;
- domain = "*" + domain.substring(nextdot);
- } while (domain.length() > 0);
-
- return false;
- }
-}
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.impl.cookie;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.http.client.utils.Punycode;
+import org.apache.http.cookie.Cookie;
+import org.apache.http.cookie.CookieAttributeHandler;
+import org.apache.http.cookie.CookieOrigin;
+import org.apache.http.cookie.MalformedCookieException;
+import org.apache.http.cookie.SetCookie;
+
+/**
+ * Wraps a CookieAttributeHandler and leverages its match method
+ * to never match a suffix from a black list. May be used to provide
+ * additional security for cross-site attack types by preventing
+ * cookies from apparent domains that are not publicly available.
+ * An uptodate list of suffixes can be obtained from
+ * <a href="http://publicsuffix.org/">publicsuffix.org</a>
+ */
+public class PublicSuffixFilter implements CookieAttributeHandler {
+ private CookieAttributeHandler wrapped;
+ private Set<String> exceptions;
+ private Set<String> suffixes;
+
+ public PublicSuffixFilter(CookieAttributeHandler wrapped) {
+ this.wrapped = wrapped;
+ }
+
+ /**
+ * Sets the suffix blacklist patterns.
+ * A pattern can be "com", "*.jp"
+ * TODO add support for patterns like "lib.*.us"
+ * @param suffixes
+ */
+ public void setPublicSuffixes(Collection<String> suffixes) {
+ this.suffixes = new HashSet<String>(suffixes);
+ }
+
+ /**
+ * Sets the exceptions from the blacklist. Exceptions can not be patterns.
+ * TODO add support for patterns
+ * @param exceptions
+ */
+ public void setExceptions(Collection<String> exceptions) {
+ this.exceptions = new HashSet<String>(exceptions);
+ }
+
+ /**
+ * Never matches if the cookie's domain is from the blacklist.
+ */
+ public boolean match(Cookie cookie, CookieOrigin origin) {
+ if (isForPublicSuffix(cookie)) return false;
+ return wrapped.match(cookie, origin);
+ }
+
+ public void parse(SetCookie cookie, String value) throws MalformedCookieException {
+ wrapped.parse(cookie, value);
+ }
+
+ public void validate(Cookie cookie, CookieOrigin origin) throws MalformedCookieException {
+ wrapped.validate(cookie, origin);
+ }
+
+ private boolean isForPublicSuffix(Cookie cookie) {
+ String domain = cookie.getDomain();
+ if (domain.startsWith(".")) domain = domain.substring(1);
+ domain = Punycode.toUnicode(domain);
+
+ // An exception rule takes priority over any other matching rule.
+ if (this.exceptions != null) {
+ if (this.exceptions.contains(domain)) return false;
+ }
+
+
+ if (this.suffixes == null) return false;
+
+ do {
+ if (this.suffixes.contains(domain)) return true;
+ // patterns
+ if (domain.startsWith("*.")) domain = domain.substring(2);
+ int nextdot = domain.indexOf('.');
+ if (nextdot == -1) break;
+ domain = "*" + domain.substring(nextdot);
+ } while (domain.length() > 0);
+
+ return false;
+ }
+}
Propchange: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/PublicSuffixFilter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/PublicSuffixListParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/PublicSuffixListParser.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/PublicSuffixListParser.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/PublicSuffixListParser.java Sun Feb 15 16:34:53 2009
@@ -1,108 +1,108 @@
-/*
- * $HeadURL$
- * $Revision$
- * $Date$
- *
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.http.impl.cookie;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * Parses the list from <a href="http://publicsuffix.org/">publicsuffix.org</a>
- * and configures a PublicSuffixFilter.
- */
-public class PublicSuffixListParser {
- private static final int MAX_LINE_LEN = 256;
- private PublicSuffixFilter filter;
-
- PublicSuffixListParser(PublicSuffixFilter filter) {
- this.filter = filter;
- }
-
- /**
- * Parses the public suffix list format.
- * When creating the reader from the file, make sure to
- * use the correct encoding (the original list is in UTF-8).
- *
- * @param list the suffix list. The caller is responsible for closing the reader.
- * @throws IOException on error while reading from list
- */
- public void parse(Reader list) throws IOException {
- Collection<String> rules = new ArrayList<String>();
- Collection<String> exceptions = new ArrayList<String>();
- BufferedReader r = new BufferedReader(list);
- StringBuilder sb = new StringBuilder(256);
- boolean more = true;
- while (more) {
- more = readLine(r, sb);
- String line = sb.toString();
- if (line.length() == 0) continue;
- if (line.startsWith("//")) continue; //entire lines can also be commented using //
- if (line.startsWith(".")) line = line.substring(1); // A leading dot is optional
- // An exclamation mark (!) at the start of a rule marks an exception to a previous wildcard rule
- boolean isException = line.startsWith("!");
- if (isException) line = line.substring(1);
-
- if (isException) {
- exceptions.add(line);
- } else {
- rules.add(line);
- }
- }
-
- filter.setPublicSuffixes(rules);
- filter.setExceptions(exceptions);
- }
-
- /**
- *
- * @param r
- * @param sb
- * @return false when the end of the stream is reached
- * @throws IOException
- */
- private boolean readLine(Reader r, StringBuilder sb) throws IOException {
- sb.setLength(0);
- int b;
- boolean hitWhitespace = false;
- while ((b = r.read()) != -1) {
- char c = (char) b;
- if (c == '\n') break;
- // Each line is only read up to the first whitespace
- if (Character.isWhitespace(c)) hitWhitespace = true;
- if (!hitWhitespace) sb.append(c);
- if (sb.length() > MAX_LINE_LEN) throw new IOException("Line too long"); // prevent excess memory usage
- }
- return (b != -1);
- }
-}
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.impl.cookie;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * Parses the list from <a href="http://publicsuffix.org/">publicsuffix.org</a>
+ * and configures a PublicSuffixFilter.
+ */
+public class PublicSuffixListParser {
+ private static final int MAX_LINE_LEN = 256;
+ private PublicSuffixFilter filter;
+
+ PublicSuffixListParser(PublicSuffixFilter filter) {
+ this.filter = filter;
+ }
+
+ /**
+ * Parses the public suffix list format.
+ * When creating the reader from the file, make sure to
+ * use the correct encoding (the original list is in UTF-8).
+ *
+ * @param list the suffix list. The caller is responsible for closing the reader.
+ * @throws IOException on error while reading from list
+ */
+ public void parse(Reader list) throws IOException {
+ Collection<String> rules = new ArrayList<String>();
+ Collection<String> exceptions = new ArrayList<String>();
+ BufferedReader r = new BufferedReader(list);
+ StringBuilder sb = new StringBuilder(256);
+ boolean more = true;
+ while (more) {
+ more = readLine(r, sb);
+ String line = sb.toString();
+ if (line.length() == 0) continue;
+ if (line.startsWith("//")) continue; //entire lines can also be commented using //
+ if (line.startsWith(".")) line = line.substring(1); // A leading dot is optional
+ // An exclamation mark (!) at the start of a rule marks an exception to a previous wildcard rule
+ boolean isException = line.startsWith("!");
+ if (isException) line = line.substring(1);
+
+ if (isException) {
+ exceptions.add(line);
+ } else {
+ rules.add(line);
+ }
+ }
+
+ filter.setPublicSuffixes(rules);
+ filter.setExceptions(exceptions);
+ }
+
+ /**
+ *
+ * @param r
+ * @param sb
+ * @return false when the end of the stream is reached
+ * @throws IOException
+ */
+ private boolean readLine(Reader r, StringBuilder sb) throws IOException {
+ sb.setLength(0);
+ int b;
+ boolean hitWhitespace = false;
+ while ((b = r.read()) != -1) {
+ char c = (char) b;
+ if (c == '\n') break;
+ // Each line is only read up to the first whitespace
+ if (Character.isWhitespace(c)) hitWhitespace = true;
+ if (!hitWhitespace) sb.append(c);
+ if (sb.length() > MAX_LINE_LEN) throw new IOException("Line too long"); // prevent excess memory usage
+ }
+ return (b != -1);
+ }
+}
Propchange: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/PublicSuffixListParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java Sun Feb 15 16:34:53 2009
@@ -49,16 +49,6 @@
/**
* RFC 2109 compliant cookie policy
*
- * @author B.C. Holmes
- * @author <a href="mailto:jericho@thinkfree.com">Park, Sung-Gu</a>
- * @author <a href="mailto:dsale@us.britannica.com">Doug Sale</a>
- * @author Rod Waldhoff
- * @author dIon Gillard
- * @author Sean C. Sullivan
- * @author <a href="mailto:JEvans@Cyveillance.com">John Evans</a>
- * @author Marc A. Saegesser
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
- * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
*
* @since 4.0
*/
Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java Sun Feb 15 16:34:53 2009
@@ -38,7 +38,6 @@
/**
*
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*
* @since 4.0
*/
Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java Sun Feb 15 16:34:53 2009
@@ -43,7 +43,6 @@
/**
* <tt>"Domain"</tt> cookie attribute handler for RFC 2965 cookie spec.
*
- * @author jain.samit@gmail.com (Samit Jain)
*
* @since 3.1
*/
Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java Sun Feb 15 16:34:53 2009
@@ -51,8 +51,6 @@
/**
* <p>RFC 2965 specific cookie management functions.</p>
*
- * @author jain.samit@gmail.com (Samit Jain)
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*
* @since 3.1
*/
Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java Sun Feb 15 16:34:53 2009
@@ -38,7 +38,6 @@
/**
*
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*
* @since 4.0
*/
Propchange: httpcomponents/httpclient/trunk/module-client/src/main/resources/META-INF/LICENSE
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/module-client/src/main/resources/META-INF/NOTICE
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/utils/TestRfc3492Idn.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/utils/TestRfc3492Idn.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/utils/TestRfc3492Idn.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/utils/TestRfc3492Idn.java Sun Feb 15 16:34:53 2009
@@ -1,95 +1,95 @@
-/*
- * $HeadURL$
- * $Revision$
- * $Date$
- *
- * ====================================================================
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.http.client.utils;
-
-import org.apache.http.client.utils.Rfc3492Idn;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class TestRfc3492Idn extends TestCase {
- public TestRfc3492Idn(String testName) {
- super(testName);
- }
-
- public static void main(String args[]) {
- String[] testCaseName = { TestRfc3492Idn.class.getName() };
- junit.textui.TestRunner.main(testCaseName);
- }
-
- public static Test suite() {
- return new TestSuite(TestRfc3492Idn.class);
- }
-
- /**
- * Some of the sample strings from RFC 3492
- */
- public void testDecode() throws Exception {
- Rfc3492Idn idn = new Rfc3492Idn();
- // (A) Arabic
- assertEquals("\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" +
- "\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F",
- idn.decode("egbpdaj6bu4bxfgehfvwxn"));
-
- // (B) Chinese (simplified)
- assertEquals("\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587",
- idn.decode("ihqwcrb4cv8a8dqg056pqjye"));
-
- // (I) Russian (Cyrillic)
- assertEquals("\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E"+
- "\u043D\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440"+
- "\u044F\u0442\u043F\u043E\u0440\u0443\u0441\u0441\u043A"+
- "\u0438",
- idn.decode("b1abfaaepdrnnbgefbaDotcwatmq2g4l"));
-
- // (P) Maji<de>Koi<suru>5<byou><mae>
- assertEquals("\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059" +
- "\u308B\u0035\u79D2\u524D",
- idn.decode("MajiKoi5-783gue6qz075azm5e"));
-
- }
-
- public void testToUnicode() throws Exception {
- Rfc3492Idn idn = new Rfc3492Idn();
- // (A) Arabic
- assertEquals("\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" +
- "\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F",
- idn.toUnicode("xn--egbpdaj6bu4bxfgehfvwxn"));
-
- // some real-world domains
- assertEquals("www.z\u00fcrich.ch",
- idn.toUnicode("www.xn--zrich-kva.ch"));
-
- assertEquals("www.g\u00e4ggelig\u00e4\u00e4l.ch",
- idn.toUnicode("www.xn--gggeligl-0zaga.ch"));
- }
-}
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.client.utils;
+
+import org.apache.http.client.utils.Rfc3492Idn;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class TestRfc3492Idn extends TestCase {
+ public TestRfc3492Idn(String testName) {
+ super(testName);
+ }
+
+ public static void main(String args[]) {
+ String[] testCaseName = { TestRfc3492Idn.class.getName() };
+ junit.textui.TestRunner.main(testCaseName);
+ }
+
+ public static Test suite() {
+ return new TestSuite(TestRfc3492Idn.class);
+ }
+
+ /**
+ * Some of the sample strings from RFC 3492
+ */
+ public void testDecode() throws Exception {
+ Rfc3492Idn idn = new Rfc3492Idn();
+ // (A) Arabic
+ assertEquals("\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" +
+ "\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F",
+ idn.decode("egbpdaj6bu4bxfgehfvwxn"));
+
+ // (B) Chinese (simplified)
+ assertEquals("\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587",
+ idn.decode("ihqwcrb4cv8a8dqg056pqjye"));
+
+ // (I) Russian (Cyrillic)
+ assertEquals("\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E"+
+ "\u043D\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440"+
+ "\u044F\u0442\u043F\u043E\u0440\u0443\u0441\u0441\u043A"+
+ "\u0438",
+ idn.decode("b1abfaaepdrnnbgefbaDotcwatmq2g4l"));
+
+ // (P) Maji<de>Koi<suru>5<byou><mae>
+ assertEquals("\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059" +
+ "\u308B\u0035\u79D2\u524D",
+ idn.decode("MajiKoi5-783gue6qz075azm5e"));
+
+ }
+
+ public void testToUnicode() throws Exception {
+ Rfc3492Idn idn = new Rfc3492Idn();
+ // (A) Arabic
+ assertEquals("\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" +
+ "\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F",
+ idn.toUnicode("xn--egbpdaj6bu4bxfgehfvwxn"));
+
+ // some real-world domains
+ assertEquals("www.z\u00fcrich.ch",
+ idn.toUnicode("www.xn--zrich-kva.ch"));
+
+ assertEquals("www.g\u00e4ggelig\u00e4\u00e4l.ch",
+ idn.toUnicode("www.xn--gggeligl-0zaga.ch"));
+ }
+}
Propchange: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/utils/TestRfc3492Idn.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestScheme.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestScheme.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestScheme.java Sun Feb 15 16:34:53 2009
@@ -48,8 +48,6 @@
/**
* Unit tests for {@link Scheme} and {@link SchemeRegistry}.
*
- * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*/
public class TestScheme extends TestCase {
Propchange: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/scheme/TestScheme.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/CertificatesToPlayWith.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/CertificatesToPlayWith.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/CertificatesToPlayWith.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/CertificatesToPlayWith.java Sun Feb 15 16:34:53 2009
@@ -41,7 +41,6 @@
* find 花子.co.jp. So would the CN in the certificate contain
* "xn--i8s592g.co.jp" in ASCII, or "花子.co.jp" in UTF8? (Both?)
*
- * @author Julius Davies
* @since 11-Dec-2006
*/
public interface CertificatesToPlayWith {
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java Sun Feb 15 16:34:53 2009
@@ -45,7 +45,6 @@
/**
* Unit tests for {@link X509HostnameVerifier}.
*
- * @author Julius Davies
* @since 11-Dec-2006
*/
public class TestHostnameVerifier extends TestCase
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java Sun Feb 15 16:34:53 2009
@@ -65,7 +65,6 @@
/**
* Unit tests for {@link SSLSocketFactory}.
*
- * @author Julius Davies
* @since 8-Dec-2006
*/
public class TestSSLSocketFactory extends TestCase
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java Sun Feb 15 16:34:53 2009
@@ -51,9 +51,6 @@
/**
* Test Methods for DigestScheme Authentication.
*
- * @author Rodney Waldhoff
- * @author <a href="mailto:jsdever@apache.org">Jeff Dever</a>
- * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
*/
public class TestDigestScheme extends TestCase {
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java Sun Feb 15 16:34:53 2009
@@ -38,10 +38,6 @@
*
* Simple tests for {@link BasicCredentialsProvider}.
*
- * @author Rodney Waldhoff
- * @author <a href="mailto:jsdever@apache.org">Jeff Dever</a>
- * @author Sean C. Sullivan
- * @author Oleg Kalnichevski
*
* @version $Id$
*
Propchange: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestCookieIdentityComparator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/ExecReqThread.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/ExecReqThread.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/ExecReqThread.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/ExecReqThread.java Sun Feb 15 16:34:53 2009
@@ -45,8 +45,6 @@
/**
* Executes a request from a new thread.
*
- * @author Michael Becke
- * @author Roland Weber (rolandw at apache.org)
*/
public class ExecReqThread extends GetConnThread {
Propchange: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestSCMWithServer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestSpuriousWakeup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestSpuriousWakeup.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestSpuriousWakeup.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestSpuriousWakeup.java Sun Feb 15 16:34:53 2009
@@ -64,7 +64,6 @@
* which is required to trigger a wakeup without actually
* satisfying the condition.
*
- * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
*/
public class TestSpuriousWakeup extends TestCase {
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java Sun Feb 15 16:34:53 2009
@@ -50,12 +50,6 @@
/**
* Test cases for BrowserCompatSpec
*
- * @author BC Holmes
- * @author Rod Waldhoff
- * @author dIon Gillard
- * @author <a href="mailto:JEvans@Cyveillance.com">John Evans</a>
- * @author Marc A. Saegesser
- * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
* @version $Revision$
*/
public class TestBrowserCompatSpec extends TestCase {
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java Sun Feb 15 16:34:53 2009
@@ -49,7 +49,6 @@
/**
* Test cases for 'best match' cookie policy
*
- * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
*
* @version $Revision$
*/
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java Sun Feb 15 16:34:53 2009
@@ -48,7 +48,6 @@
/**
* Test cases for Netscape cookie draft
*
- * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
*
* @version $Revision$
*/
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java Sun Feb 15 16:34:53 2009
@@ -49,7 +49,6 @@
/**
* Test cases for RFC2109 cookie spec
*
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*
* @version $Revision$
*/
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2965Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2965Spec.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2965Spec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2965Spec.java Sun Feb 15 16:34:53 2009
@@ -48,7 +48,6 @@
/**
* Test cases for RFC2965 cookie spec
*
- * @author jain.samit@gmail.com (Samit Jain)
*/
public class TestCookieRFC2965Spec extends TestCase {
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestDateUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestDateUtils.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestDateUtils.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestDateUtils.java Sun Feb 15 16:34:53 2009
@@ -41,7 +41,6 @@
/**
* Unit tests for {@link DateUtils}.
*
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*/
public class TestDateUtils extends TestCase {
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestNetscapeDraftHeaderParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestNetscapeDraftHeaderParser.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestNetscapeDraftHeaderParser.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestNetscapeDraftHeaderParser.java Sun Feb 15 16:34:53 2009
@@ -43,7 +43,6 @@
/**
* Unit tests for {@link NetscapeDraftHeaderParser}.
*
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*/
public class TestNetscapeDraftHeaderParser extends TestCase {
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestPublicSuffixListParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestPublicSuffixListParser.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestPublicSuffixListParser.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestPublicSuffixListParser.java Sun Feb 15 16:34:53 2009
@@ -1,115 +1,115 @@
-/*
- * $HeadURL$
- * $Revision$
- * $Date$
- *
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.http.impl.cookie;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.apache.http.cookie.CookieOrigin;
-
-public class TestPublicSuffixListParser extends TestCase {
- private static final String LIST_FILE = "/suffixlist.txt";
- private PublicSuffixFilter filter;
-
- public TestPublicSuffixListParser(String testName) {
- super(testName);
- try {
- Reader r = new InputStreamReader(getClass().getResourceAsStream(LIST_FILE), "UTF-8");
- filter = new PublicSuffixFilter(new RFC2109DomainHandler());
- PublicSuffixListParser parser = new PublicSuffixListParser(filter);
- parser.parse(r);
- } catch (IOException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
- public static Test suite() {
- return new TestSuite(TestPublicSuffixListParser.class);
- }
-
- public static void main(String args[]) {
- String[] testCaseName = { TestPublicSuffixListParser.class.getName() };
- junit.textui.TestRunner.main(testCaseName);
- }
-
- public void testParse() throws Exception {
- BasicClientCookie cookie = new BasicClientCookie("name", "value");
-
- cookie.setDomain(".jp");
- assertFalse(filter.match(cookie, new CookieOrigin("apache.jp", 80, "/stuff", false)));
-
- cookie.setDomain(".ac.jp");
- assertFalse(filter.match(cookie, new CookieOrigin("apache.ac.jp", 80, "/stuff", false)));
-
- cookie.setDomain(".any.tokyo.jp");
- assertFalse(filter.match(cookie, new CookieOrigin("apache.any.tokyo.jp", 80, "/stuff", false)));
-
- // exception
- cookie.setDomain(".metro.tokyo.jp");
- assertTrue(filter.match(cookie, new CookieOrigin("apache.metro.tokyo.jp", 80, "/stuff", false)));
- }
-
- public void testUnicode() throws Exception {
- BasicClientCookie cookie = new BasicClientCookie("name", "value");
-
- cookie.setDomain(".h\u00E5.no"); // \u00E5 is <aring>
- assertFalse(filter.match(cookie, new CookieOrigin("apache.h\u00E5.no", 80, "/stuff", false)));
-
- cookie.setDomain(".xn--h-2fa.no");
- assertFalse(filter.match(cookie, new CookieOrigin("apache.xn--h-2fa.no", 80, "/stuff", false)));
-
- cookie.setDomain(".h\u00E5.no");
- assertFalse(filter.match(cookie, new CookieOrigin("apache.xn--h-2fa.no", 80, "/stuff", false)));
-
- cookie.setDomain(".xn--h-2fa.no");
- assertFalse(filter.match(cookie, new CookieOrigin("apache.h\u00E5.no", 80, "/stuff", false)));
- }
-
- public void testWhitespace() throws Exception {
- BasicClientCookie cookie = new BasicClientCookie("name", "value");
- cookie.setDomain(".xx");
- assertFalse(filter.match(cookie, new CookieOrigin("apache.xx", 80, "/stuff", false)));
-
- // yy appears after whitespace
- cookie.setDomain(".yy");
- assertTrue(filter.match(cookie, new CookieOrigin("apache.yy", 80, "/stuff", false)));
-
- // zz is commented
- cookie.setDomain(".zz");
- assertTrue(filter.match(cookie, new CookieOrigin("apache.zz", 80, "/stuff", false)));
- }
-}
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.impl.cookie;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.http.cookie.CookieOrigin;
+
+public class TestPublicSuffixListParser extends TestCase {
+ private static final String LIST_FILE = "/suffixlist.txt";
+ private PublicSuffixFilter filter;
+
+ public TestPublicSuffixListParser(String testName) {
+ super(testName);
+ try {
+ Reader r = new InputStreamReader(getClass().getResourceAsStream(LIST_FILE), "UTF-8");
+ filter = new PublicSuffixFilter(new RFC2109DomainHandler());
+ PublicSuffixListParser parser = new PublicSuffixListParser(filter);
+ parser.parse(r);
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public static Test suite() {
+ return new TestSuite(TestPublicSuffixListParser.class);
+ }
+
+ public static void main(String args[]) {
+ String[] testCaseName = { TestPublicSuffixListParser.class.getName() };
+ junit.textui.TestRunner.main(testCaseName);
+ }
+
+ public void testParse() throws Exception {
+ BasicClientCookie cookie = new BasicClientCookie("name", "value");
+
+ cookie.setDomain(".jp");
+ assertFalse(filter.match(cookie, new CookieOrigin("apache.jp", 80, "/stuff", false)));
+
+ cookie.setDomain(".ac.jp");
+ assertFalse(filter.match(cookie, new CookieOrigin("apache.ac.jp", 80, "/stuff", false)));
+
+ cookie.setDomain(".any.tokyo.jp");
+ assertFalse(filter.match(cookie, new CookieOrigin("apache.any.tokyo.jp", 80, "/stuff", false)));
+
+ // exception
+ cookie.setDomain(".metro.tokyo.jp");
+ assertTrue(filter.match(cookie, new CookieOrigin("apache.metro.tokyo.jp", 80, "/stuff", false)));
+ }
+
+ public void testUnicode() throws Exception {
+ BasicClientCookie cookie = new BasicClientCookie("name", "value");
+
+ cookie.setDomain(".h\u00E5.no"); // \u00E5 is <aring>
+ assertFalse(filter.match(cookie, new CookieOrigin("apache.h\u00E5.no", 80, "/stuff", false)));
+
+ cookie.setDomain(".xn--h-2fa.no");
+ assertFalse(filter.match(cookie, new CookieOrigin("apache.xn--h-2fa.no", 80, "/stuff", false)));
+
+ cookie.setDomain(".h\u00E5.no");
+ assertFalse(filter.match(cookie, new CookieOrigin("apache.xn--h-2fa.no", 80, "/stuff", false)));
+
+ cookie.setDomain(".xn--h-2fa.no");
+ assertFalse(filter.match(cookie, new CookieOrigin("apache.h\u00E5.no", 80, "/stuff", false)));
+ }
+
+ public void testWhitespace() throws Exception {
+ BasicClientCookie cookie = new BasicClientCookie("name", "value");
+ cookie.setDomain(".xx");
+ assertFalse(filter.match(cookie, new CookieOrigin("apache.xx", 80, "/stuff", false)));
+
+ // yy appears after whitespace
+ cookie.setDomain(".yy");
+ assertTrue(filter.match(cookie, new CookieOrigin("apache.yy", 80, "/stuff", false)));
+
+ // zz is commented
+ cookie.setDomain(".zz");
+ assertTrue(filter.match(cookie, new CookieOrigin("apache.zz", 80, "/stuff", false)));
+ }
+}
Propchange: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/cookie/TestPublicSuffixListParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/EchoHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/EchoHandler.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/EchoHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/EchoHandler.java Sun Feb 15 16:34:53 2009
@@ -51,8 +51,6 @@
/**
* A handler that echos the incoming request entity.
*
- * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*
*
* <!-- empty lines to avoid 'svn diff' problems -->
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/LocalTestServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/LocalTestServer.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/LocalTestServer.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/LocalTestServer.java Sun Feb 15 16:34:53 2009
@@ -69,8 +69,6 @@
* Local HTTP server for tests that require one.
* Based on the <code>ElementalHttpServer</code> example in HttpCore.
*
- * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*
*
* <!-- empty lines to avoid 'svn diff' problems -->
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/RandomHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/RandomHandler.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/RandomHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/RandomHandler.java Sun Feb 15 16:34:53 2009
@@ -51,8 +51,6 @@
/**
* A handler that generates random data.
*
- * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*
*
* <!-- empty lines to avoid 'svn diff' problems -->
Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/mockup/HttpConnectionMockup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/mockup/HttpConnectionMockup.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/mockup/HttpConnectionMockup.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/mockup/HttpConnectionMockup.java Sun Feb 15 16:34:53 2009
@@ -38,7 +38,6 @@
/**
* {@link HttpConnection} mockup implementation.
*
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*/
public class HttpConnectionMockup implements HttpConnection {
Propchange: httpcomponents/httpclient/trunk/module-client/src/test/resources/suffixlist.txt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java (original)
+++ httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java Sun Feb 15 16:34:53 2009
@@ -43,7 +43,6 @@
* automatically populates the header with standard fields based
* on the content description of the enclosed body.
*
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*/
public class FormBodyPart extends BodyPart {
Modified: httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/HttpMultipart.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/HttpMultipart.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/HttpMultipart.java (original)
+++ httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/HttpMultipart.java Sun Feb 15 16:34:53 2009
@@ -56,7 +56,6 @@
* capable of operating either in the strict (fully RFC 822, RFC 2045,
* RFC 2046 compliant) or the browser compatible modes.
*
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*/
public class HttpMultipart extends Multipart {
Modified: httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntity.java?rev=744689&r1=744688&r2=744689&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntity.java (original)
+++ httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntity.java Sun Feb 15 16:34:53 2009
@@ -52,7 +52,6 @@
* Multipart/form coded HTTP entity consisting of multiple
* body parts.
*
- * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*/
public class MultipartEntity implements HttpEntity {
Propchange: httpcomponents/httpclient/trunk/module-httpmime/src/main/java/org/apache/http/entity/mime/content/AbstractContentBody.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/module-httpmime/src/main/resources/META-INF/LICENSE
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/module-httpmime/src/main/resources/META-INF/NOTICE
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/module-httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartContentBody.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/module-osgi-bundle/src/main/resources/LICENSE
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/module-osgi-bundle/src/main/resources/NOTICE
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/src/main/assembly/bin-with-deps.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/src/main/assembly/bin.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/src/main/assembly/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/src/main/assembly/osgi-bin.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/src/main/assembly/src.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/src/site/resources/images/browser.png
('svn:executable' removed)
Propchange: httpcomponents/httpclient/trunk/src/site/resources/images/httpclient.png
('svn:executable' removed)