Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/AutoCloseInputStream.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/AutoCloseInputStream.java (.../AutoCloseInputStream.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/AutoCloseInputStream.java (.../AutoCloseInputStream.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -130,6 +131,23 @@ } /** + * Obtains the number of bytes that can be read without blocking. + * + * @return the number of bytes available without blocking + * @throws IOException in case of a problem + */ + public int available() throws IOException { + int a = 0; // not -1 + + if (isReadAllowed()) { + a = super.available(); + // no checkClose() here, available() can't trigger EOF + } + + return a; + } + + /** * Close the stream, and also close the underlying stream if it is not * already closed. * @throws IOException If an IO problem occurs. Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ChunkedInputStream.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ChunkedInputStream.java (.../ChunkedInputStream.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ChunkedInputStream.java (.../ChunkedInputStream.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ChunkedOutputStream.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ChunkedOutputStream.java (.../ChunkedOutputStream.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ChunkedOutputStream.java (.../ChunkedOutputStream.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/CircularRedirectException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/CircularRedirectException.java (.../CircularRedirectException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/CircularRedirectException.java (.../CircularRedirectException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ConnectMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ConnectMethod.java (.../ConnectMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ConnectMethod.java (.../ConnectMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -49,13 +50,18 @@ /** the name of this method */ public static final String NAME = "CONNECT"; + private final HostConfiguration targethost; + /** + * @deprecated use #ConnectMethod(HttpHost); + * * Create a connect method. * * @since 3.0 */ public ConnectMethod() { - LOG.trace("enter ConnectMethod()"); + super(); + this.targethost = null; } /** @@ -67,18 +73,53 @@ * to the server */ public ConnectMethod(HttpMethod method) { - LOG.trace("enter ConnectMethod(HttpMethod)"); + super(); + this.targethost = null; } /** + * Create a connect method. + * + * @since 3.0 + */ + public ConnectMethod(final HostConfiguration targethost) { + super(); + if (targethost == null) { + throw new IllegalArgumentException("Target host may not be null"); + } + this.targethost = targethost; + } + + /** * Provide the {@link #NAME name} of this method. * * @return the String "CONNECT" */ public String getName() { return NAME; } + + public String getPath() { + if (this.targethost != null) { + StringBuffer buffer = new StringBuffer(); + buffer.append(this.targethost.getHost()); + int port = this.targethost.getPort(); + if (port == -1) { + port = this.targethost.getProtocol().getDefaultPort(); + } + buffer.append(':'); + buffer.append(port); + return buffer.toString(); + } else { + return "/"; + } + } + public URI getURI() throws URIException { + String charset = getParams().getUriCharset(); + return new URI(getPath(), true, charset); + } + /** * This method does nothing. CONNECT request is not supposed * to contain Cookie request header. @@ -158,15 +199,17 @@ */ protected void writeRequestLine(HttpState state, HttpConnection conn) throws IOException, HttpException { - int port = conn.getPort(); - if (port == -1) { - port = conn.getProtocol().getDefaultPort(); - } StringBuffer buffer = new StringBuffer(); buffer.append(getName()); buffer.append(' '); - buffer.append(conn.getHost()); - if (port > -1) { + if (this.targethost != null) { + buffer.append(getPath()); + } else { + int port = conn.getPort(); + if (port == -1) { + port = conn.getProtocol().getDefaultPort(); + } + buffer.append(conn.getHost()); buffer.append(':'); buffer.append(port); } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ConnectTimeoutException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ConnectTimeoutException.java (.../ConnectTimeoutException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ConnectTimeoutException.java (.../ConnectTimeoutException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ConnectionPoolTimeoutException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ConnectionPoolTimeoutException.java (.../ConnectionPoolTimeoutException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ConnectionPoolTimeoutException.java (.../ConnectionPoolTimeoutException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ContentLengthInputStream.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ContentLengthInputStream.java (.../ContentLengthInputStream.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ContentLengthInputStream.java (.../ContentLengthInputStream.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -204,4 +205,16 @@ } return length; } + + public int available() throws IOException { + if (this.closed) { + return 0; + } + int avail = this.wrappedStream.available(); + if (this.pos + avail > this.contentLength ) { + avail = (int)(this.contentLength - this.pos); + } + return avail; + } + } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Cookie.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Cookie.java (.../Cookie.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Cookie.java (.../Cookie.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -30,10 +31,8 @@ package org.apache.commons.httpclient; import java.io.Serializable; -import java.text.RuleBasedCollator; import java.util.Comparator; import java.util.Date; -import java.util.Locale; import org.apache.commons.httpclient.cookie.CookiePolicy; import org.apache.commons.httpclient.cookie.CookieSpec; @@ -481,7 +480,7 @@ return 1; } } else { - return STRING_COLLATOR.compare(c1.getPath(), c2.getPath()); + return c1.getPath().compareTo(c2.getPath()); } } @@ -530,14 +529,6 @@ // -------------------------------------------------------------- Constants - /** - * Collator for Cookie comparisons. Could be replaced with references to - * specific Locales. - */ - private static final RuleBasedCollator STRING_COLLATOR = - (RuleBasedCollator) RuleBasedCollator.getInstance( - new Locale("en", "US", "")); - /** Log object for this class */ private static final Log LOG = LogFactory.getLog(Cookie.class); Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Credentials.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Credentials.java (.../Credentials.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Credentials.java (.../Credentials.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/DefaultHttpMethodRetryHandler.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/DefaultHttpMethodRetryHandler.java (.../DefaultHttpMethodRetryHandler.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/DefaultHttpMethodRetryHandler.java (.../DefaultHttpMethodRetryHandler.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/DefaultMethodRetryHandler.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/DefaultMethodRetryHandler.java (.../DefaultMethodRetryHandler.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/DefaultMethodRetryHandler.java (.../DefaultMethodRetryHandler.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Header.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Header.java (.../Header.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Header.java (.../Header.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HeaderElement.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HeaderElement.java (.../HeaderElement.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HeaderElement.java (.../HeaderElement.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HeaderGroup.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HeaderGroup.java (.../HeaderGroup.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HeaderGroup.java (.../HeaderGroup.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2003-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HostConfiguration.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HostConfiguration.java (.../HostConfiguration.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HostConfiguration.java (.../HostConfiguration.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -80,6 +81,10 @@ * @param hostConfiguration the hostConfiguration to copy */ public HostConfiguration (final HostConfiguration hostConfiguration) { + init(hostConfiguration); + } + + private void init(final HostConfiguration hostConfiguration) { // wrap all of the assignments in a synchronized block to avoid // having to negotiate the monitor for each method call synchronized (hostConfiguration) { @@ -106,7 +111,14 @@ * @see java.lang.Object#clone() */ public Object clone() { - return new HostConfiguration(this); + HostConfiguration copy; + try { + copy = (HostConfiguration) super.clone(); + } catch (CloneNotSupportedException e) { + throw new IllegalArgumentException("Host configuration could not be cloned"); + } + copy.init(this); + return copy; } /** Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpClient.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpClient.java (.../HttpClient.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpClient.java (.../HttpClient.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -152,9 +153,7 @@ } this.params = params; this.httpConnectionManager = httpConnectionManager; - if (this.httpConnectionManager != null) { - this.httpConnectionManager.getParams().setDefaults(this.params); - } + this.httpConnectionManager.getParams().setDefaults(this.params); } /** @@ -329,6 +328,7 @@ * {@link HostConfiguration host configuration}. * * @param hostConfiguration The {@link HostConfiguration host configuration} to use. + * If null, the host configuration returned by {@link #getHostConfiguration} will be used. * @param method the {@link HttpMethod HTTP method} to execute. * @return the method's response code * @@ -354,9 +354,10 @@ * {@link HttpState HTTP state}. * * @param hostconfig The {@link HostConfiguration host configuration} to use. + * If null, the host configuration returned by {@link #getHostConfiguration} will be used. * @param method the {@link HttpMethod HTTP method} to execute. * @param state the {@link HttpState HTTP state} to use when executing the method. - * If null, the state returned by {@link #getState} will be used instead. + * If null, the state returned by {@link #getState} will be used. * * @return the method's response code * @@ -382,7 +383,7 @@ URI uri = method.getURI(); if (hostconfig == defaulthostconfig || uri.isAbsoluteURI()) { // make a deep copy of the host defaults - hostconfig = new HostConfiguration(hostconfig); + hostconfig = (HostConfiguration) hostconfig.clone(); if (uri.isAbsoluteURI()) { hostconfig.setHost(uri); } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpClientError.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpClientError.java (.../HttpClientError.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpClientError.java (.../HttpClientError.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpConnection.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpConnection.java (.../HttpConnection.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpConnection.java (.../HttpConnection.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpConnectionManager.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpConnectionManager.java (.../HttpConnectionManager.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpConnectionManager.java (.../HttpConnectionManager.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpConstants.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpConstants.java (.../HttpConstants.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpConstants.java (.../HttpConstants.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpContentTooLargeException.java =================================================================== diff -u --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpContentTooLargeException.java (revision 0) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpContentTooLargeException.java (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -0,0 +1,22 @@ +package org.apache.commons.httpclient; + +/** + * Signals that the response content was larger than anticipated. + * + * @author Ortwin Gl�ck + */ +public class HttpContentTooLargeException extends HttpException { + private int maxlen; + + public HttpContentTooLargeException(String message, int maxlen) { + super(message); + this.maxlen = maxlen; + } + + /** + * @return the maximum anticipated content length in bytes. + */ + public int getMaxLength() { + return maxlen; + } +} Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpException.java (.../HttpException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpException.java (.../HttpException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpHost.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpHost.java (.../HttpHost.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpHost.java (.../HttpHost.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -113,16 +114,23 @@ */ public HttpHost (final HttpHost httphost) { super(); + init(httphost); + } + + private void init(final HttpHost httphost) { this.hostname = httphost.hostname; this.port = httphost.port; this.protocol = httphost.protocol; } /** + * @throws CloneNotSupportedException * @see java.lang.Object#clone() */ - public Object clone() { - return new HttpHost(this); + public Object clone() throws CloneNotSupportedException { + HttpHost copy = (HttpHost) super.clone(); + copy.init(this); + return copy; } /** @@ -158,10 +166,8 @@ */ public String toURI() { StringBuffer buffer = new StringBuffer(50); - if (this.protocol != null) { - buffer.append(this.protocol.getScheme()); - buffer.append("://"); - } + buffer.append(this.protocol.getScheme()); + buffer.append("://"); buffer.append(this.hostname); if (this.port != this.protocol.getDefaultPort()) { buffer.append(':'); Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethod.java (.../HttpMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethod.java (.../HttpMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethodBase.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethodBase.java (.../HttpMethodBase.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethodBase.java (.../HttpMethodBase.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -39,6 +40,7 @@ import org.apache.commons.httpclient.auth.AuthState; import org.apache.commons.httpclient.cookie.CookiePolicy; import org.apache.commons.httpclient.cookie.CookieSpec; +import org.apache.commons.httpclient.cookie.CookieVersionSupport; import org.apache.commons.httpclient.cookie.MalformedCookieException; import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.commons.httpclient.protocol.Protocol; @@ -107,7 +109,7 @@ private HeaderGroup requestHeaders = new HeaderGroup(); /** The Status-Line from the response. */ - private StatusLine statusLine = null; + protected StatusLine statusLine = null; /** Response headers, if any. */ private HeaderGroup responseHeaders = new HeaderGroup(); @@ -171,10 +173,10 @@ private static final int RESPONSE_WAIT_TIME_MS = 3000; /** HTTP protocol version used for execution of this method. */ - private HttpVersion effectiveVersion = null; + protected HttpVersion effectiveVersion = null; /** Whether the execution of this method has been aborted */ - private transient boolean aborted = false; + private volatile boolean aborted = false; /** Whether the HTTP request has been transmitted to the target * server it its entirety */ @@ -214,7 +216,8 @@ if (uri == null || uri.equals("")) { uri = "/"; } - setURI(new URI(uri, true)); + String charset = getParams().getUriCharset(); + setURI(new URI(uri, true, charset)); } catch (URIException e) { throw new IllegalArgumentException("Invalid uri '" + uri + "': " + e.getMessage() @@ -258,7 +261,8 @@ buffer.append('?'); buffer.append(this.queryString); } - return new URI(buffer.toString(), true); + String charset = getParams().getUriCharset(); + return new URI(buffer.toString(), true, charset); } /** @@ -651,7 +655,9 @@ /** * Returns the response body of the HTTP method, if any, as an array of bytes. - * If response body is not available or cannot be read, returns null + * If response body is not available or cannot be read, returns null. + * Buffers the response and this method can be called several times yielding + * the same result each time. * * Note: This will cause the entire response body to be buffered in memory. A * malicious server may easily exhaust all the VM memory. It is strongly @@ -693,10 +699,71 @@ } /** + * Returns the response body of the HTTP method, if any, as an array of bytes. + * If response body is not available or cannot be read, returns null. + * Buffers the response and this method can be called several times yielding + * the same result each time. + * + * Note: This will cause the entire response body to be buffered in memory. This method is + * safe if the content length of the response is unknown, because the amount of memory used + * is limited.

+ * + * If the response is large this method involves lots of array copying and many object + * allocations, which makes it unsuitable for high-performance / low-footprint applications. + * Those applications should use {@link #getResponseBodyAsStream()}. + * + * @param maxlen the maximum content length to accept (number of bytes). + * @return The response body. + * + * @throws IOException If an I/O (transport) problem occurs while obtaining the + * response body. + */ + public byte[] getResponseBody(int maxlen) throws IOException { + if (maxlen < 0) throw new IllegalArgumentException("maxlen must be positive"); + if (this.responseBody == null) { + InputStream instream = getResponseBodyAsStream(); + if (instream != null) { + // we might already know that the content is larger + long contentLength = getResponseContentLength(); + if ((contentLength != -1) && (contentLength > maxlen)) { + throw new HttpContentTooLargeException( + "Content-Length is " + contentLength, maxlen); + } + + LOG.debug("Buffering response body"); + ByteArrayOutputStream rawdata = new ByteArrayOutputStream( + contentLength > 0 ? (int) contentLength : DEFAULT_INITIAL_BUFFER_SIZE); + byte[] buffer = new byte[2048]; + int pos = 0; + int len; + do { + len = instream.read(buffer, 0, Math.min(buffer.length, maxlen-pos)); + if (len == -1) break; + rawdata.write(buffer, 0, len); + pos += len; + } while (pos < maxlen); + + setResponseStream(null); + // check if there is even more data + if (pos == maxlen) { + if (instream.read() != -1) + throw new HttpContentTooLargeException( + "Content-Length not known but larger than " + + maxlen, maxlen); + } + this.responseBody = rawdata.toByteArray(); + } + } + return this.responseBody; + } + + /** * Returns the response body of the HTTP method, if any, as an {@link InputStream}. - * If response body is not available, returns null + * If response body is not available, returns null. If the response has been + * buffered this method returns a new stream object on every call. If the response + * has not been buffered the returned stream can only be read once. * - * @return The response body + * @return The response body or null. * * @throws IOException If an I/O (transport) problem occurs while obtaining the * response body. @@ -717,14 +784,15 @@ * Returns the response body of the HTTP method, if any, as a {@link String}. * If response body is not available or cannot be read, returns null * The string conversion on the data is done using the character encoding specified - * in Content-Type header. + * in Content-Type header. Buffers the response and this method can be + * called several times yielding the same result each time. * * Note: This will cause the entire response body to be buffered in memory. A * malicious server may easily exhaust all the VM memory. It is strongly * recommended, to use getResponseAsStream if the content length of the response * is unknown or resonably large. * - * @return The response body. + * @return The response body or null. * * @throws IOException If an I/O (transport) problem occurs while obtaining the * response body. @@ -740,6 +808,41 @@ return null; } } + + /** + * Returns the response body of the HTTP method, if any, as a {@link String}. + * If response body is not available or cannot be read, returns null + * The string conversion on the data is done using the character encoding specified + * in Content-Type header. Buffers the response and this method can be + * called several times yielding the same result each time.

+ * + * Note: This will cause the entire response body to be buffered in memory. This method is + * safe if the content length of the response is unknown, because the amount of memory used + * is limited.

+ * + * If the response is large this method involves lots of array copying and many object + * allocations, which makes it unsuitable for high-performance / low-footprint applications. + * Those applications should use {@link #getResponseBodyAsStream()}. + * + * @param maxlen the maximum content length to accept (number of bytes). Note that, + * depending on the encoding, this is not equal to the number of characters. + * @return The response body or null. + * + * @throws IOException If an I/O (transport) problem occurs while obtaining the + * response body. + */ + public String getResponseBodyAsString(int maxlen) throws IOException { + if (maxlen < 0) throw new IllegalArgumentException("maxlen must be positive"); + byte[] rawdata = null; + if (responseAvailable()) { + rawdata = getResponseBody(maxlen); + } + if (rawdata != null) { + return EncodingUtil.getString(rawdata, getResponseCharSet()); + } else { + return null; + } + } /** * Returns an array of the response footers that the HTTP method currently has @@ -1190,6 +1293,20 @@ getRequestHeaderGroup().addHeader(new Header("Cookie", s, true)); } } + if (matcher instanceof CookieVersionSupport) { + CookieVersionSupport versupport = (CookieVersionSupport) matcher; + int ver = versupport.getVersion(); + boolean needVersionHeader = false; + for (int i = 0; i < cookies.length; i++) { + if (ver != cookies[i].getVersion()) { + needVersionHeader = true; + } + } + if (needVersionHeader) { + // Advertise cookie version support + getRequestHeaderGroup().addHeader(versupport.getVersionHeader()); + } + } } } @@ -1462,14 +1579,42 @@ LOG.trace("enter HttpMethodBase.processResponseHeaders(HttpState, " + "HttpConnection)"); - Header[] headers = getResponseHeaderGroup().getHeaders("set-cookie2"); - //Only process old style set-cookie headers if new style headres - //are not present - if (headers.length == 0) { - headers = getResponseHeaderGroup().getHeaders("set-cookie"); - } - CookieSpec parser = getCookieSpec(state); + + // process set-cookie headers + Header[] headers = getResponseHeaderGroup().getHeaders("set-cookie"); + processCookieHeaders(parser, headers, state, conn); + + // see if the cookie spec supports cookie versioning. + if (parser instanceof CookieVersionSupport) { + CookieVersionSupport versupport = (CookieVersionSupport) parser; + if (versupport.getVersion() > 0) { + // process set-cookie2 headers. + // Cookie2 will replace equivalent Cookie instances + headers = getResponseHeaderGroup().getHeaders("set-cookie2"); + processCookieHeaders(parser, headers, state, conn); + } + } + } + + /** + * This method processes the specified cookie headers. It is invoked from + * within {@link #processResponseHeaders(HttpState,HttpConnection)} + * + * @param headers cookie {@link Header}s to be processed + * @param state the {@link HttpState state} information associated with + * this HTTP method + * @param conn the {@link HttpConnection connection} used to execute + * this HTTP method + */ + protected void processCookieHeaders( + final CookieSpec parser, + final Header[] headers, + final HttpState state, + final HttpConnection conn) { + LOG.trace("enter HttpMethodBase.processCookieHeaders(Header[], HttpState, " + + "HttpConnection)"); + String host = this.params.getVirtualHost(); if (host == null) { host = conn.getHost(); @@ -1789,11 +1934,7 @@ Header[] headers = HttpParser.parseHeaders( conn.getResponseInputStream(), getParams().getHttpElementCharset()); - if (Wire.HEADER_WIRE.enabled()) { - for (int i = 0; i < headers.length; i++) { - Wire.HEADER_WIRE.input(headers[i].toExternalForm()); - } - } + // Wire logging moved to HttpParser getResponseHeaderGroup().setHeaders(headers); } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethodDirector.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethodDirector.java (.../HttpMethodDirector.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethodDirector.java (.../HttpMethodDirector.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -452,7 +453,7 @@ releaseConnection = true; throw e; } catch (RuntimeException e) { - if (this.conn.isOpen) { + if (this.conn.isOpen()) { LOG.debug("Closing the connection."); this.conn.close(); } @@ -472,7 +473,7 @@ private boolean executeConnect() throws IOException, HttpException { - this.connectMethod = new ConnectMethod(); + this.connectMethod = new ConnectMethod(this.hostConfiguration); this.connectMethod.getParams().setDefaults(this.hostConfiguration.getParams()); int code; @@ -515,6 +516,7 @@ this.connectMethod = null; return true; } else { + this.conn.close(); return false; } } @@ -594,7 +596,10 @@ this.conn.getPort(), method.getPath() ); - redirectUri = new URI(location, true); + + String charset = method.getParams().getUriCharset(); + redirectUri = new URI(location, true, charset); + if (redirectUri.isRelativeURI()) { if (this.params.isParameterTrue(HttpClientParams.REJECT_RELATIVE_REDIRECT)) { LOG.warn("Relative redirect location '" + location + "' not allowed"); @@ -604,12 +609,15 @@ LOG.debug("Redirect URI is not absolute - parsing as relative"); redirectUri = new URI(currentUri, redirectUri); } + } else { + // Reset the default params + method.getParams().setDefaults(this.params); } method.setURI(redirectUri); hostConfiguration.setHost(redirectUri); - } catch (URIException e) { - LOG.warn("Redirected location '" + location + "' is malformed"); - return false; + } catch (URIException ex) { + throw new InvalidRedirectLocationException( + "Invalid redirect location: " + location, location, ex); } if (this.params.isParameterFalse(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS)) { @@ -811,8 +819,6 @@ if (method.getFollowRedirects()) { return true; } else { - LOG.info("Redirect requested but followRedirects is " - + "disabled"); return false; } default: Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethodRetryHandler.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethodRetryHandler.java (.../HttpMethodRetryHandler.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpMethodRetryHandler.java (.../HttpMethodRetryHandler.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpParser.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpParser.java (.../HttpParser.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpParser.java (.../HttpParser.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -119,7 +120,17 @@ } } } - return EncodingUtil.getString(rawdata, 0, len - offset, charset); + final String result = + EncodingUtil.getString(rawdata, 0, len - offset, charset); + if (Wire.HEADER_WIRE.enabled()) { + String logoutput = result; + if (offset == 2) + logoutput = result + "\r\n"; + else if (offset == 1) + logoutput = result + "\n"; + Wire.HEADER_WIRE.input(logoutput); + } + return result; } /** Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpRecoverableException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpRecoverableException.java (.../HttpRecoverableException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpRecoverableException.java (.../HttpRecoverableException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpState.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpState.java (.../HttpState.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpState.java (.../HttpState.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -68,23 +69,23 @@ * Map of {@link Credentials credentials} by realm that this * HTTP state contains. */ - private HashMap credMap = new HashMap(); + protected HashMap credMap = new HashMap(); /** * Map of {@link Credentials proxy credentials} by realm that this * HTTP state contains */ - private HashMap proxyCred = new HashMap(); + protected HashMap proxyCred = new HashMap(); /** * Array of {@link Cookie cookies} that this HTTP state contains. */ - private ArrayList cookies = new ArrayList(); + protected ArrayList cookies = new ArrayList(); private boolean preemptive = false; private int cookiePolicy = -1; - // -------------------------------------------------------- Class Variables + // -------------------------------------------------------- Class Variables /** * The boolean system property name to turn on preemptive authentication. @@ -610,7 +611,7 @@ /** * Clears all cookies. */ - public void clearCookies() { + public synchronized void clearCookies() { this.cookies.clear(); } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpStatus.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpStatus.java (.../HttpStatus.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpStatus.java (.../HttpStatus.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpURL.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpURL.java (.../HttpURL.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpURL.java (.../HttpURL.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -548,7 +549,8 @@ "escaped user not valid"); } String username = new String(escapedUser); - String password = new String(getRawPassword()); + char[] rawPassword = getRawPassword(); + String password = rawPassword == null ? null : new String(rawPassword); String userinfo = username + ((password == null) ? "" : ":" + password); String hostname = new String(getRawHost()); String hostport = (_port == -1) ? hostname : hostname + ":" + _port; @@ -643,7 +645,7 @@ throw new URIException(URIException.PARSING, "username required"); } String username = new String(getRawUser()); - String password = new String(escapedPassword); + String password = escapedPassword == null ? null : new String(escapedPassword); // an emtpy string is allowed as a password String userinfo = username + ((password == null) ? "" : ":" + password); String hostname = new String(getRawHost()); @@ -828,5 +830,51 @@ } } + /** + * Once it's parsed successfully, set this URI. + * + * @see #getRawURI + */ + protected void setURI() { + // set _uri + StringBuffer buf = new StringBuffer(); + // ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? + if (_scheme != null) { + buf.append(_scheme); + buf.append(':'); + } + if (_is_net_path) { + buf.append("//"); + if (_authority != null) { // has_authority + if (_userinfo != null) { // by default, remove userinfo part + if (_host != null) { + buf.append(_host); + if (_port != -1) { + buf.append(':'); + buf.append(_port); + } + } + } else { + buf.append(_authority); + } + } + } + if (_opaque != null && _is_opaque_part) { + buf.append(_opaque); + } else if (_path != null) { + // _is_hier_part or _is_relativeURI + if (_path.length != 0) { + buf.append(_path); + } + } + if (_query != null) { // has_query + buf.append('?'); + buf.append(_query); + } + // ignore the fragment identifier + _uri = buf.toString().toCharArray(); + hash = 0; + } + } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpVersion.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpVersion.java (.../HttpVersion.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpVersion.java (.../HttpVersion.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpsURL.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpsURL.java (.../HttpsURL.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/HttpsURL.java (.../HttpsURL.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/InvalidRedirectLocationException.java =================================================================== diff -u --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/InvalidRedirectLocationException.java (revision 0) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/InvalidRedirectLocationException.java (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -0,0 +1,74 @@ +/* + * $HeadRL$ + * $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 + * . + * + */ + +package org.apache.commons.httpclient; + +/** + * Signals violation of HTTP specification caused by an invalid redirect + * location + * + * @author Oleg Kalnichevski + * + * @since 3.1 + */ +public class InvalidRedirectLocationException extends RedirectException { + + private final String location; + + /** + * Creates a new InvalidRedirectLocationException with the specified detail message. + * + * @param message the exception detail message + * @param location redirect location + */ + public InvalidRedirectLocationException(final String message, final String location) { + super(message); + this.location = location; + } + + /** + * Creates a new RedirectException with the specified detail message and cause. + * + * @param message the exception detail message + * @param location redirect location + * @param cause the Throwable that caused this exception, or null + * if the cause is unavailable, unknown, or not a Throwable + */ + public InvalidRedirectLocationException(final String message, final String location, + final Throwable cause) { + super(message, cause); + this.location = location; + } + + public String getLocation() { + return this.location; + } + +} Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/MethodRetryHandler.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/MethodRetryHandler.java (.../MethodRetryHandler.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/MethodRetryHandler.java (.../MethodRetryHandler.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java (.../MultiThreadedHttpConnectionManager.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java (.../MultiThreadedHttpConnectionManager.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -112,12 +113,20 @@ synchronized (REFERENCE_TO_CONNECTION_SOURCE) { // shutdown all connection managers synchronized (ALL_CONNECTION_MANAGERS) { - Iterator connIter = ALL_CONNECTION_MANAGERS.keySet().iterator(); - while (connIter.hasNext()) { - MultiThreadedHttpConnectionManager connManager = - (MultiThreadedHttpConnectionManager) connIter.next(); - connIter.remove(); - connManager.shutdown(); + // Don't use an iterator here. Iterators on WeakHashMap can + // get ConcurrentModificationException on garbage collection. + MultiThreadedHttpConnectionManager[] + connManagers = (MultiThreadedHttpConnectionManager[]) + ALL_CONNECTION_MANAGERS.keySet().toArray( + new MultiThreadedHttpConnectionManager + [ALL_CONNECTION_MANAGERS.size()] + ); + + // The map may shrink after size() is called, or some entry + // may get GCed while the array is built, so expect null. + for (int i=0; iThe connection manager can no longer be used once shutdown. + *

The connection manager can no longer be used once shut down. * *

Calling this method more than once will have no effect. */ @@ -337,7 +346,7 @@ * {@link HttpConnectionManager#getParams()}. */ public void setMaxTotalConnections(int maxTotalConnections) { - this.params.getMaxTotalConnections(); + this.params.setMaxTotalConnections(maxTotalConnections); } /** @@ -373,7 +382,20 @@ } /** - * @see HttpConnectionManager#getConnectionWithTimeout(HostConfiguration, long) + * Gets a connection or waits if one is not available. A connection is + * available if one exists that is not being used or if fewer than + * maxHostConnections have been created in the connectionPool, and fewer + * than maxTotalConnections have been created in all connectionPools. + * + * @param hostConfiguration The host configuration specifying the connection + * details. + * @param timeout the number of milliseconds to wait for a connection, 0 to + * wait indefinitely + * + * @return HttpConnection an available connection + * + * @throws HttpException if a connection does not become available in + * 'timeout' milliseconds * * @since 3.0 */ @@ -414,21 +436,6 @@ } } - /** - * Gets a connection or waits if one is not available. A connection is - * available if one exists that is not being used or if fewer than - * maxHostConnections have been created in the connectionPool, and fewer - * than maxTotalConnections have been created in all connectionPools. - * - * @param hostConfiguration The host configuration. - * @param timeout the number of milliseconds to wait for a connection, 0 to - * wait indefinitely - * - * @return HttpConnection an available connection - * - * @throws HttpException if a connection does not become available in - * 'timeout' milliseconds - */ private HttpConnection doGetConnection(HostConfiguration hostConfiguration, long timeout) throws ConnectionPoolTimeoutException { @@ -442,7 +449,7 @@ // we clone the hostConfiguration // so that it cannot be changed once the connection has been retrieved hostConfiguration = new HostConfiguration(hostConfiguration); - HostConnectionPool hostPool = connectionPool.getHostPool(hostConfiguration); + HostConnectionPool hostPool = connectionPool.getHostPool(hostConfiguration, true); WaitingThread waitingThread = null; boolean useTimeout = (timeout > 0); @@ -498,6 +505,8 @@ waitingThread = new WaitingThread(); waitingThread.hostConnectionPool = hostPool; waitingThread.thread = Thread.currentThread(); + } else { + waitingThread.interruptedByConnectionPool = false; } if (useTimeout) { @@ -507,14 +516,24 @@ hostPool.waitingThreads.addLast(waitingThread); connectionPool.waitingThreads.addLast(waitingThread); connectionPool.wait(timeToWait); - - // we have not been interrupted so we need to remove ourselves from the - // wait queue - hostPool.waitingThreads.remove(waitingThread); - connectionPool.waitingThreads.remove(waitingThread); } catch (InterruptedException e) { - // do nothing + if (!waitingThread.interruptedByConnectionPool) { + LOG.debug("Interrupted while waiting for connection", e); + throw new IllegalThreadStateException( + "Interrupted while waiting in MultiThreadedHttpConnectionManager"); + } + // Else, do nothing, we were interrupted by the connection pool + // and should now have a connection waiting for us, continue + // in the loop and let's get it. } finally { + if (!waitingThread.interruptedByConnectionPool) { + // Either we timed out, experienced a "spurious wakeup", or were + // interrupted by an external thread. Regardless we need to + // cleanup for ourselves in the wait queue. + hostPool.waitingThreads.remove(waitingThread); + connectionPool.waitingThreads.remove(waitingThread); + } + if (useTimeout) { endWait = System.currentTimeMillis(); timeToWait -= (endWait - startWait); @@ -538,8 +557,8 @@ */ public int getConnectionsInPool(HostConfiguration hostConfiguration) { synchronized (connectionPool) { - HostConnectionPool hostPool = connectionPool.getHostPool(hostConfiguration); - return hostPool.numConnections; + HostConnectionPool hostPool = connectionPool.getHostPool(hostConfiguration, false); + return (hostPool != null) ? hostPool.numConnections : 0; } } @@ -597,6 +616,7 @@ */ public void closeIdleConnections(long idleTimeout) { connectionPool.closeIdleConnections(idleTimeout); + deleteClosedConnections(); } /** @@ -717,6 +737,7 @@ while (iter.hasNext()) { WaitingThread waiter = (WaitingThread) iter.next(); iter.remove(); + waiter.interruptedByConnectionPool = true; waiter.thread.interrupt(); } @@ -734,7 +755,7 @@ * @return a new connection or null if none are available */ public synchronized HttpConnection createConnection(HostConfiguration hostConfiguration) { - HostConnectionPool hostPool = getHostPool(hostConfiguration); + HostConnectionPool hostPool = getHostPool(hostConfiguration, true); if (LOG.isDebugEnabled()) { LOG.debug("Allocating new connection, hostConfig=" + hostConfiguration); } @@ -758,9 +779,14 @@ * @param config the host configuration of the connection that was lost */ public synchronized void handleLostConnection(HostConfiguration config) { - HostConnectionPool hostPool = getHostPool(config); + HostConnectionPool hostPool = getHostPool(config, true); hostPool.numConnections--; + if ((hostPool.numConnections == 0) && + hostPool.waitingThreads.isEmpty()) { + mapHosts.remove(config); + } + numConnections--; notifyWaitingThread(config); } @@ -769,15 +795,19 @@ * Get the pool (list) of connections available for the given hostConfig. * * @param hostConfiguration the configuraton for the connection pool - * @return a pool (list) of connections available for the given config + * @param create true to create a pool if not found, + * false to return null + * + * @return a pool (list) of connections available for the given config, + * or null if neither found nor created */ - public synchronized HostConnectionPool getHostPool(HostConfiguration hostConfiguration) { + public synchronized HostConnectionPool getHostPool(HostConfiguration hostConfiguration, boolean create) { LOG.trace("enter HttpConnectionManager.ConnectionPool.getHostPool(HostConfiguration)"); // Look for a list of connections for the given config HostConnectionPool listConnections = (HostConnectionPool) mapHosts.get(hostConfiguration); - if (listConnections == null) { + if ((listConnections == null) && create) { // First time for this config listConnections = new HostConnectionPool(); listConnections.hostConfiguration = hostConfiguration; @@ -797,10 +827,10 @@ HttpConnectionWithReference connection = null; - HostConnectionPool hostPool = getHostPool(hostConfiguration); + HostConnectionPool hostPool = getHostPool(hostConfiguration, false); - if (hostPool.freeConnections.size() > 0) { - connection = (HttpConnectionWithReference) hostPool.freeConnections.removeFirst(); + if ((hostPool != null) && (hostPool.freeConnections.size() > 0)) { + connection = (HttpConnectionWithReference) hostPool.freeConnections.removeLast(); freeConnections.remove(connection); // store a reference to this connection so that it can be cleaned up // in the event it is not correctly released @@ -861,12 +891,17 @@ connection.close(); - HostConnectionPool hostPool = getHostPool(connectionConfiguration); + HostConnectionPool hostPool = getHostPool(connectionConfiguration, true); hostPool.freeConnections.remove(connection); hostPool.numConnections--; numConnections--; + if ((hostPool.numConnections == 0) && + hostPool.waitingThreads.isEmpty()) { + mapHosts.remove(connectionConfiguration); + } + // remove the connection from the timeout handler idleConnectionHandler.remove(connection); } @@ -892,7 +927,7 @@ * @see #notifyWaitingThread(HostConnectionPool) */ public synchronized void notifyWaitingThread(HostConfiguration configuration) { - notifyWaitingThread(getHostPool(configuration)); + notifyWaitingThread(getHostPool(configuration, true)); } /** @@ -913,7 +948,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("Notifying thread waiting on host pool, hostConfig=" + hostPool.hostConfiguration); - } + } waitingThread = (WaitingThread) hostPool.waitingThreads.removeFirst(); waitingThreads.remove(waitingThread); } else if (waitingThreads.size() > 0) { @@ -927,6 +962,7 @@ } if (waitingThread != null) { + waitingThread.interruptedByConnectionPool = true; waitingThread.thread.interrupt(); } } @@ -952,7 +988,7 @@ return; } - HostConnectionPool hostPool = getHostPool(connectionConfiguration); + HostConnectionPool hostPool = getHostPool(connectionConfiguration, true); // Put the connect back in the available list and notify a waiter hostPool.freeConnections.add(conn); @@ -1023,6 +1059,11 @@ /** The connection pool the thread is waiting for */ public HostConnectionPool hostConnectionPool; + + /** Flag to indicate if the thread was interrupted by the ConnectionPool. Set + * to true inside {@link ConnectionPool#notifyWaitingThread(HostConnectionPool)} + * before the thread is interrupted. */ + public boolean interruptedByConnectionPool = false; } /** @@ -1031,7 +1072,7 @@ */ private static class ReferenceQueueThread extends Thread { - private boolean shutdown = false; + private volatile boolean shutdown = false; /** * Create an instance and make this a daemon thread. @@ -1043,6 +1084,7 @@ public void shutdown() { this.shutdown = true; + this.interrupt(); } /** @@ -1076,10 +1118,8 @@ public void run() { while (!shutdown) { try { - // remove the next reference and process it, a timeout - // is used so that the thread does not block indefinitely - // and therefore keep the thread from shutting down - Reference ref = REFERENCE_QUEUE.remove(1000); + // remove the next reference and process it + Reference ref = REFERENCE_QUEUE.remove(); if (ref != null) { handleReference(ref); } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/NTCredentials.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/NTCredentials.java (.../NTCredentials.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/NTCredentials.java (.../NTCredentials.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/NameValuePair.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/NameValuePair.java (.../NameValuePair.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/NameValuePair.java (.../NameValuePair.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/NoHttpResponseException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/NoHttpResponseException.java (.../NoHttpResponseException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/NoHttpResponseException.java (.../NoHttpResponseException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ProtocolException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ProtocolException.java (.../ProtocolException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ProtocolException.java (.../ProtocolException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ProxyClient.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ProxyClient.java (.../ProxyClient.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ProxyClient.java (.../ProxyClient.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -36,7 +37,6 @@ import org.apache.commons.httpclient.params.HttpConnectionManagerParams; import org.apache.commons.httpclient.params.HttpParams; - /** * A client that provides {@link java.net.Socket sockets} for communicating through HTTP proxies * via the HTTP CONNECT method. This is primarily needed for non-HTTP protocols that wish to @@ -179,22 +179,26 @@ */ public ConnectResponse connect() throws IOException, HttpException { - if (getHostConfiguration().getProxyHost() == null) { + HostConfiguration hostconf = getHostConfiguration(); + if (hostconf.getProxyHost() == null) { throw new IllegalStateException("proxy host must be configured"); } - if (getHostConfiguration().getHost() == null) { + if (hostconf.getHost() == null) { throw new IllegalStateException("destination host must be configured"); } + if (hostconf.getProtocol().isSecure()) { + throw new IllegalStateException("secure protocol socket factory may not be used"); + } - ConnectMethod method = new ConnectMethod(); + ConnectMethod method = new ConnectMethod(getHostConfiguration()); method.getParams().setDefaults(getParams()); DummyConnectionManager connectionManager = new DummyConnectionManager(); connectionManager.setConnectionParams(getParams()); HttpMethodDirector director = new HttpMethodDirector( connectionManager, - getHostConfiguration(), + hostconf, getParams(), getState() ); Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ProxyHost.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ProxyHost.java (.../ProxyHost.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ProxyHost.java (.../ProxyHost.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -73,10 +74,12 @@ } /** + * @throws CloneNotSupportedException * @see java.lang.Object#clone() */ - public Object clone() { - return new ProxyHost(this); + public Object clone() throws CloneNotSupportedException { + ProxyHost copy = (ProxyHost) super.clone(); + return copy; } } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/RedirectException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/RedirectException.java (.../RedirectException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/RedirectException.java (.../RedirectException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ResponseConsumedWatcher.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ResponseConsumedWatcher.java (.../ResponseConsumedWatcher.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/ResponseConsumedWatcher.java (.../ResponseConsumedWatcher.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/SimpleHttpConnectionManager.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/SimpleHttpConnectionManager.java (.../SimpleHttpConnectionManager.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/SimpleHttpConnectionManager.java (.../SimpleHttpConnectionManager.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -71,7 +72,6 @@ try { lastResponse.close(); } catch (IOException ioe) { - //FIXME: badness - close to force reconnect. conn.close(); } } @@ -97,8 +97,29 @@ * It will not be used to enforce thread safety. */ private volatile boolean inUse = false; + + private boolean alwaysClose = false; + + /** + * The connection manager created with this constructor will try to keep the + * connection open (alive) between consecutive requests if the alwaysClose + * parameter is set to false. Otherwise the connection manager will + * always close connections upon release. + * + * @param alwaysClose if set true, the connection manager will always + * close connections upon release. + */ + public SimpleHttpConnectionManager(boolean alwaysClose) { + super(); + this.alwaysClose = alwaysClose; + } + /** + * The connection manager created with this constructor will always try to keep + * the connection open (alive) between consecutive requests. + */ public SimpleHttpConnectionManager() { + super(); } /** @@ -138,8 +159,13 @@ } /** - * @see HttpConnectionManager#getConnectionWithTimeout(HostConfiguration, long) + * This method always returns the same connection object. If the connection is already + * open, it will be closed and the new host configuration will be applied. * + * @param hostConfiguration The host configuration specifying the connection + * details. + * @param timeout this parameter has no effect. The connection is always returned + * immediately. * @since 3.0 */ public HttpConnection getConnectionWithTimeout( @@ -198,8 +224,12 @@ if (conn != httpConnection) { throw new IllegalStateException("Unexpected release of an unknown connection."); } - - finishLastResponse(httpConnection); + if (this.alwaysClose) { + httpConnection.close(); + } else { + // make sure the connection is reuseable + finishLastResponse(httpConnection); + } inUse = false; @@ -243,4 +273,12 @@ httpConnection.close(); } } + + /** + * since 3.1 + */ + public void shutdown() { + httpConnection.close(); + } + } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/StatusLine.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/StatusLine.java (.../StatusLine.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/StatusLine.java (.../StatusLine.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/URI.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/URI.java (.../URI.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/URI.java (.../URI.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -1,16 +1,17 @@ /* - * $Header$ + * $HeadURL: https://svn.apache.org/repos/asf/jakarta/httpcomponents/oac.hc3x/tags/HTTPCLIENT_3_1/src/java/org/apache/commons/httpclient/URI.java $ * $Revision$ * $Date$ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -33,6 +34,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; +import java.util.Arrays; import java.util.Locale; import java.util.BitSet; import java.util.Hashtable; @@ -272,8 +274,7 @@ getProtocolCharset()); // Set flag _is_opaque_part = true; - _fragment = fragment.toCharArray(); - + _fragment = fragment == null ? null : fragment.toCharArray(); setURI(); } @@ -513,6 +514,7 @@ if (base._scheme != null) { this._scheme = base._scheme; this._authority = base._authority; + this._is_net_path = base._is_net_path; } if (base._is_opaque_part || relative._is_opaque_part) { this._scheme = base._scheme; @@ -523,7 +525,9 @@ this.setURI(); return; } - if (relative._scheme != null) { + boolean schemesEqual = Arrays.equals(base._scheme,relative._scheme); + if (relative._scheme != null + && (!schemesEqual || relative._authority != null)) { this._scheme = relative._scheme; this._is_net_path = relative._is_net_path; this._authority = relative._authority; @@ -566,7 +570,8 @@ this._path = relative._path; } // resolve the path and query if necessary - if (relative._scheme == null && relative._authority == null) { + if (relative._authority == null + && (relative._scheme == null || schemesEqual)) { if ((relative._path == null || relative._path.length == 0) && relative._query == null) { // handle a reference to the current document, see RFC 2396 @@ -709,7 +714,7 @@ /** * The root path. */ - protected static char[] rootPath = { '/' }; + protected static final char[] rootPath = { '/' }; // ---------------------- Generous characters for each component validation @@ -1553,6 +1558,7 @@ allowed_abs_path.or(abs_path); // allowed_abs_path.set('/'); // aleady included allowed_abs_path.andNot(percent); + allowed_abs_path.clear('+'); } @@ -1564,6 +1570,7 @@ static { allowed_rel_path.or(rel_path); allowed_rel_path.clear('%'); + allowed_rel_path.clear('+'); } @@ -1913,7 +1920,8 @@ boolean isStartedFromPath = false; int atColon = tmp.indexOf(':'); int atSlash = tmp.indexOf('/'); - if (atColon <= 0 || (atSlash >= 0 && atSlash < atColon)) { + if ((atColon <= 0 && !tmp.startsWith("//")) + || (atSlash >= 0 && atSlash < atColon)) { isStartedFromPath = true; } @@ -1959,7 +1967,8 @@ if (0 <= at && at < length && tmp.charAt(at) == '/') { // Set flag _is_hier_part = true; - if (at + 2 < length && tmp.charAt(at + 1) == '/') { + if (at + 2 < length && tmp.charAt(at + 1) == '/' + && !isStartedFromPath) { // the temporary index to start the search from int next = indexFirstOf(tmp, "/?#", at + 2); if (next == -1) { @@ -2009,10 +2018,11 @@ _path = null; } } + String s = tmp.substring(from, next); if (escaped) { - setRawPath(tmp.substring(from, next).toCharArray()); + setRawPath(s.toCharArray()); } else { - setPath(tmp.substring(from, next)); + setPath(s); } at = next; } @@ -2033,8 +2043,14 @@ if (next == -1) { next = tmp.length(); } - _query = (escaped) ? tmp.substring(at + 1, next).toCharArray() - : encode(tmp.substring(at + 1, next), allowed_query, charset); + if (escaped) { + _query = tmp.substring(at + 1, next).toCharArray(); + if (!validate(_query, uric)) { + throw new URIException("Invalid query"); + } + } else { + _query = encode(tmp.substring(at + 1, next), allowed_query, charset); + } at = next; } @@ -2214,8 +2230,14 @@ _is_server = _is_hostname = _is_IPv4address = _is_IPv6reference = false; // set a registry-based naming authority - _authority = (escaped) ? original.toString().toCharArray() - : encode(original.toString(), allowed_reg_name, charset); + if (escaped) { + _authority = original.toCharArray(); + if (!validate(_authority, reg_name)) { + throw new URIException("Invalid authority"); + } + } else { + _authority = encode(original, allowed_reg_name, charset); + } } else { if (original.length() - 1 > next && hasPort && original.charAt(next) == ':') { // not empty @@ -2263,17 +2285,7 @@ if (_is_net_path) { buf.append("//"); if (_authority != null) { // has_authority - if (_userinfo != null) { // by default, remove userinfo part - if (_host != null) { - buf.append(_host); - if (_port != -1) { - buf.append(':'); - buf.append(_port); - } - } - } else { - buf.append(_authority); - } + buf.append(_authority); } } if (_opaque != null && _is_opaque_part) { @@ -2930,16 +2942,17 @@ // REMINDME: paths are never null String base = (basePath == null) ? "" : new String(basePath); - int at = base.lastIndexOf('/'); - if (at != -1) { - basePath = base.substring(0, at + 1).toCharArray(); - } + // _path could be empty if (relPath == null || relPath.length == 0) { return normalize(basePath); } else if (relPath[0] == '/') { return normalize(relPath); } else { + int at = base.lastIndexOf('/'); + if (at != -1) { + basePath = base.substring(0, at + 1).toCharArray(); + } StringBuffer buff = new StringBuffer(base.length() + relPath.length); buff.append((at != -1) ? base.substring(0, at + 1) : "/"); @@ -3594,7 +3607,7 @@ * @param oos the object-output stream * @throws IOException If an IO problem occurs. */ - protected void writeObject(ObjectOutputStream oos) + private void writeObject(ObjectOutputStream oos) throws IOException { oos.defaultWriteObject(); @@ -3609,7 +3622,7 @@ * input stream cannot be found. * @throws IOException If an IO problem occurs. */ - protected void readObject(ObjectInputStream ois) + private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); @@ -3671,9 +3684,9 @@ * * @return a clone of this instance */ - public synchronized Object clone() { + public synchronized Object clone() throws CloneNotSupportedException { - URI instance = new URI(); + URI instance = (URI) super.clone(); instance._uri = _uri; instance._scheme = _scheme; Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/URIException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/URIException.java (.../URIException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/URIException.java (.../URIException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/UsernamePasswordCredentials.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/UsernamePasswordCredentials.java (.../UsernamePasswordCredentials.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/UsernamePasswordCredentials.java (.../UsernamePasswordCredentials.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Wire.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Wire.java (.../Wire.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/Wire.java (.../Wire.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/WireLogInputStream.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/WireLogInputStream.java (.../WireLogInputStream.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/WireLogInputStream.java (.../WireLogInputStream.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/WireLogOutputStream.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/WireLogOutputStream.java (.../WireLogOutputStream.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/WireLogOutputStream.java (.../WireLogOutputStream.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthChallengeException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthChallengeException.java (.../AuthChallengeException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthChallengeException.java (.../AuthChallengeException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthChallengeParser.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthChallengeParser.java (.../AuthChallengeParser.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthChallengeParser.java (.../AuthChallengeParser.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthChallengeProcessor.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthChallengeProcessor.java (.../AuthChallengeProcessor.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthChallengeProcessor.java (.../AuthChallengeProcessor.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthPolicy.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthPolicy.java (.../AuthPolicy.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthPolicy.java (.../AuthPolicy.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthScheme.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthScheme.java (.../AuthScheme.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthScheme.java (.../AuthScheme.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthSchemeBase.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthSchemeBase.java (.../AuthSchemeBase.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthSchemeBase.java (.../AuthSchemeBase.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthScope.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthScope.java (.../AuthScope.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthScope.java (.../AuthScope.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthState.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthState.java (.../AuthState.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthState.java (.../AuthState.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthenticationException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthenticationException.java (.../AuthenticationException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/AuthenticationException.java (.../AuthenticationException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/BasicScheme.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/BasicScheme.java (.../BasicScheme.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/BasicScheme.java (.../BasicScheme.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/CredentialsNotAvailableException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/CredentialsNotAvailableException.java (.../CredentialsNotAvailableException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/CredentialsNotAvailableException.java (.../CredentialsNotAvailableException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/CredentialsProvider.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/CredentialsProvider.java (.../CredentialsProvider.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/CredentialsProvider.java (.../CredentialsProvider.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/DigestScheme.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/DigestScheme.java (.../DigestScheme.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/DigestScheme.java (.../DigestScheme.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -304,7 +305,15 @@ + credentials.getClass().getName()); } getParameters().put("methodname", method.getName()); - getParameters().put("uri", method.getPath()); + StringBuffer buffer = new StringBuffer(method.getPath()); + String query = method.getQueryString(); + if (query != null) { + if (query.indexOf("?") != 0) { + buffer.append("?"); + } + buffer.append(method.getQueryString()); + } + getParameters().put("uri", buffer.toString()); String charset = getParameter("charset"); if (charset == null) { getParameters().put("charset", method.getParams().getCredentialCharset()); Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/HttpAuthRealm.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/HttpAuthRealm.java (.../HttpAuthRealm.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/HttpAuthRealm.java (.../HttpAuthRealm.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/HttpAuthenticator.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/HttpAuthenticator.java (.../HttpAuthenticator.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/HttpAuthenticator.java (.../HttpAuthenticator.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/InvalidCredentialsException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/InvalidCredentialsException.java (.../InvalidCredentialsException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/InvalidCredentialsException.java (.../InvalidCredentialsException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/MalformedChallengeException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/MalformedChallengeException.java (.../MalformedChallengeException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/MalformedChallengeException.java (.../MalformedChallengeException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/NTLM.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/NTLM.java (.../NTLM.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/NTLM.java (.../NTLM.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/NTLMScheme.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/NTLMScheme.java (.../NTLMScheme.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/NTLMScheme.java (.../NTLMScheme.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/RFC2617Scheme.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/RFC2617Scheme.java (.../RFC2617Scheme.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/auth/RFC2617Scheme.java (.../RFC2617Scheme.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/Cookie2.java =================================================================== diff -u --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/Cookie2.java (revision 0) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/Cookie2.java (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -0,0 +1,310 @@ +/* + * $Header$ + * $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 + * . + * + */ + +package org.apache.commons.httpclient.cookie; + +import java.util.Date; + +import org.apache.commons.httpclient.Cookie; + +/** + *

+ * Cookie class for {@link org.apache.commons.httpclient.cookie.RFC2965Spec} + * cookie specification. It extends {@link Cookie} class and adds newer cookie + * attributes and functions required for this specification. + *

+ * + * @author Samit Jain (jain.samit@gmail.com) + * + * @since 3.1 + */ +public class Cookie2 extends Cookie { + + // string constants for cookie attributes + public static final String DOMAIN = "domain"; + public static final String PATH = "path"; + public static final String PORT = "port"; + public static final String VERSION = "version"; + public static final String SECURE = "secure"; + public static final String MAXAGE = "max-age"; + public static final String COMMENT = "comment"; + public static final String COMMENTURL = "commenturl"; + public static final String DISCARD = "discard"; + + /** + * Default constructor. Creates a blank cookie + */ + public Cookie2() { + super(null, "noname", null, null, null, false); + } + + /** + * Creates a cookie with the given name, value and domain attribute. + * + * @param name the cookie name + * @param value the cookie value + * @param domain the domain this cookie can be sent to + */ + public Cookie2(String domain, String name, String value) { + super(domain, name, value); + } + + /** + * Creates a cookie with the given name, value, domain attribute, + * path attribute, expiration attribute, and secure attribute + * + * @param name the cookie name + * @param value the cookie value + * @param domain the domain this cookie can be sent to + * @param path the path prefix for which this cookie can be sent + * @param expires the {@link Date} at which this cookie expires, + * or null if the cookie expires at the end + * of the session + * @param secure if true this cookie can only be sent over secure + * connections + * @throws IllegalArgumentException If cookie name is null or blank, + * cookie name contains a blank, or cookie name starts with character $ + * + */ + public Cookie2(String domain, String name, String value, + String path, Date expires, boolean secure) { + super(domain, name, value, path, expires, secure); + } + + /** + * Creates a cookie with the given name, value, domain attribute, + * path attribute, expiration attribute, secure attribute, and ports + * attribute. + * + * @param name the cookie name + * @param value the cookie value + * @param domain the domain this cookie can be sent to + * @param path the path prefix for which this cookie can be sent + * @param expires the {@link Date} at which this cookie expires, + * or null if the cookie expires at the end + * of the session + * @param secure if true this cookie can only be sent over secure + * connections + * @param ports the ports for which this cookie can be sent + * @throws IllegalArgumentException If cookie name is null or blank, + * cookie name contains a blank, or cookie name starts with character $ + * + */ + public Cookie2(String domain, String name, String value, + String path, Date expires, boolean secure, int[] ports) { + super(domain, name, value, path, expires, secure); + setPorts(ports); + } + + /** + * If a user agent (web browser) presents this cookie to a user, the + * cookie's purpose will be described by the information at this URL. + * + * @see #setCommentURL(String) + */ + public String getCommentURL() { + return cookieCommentURL; + } + + /** + * If a user agent (web browser) presents this cookie to a user, the + * cookie's purpose will be described by the information at this URL. + * + * @param commentURL + * + * @see #getCommentURL() + */ + public void setCommentURL(String commentURL) { + this.cookieCommentURL = commentURL; + } + + /** + * Get the Port attribute. It restricts the ports to which a cookie + * may be returned in a Cookie request header. + * + * @see #setPorts(int[]) + */ + public int[] getPorts() { + return cookiePorts; + } + + /** + * Set the Port attribute. It restricts the ports to which a cookie + * may be returned in a Cookie request header. + * + * @param ports + * + * @see #getPorts() + */ + public void setPorts(int[] ports) { + this.cookiePorts = ports; + } + + /** + * Set the Discard attribute. + * + * Note: Discard attribute overrides Max-age. + * + * @see #isPersistent() + */ + public void setDiscard(boolean toDiscard) { + discard = toDiscard; + } + + /** + * Returns false if the cookie should be discarded at the end + * of the "session"; true otherwise. + * + * @return false if the cookie should be discarded at the end + * of the "session"; true otherwise + */ + public boolean isPersistent() { + return (null != getExpiryDate()) && !discard; + } + + /** + * Indicates whether the cookie had a port attribute specified in the + * Set-Cookie2 response header. + * + * @param value true if port attribute is specified in response + * header. + * + * @see #isPortAttributeSpecified + */ + public void setPortAttributeSpecified(boolean value) { + hasPortAttribute = value; + } + + /** + * @return true if cookie port attribute was specified in the + * Set-Cookie2 header. + * + * @see #setPortAttributeSpecified + */ + public boolean isPortAttributeSpecified() { + return hasPortAttribute; + } + + /** + * Indicates whether the Port attribute in Set-Cookie2 header + * contains no value (is of the form Port=""). + *

+ * This value is required for generating + * the Cookie request header because the specification requires that if + * Set-Cookie2 header contains a blank value for port attribute, + * the Cookie header should also contain a port attribute with no value. + * + * @param value true if port attribute is specified as blank in response + * header. + * + * @see #isPortAttributeBlank + */ + public void setPortAttributeBlank(boolean value) { + isPortAttributeBlank = value; + } + + /** + * @return true if the port attribute in Set-Cookie2 header + * had no value (was of the form Port=""). + * + * @see #setPortAttributeBlank + */ + public boolean isPortAttributeBlank() { + return isPortAttributeBlank; + } + + /** + * Indicates whether the cookie had a version attribute specified in the + * Set-Cookie2 response header. + * + * @param value true if version attribute is specified in response + * header. + * @see #isVersionAttributeSpecified() + */ + public void setVersionAttributeSpecified(boolean value) { + hasVersionAttribute = value; + } + + /** + * @return true if cookie version attribute was specified in the + * Set-Cookie2 header. + * + * @see #setVersionAttributeSpecified + */ + public boolean isVersionAttributeSpecified() { + return hasVersionAttribute; + } + + /** + * Return a textual representation of the cookie. + * + * @return string. + */ + public String toExternalForm() { + CookieSpec spec = + CookiePolicy.getCookieSpec(CookiePolicy.RFC_2965); + return spec.formatCookie(this); + } + + /** + * Comment URL attribute + */ + private String cookieCommentURL; + + /** + * Port attribute. + */ + private int[] cookiePorts; + + /** + * Discard attribute. + */ + private boolean discard = false; + + /** + * Indicates if the set-cookie2 header included a Port attribute for this + * cookie + */ + private boolean hasPortAttribute = false; + + /** + * Indicates if the set-cookie2 header's Port attribute did not have + * any value. + */ + private boolean isPortAttributeBlank = false; + + /** + * Indicates if the set-cookie2 header included a Version attribute + */ + private boolean hasVersionAttribute = false; + + +} + Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieAttributeHandler.java =================================================================== diff -u --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieAttributeHandler.java (revision 0) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieAttributeHandler.java (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -0,0 +1,79 @@ +/* + * $HeadURL:https://svn.apache.org/repos/asf/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/cookie/CookieAttributeHandler.java $ + * $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 + * . + * + */ +package org.apache.commons.httpclient.cookie; + +import org.apache.commons.httpclient.Cookie; + +/** + * Ths interface represents a cookie attribute handler responsible + * for parsing, validating, and matching a specific cookie attribute, + * such as path, domain, port, etc. + * + * Different cookie specifications can provide a specific + * implementation for this class based on their cookie handling + * rules. + * + * @author jain.samit@gmail.com (Samit Jain) + * + * @since 3.1 + */ +public interface CookieAttributeHandler { + + /** + * Parse the given cookie attribute value and update the corresponding + * {@link org.apache.commons.httpclient.Cookie} property. + * + * @param cookie {@link org.apache.commons.httpclient.Cookie} to be updated + * @param value cookie attribute value from the cookie response header + */ + void parse(Cookie cookie, String value) + throws MalformedCookieException; + + /** + * Peforms cookie validation for the given attribute value. + * + * @param cookie {@link org.apache.commons.httpclient.Cookie} to validate + * @param origin the cookie source to validate against + * @throws MalformedCookieException if cookie validation fails for this attribute + */ + void validate(Cookie cookie, CookieOrigin origin) + throws MalformedCookieException; + + /** + * Matches the given value (property of the destination host where request is being + * submitted) with the corresponding cookie attribute. + * + * @param cookie {@link org.apache.commons.httpclient.Cookie} to match + * @param origin the cookie source to match against + * @return true if the match is successful; false otherwise + */ + boolean match(Cookie cookie, CookieOrigin origin); + +} Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieOrigin.java =================================================================== diff -u --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieOrigin.java (revision 0) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieOrigin.java (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -0,0 +1,86 @@ +/* + * $HeadURL:https://svn.apache.org/repos/asf/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/cookie/CookieOrigin.java $ + * $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 + * . + * + */ +package org.apache.commons.httpclient.cookie; + +/** + * CookieOrigin class incapsulates details of an origin server that + * are relevant when parsing, validating or matching HTTP cookies. + * + * @author Oleg Kalnichevski + * + * @since 3.1 + */ +public final class CookieOrigin { + + private final String host; + private final int port; + private final String path; + private final boolean secure; + + public CookieOrigin(final String host, int port, final String path, boolean secure) { + super(); + if (host == null) { + throw new IllegalArgumentException( + "Host of origin may not be null"); + } + if (host.trim().equals("")) { + throw new IllegalArgumentException( + "Host of origin may not be blank"); + } + if (port < 0) { + throw new IllegalArgumentException("Invalid port: " + port); + } + if (path == null) { + throw new IllegalArgumentException( + "Path of origin may not be null."); + } + this.host = host; + this.port = port; + this.path = path; + this.secure = secure; + } + + public String getHost() { + return this.host; + } + + public String getPath() { + return this.path; + } + + public int getPort() { + return this.port; + } + + public boolean isSecure() { + return this.secure; + } + +} Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookiePathComparator.java =================================================================== diff -u --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookiePathComparator.java (revision 0) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookiePathComparator.java (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -0,0 +1,83 @@ +/* + * $Header$ + * $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 + * . + * + */ + +package org.apache.commons.httpclient.cookie; + +import java.util.Comparator; + +import org.apache.commons.httpclient.Cookie; + +/** + * This cookie comparator ensures that multiple cookies satisfying + * a common criteria are ordered in the Cookie header such + * that those with more specific Path attributes precede those with + * less specific. + * + *

+ * This comparator assumes that Path attributes of two cookies + * path-match a commmon request-URI. Otherwise, the result of the + * comparison is undefined. + *

+ * + * @author Oleg Kalnichevski + * + * @since 3.1 + */ +public class CookiePathComparator implements Comparator { + + private String normalizePath(final Cookie cookie) { + String path = cookie.getPath(); + if (path == null) { + path = "/"; + } + if (!path.endsWith("/")) { + path = path + "/"; + } + return path; + } + + public int compare(final Object o1, final Object o2) { + Cookie c1 = (Cookie) o1; + Cookie c2 = (Cookie) o2; + String path1 = normalizePath(c1); + String path2 = normalizePath(c2); + if (path1.equals(path2)) { + return 0; + } else if (path1.startsWith(path2)) { + return -1; + } else if (path2.startsWith(path1)) { + return 1; + } else { + // Does not really matter + return 0; + } + } + +} Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookiePolicy.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookiePolicy.java (.../CookiePolicy.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookiePolicy.java (.../CookiePolicy.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -80,8 +81,15 @@ * @since 3.0 */ public static final String RFC_2109 = "rfc2109"; - - /** + + /** + * The RFC 2965 compliant policy. + * + * @since 3.0 + */ + public static final String RFC_2965 = "rfc2965"; + + /** * The policy that ignores cookies. * * @since 3.0 @@ -98,6 +106,7 @@ static { CookiePolicy.registerCookieSpec(DEFAULT, RFC2109Spec.class); CookiePolicy.registerCookieSpec(RFC_2109, RFC2109Spec.class); + CookiePolicy.registerCookieSpec(RFC_2965, RFC2965Spec.class); CookiePolicy.registerCookieSpec(BROWSER_COMPATIBILITY, CookieSpecBase.class); CookiePolicy.registerCookieSpec(NETSCAPE, NetscapeDraftSpec.class); CookiePolicy.registerCookieSpec(IGNORE_COOKIES, IgnoreCookiesSpec.class); @@ -125,7 +134,14 @@ */ public static final int RFC2109 = 2; - /** + /** + * The RFC2965 RFC 2965 compliant policy. + * + * @deprecated Use {@link #RFC_2965} + */ + public static final int RFC2965 = 3; + + /** * The default cookie policy. * * @deprecated Use {@link #DEFAULT} @@ -241,6 +257,8 @@ return new NetscapeDraftSpec(); case RFC2109: return new RFC2109Spec(); + case RFC2965: + return new RFC2965Spec(); default: return getDefaultSpec(); } @@ -302,4 +320,19 @@ public static CookieSpec getCompatibilitySpec() { return getSpecByPolicy(COMPATIBILITY); } + + /** + * Obtains the currently registered cookie policy names. + * + * Note that the DEFAULT policy (if present) is likely to be the same + * as one of the other policies, but does not have to be. + * + * @return array of registered cookie policy names + * + * @since 3.1 + */ + public static String[] getRegisteredCookieSpecs(){ + return (String[]) SPECS.keySet().toArray(new String [SPECS.size()]); + } + } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieSpec.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieSpec.java (.../CookieSpec.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieSpec.java (.../CookieSpec.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieSpecBase.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieSpecBase.java (.../CookieSpecBase.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieSpecBase.java (.../CookieSpecBase.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieVersionSupport.java =================================================================== diff -u --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieVersionSupport.java (revision 0) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/CookieVersionSupport.java (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -0,0 +1,48 @@ +/* + * $Header$ + * $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 + * . + * + */ + +package org.apache.commons.httpclient.cookie; + +import org.apache.commons.httpclient.Header; + +/** + * Defines cookie specification specific capabilities + * + * @author Oleg Kalnichevski + * + * @since 3.1 + */ +public interface CookieVersionSupport { + + int getVersion(); + + Header getVersionHeader(); + +} Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/IgnoreCookiesSpec.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/IgnoreCookiesSpec.java (.../IgnoreCookiesSpec.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/IgnoreCookiesSpec.java (.../IgnoreCookiesSpec.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/MalformedCookieException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/MalformedCookieException.java (.../MalformedCookieException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/MalformedCookieException.java (.../MalformedCookieException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/NetscapeDraftSpec.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/NetscapeDraftSpec.java (.../NetscapeDraftSpec.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/NetscapeDraftSpec.java (.../NetscapeDraftSpec.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/RFC2109Spec.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/RFC2109Spec.java (.../RFC2109Spec.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/RFC2109Spec.java (.../RFC2109Spec.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -53,8 +54,14 @@ public class RFC2109Spec extends CookieSpecBase { private final ParameterFormatter formatter; - - /** Default constructor */ + + /** + * Cookie Response Header name for cookies processed + * by this spec. + */ + public final static String SET_COOKIE_KEY = "set-cookie"; + + /** Default constructor */ public RFC2109Spec() { super(); this.formatter = new ParameterFormatter(); Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/RFC2965Spec.java =================================================================== diff -u --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/RFC2965Spec.java (revision 0) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/cookie/RFC2965Spec.java (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -0,0 +1,1118 @@ +/* + * $HeadURL: https://svn.apache.org/repos/asf/jakarta/httpcomponents/oac.hc3x/tags/HTTPCLIENT_3_1/src/java/org/apache/commons/httpclient/cookie/RFC2965Spec.java $ + * $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 + * . + * + */ + +package org.apache.commons.httpclient.cookie; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import org.apache.commons.httpclient.Cookie; +import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.HeaderElement; +import org.apache.commons.httpclient.NameValuePair; +import org.apache.commons.httpclient.util.ParameterFormatter; + +/** + *

RFC 2965 specific cookie management functions.

+ * + * @author jain.samit@gmail.com (Samit Jain) + * + * @since 3.1 + */ +public class RFC2965Spec extends CookieSpecBase implements CookieVersionSupport { + + private static final Comparator PATH_COMPOARATOR = new CookiePathComparator(); + + /** + * Cookie Response Header name for cookies processed + * by this spec. + */ + public final static String SET_COOKIE2_KEY = "set-cookie2"; + + /** + * used for formatting RFC 2956 style cookies + */ + private final ParameterFormatter formatter; + + /** + * Stores the list of attribute handlers + */ + private final List attribHandlerList; + + /** + * Stores attribute name -> attribute handler mappings + */ + private final Map attribHandlerMap; + + /** + * Fallback cookie spec (RFC 2109) + */ + private final CookieSpec rfc2109; + + /** + * Default constructor + * */ + public RFC2965Spec() { + super(); + this.formatter = new ParameterFormatter(); + this.formatter.setAlwaysUseQuotes(true); + this.attribHandlerMap = new HashMap(10); + this.attribHandlerList = new ArrayList(10); + this.rfc2109 = new RFC2109Spec(); + + registerAttribHandler(Cookie2.PATH, new Cookie2PathAttributeHandler()); + registerAttribHandler(Cookie2.DOMAIN, new Cookie2DomainAttributeHandler()); + registerAttribHandler(Cookie2.PORT, new Cookie2PortAttributeHandler()); + registerAttribHandler(Cookie2.MAXAGE, new Cookie2MaxageAttributeHandler()); + registerAttribHandler(Cookie2.SECURE, new CookieSecureAttributeHandler()); + registerAttribHandler(Cookie2.COMMENT, new CookieCommentAttributeHandler()); + registerAttribHandler(Cookie2.COMMENTURL, new CookieCommentUrlAttributeHandler()); + registerAttribHandler(Cookie2.DISCARD, new CookieDiscardAttributeHandler()); + registerAttribHandler(Cookie2.VERSION, new Cookie2VersionAttributeHandler()); + } + + protected void registerAttribHandler( + final String name, final CookieAttributeHandler handler) { + if (name == null) { + throw new IllegalArgumentException("Attribute name may not be null"); + } + if (handler == null) { + throw new IllegalArgumentException("Attribute handler may not be null"); + } + if (!this.attribHandlerList.contains(handler)) { + this.attribHandlerList.add(handler); + } + this.attribHandlerMap.put(name, handler); + } + + /** + * Finds an attribute handler {@link CookieAttributeHandler} for the + * given attribute. Returns null if no attribute handler is + * found for the specified attribute. + * + * @param name attribute name. e.g. Domain, Path, etc. + * @return an attribute handler or null + */ + protected CookieAttributeHandler findAttribHandler(final String name) { + return (CookieAttributeHandler) this.attribHandlerMap.get(name); + } + + /** + * Gets attribute handler {@link CookieAttributeHandler} for the + * given attribute. + * + * @param name attribute name. e.g. Domain, Path, etc. + * @throws IllegalStateException if handler not found for the + * specified attribute. + */ + protected CookieAttributeHandler getAttribHandler(final String name) { + CookieAttributeHandler handler = findAttribHandler(name); + if (handler == null) { + throw new IllegalStateException("Handler not registered for " + + name + " attribute."); + } else { + return handler; + } + } + + protected Iterator getAttribHandlerIterator() { + return this.attribHandlerList.iterator(); + } + + /** + * Parses the Set-Cookie2 value into an array of Cookies. + * + *

The syntax for the Set-Cookie2 response header is: + * + *

+     * set-cookie      =    "Set-Cookie2:" cookies
+     * cookies         =    1#cookie
+     * cookie          =    NAME "=" VALUE * (";" cookie-av)
+     * NAME            =    attr
+     * VALUE           =    value
+     * cookie-av       =    "Comment" "=" value
+     *                 |    "CommentURL" "=" <"> http_URL <">
+     *                 |    "Discard"
+     *                 |    "Domain" "=" value
+     *                 |    "Max-Age" "=" value
+     *                 |    "Path" "=" value
+     *                 |    "Port" [ "=" <"> portlist <"> ]
+     *                 |    "Secure"
+     *                 |    "Version" "=" 1*DIGIT
+     * portlist        =       1#portnum
+     * portnum         =       1*DIGIT
+     * 
+ * + * @param host the host from which the Set-Cookie2 value was + * received + * @param port the port from which the Set-Cookie2 value was + * received + * @param path the path from which the Set-Cookie2 value was + * received + * @param secure true when the Set-Cookie2 value was + * received over secure conection + * @param header the Set-Cookie2 Header received from the server + * @return an array of Cookies parsed from the Set-Cookie2 value + * @throws MalformedCookieException if an exception occurs during parsing + */ + public Cookie[] parse( + String host, int port, String path, boolean secure, final Header header) + throws MalformedCookieException { + LOG.trace("enter RFC2965.parse(" + + "String, int, String, boolean, Header)"); + + if (header == null) { + throw new IllegalArgumentException("Header may not be null."); + } + if (header.getName() == null) { + throw new IllegalArgumentException("Header name may not be null."); + } + + if (header.getName().equalsIgnoreCase(SET_COOKIE2_KEY)) { + // parse cookie2 cookies + return parse(host, port, path, secure, header.getValue()); + } else if (header.getName().equalsIgnoreCase(RFC2109Spec.SET_COOKIE_KEY)) { + // delegate parsing of old-style cookies to rfc2109Spec + return this.rfc2109.parse(host, port, path, secure, header.getValue()); + } else { + throw new MalformedCookieException("Header name is not valid. " + + "RFC 2965 supports \"set-cookie\" " + + "and \"set-cookie2\" headers."); + } + } + + /** + * @see #parse(String, int, String, boolean, org.apache.commons.httpclient.Header) + */ + public Cookie[] parse(String host, int port, String path, + boolean secure, final String header) + throws MalformedCookieException { + LOG.trace("enter RFC2965Spec.parse(" + + "String, int, String, boolean, String)"); + + // before we do anything, lets check validity of arguments + if (host == null) { + throw new IllegalArgumentException( + "Host of origin may not be null"); + } + if (host.trim().equals("")) { + throw new IllegalArgumentException( + "Host of origin may not be blank"); + } + if (port < 0) { + throw new IllegalArgumentException("Invalid port: " + port); + } + if (path == null) { + throw new IllegalArgumentException( + "Path of origin may not be null."); + } + if (header == null) { + throw new IllegalArgumentException("Header may not be null."); + } + + if (path.trim().equals("")) { + path = PATH_DELIM; + } + host = getEffectiveHost(host); + + HeaderElement[] headerElements = + HeaderElement.parseElements(header.toCharArray()); + + List cookies = new LinkedList(); + for (int i = 0; i < headerElements.length; i++) { + HeaderElement headerelement = headerElements[i]; + Cookie2 cookie = null; + try { + cookie = new Cookie2(host, + headerelement.getName(), + headerelement.getValue(), + path, + null, + false, + new int[] {port}); + } catch (IllegalArgumentException ex) { + throw new MalformedCookieException(ex.getMessage()); + } + NameValuePair[] parameters = headerelement.getParameters(); + // could be null. In case only a header element and no parameters. + if (parameters != null) { + // Eliminate duplicate attribues. The first occurence takes precedence + Map attribmap = new HashMap(parameters.length); + for (int j = parameters.length - 1; j >= 0; j--) { + NameValuePair param = parameters[j]; + attribmap.put(param.getName().toLowerCase(), param); + } + for (Iterator it = attribmap.entrySet().iterator(); it.hasNext(); ) { + Map.Entry entry = (Map.Entry) it.next(); + parseAttribute((NameValuePair) entry.getValue(), cookie); + } + } + cookies.add(cookie); + // cycle through the parameters + } + return (Cookie[]) cookies.toArray(new Cookie[cookies.size()]); + } + + /** + * Parse RFC 2965 specific cookie attribute and update the corresponsing + * {@link org.apache.commons.httpclient.Cookie} properties. + * + * @param attribute {@link org.apache.commons.httpclient.NameValuePair} cookie attribute from the + * Set-Cookie2 header. + * @param cookie {@link org.apache.commons.httpclient.Cookie} to be updated + * @throws MalformedCookieException if an exception occurs during parsing + */ + public void parseAttribute( + final NameValuePair attribute, final Cookie cookie) + throws MalformedCookieException { + if (attribute == null) { + throw new IllegalArgumentException("Attribute may not be null."); + } + if (attribute.getName() == null) { + throw new IllegalArgumentException("Attribute Name may not be null."); + } + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null."); + } + final String paramName = attribute.getName().toLowerCase(); + final String paramValue = attribute.getValue(); + + CookieAttributeHandler handler = findAttribHandler(paramName); + if (handler == null) { + // ignore unknown attribute-value pairs + if (LOG.isDebugEnabled()) + LOG.debug("Unrecognized cookie attribute: " + + attribute.toString()); + } else { + handler.parse(cookie, paramValue); + } + } + + /** + * Performs RFC 2965 compliant {@link org.apache.commons.httpclient.Cookie} validation + * + * @param host the host from which the {@link org.apache.commons.httpclient.Cookie} was received + * @param port the port from which the {@link org.apache.commons.httpclient.Cookie} was received + * @param path the path from which the {@link org.apache.commons.httpclient.Cookie} was received + * @param secure true when the {@link org.apache.commons.httpclient.Cookie} was received using a + * secure connection + * @param cookie The cookie to validate + * @throws MalformedCookieException if an exception occurs during + * validation + */ + public void validate(final String host, int port, final String path, + boolean secure, final Cookie cookie) + throws MalformedCookieException { + + LOG.trace("enter RFC2965Spec.validate(String, int, String, " + + "boolean, Cookie)"); + + if (cookie instanceof Cookie2) { + if (cookie.getName().indexOf(' ') != -1) { + throw new MalformedCookieException("Cookie name may not contain blanks"); + } + if (cookie.getName().startsWith("$")) { + throw new MalformedCookieException("Cookie name may not start with $"); + } + CookieOrigin origin = new CookieOrigin(getEffectiveHost(host), port, path, secure); + for (Iterator i = getAttribHandlerIterator(); i.hasNext(); ) { + CookieAttributeHandler handler = (CookieAttributeHandler) i.next(); + handler.validate(cookie, origin); + } + } else { + // old-style cookies are validated according to the old rules + this.rfc2109.validate(host, port, path, secure, cookie); + } + } + + /** + * Return true if the cookie should be submitted with a request + * with given attributes, false otherwise. + * @param host the host to which the request is being submitted + * @param port the port to which the request is being submitted (ignored) + * @param path the path to which the request is being submitted + * @param secure true if the request is using a secure connection + * @return true if the cookie matches the criterium + */ + public boolean match(String host, int port, String path, + boolean secure, final Cookie cookie) { + + LOG.trace("enter RFC2965.match(" + + "String, int, String, boolean, Cookie"); + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (cookie instanceof Cookie2) { + // check if cookie has expired + if (cookie.isPersistent() && cookie.isExpired()) { + return false; + } + CookieOrigin origin = new CookieOrigin(getEffectiveHost(host), port, path, secure); + for (Iterator i = getAttribHandlerIterator(); i.hasNext(); ) { + CookieAttributeHandler handler = (CookieAttributeHandler) i.next(); + if (!handler.match(cookie, origin)) { + return false; + } + } + return true; + } else { + // old-style cookies are matched according to the old rules + return this.rfc2109.match(host, port, path, secure, cookie); + } + } + + private void doFormatCookie2(final Cookie2 cookie, final StringBuffer buffer) { + String name = cookie.getName(); + String value = cookie.getValue(); + if (value == null) { + value = ""; + } + this.formatter.format(buffer, new NameValuePair(name, value)); + // format domain attribute + if (cookie.getDomain() != null && cookie.isDomainAttributeSpecified()) { + buffer.append("; "); + this.formatter.format(buffer, new NameValuePair("$Domain", cookie.getDomain())); + } + // format path attribute + if ((cookie.getPath() != null) && (cookie.isPathAttributeSpecified())) { + buffer.append("; "); + this.formatter.format(buffer, new NameValuePair("$Path", cookie.getPath())); + } + // format port attribute + if (cookie.isPortAttributeSpecified()) { + String portValue = ""; + if (!cookie.isPortAttributeBlank()) { + portValue = createPortAttribute(cookie.getPorts()); + } + buffer.append("; "); + this.formatter.format(buffer, new NameValuePair("$Port", portValue)); + } + } + + /** + * Return a string suitable for sending in a "Cookie" header as + * defined in RFC 2965 + * @param cookie a {@link org.apache.commons.httpclient.Cookie} to be formatted as string + * @return a string suitable for sending in a "Cookie" header. + */ + public String formatCookie(final Cookie cookie) { + LOG.trace("enter RFC2965Spec.formatCookie(Cookie)"); + + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (cookie instanceof Cookie2) { + Cookie2 cookie2 = (Cookie2) cookie; + int version = cookie2.getVersion(); + final StringBuffer buffer = new StringBuffer(); + this.formatter.format(buffer, new NameValuePair("$Version", Integer.toString(version))); + buffer.append("; "); + doFormatCookie2(cookie2, buffer); + return buffer.toString(); + } else { + // old-style cookies are formatted according to the old rules + return this.rfc2109.formatCookie(cookie); + } + } + + /** + * Create a RFC 2965 compliant "Cookie" header value containing all + * {@link org.apache.commons.httpclient.Cookie}s suitable for + * sending in a "Cookie" header + * @param cookies an array of {@link org.apache.commons.httpclient.Cookie}s to be formatted + * @return a string suitable for sending in a Cookie header. + */ + public String formatCookies(final Cookie[] cookies) { + LOG.trace("enter RFC2965Spec.formatCookieHeader(Cookie[])"); + + if (cookies == null) { + throw new IllegalArgumentException("Cookies may not be null"); + } + // check if cookies array contains a set-cookie (old style) cookie + boolean hasOldStyleCookie = false; + int version = -1; + for (int i = 0; i < cookies.length; i++) { + Cookie cookie = cookies[i]; + if (!(cookie instanceof Cookie2)) { + hasOldStyleCookie = true; + break; + } + if (cookie.getVersion() > version) { + version = cookie.getVersion(); + } + } + if (version < 0) { + version = 0; + } + if (hasOldStyleCookie || version < 1) { + // delegate old-style cookie formatting to rfc2109Spec + return this.rfc2109.formatCookies(cookies); + } + // Arrange cookies by path + Arrays.sort(cookies, PATH_COMPOARATOR); + + final StringBuffer buffer = new StringBuffer(); + // format cookie version + this.formatter.format(buffer, new NameValuePair("$Version", Integer.toString(version))); + for (int i = 0; i < cookies.length; i++) { + buffer.append("; "); + Cookie2 cookie = (Cookie2) cookies[i]; + // format cookie attributes + doFormatCookie2(cookie, buffer); + } + return buffer.toString(); + } + + /** + * Retrieves valid Port attribute value for the given ports array. + * e.g. "8000,8001,8002" + * + * @param ports int array of ports + */ + private String createPortAttribute(int[] ports) { + StringBuffer portValue = new StringBuffer(); + for (int i = 0, len = ports.length; i < len; i++) { + if (i > 0) { + portValue.append(","); + } + portValue.append(ports[i]); + } + return portValue.toString(); + } + + /** + * Parses the given Port attribute value (e.g. "8000,8001,8002") + * into an array of ports. + * + * @param portValue port attribute value + * @return parsed array of ports + * @throws MalformedCookieException if there is a problem in + * parsing due to invalid portValue. + */ + private int[] parsePortAttribute(final String portValue) + throws MalformedCookieException { + StringTokenizer st = new StringTokenizer(portValue, ","); + int[] ports = new int[st.countTokens()]; + try { + int i = 0; + while(st.hasMoreTokens()) { + ports[i] = Integer.parseInt(st.nextToken().trim()); + if (ports[i] < 0) { + throw new MalformedCookieException ("Invalid Port attribute."); + } + ++i; + } + } catch (NumberFormatException e) { + throw new MalformedCookieException ("Invalid Port " + + "attribute: " + e.getMessage()); + } + return ports; + } + + /** + * Gets 'effective host name' as defined in RFC 2965. + *

+ * If a host name contains no dots, the effective host name is + * that name with the string .local appended to it. Otherwise + * the effective host name is the same as the host name. Note + * that all effective host names contain at least one dot. + * + * @param host host name where cookie is received from or being sent to. + * @return + */ + private static String getEffectiveHost(final String host) { + String effectiveHost = host.toLowerCase(); + if (host.indexOf('.') < 0) { + effectiveHost += ".local"; + } + return effectiveHost; + } + + /** + * Performs domain-match as defined by the RFC2965. + *

+ * Host A's name domain-matches host B's if + *

    + *
      their host name strings string-compare equal; or
    + *
      A is a HDN string and has the form NB, where N is a non-empty + * name string, B has the form .B', and B' is a HDN string. (So, + * x.y.com domain-matches .Y.com but not Y.com.)
    + *
+ * + * @param host host name where cookie is received from or being sent to. + * @param domain The cookie domain attribute. + * @return true if the specified host matches the given domain. + */ + public boolean domainMatch(String host, String domain) { + boolean match = host.equals(domain) + || (domain.startsWith(".") && host.endsWith(domain)); + + return match; + } + + /** + * Returns true if the given port exists in the given + * ports list. + * + * @param port port of host where cookie was received from or being sent to. + * @param ports port list + * @return true returns true if the given port exists in + * the given ports list; false otherwise. + */ + private boolean portMatch(int port, int[] ports) { + boolean portInList = false; + for (int i = 0, len = ports.length; i < len; i++) { + if (port == ports[i]) { + portInList = true; + break; + } + } + return portInList; + } + + /** + * "Path" attribute handler for RFC 2965 cookie spec. + */ + private class Cookie2PathAttributeHandler + implements CookieAttributeHandler { + + /** + * Parse cookie path attribute. + */ + public void parse(final Cookie cookie, final String path) + throws MalformedCookieException { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (path == null) { + throw new MalformedCookieException( + "Missing value for path attribute"); + } + if (path.trim().equals("")) { + throw new MalformedCookieException( + "Blank value for path attribute"); + } + cookie.setPath(path); + cookie.setPathAttributeSpecified(true); + } + + /** + * Validate cookie path attribute. The value for the Path attribute must be a + * prefix of the request-URI (case-sensitive matching). + */ + public void validate(final Cookie cookie, final CookieOrigin origin) + throws MalformedCookieException { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (origin == null) { + throw new IllegalArgumentException("Cookie origin may not be null"); + } + String path = origin.getPath(); + if (path == null) { + throw new IllegalArgumentException( + "Path of origin host may not be null."); + } + if (cookie.getPath() == null) { + throw new MalformedCookieException("Invalid cookie state: " + + "path attribute is null."); + } + if (path.trim().equals("")) { + path = PATH_DELIM; + } + + if (!pathMatch(path, cookie.getPath())) { + throw new MalformedCookieException( + "Illegal path attribute \"" + cookie.getPath() + + "\". Path of origin: \"" + path + "\""); + } + } + + /** + * Match cookie path attribute. The value for the Path attribute must be a + * prefix of the request-URI (case-sensitive matching). + */ + public boolean match(final Cookie cookie, final CookieOrigin origin) { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (origin == null) { + throw new IllegalArgumentException("Cookie origin may not be null"); + } + String path = origin.getPath(); + if (cookie.getPath() == null) { + LOG.warn("Invalid cookie state: path attribute is null."); + return false; + } + if (path.trim().equals("")) { + path = PATH_DELIM; + } + + if (!pathMatch(path, cookie.getPath())) { + return false; + } + return true; + } + } + + /** + * "Domain" cookie attribute handler for RFC 2965 cookie spec. + */ + private class Cookie2DomainAttributeHandler + implements CookieAttributeHandler { + + /** + * Parse cookie domain attribute. + */ + public void parse(final Cookie cookie, String domain) + throws MalformedCookieException { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (domain == null) { + throw new MalformedCookieException( + "Missing value for domain attribute"); + } + if (domain.trim().equals("")) { + throw new MalformedCookieException( + "Blank value for domain attribute"); + } + domain = domain.toLowerCase(); + if (!domain.startsWith(".")) { + // Per RFC 2965 section 3.2.2 + // "... If an explicitly specified value does not start with + // a dot, the user agent supplies a leading dot ..." + // That effectively implies that the domain attribute + // MAY NOT be an IP address of a host name + domain = "." + domain; + } + cookie.setDomain(domain); + cookie.setDomainAttributeSpecified(true); + } + + /** + * Validate cookie domain attribute. + */ + public void validate(final Cookie cookie, final CookieOrigin origin) + throws MalformedCookieException { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (origin == null) { + throw new IllegalArgumentException("Cookie origin may not be null"); + } + String host = origin.getHost().toLowerCase(); + if (cookie.getDomain() == null) { + throw new MalformedCookieException("Invalid cookie state: " + + "domain not specified"); + } + String cookieDomain = cookie.getDomain().toLowerCase(); + + if (cookie.isDomainAttributeSpecified()) { + // Domain attribute must start with a dot + if (!cookieDomain.startsWith(".")) { + throw new MalformedCookieException("Domain attribute \"" + + cookie.getDomain() + "\" violates RFC 2109: domain must start with a dot"); + } + + // Domain attribute must contain atleast one embedded dot, + // or the value must be equal to .local. + int dotIndex = cookieDomain.indexOf('.', 1); + if (((dotIndex < 0) || (dotIndex == cookieDomain.length() - 1)) + && (!cookieDomain.equals(".local"))) { + throw new MalformedCookieException( + "Domain attribute \"" + cookie.getDomain() + + "\" violates RFC 2965: the value contains no embedded dots " + + "and the value is not .local"); + } + + // The effective host name must domain-match domain attribute. + if (!domainMatch(host, cookieDomain)) { + throw new MalformedCookieException( + "Domain attribute \"" + cookie.getDomain() + + "\" violates RFC 2965: effective host name does not " + + "domain-match domain attribute."); + } + + // effective host name minus domain must not contain any dots + String effectiveHostWithoutDomain = host.substring( + 0, host.length() - cookieDomain.length()); + if (effectiveHostWithoutDomain.indexOf('.') != -1) { + throw new MalformedCookieException("Domain attribute \"" + + cookie.getDomain() + "\" violates RFC 2965: " + + "effective host minus domain may not contain any dots"); + } + } else { + // Domain was not specified in header. In this case, domain must + // string match request host (case-insensitive). + if (!cookie.getDomain().equals(host)) { + throw new MalformedCookieException("Illegal domain attribute: \"" + + cookie.getDomain() + "\"." + + "Domain of origin: \"" + + host + "\""); + } + } + } + + /** + * Match cookie domain attribute. + */ + public boolean match(final Cookie cookie, final CookieOrigin origin) { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (origin == null) { + throw new IllegalArgumentException("Cookie origin may not be null"); + } + String host = origin.getHost().toLowerCase(); + String cookieDomain = cookie.getDomain(); + + // The effective host name MUST domain-match the Domain + // attribute of the cookie. + if (!domainMatch(host, cookieDomain)) { + return false; + } + // effective host name minus domain must not contain any dots + String effectiveHostWithoutDomain = host.substring( + 0, host.length() - cookieDomain.length()); + if (effectiveHostWithoutDomain.indexOf('.') != -1) { + return false; + } + return true; + } + + } + + /** + * "Port" cookie attribute handler for RFC 2965 cookie spec. + */ + private class Cookie2PortAttributeHandler + implements CookieAttributeHandler { + + /** + * Parse cookie port attribute. + */ + public void parse(final Cookie cookie, final String portValue) + throws MalformedCookieException { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (cookie instanceof Cookie2) { + Cookie2 cookie2 = (Cookie2) cookie; + if ((portValue == null) || (portValue.trim().equals(""))) { + // If the Port attribute is present but has no value, the + // cookie can only be sent to the request-port. + // Since the default port list contains only request-port, we don't + // need to do anything here. + cookie2.setPortAttributeBlank(true); + } else { + int[] ports = parsePortAttribute(portValue); + cookie2.setPorts(ports); + } + cookie2.setPortAttributeSpecified(true); + } + } + + /** + * Validate cookie port attribute. If the Port attribute was specified + * in header, the request port must be in cookie's port list. + */ + public void validate(final Cookie cookie, final CookieOrigin origin) + throws MalformedCookieException { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (origin == null) { + throw new IllegalArgumentException("Cookie origin may not be null"); + } + if (cookie instanceof Cookie2) { + Cookie2 cookie2 = (Cookie2) cookie; + int port = origin.getPort(); + if (cookie2.isPortAttributeSpecified()) { + if (!portMatch(port, cookie2.getPorts())) { + throw new MalformedCookieException( + "Port attribute violates RFC 2965: " + + "Request port not found in cookie's port list."); + } + } + } + } + + /** + * Match cookie port attribute. If the Port attribute is not specified + * in header, the cookie can be sent to any port. Otherwise, the request port + * must be in the cookie's port list. + */ + public boolean match(final Cookie cookie, final CookieOrigin origin) { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (origin == null) { + throw new IllegalArgumentException("Cookie origin may not be null"); + } + if (cookie instanceof Cookie2) { + Cookie2 cookie2 = (Cookie2) cookie; + int port = origin.getPort(); + if (cookie2.isPortAttributeSpecified()) { + if (cookie2.getPorts() == null) { + LOG.warn("Invalid cookie state: port not specified"); + return false; + } + if (!portMatch(port, cookie2.getPorts())) { + return false; + } + } + return true; + } else { + return false; + } + } + } + + /** + * "Max-age" cookie attribute handler for RFC 2965 cookie spec. + */ + private class Cookie2MaxageAttributeHandler + implements CookieAttributeHandler { + + /** + * Parse cookie max-age attribute. + */ + public void parse(final Cookie cookie, final String value) + throws MalformedCookieException { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (value == null) { + throw new MalformedCookieException( + "Missing value for max-age attribute"); + } + int age = -1; + try { + age = Integer.parseInt(value); + } catch (NumberFormatException e) { + age = -1; + } + if (age < 0) { + throw new MalformedCookieException ("Invalid max-age attribute."); + } + cookie.setExpiryDate(new Date(System.currentTimeMillis() + age * 1000L)); + } + + /** + * validate cookie max-age attribute. + */ + public void validate(final Cookie cookie, final CookieOrigin origin) { + } + + /** + * @see CookieAttributeHandler#match(org.apache.commons.httpclient.Cookie, String) + */ + public boolean match(final Cookie cookie, final CookieOrigin origin) { + return true; + } + + } + + /** + * "Secure" cookie attribute handler for RFC 2965 cookie spec. + */ + private class CookieSecureAttributeHandler + implements CookieAttributeHandler { + + public void parse(final Cookie cookie, final String secure) + throws MalformedCookieException { + cookie.setSecure(true); + } + + public void validate(final Cookie cookie, final CookieOrigin origin) + throws MalformedCookieException { + } + + public boolean match(final Cookie cookie, final CookieOrigin origin) { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (origin == null) { + throw new IllegalArgumentException("Cookie origin may not be null"); + } + return cookie.getSecure() == origin.isSecure(); + } + + } + + /** + * "Commant" cookie attribute handler for RFC 2965 cookie spec. + */ + private class CookieCommentAttributeHandler + implements CookieAttributeHandler { + + public void parse(final Cookie cookie, final String comment) + throws MalformedCookieException { + cookie.setComment(comment); + } + + public void validate(final Cookie cookie, final CookieOrigin origin) + throws MalformedCookieException { + } + + public boolean match(final Cookie cookie, final CookieOrigin origin) { + return true; + } + + } + + /** + * "CommantURL" cookie attribute handler for RFC 2965 cookie spec. + */ + private class CookieCommentUrlAttributeHandler + implements CookieAttributeHandler { + + public void parse(final Cookie cookie, final String commenturl) + throws MalformedCookieException { + if (cookie instanceof Cookie2) { + Cookie2 cookie2 = (Cookie2) cookie; + cookie2.setCommentURL(commenturl); + } + } + + public void validate(final Cookie cookie, final CookieOrigin origin) + throws MalformedCookieException { + } + + public boolean match(final Cookie cookie, final CookieOrigin origin) { + return true; + } + + } + + /** + * "Discard" cookie attribute handler for RFC 2965 cookie spec. + */ + private class CookieDiscardAttributeHandler + implements CookieAttributeHandler { + + public void parse(final Cookie cookie, final String commenturl) + throws MalformedCookieException { + if (cookie instanceof Cookie2) { + Cookie2 cookie2 = (Cookie2) cookie; + cookie2.setDiscard(true); + } + } + + public void validate(final Cookie cookie, final CookieOrigin origin) + throws MalformedCookieException { + } + + public boolean match(final Cookie cookie, final CookieOrigin origin) { + return true; + } + + } + + /** + * "Version" cookie attribute handler for RFC 2965 cookie spec. + */ + private class Cookie2VersionAttributeHandler + implements CookieAttributeHandler { + + /** + * Parse cookie version attribute. + */ + public void parse(final Cookie cookie, final String value) + throws MalformedCookieException { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (cookie instanceof Cookie2) { + Cookie2 cookie2 = (Cookie2) cookie; + if (value == null) { + throw new MalformedCookieException( + "Missing value for version attribute"); + } + int version = -1; + try { + version = Integer.parseInt(value); + } catch (NumberFormatException e) { + version = -1; + } + if (version < 0) { + throw new MalformedCookieException("Invalid cookie version."); + } + cookie2.setVersion(version); + cookie2.setVersionAttributeSpecified(true); + } + } + + /** + * validate cookie version attribute. Version attribute is REQUIRED. + */ + public void validate(final Cookie cookie, final CookieOrigin origin) + throws MalformedCookieException { + if (cookie == null) { + throw new IllegalArgumentException("Cookie may not be null"); + } + if (cookie instanceof Cookie2) { + Cookie2 cookie2 = (Cookie2) cookie; + if (!cookie2.isVersionAttributeSpecified()) { + throw new MalformedCookieException( + "Violates RFC 2965. Version attribute is required."); + } + } + } + + public boolean match(final Cookie cookie, final CookieOrigin origin) { + return true; + } + + } + + public int getVersion() { + return 1; + } + + public Header getVersionHeader() { + ParameterFormatter formatter = new ParameterFormatter(); + StringBuffer buffer = new StringBuffer(); + formatter.format(buffer, new NameValuePair("$Version", + Integer.toString(getVersion()))); + return new Header("Cookie2", buffer.toString(), true); + } + +} + Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/ByteArrayRequestEntity.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/ByteArrayRequestEntity.java (.../ByteArrayRequestEntity.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/ByteArrayRequestEntity.java (.../ByteArrayRequestEntity.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/DeleteMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/DeleteMethod.java (.../DeleteMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/DeleteMethod.java (.../DeleteMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java (.../EntityEnclosingMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java (.../EntityEnclosingMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2003-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -189,8 +190,11 @@ if (LOG.isWarnEnabled()) { LOG.warn(charset + " not supported"); } - this.requestEntity = new StringRequestEntity( - requestString); + try { + this.requestEntity = new StringRequestEntity( + requestString, null, null); + } catch (UnsupportedEncodingException ignore) { + } } } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/ExpectContinueMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/ExpectContinueMethod.java (.../ExpectContinueMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/ExpectContinueMethod.java (.../ExpectContinueMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2003-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/FileRequestEntity.java =================================================================== diff -u --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/FileRequestEntity.java (revision 0) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/FileRequestEntity.java (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -0,0 +1,83 @@ +/* + * $HeadURL: https://svn.apache.org/repos/asf/jakarta/httpcomponents/oac.hc3x/tags/HTTPCLIENT_3_1/src/java/org/apache/commons/httpclient/methods/FileRequestEntity.java $ + * $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 + * . + * + */ +package org.apache.commons.httpclient.methods; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import org.apache.commons.httpclient.methods.RequestEntity; + +/** + * A RequestEntity that represents a File. + * + * @since 3.1 + */ +public class FileRequestEntity implements RequestEntity { + + final File file; + final String contentType; + + public FileRequestEntity(final File file, final String contentType) { + super(); + if (file == null) { + throw new IllegalArgumentException("File may not be null"); + } + this.file = file; + this.contentType = contentType; + } + public long getContentLength() { + return this.file.length(); + } + + public String getContentType() { + return this.contentType; + } + + public boolean isRepeatable() { + return true; + } + + public void writeRequest(final OutputStream out) throws IOException { + byte[] tmp = new byte[4096]; + int i = 0; + InputStream instream = new FileInputStream(this.file); + try { + while ((i = instream.read(tmp)) >= 0) { + out.write(tmp, 0, i); + } + } finally { + instream.close(); + } + } + +} Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/GetMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/GetMethod.java (.../GetMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/GetMethod.java (.../GetMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/HeadMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/HeadMethod.java (.../HeadMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/HeadMethod.java (.../HeadMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/InputStreamRequestEntity.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/InputStreamRequestEntity.java (.../InputStreamRequestEntity.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/InputStreamRequestEntity.java (.../InputStreamRequestEntity.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/MultipartPostMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/MultipartPostMethod.java (.../MultipartPostMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/MultipartPostMethod.java (.../MultipartPostMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/OptionsMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/OptionsMethod.java (.../OptionsMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/OptionsMethod.java (.../OptionsMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/PostMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/PostMethod.java (.../PostMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/PostMethod.java (.../PostMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/PutMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/PutMethod.java (.../PutMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/PutMethod.java (.../PutMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/RequestEntity.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/RequestEntity.java (.../RequestEntity.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/RequestEntity.java (.../RequestEntity.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/StringRequestEntity.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/StringRequestEntity.java (.../StringRequestEntity.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/StringRequestEntity.java (.../StringRequestEntity.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -1,16 +1,17 @@ /* - * $Header$ + * $HeadURL: https://svn.apache.org/repos/asf/jakarta/httpcomponents/oac.hc3x/tags/HTTPCLIENT_3_1/src/java/org/apache/commons/httpclient/methods/StringRequestEntity.java $ * $Revision$ * $Date$ * * ==================================================================== * - * Copyright 2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -58,16 +59,11 @@ * will use the default platform charset to convert the content string * and will provide no content type.

* - *

This constructor may be deprecated or changed to use the - * default HTTP content charset (ISO-8859-1) in the release 3.1

- * - *

It is strongly recommended to use - * {@link #StringRequestEntity(String, String, String)} constructor - * instead.

- * * @see #StringRequestEntity(String, String, String) * * @param content The content to set. + * + * @deprecated use {@link #StringRequestEntity(String, String, String)} instead */ public StringRequestEntity(String content) { super(); Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/TraceMethod.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/TraceMethod.java (.../TraceMethod.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/TraceMethod.java (.../TraceMethod.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/ByteArrayPartSource.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/ByteArrayPartSource.java (.../ByteArrayPartSource.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/ByteArrayPartSource.java (.../ByteArrayPartSource.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/FilePart.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/FilePart.java (.../FilePart.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/FilePart.java (.../FilePart.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/FilePartSource.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/FilePartSource.java (.../FilePartSource.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/FilePartSource.java (.../FilePartSource.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/MultipartRequestEntity.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/MultipartRequestEntity.java (.../MultipartRequestEntity.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/MultipartRequestEntity.java (.../MultipartRequestEntity.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -57,7 +58,7 @@ *

This entity is designed to be used in conjunction with the * {@link org.apache.commons.httpclient.methods.PostMethod post method} to provide * multipart posts. Example usage:

- * + *
  *  File f = new File("/path/fileToUpload.txt");
  *  PostMethod filePost = new PostMethod("http://host/some_path");
  *  Part[] parts = {
@@ -69,7 +70,7 @@
  *      );
  *  HttpClient client = new HttpClient();
  *  int status = client.executeMethod(filePost);
- * 
+ * 
* * @since 3.0 */ Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/Part.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/Part.java (.../Part.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/Part.java (.../Part.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/PartBase.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/PartBase.java (.../PartBase.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/PartBase.java (.../PartBase.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/PartSource.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/PartSource.java (.../PartSource.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/PartSource.java (.../PartSource.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/StringPart.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/StringPart.java (.../StringPart.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/methods/multipart/StringPart.java (.../StringPart.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/DefaultHttpParams.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/DefaultHttpParams.java (.../DefaultHttpParams.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/DefaultHttpParams.java (.../DefaultHttpParams.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -208,7 +209,7 @@ } public void setBooleanParameter(final String name, boolean value) { - setParameter(name, new Boolean(value)); + setParameter(name, value ? Boolean.TRUE : Boolean.FALSE);// Boolean.valueOf() = Java 1.4+ } public boolean isParameterSet(final String name) { Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/DefaultHttpParamsFactory.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/DefaultHttpParamsFactory.java (.../DefaultHttpParamsFactory.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/DefaultHttpParamsFactory.java (.../DefaultHttpParamsFactory.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -66,10 +67,10 @@ protected HttpParams createParams() { HttpClientParams params = new HttpClientParams(null); - params.setParameter(HttpMethodParams.USER_AGENT, "Jakarta Commons-HttpClient/3.0"); + params.setParameter(HttpMethodParams.USER_AGENT, "Jakarta Commons-HttpClient/3.1"); params.setVersion(HttpVersion.HTTP_1_1); params.setConnectionManagerClass(SimpleHttpConnectionManager.class); - params.setCookiePolicy(CookiePolicy.RFC_2109); + params.setCookiePolicy(CookiePolicy.DEFAULT); params.setHttpElementCharset("US-ASCII"); params.setContentCharset("ISO-8859-1"); params.setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler()); Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HostParams.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HostParams.java (.../HostParams.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HostParams.java (.../HostParams.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpClientParams.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpClientParams.java (.../HttpClientParams.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpClientParams.java (.../HttpClientParams.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java (.../HttpConnectionManagerParams.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java (.../HttpConnectionManagerParams.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpConnectionParams.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpConnectionParams.java (.../HttpConnectionParams.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpConnectionParams.java (.../HttpConnectionParams.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpMethodParams.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpMethodParams.java (.../HttpMethodParams.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpMethodParams.java (.../HttpMethodParams.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -166,6 +167,14 @@ public static final String HTTP_ELEMENT_CHARSET = "http.protocol.element-charset"; /** + * Defines the charset to be used for parsing URIs. + *

+ * This parameter expects a value of type {@link String}. + *

+ */ + public static final String HTTP_URI_CHARSET = "http.protocol.uri-charset"; + + /** * Defines the charset to be used for encoding content body. *

* This parameter expects a value of type {@link String}. @@ -336,6 +345,26 @@ } /** + * Sets the charset to be used for parsing URIs. + * @param charset The charset + */ + public void setUriCharset(String charset) { + setParameter(HTTP_URI_CHARSET, charset); + } + + /** + * Returns the charset to be used for parsing URIs. + * @return The charset + */ + public String getUriCharset() { + String charset = (String) getParameter(HTTP_URI_CHARSET); + if (charset == null) { + charset = "UTF-8"; + } + return charset; + } + + /** * Sets the default charset to be used for writing content body, * when no charset explicitly specified. * @param charset The charset Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpParams.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpParams.java (.../HttpParams.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpParams.java (.../HttpParams.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpParamsFactory.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpParamsFactory.java (.../HttpParamsFactory.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/params/HttpParamsFactory.java (.../HttpParamsFactory.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/ControllerThreadSocketFactory.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/ControllerThreadSocketFactory.java (.../ControllerThreadSocketFactory.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/ControllerThreadSocketFactory.java (.../ControllerThreadSocketFactory.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/DefaultProtocolSocketFactory.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/DefaultProtocolSocketFactory.java (.../DefaultProtocolSocketFactory.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/DefaultProtocolSocketFactory.java (.../DefaultProtocolSocketFactory.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -143,14 +144,14 @@ * All instances of DefaultProtocolSocketFactory are the same. */ public boolean equals(Object obj) { - return ((obj != null) && obj.getClass().equals(DefaultProtocolSocketFactory.class)); + return ((obj != null) && obj.getClass().equals(getClass())); } /** * All instances of DefaultProtocolSocketFactory have the same hash code. */ public int hashCode() { - return DefaultProtocolSocketFactory.class.hashCode(); + return getClass().hashCode(); } } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/Protocol.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/Protocol.java (.../Protocol.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/Protocol.java (.../Protocol.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/ProtocolSocketFactory.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/ProtocolSocketFactory.java (.../ProtocolSocketFactory.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/ProtocolSocketFactory.java (.../ProtocolSocketFactory.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/ReflectionSocketFactory.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/ReflectionSocketFactory.java (.../ReflectionSocketFactory.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/ReflectionSocketFactory.java (.../ReflectionSocketFactory.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/SSLProtocolSocketFactory.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/SSLProtocolSocketFactory.java (.../SSLProtocolSocketFactory.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/SSLProtocolSocketFactory.java (.../SSLProtocolSocketFactory.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -168,14 +169,14 @@ * All instances of SSLProtocolSocketFactory are the same. */ public boolean equals(Object obj) { - return ((obj != null) && obj.getClass().equals(SSLProtocolSocketFactory.class)); + return ((obj != null) && obj.getClass().equals(getClass())); } /** * All instances of SSLProtocolSocketFactory have the same hash code. */ public int hashCode() { - return SSLProtocolSocketFactory.class.hashCode(); + return getClass().hashCode(); } } Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/SecureProtocolSocketFactory.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/SecureProtocolSocketFactory.java (.../SecureProtocolSocketFactory.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/protocol/SecureProtocolSocketFactory.java (.../SecureProtocolSocketFactory.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/DateParseException.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/DateParseException.java (.../DateParseException.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/DateParseException.java (.../DateParseException.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/DateParser.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/DateParser.java (.../DateParser.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/DateParser.java (.../DateParser.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/DateUtil.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/DateUtil.java (.../DateUtil.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/DateUtil.java (.../DateUtil.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/EncodingUtil.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/EncodingUtil.java (.../EncodingUtil.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/EncodingUtil.java (.../EncodingUtil.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/ExceptionUtil.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/ExceptionUtil.java (.../ExceptionUtil.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/ExceptionUtil.java (.../ExceptionUtil.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/HttpURLConnection.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/HttpURLConnection.java (.../HttpURLConnection.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/HttpURLConnection.java (.../HttpURLConnection.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/IdleConnectionHandler.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/IdleConnectionHandler.java (.../IdleConnectionHandler.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/IdleConnectionHandler.java (.../IdleConnectionHandler.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java (.../IdleConnectionTimeoutThread.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java (.../IdleConnectionTimeoutThread.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -83,6 +84,15 @@ } /** + * Handles calling {@link HttpConnectionManager#closeIdleConnections(long) closeIdleConnections()} + * and doing any other cleanup work on the given connection mangaer. + * @param connectionManager The connection manager to close idle connections for + */ + protected void handleCloseIdleConnections(HttpConnectionManager connectionManager) { + connectionManager.closeIdleConnections(connectionTimeout); + } + + /** * Closes idle connections. */ public synchronized void run() { @@ -91,7 +101,7 @@ while (iter.hasNext()) { HttpConnectionManager connectionManager = (HttpConnectionManager) iter.next(); - connectionManager.closeIdleConnections(connectionTimeout); + handleCloseIdleConnections(connectionManager); } try { Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/LangUtils.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/LangUtils.java (.../LangUtils.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/LangUtils.java (.../LangUtils.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -1,16 +1,17 @@ /* - * $HeadURL: http://svn.apache.org/repos/asf/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/LangUtils.java $ + * $HeadURL: https://svn.apache.org/repos/asf/jakarta/httpcomponents/oac.hc3x/tags/HTTPCLIENT_3_1/src/java/org/apache/commons/httpclient/util/LangUtils.java $ * $Revision$ * $Date$ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/ParameterFormatter.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/ParameterFormatter.java (.../ParameterFormatter.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/ParameterFormatter.java (.../ParameterFormatter.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -1,16 +1,17 @@ /* - * $HeadURL: http://svn.apache.org/repos/asf/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/ParameterFormatter.java $ + * $HeadURL: https://svn.apache.org/repos/asf/jakarta/httpcomponents/oac.hc3x/tags/HTTPCLIENT_3_1/src/java/org/apache/commons/httpclient/util/ParameterFormatter.java $ * $Revision$ * $Date$ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/ParameterParser.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/ParameterParser.java (.../ParameterParser.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/ParameterParser.java (.../ParameterParser.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/TimeoutController.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/TimeoutController.java (.../TimeoutController.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/TimeoutController.java (.../TimeoutController.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 1999-2004 The Apache Software Foundation + * 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 * - * Licensed 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 Index: 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/URIUtil.java =================================================================== diff -u -r7869bcd6bc491abcb4984c44cd7a904e98cab359 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/URIUtil.java (.../URIUtil.java) (revision 7869bcd6bc491abcb4984c44cd7a904e98cab359) +++ 3rdParty_sources/commons-httpclient/org/apache/commons/httpclient/util/URIUtil.java (.../URIUtil.java) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -5,12 +5,13 @@ * * ==================================================================== * - * Copyright 2002-2004 The Apache Software Foundation + * 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 * - * Licensed 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 @@ -624,7 +625,7 @@ for (int i = from.length; i > 0; --i) { original = replace(original, from[i], to[i]); } - return original.toString(); + return original; } Index: 3rdParty_sources/versions.txt =================================================================== diff -u -rc08ba6bf73897a72b1699db8aab0f3ad0ba84a60 -r16cc058ce89c282bab4a57afe93dab4a8198727d --- 3rdParty_sources/versions.txt (.../versions.txt) (revision c08ba6bf73897a72b1699db8aab0f3ad0ba84a60) +++ 3rdParty_sources/versions.txt (.../versions.txt) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -11,7 +11,7 @@ CKEditor 3.6.2 -Commons HttpClient 3.0 +Commons HttpClient 3.1 Commons Lang 2.6 Index: lams_build/3rdParty.userlibraries =================================================================== diff -u -rbf53c8a97c1eda9ff308c684e30f7bc81fd8579b -r16cc058ce89c282bab4a57afe93dab4a8198727d --- lams_build/3rdParty.userlibraries (.../3rdParty.userlibraries) (revision bf53c8a97c1eda9ff308c684e30f7bc81fd8579b) +++ lams_build/3rdParty.userlibraries (.../3rdParty.userlibraries) (revision 16cc058ce89c282bab4a57afe93dab4a8198727d) @@ -1,6 +1,6 @@ - + @@ -44,7 +44,7 @@ - + Index: lams_build/lib/jakarta-commons/commons-httpclient-3.0.jar =================================================================== diff -u -rab19db088359a46353cc92e806c40ff5cff818b9 -r16cc058ce89c282bab4a57afe93dab4a8198727d Binary files differ Index: lams_build/lib/jakarta-commons/commons-httpclient-3.1.jar =================================================================== diff -u Binary files differ