You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ol...@apache.org on 2003/09/11 22:08:33 UTC

cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient SimpleHttpConnection.java TestHttpConnection.java

olegk       2003/09/11 13:08:33

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpClient.java HttpMethod.java HttpMethodBase.java
                        HttpMethodDirector.java HttpState.java
               httpclient/src/java/org/apache/commons/httpclient/methods
                        HeadMethod.java
               httpclient/src/test/org/apache/commons/httpclient
                        SimpleHttpConnection.java TestHttpConnection.java
  Added:       httpclient/src/java/org/apache/commons/httpclient/params
                        DefaultHttpParams.java
                        DefaultHttpParamsFactory.java HttpClientParams.java
                        HttpMethodParams.java HttpParams.java
                        HttpParamsFactory.java package.html
  Removed:     httpclient/src/examples CustomHttpConnection.java
  Log:
  PR #15435 (New Preferences Architecture)
  
  Features:
  - collections of HTTP parameters may be linked together to form a hierarchy
  - Parameters can be set at the global level, Http client level or Http method level
  - If a parameter is not defined at the current level, its value is drawn from a
  higher levels of the hierarchy at which the parameter is defined
  - If parameter is not defined at the current level or any level above, a default
  value is returned
  - Not reliant on system properties
  
  Contributed by Oleg Kalnichevski & Michael Becke
  
  Revision  Changes    Path
  1.81      +36 -26    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java
  
  Index: HttpClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- HttpClient.java	12 Aug 2003 02:35:17 -0000	1.80
  +++ HttpClient.java	11 Sep 2003 20:08:32 -0000	1.81
  @@ -67,6 +67,7 @@
   import java.security.Security; 
   import java.security.Provider;  
   
  +import org.apache.commons.httpclient.params.*;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  @@ -143,6 +144,7 @@
           this.httpConnectionManager = httpConnectionManager;
   
           this.hostConfiguration = new HostConfiguration();
  +        this.params = new HttpClientParams(); 
           
       }
       
  @@ -155,22 +157,12 @@
        * My {@link HttpState state}.
        */
       private HttpState state;
  -
  -    /** the timout when waiting for a connection from the connectionManager */
  -    private long httpConnectionTimeout = 0;
  -
  -    /** The timeout in milliseconds*/
  -    private int timeoutInMilliseconds = 0;
  -
  -    /** The connection timeout. */
  -    private int connectionTimeout = 0;
  +    
  +    private HttpClientParams params; 
   
       /** The host configuration to use */
       private HostConfiguration hostConfiguration;
       
  -    /** True if strict mode is enabled. */
  -    private boolean strictMode = false;
  -
       // ------------------------------------------------------------- Properties
   
       /**
  @@ -199,20 +191,28 @@
        *
        * @see #isStrictMode()
        *
  +     * @deprecated Use {@link HttpClientParams#setParameter(String, Object)}
  +     * to exercise a more granular control over HTTP protocol strictness.
        */
       public synchronized void setStrictMode(boolean strictMode) {
  -        this.strictMode = strictMode;
  +        if (strictMode) {
  +            this.params.makeStrict();
  +        } else {
  +            this.params.makeLenient();
  +        }
       }
   
       /**
        *
  -     * @return <code>true</code> if strict mode being used
  +     * @return <code>false</code>
        *
        * @see #setStrictMode(boolean)
        *
  +     * @deprecated Use {@link HttpClientParams#getParameter(String)} 
  +     * to exercise a more granular control over HTTP protocol strictness.
        */
       public synchronized boolean isStrictMode() {
  -        return strictMode;
  +        return false;
       }
   
       /**
  @@ -221,10 +221,13 @@
        * A timeout value of zero is interpreted as an infinite timeout.
        *
        * @param newTimeoutInMilliseconds Timeout in milliseconds
  +     * 
  +     * @deprecated Use {@link HttpClientParams#setSoTimeout(int)},
  +     * {@link HttpClient#getParams()}.
        *
        */
       public synchronized void setTimeout(int newTimeoutInMilliseconds) {
  -        this.timeoutInMilliseconds = newTimeoutInMilliseconds;
  +        this.params.setSoTimeout(newTimeoutInMilliseconds);
       }
   
       /**
  @@ -234,9 +237,12 @@
        * @param timeout the timeout in milliseconds
        * 
        * @see HttpConnectionManager#getConnection(HostConfiguration, long)
  +     * 
  +     * @deprecated Use {@link HttpClientParams#setConnectionManagerTimeout(long)},
  +     * {@link HttpClient#getParams()}
        */
       public synchronized void setHttpConnectionFactoryTimeout(long timeout) {
  -        this.httpConnectionTimeout = timeout;
  +        this.params.setConnectionManagerTimeout(timeout);
       }
   
       /**
  @@ -244,9 +250,12 @@
        * the timeout is not used. The default value is 0.
        * @see HttpConnection#setConnectionTimeout(int)
        * @param newTimeoutInMilliseconds Timeout in milliseconds.
  +     * 
  +     * @deprecated Use {@link HttpClientParams#setConnectionTimeout(int)},
  +     * {@link HttpClient#getParams()}.
        */
       public synchronized void setConnectionTimeout(int newTimeoutInMilliseconds) {
  -       this.connectionTimeout = newTimeoutInMilliseconds;
  +       this.params.setConnectionTimeout(newTimeoutInMilliseconds);
       }
   
       // --------------------------------------------------------- Public Methods
  @@ -336,10 +345,7 @@
            * for each item.
            */
           synchronized (this) {
  -            methodDirector.setSoTimeout(this.timeoutInMilliseconds);
  -            methodDirector.setStrictMode(this.strictMode);
  -            methodDirector.setConnectionTimeout(this.connectionTimeout);
  -            methodDirector.setHttpConnectionFactoryTimeout(this.httpConnectionTimeout);
  +            methodDirector.setParams(this.params);
               methodDirector.setState(state == null ? getState() : state);
               methodDirector.setConnectionManager(this.httpConnectionManager);
               defaultHostConfiguration = getHostConfiguration();
  @@ -440,6 +446,10 @@
           HttpConnectionManager httpConnectionManager
       ) {
           this.httpConnectionManager = httpConnectionManager;
  +    }
  +
  +    public HttpParams getParams() {
  +        return this.params;
       }
   
   }
  
  
  
  1.29      +17 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java
  
  Index: HttpMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- HttpMethod.java	12 Aug 2003 02:55:22 -0000	1.28
  +++ HttpMethod.java	11 Sep 2003 20:08:32 -0000	1.29
  @@ -66,6 +66,9 @@
   import java.io.IOException;
   import java.io.InputStream;
   
  +import org.apache.commons.httpclient.params.*;
  +
  +
   /**
    * <p>
    * HttpMethod interface represents a request to be sent via a 
  @@ -517,5 +520,15 @@
        * @see #getDoAuthentication()
        */
       void setDoAuthentication(boolean doAuthentication);
  +
  +
  +    /**
  +     * Returns a collection of parameters associated with this method
  +     * 
  +     * @since 2.1
  +     * 
  +     * @see HttpMethodParams
  +     */
  +    public HttpMethodParams getParams();
   
   }
  
  
  
  1.180     +57 -75    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
  
  Index: HttpMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
  retrieving revision 1.179
  retrieving revision 1.180
  diff -u -r1.179 -r1.180
  --- HttpMethodBase.java	4 Sep 2003 02:12:13 -0000	1.179
  +++ HttpMethodBase.java	11 Sep 2003 20:08:32 -0000	1.180
  @@ -74,6 +74,7 @@
   import org.apache.commons.httpclient.cookie.CookiePolicy;
   import org.apache.commons.httpclient.cookie.CookieSpec;
   import org.apache.commons.httpclient.cookie.MalformedCookieException;
  +import org.apache.commons.httpclient.params.*;
   import org.apache.commons.httpclient.protocol.Protocol;
   import org.apache.commons.httpclient.util.EncodingUtil;
   import org.apache.commons.logging.Log;
  @@ -87,16 +88,6 @@
    *   <li>{@link #getName} to return the approriate name for this method
    *   </li>
    * </ul>
  - *
  - * <p>
  - * When a method's request may contain a body, subclasses will typically want
  - * to override:
  - * <ul>
  - *   <li>{@link #getRequestContentLength} to indicate the length (in bytes)
  - *     of that body</li>
  - *   <li>{@link #writeRequestBody writeRequestBody(HttpState,HttpConnection)}
  - *     to write the body</li>
  - * </ul>
    * </p>
    *
    * <p>
  @@ -142,16 +133,6 @@
       /** Log object for this class. */
       private static final Log LOG = LogFactory.getLog(HttpMethodBase.class);
   
  -    /** The User-Agent header sent on every request. */
  -    protected static final Header USER_AGENT;
  -
  -    static {
  -        String agent = System.getProperties()
  -                             .getProperty("httpclient.useragent",
  -                                          "Jakarta Commons-HttpClient/2.1m1");
  -        USER_AGENT = new Header("User-Agent", agent);
  -    }
  -
       // ----------------------------------------------------- Instance variables 
   
       /** Request headers, if any. */
  @@ -195,12 +176,8 @@
       *  HTTP authentication challenges. */
       private boolean doAuthentication = true;
   
  -    /** Version of the HTTP protocol to be used. */
  -    private HttpVersion version = HttpVersion.HTTP_1_1;
  -
  -    /** True if this HTTP method should strictly follow the HTTP protocol
  -    * specification. */
  -    private boolean strictMode = false;
  +    /** HTTP protocol parameters. */
  +    private HttpMethodParams params = new HttpMethodParams();
   
       /** True if this method has already been executed. */
       private boolean used = false;
  @@ -363,13 +340,13 @@
        *
        * @param http11 <tt>true</tt> to use HTTP/1.1, <tt>false</tt> to use 1.0
        * 
  -     * @deprecated Use {@link #setHttpVersion(HttpVersion)}
  +     * @deprecated Use {@link HttpMethodParams#setVersion(HttpVersion)}
        */
       public void setHttp11(boolean http11) {
           if (http11) {
  -            this.version = HttpVersion.HTTP_1_1;
  +            this.params.setVersion(HttpVersion.HTTP_1_1);
           } else {
  -            this.version = HttpVersion.HTTP_1_0;
  +            this.params.setVersion(HttpVersion.HTTP_1_0);
           } 
       }
   
  @@ -407,10 +384,10 @@
        *
        * @return <tt>true</tt> to use HTTP/1.1, <tt>false</tt> to use 1.0
        * 
  -     * @deprecated Use {@link #getHttpVersion()}
  +     * @deprecated Use {@link HttpMethodParams#getVersion()}
        */
       public boolean isHttp11() {
  -        return this.version.equals(HttpVersion.HTTP_1_1);
  +        return getHttpVersion().equals(HttpVersion.HTTP_1_1);
       }
   
       /**
  @@ -837,18 +814,26 @@
        * which many HTTP servers expect.
        * 
        * @param strictMode <tt>true</tt> for strict mode, <tt>false</tt> otherwise
  +     * 
  +     * @deprecated Use {@link HttpParams#setParameter(String, Object)} to exercise 
  +     * a more granular control over HTTP protocol strictness.
        */
       public void setStrictMode(boolean strictMode) {
  -        this.strictMode = strictMode;
  +        if (strictMode) {
  +            this.params.makeStrict();
  +        } else {
  +            this.params.makeLenient();
  +        }
       }
   
       /**
  -     * Returns the value of the strict mode flag.
  +     * @deprecated Use {@link HttpParams#setParameter(String, Object)} to exercise 
  +     * a more granular control over HTTP protocol strictness.
        *
  -     * @return <tt>true</tt> if strict mode is enabled, <tt>false</tt> otherwise
  +     * @return <tt>false</tt>
        */
       public boolean isStrictMode() {
  -        return strictMode;
  +        return false;
       }
   
       /**
  @@ -933,16 +918,17 @@
           }
           LOG.debug("Resorting to protocol version default close connection policy");
           // missing or invalid connection header, do the default
  -        if (this.version.greaterEquals(HttpVersion.HTTP_1_1)) {
  +        HttpVersion version = getHttpVersion();
  +        if (version.greaterEquals(HttpVersion.HTTP_1_1)) {
               if (LOG.isDebugEnabled()) {
  -                LOG.debug("Should NOT close connection, using " + this.version.toString());
  +                LOG.debug("Should NOT close connection, using " + version.toString());
               }
           } else {
               if (LOG.isDebugEnabled()) {
  -                LOG.debug("Should close connection, using " + this.version.toString());
  +                LOG.debug("Should close connection, using " + version.toString());
               }
           }
  -        return this.version.lessEquals(HttpVersion.HTTP_1_0);
  +        return version.lessEquals(HttpVersion.HTTP_1_0);
       }
       
       /**
  @@ -971,21 +957,13 @@
       }
   
       /**
  -     * Execute this HTTP method. Note that we cannot currently support redirects
  -     * that change  the connection parameters (host, port, protocol) because
  -     * we  don't yet have a good way to get the new connection.  For  the time
  -     * being, we just return the redirect response code,  and allow the user
  -     * agent to resubmit if desired.
  +     * Executes this method using the specified <code>HttpConnection</code> and
  +     * <code>HttpState</code>. 
        *
        * @param state {@link HttpState state} information to associate with this
        *        request. Must be non-null.
        * @param conn the {@link HttpConnection connection} to used to execute
        *        this HTTP method. Must be non-null.
  -     *        Note that we cannot currently support redirects that
  -     *        change the HttpConnection parameters (host, port, protocol)
  -     *        because we don't yet have a good way to get the new connection.
  -     *        For the time being, we just return the 302 response, and allow
  -     *        the user agent to resubmit if desired.
        *
        * @return the integer status code if one was obtained, or <tt>-1</tt>
        *
  @@ -1054,7 +1032,7 @@
           getResponseTrailerHeaderGroup().clear();
           statusLine = null;
           used = false;
  -        version = HttpVersion.HTTP_1_1;
  +        params = new HttpMethodParams();
           responseBody = null;
           recoverableExceptionCount = 0;
           connectionCloseForced = false;
  @@ -1179,7 +1157,7 @@
           Cookie[] cookies = matcher.match(conn.getHost(), conn.getPort(),
               getPath(), conn.isSecure(), state.getCookies());
           if ((cookies != null) && (cookies.length > 0)) {
  -            if (this.isStrictMode()) {
  +            if (getParams().isParameterTrue(HttpMethodParams.SINGLE_COOKIE_HEADER)) {
                   // In strict mode put all cookies on the same header
                   getRequestHeaderGroup().addHeader(
                     matcher.formatCookieHeader(cookies));
  @@ -1362,8 +1340,12 @@
           LOG.trace("enter HttpMethodBase.addUserAgentRequestHeaders(HttpState, "
               + "HttpConnection)");
   
  -        if (getRequestHeader("user-agent") == null) {
  -            setRequestHeader(HttpMethodBase.USER_AGENT);
  +        if (getRequestHeader("User-Agent") == null) {
  +            String agent = (String)getParams().getParameter(HttpMethodParams.USER_AGENT);
  +            if (agent == null) {
  +                agent = "Jakarta Commons-HttpClient";
  +            }
  +            setRequestHeader("User-Agent", agent);
           }
       }
   
  @@ -1726,14 +1708,14 @@
                   if (conn.isResponseAvailable(conn.getSoTimeout())) {
                       result = new ChunkedInputStream(is, this);
                   } else {
  -                    if (isStrictMode()) {
  +                    if (getParams().isParameterTrue(HttpMethodParams.STRICT_TRANSFER_ENCODING)) {
                           throw new ProtocolException("Chunk-encoded body declared but not sent");
                       } else {
                           LOG.warn("Chunk-encoded body missing");
                       }
                   }
               } else {
  -                if (isStrictMode() && LOG.isWarnEnabled()) {
  +                if (LOG.isWarnEnabled()) {
                       LOG.warn("Transfer-Encoding is set but does not contain \"chunked\": "
                           + transferEncoding);
                   }
  @@ -1861,14 +1843,15 @@
   
           //check for a valid HTTP-Version
           String versionStr = statusLine.getHttpVersion();
  -        if (!this.strictMode && versionStr.equals("HTTP")) {
  -            this.version = HttpVersion.HTTP_1_0;
  +        if (getParams().isParameterFalse(HttpMethodParams.UNAMBIGUOUS_STATUS_LINE) 
  +           && versionStr.equals("HTTP")) {
  +            getParams().setVersion(HttpVersion.HTTP_1_0);
               if (LOG.isWarnEnabled()) {
                   LOG.warn("Ambiguous status line (HTTP protocol version missing):" +
                   statusLine.toString());
               }
           } else {
  -            this.version = HttpVersion.parse(versionStr);
  +            getParams().setVersion(HttpVersion.parse(versionStr));
           }
   
       }
  @@ -1930,6 +1913,7 @@
               Wire.output("\r\n");
           }
   
  +        HttpVersion ver = getParams().getVersion();
           Header expectheader = getRequestHeader("Expect");
           String expectvalue = null;
           if (expectheader != null) {
  @@ -1937,7 +1921,7 @@
           }
           if ((expectvalue != null) 
            && (expectvalue.compareToIgnoreCase("100-continue") == 0)) {
  -            if (this.isHttp11()) {
  +            if (ver.greaterEquals(HttpVersion.HTTP_1_1)) {
                   int readTimeout = conn.getSoTimeout();
                   try {
                       conn.setSoTimeout(RESPONSE_WAIT_TIME_MS);
  @@ -2089,28 +2073,26 @@
       }
   
       /**
  -     * Get the HTTP version to be used with this method.
  +     * Returns {@link HttpParams HTTP protocol parameters}.
        *
  -     * @return HTTP version.
  +     * @return HTTP parameters.
        *
        * @since 2.1
        */
  -    public HttpVersion getHttpVersion() {
  -        return this.version;
  +    public HttpMethodParams getParams() {
  +        return this.params;
       }
   
       /**
  -     * Set the HTTP version to be used with this method.
  +     * Returns the HTTP version to be used with this method.
  +     *
  +     * @return HTTP version.
        *
        * @since 2.1
        */
  -    public void setHttpVersion(HttpVersion version) {
  -        if (version == null) {
  -            this.version = HttpVersion.HTTP_1_1;
  -        } else {
  -            this.version = version;
  -        }
  -    } 
  +    protected HttpVersion getHttpVersion() {
  +        return this.params.getVersion();
  +    }
   
       /**
        * Per RFC 2616 section 4.3, some response can never contain a message
  
  
  
  1.3       +15 -62    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
  
  Index: HttpMethodDirector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodDirector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpMethodDirector.java	12 Aug 2003 18:46:47 -0000	1.2
  +++ HttpMethodDirector.java	11 Sep 2003 20:08:33 -0000	1.3
  @@ -72,6 +72,7 @@
   import org.apache.commons.httpclient.auth.CredentialsNotAvailableException;
   import org.apache.commons.httpclient.auth.HttpAuthenticator;
   import org.apache.commons.httpclient.auth.MalformedChallengeException;
  +import org.apache.commons.httpclient.params.*;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  @@ -95,13 +96,7 @@
       
       private HttpConnection connection;
       
  -    private int soTimeout;
  -
  -    private int connectionTimeout;
  -    
  -    private boolean strictMode;
  -    
  -    private long httpConnectionFactoryTimeout;
  +    private HttpClientParams params;
       
       /** A flag to indicate if the connection should be released after the method is executed. */
       private boolean releaseConnection = false;
  @@ -129,7 +124,7 @@
        */
       public void executeMethod() throws IOException, HttpException {
           
  -        method.setStrictMode(strictMode);
  +        method.getParams().setDefaults(this.params);
           
           try {
               int forwardCount = 0; //protect from an infinite loop
  @@ -188,7 +183,7 @@
       private void addPreemtiveAuthenticationHeaders() {
           
           //pre-emptively add the authorization header, if required.
  -        if (state.isAuthenticationPreemptive()) {
  +        if (this.params.isAuthenticationPreemptive()) {
   
               LOG.debug("Preemptively sending default basic credentials");
   
  @@ -230,7 +225,7 @@
           if (connection == null) {
               connection = connectionManager.getConnectionWithTimeout(
                   hostConfiguration,
  -                httpConnectionFactoryTimeout
  +                this.params.getConnectionManagerTimeout() 
               );
               connection.setLocked(true);
   
  @@ -248,8 +243,8 @@
               
               if (!connection.isOpen()) {
                   // this connection must be opened before it can be used
  -                connection.setSoTimeout(soTimeout);
  -                connection.setConnectionTimeout(connectionTimeout);
  +                connection.setSoTimeout(this.params.getSoTimeout());
  +                connection.setConnectionTimeout(this.params.getConnectionTimeout());
                   connection.open();
                   if (connection.isProxied() && connection.isSecure()) {
                       // we need to create a secure tunnel before we can execute the real method
  @@ -708,57 +703,15 @@
       /**
        * @return
        */
  -    public int getConnectionTimeout() {
  -        return connectionTimeout;
  -    }
  -
  -    /**
  -     * @param connectionTimeout
  -     */
  -    public void setConnectionTimeout(int connectionTimeout) {
  -        this.connectionTimeout = connectionTimeout;
  -    }
  -
  -    /**
  -     * @return
  -     */
  -    public long getHttpConnectionFactoryTimeout() {
  -        return httpConnectionFactoryTimeout;
  -    }
  -
  -    /**
  -     * @param httpConnectionFactoryTimeout
  -     */
  -    public void setHttpConnectionFactoryTimeout(long httpConnectionTimeout) {
  -        this.httpConnectionFactoryTimeout = httpConnectionTimeout;
  -    }
  -
  -    /**
  -     * @return
  -     */
  -    public int getSoTimeout() {
  -        return soTimeout;
  -    }
  -
  -    /**
  -     * @param soTimeout
  -     */
  -    public void setSoTimeout(int soTimeout) {
  -        this.soTimeout = soTimeout;
  -    }
  -
  -    /**
  -     * @return
  -     */
  -    public boolean isStrictMode() {
  -        return strictMode;
  +    public HttpParams getParams() {
  +        return this.params;
       }
   
       /**
  -     * @param strictMode
  +     * @param params
        */
  -    public void setStrictMode(boolean strictMode) {
  -        this.strictMode = strictMode;
  +    public void setParams(final HttpClientParams params) {
  +        this.params = params;
       }
   
   }
  
  
  
  1.26      +11 -37    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpState.java
  
  Index: HttpState.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpState.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- HttpState.java	13 Jul 2003 13:54:50 -0000	1.25
  +++ HttpState.java	11 Sep 2003 20:08:33 -0000	1.26
  @@ -104,22 +104,6 @@
       // ----------------------------------------------------- Instance Variables
   
       /**
  -     * Whether I should attempt to authenticate preemptively.
  -     */
  -    private boolean preemptive;
  -
  -    /**
  -     * The boolean property name to turn on preemptive authentication.
  -     */
  -    public static final String PREEMPTIVE_PROPERTY = 
  -        "httpclient.authentication.preemptive";
  -
  -    /**
  -     * The default property value for #PREEMPTIVE_PROPERTY.
  -     */
  -    public static final String PREEMPTIVE_DEFAULT = "false";
  -
  -    /**
        * My {@link Credentials Credentials}s, by realm.
        */
       private HashMap credMap = new HashMap();
  @@ -143,8 +127,7 @@
        */
       private int cookiePolicy = CookiePolicy.RFC2109;
   
  -    /** The current connection manager */
  -    private HttpConnectionManager httpConnectionManager;
  +    private boolean preemptive = false;
   
       // -------------------------------------------------------- Class Variables
   
  @@ -160,21 +143,6 @@
           
           this.cookiePolicy = CookiePolicy.getDefaultPolicy();
   
  -        // check the preemptive policy
  -        // TODO: this needs to be a service from some configuration class
  -        String preemptiveDefault =
  -            System.getProperties().getProperty(PREEMPTIVE_PROPERTY,
  -                    PREEMPTIVE_DEFAULT);
  -        preemptiveDefault = preemptiveDefault.trim().toLowerCase();
  -
  -        if (!(preemptiveDefault.equals("true")
  -                    || preemptiveDefault.equals("false"))) { // property problem
  -            LOG.warn("Configuration property " + PREEMPTIVE_PROPERTY
  -                     + " must be either true or false.  Using default: "
  -                     + PREEMPTIVE_DEFAULT);
  -            preemptiveDefault = PREEMPTIVE_DEFAULT;
  -        }
  -        this.preemptive = ("true".equals(preemptiveDefault));
       }
   
       // ------------------------------------------------------------- Properties
  @@ -326,6 +294,9 @@
        * attempted or not.
        * 
        * @param value boolean flag
  +     * 
  +     * @deprecated Use {@link HttpClientParams#setAuthenticationPreemptive(boolean)}, 
  +     *   {@link HttpClient#getParams()}.
        */
       
       public void setAuthenticationPreemptive(boolean value) {
  @@ -338,6 +309,9 @@
        * attempted, otherwise return <tt>false</tt>
        * 
        * @return boolean flag.
  +     * 
  +     * @deprecated Use {@link HttpClientParams#isAuthenticationPreemptive()}, 
  +     *   {@link HttpClient#getParams()}.
        */
       
       public boolean isAuthenticationPreemptive() {
  
  
  
  1.25      +6 -5      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java
  
  Index: HeadMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- HeadMethod.java	10 Sep 2003 21:37:48 -0000	1.24
  +++ HeadMethod.java	11 Sep 2003 20:08:33 -0000	1.25
  @@ -70,6 +70,7 @@
   import org.apache.commons.httpclient.HttpMethodBase;
   import org.apache.commons.httpclient.HttpState;
   import org.apache.commons.httpclient.ProtocolException;
  +import org.apache.commons.httpclient.params.HttpMethodParams;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  @@ -198,7 +199,7 @@
                   responseAvailable = false;
               }
               if (responseAvailable) {
  -                if (isStrictMode()) {
  +                if (getParams().isParameterTrue(HttpMethodParams.REJECT_HEAD_BODY)) {
                       throw new ProtocolException(
                           "Body content may not be sent in response to HTTP HEAD request");
                   } else {
  
  
  
  1.1                  jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/DefaultHttpParams.java
  
  Index: DefaultHttpParams.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/DefaultHttpParams.java,v 1.1 2003/09/11 20:08:33 olegk Exp $
   * $Revision: 1.1 $
   * $Date: 2003/09/11 20:08:33 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.commons.httpclient.params;
  
  import java.util.HashMap;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /**
   * This class represents a collection of HTTP protocol parameters. Protocol parameters
   * may be linked together to form a hierarchy. A parameter may be <tt>off</tt>, <tt>on</tt>
   * or not explicitly defined. If a parameter value has not been explicitly defined, 
   * its default value will be drawn from the upper level collection of parameters.
   *   
   * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
   * 
   * @version $Revision: 1.1 $
   *
   */
  
  public class DefaultHttpParams implements HttpParams {
  
      /** Log object for this class. */
      private static final Log LOG = LogFactory.getLog(DefaultHttpParams.class);
  
      private static HttpParamsFactory httpParamsFactory = new DefaultHttpParamsFactory();
  
      public static HttpParams getDefaultParams() {
          return httpParamsFactory.getDefaultParams();
      }
      
      public static void setHttpParamsFactory(HttpParamsFactory httpParamsFactory) {
          DefaultHttpParams.httpParamsFactory = httpParamsFactory;
      }
  
  
      private HttpParams defaults = null;
  
      /** Hash map of HTTP parameters that this object contains */
      private HashMap parameters = null;
      
      public DefaultHttpParams(final HttpParams defaults) {
          super();
          this.defaults = defaults; 
      }
      
      public DefaultHttpParams() {
          this(getDefaultParams());
      }
      
      /** 
       * Returns reference to 
       * 
       */
      public synchronized HttpParams getDefaults() {
          return this.defaults;
      }
      
      public synchronized void setDefaults(final HttpParams params) {
          this.defaults = params;
      }
      
      public synchronized Object getParameter(final String name) {
          // See if the parameter has been explicitly defined
          Object param = null;
          if (this.parameters != null) {
              param = this.parameters.get(name);
          }    
          if (param != null) {
              // If so, return
              return param;
          } else {
              // If not, see if defaults are available
              if (this.defaults != null) {
                  // Return default parameter value
                  return this.defaults.getParameter(name);
              } else {
                  // Otherwise, return null
                  return null;
              }
          }
      }
  
      public synchronized void setParameter(final String name, final Object value) {
          if (this.parameters == null) {
              this.parameters = new HashMap();
          }
          this.parameters.put(name, value);
          if (LOG.isDebugEnabled()) {
              LOG.debug("Set parameter " + name + " = " + value.toString());
          }
      }
      
      public synchronized void setParameters(final String[] names, final Object value) {
          for (int i = 0; i < names.length; i++) {
              setParameter(names[i], value);
          }
      }
  
      public long getLongParameter(final String name, long defaultValue) 
        throws ClassCastException {
          Object param = getParameter(name);
          if (param == null) {
              return defaultValue;
          }
          return ((Long)param).longValue();
      }
      
      public void setLongParameter(final String name, long value) {
          setParameter(name, new Long(value));
      }
  
      public int getIntParameter(final String name, int defaultValue) 
        throws ClassCastException {
          Object param = getParameter(name);
          if (param == null) {
              return defaultValue;
          }
          return ((Integer)param).intValue();
      }
      
      public void setIntParameter(final String name, int value) {
          setParameter(name, new Integer(value));
      }
  
      public double getDoubleParameter(final String name, double defaultValue) 
        throws ClassCastException {
          Object param = getParameter(name);
          if (param == null) {
              return defaultValue;
          }
          return ((Double)param).doubleValue();
      }
      
      public void setDoubleParameter(final String name, double value) {
          setParameter(name, new Double(value));
      }
  
      public boolean getBooleanParameter(final String name, boolean defaultValue) 
        throws ClassCastException {
          Object param = getParameter(name);
          if (param == null) {
              return defaultValue;
          }
          return ((Boolean)param).booleanValue();
      }
      
      public void setBooleanParameter(final String name, boolean value) {
          setParameter(name, new Boolean(value));
      }
  
      public boolean isParameterTrue(final String name) {
          Object param = getParameter(name);
          if (param == null) {
              return false;         
          }
          return ((Boolean)param).booleanValue() == true;
      }
          
      public boolean isParameterFalse(final String name) {
          Object param = getParameter(name);
          if (param == null) {
              return false;         
          }
          return ((Boolean)param).booleanValue() == false;
      }
  }
  
  
  
  1.1                  jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/DefaultHttpParamsFactory.java
  
  Index: DefaultHttpParamsFactory.java
  ===================================================================
  package org.apache.commons.httpclient.params;
  
  import org.apache.commons.httpclient.HttpVersion;
  
  
  
  public class DefaultHttpParamsFactory implements HttpParamsFactory {
  
      private HttpParams httpParams;
  
      /**
       * 
       */
      public DefaultHttpParamsFactory() {
          super();
      }
  
      /* (non-Javadoc)
       * @see org.apache.commons.httpclient.params.HttpParamsFactory#getDefaultParams()
       */
      public HttpParams getDefaultParams() {
          if (httpParams == null) {
              httpParams = createParams();
          }
  
          return httpParams;
      }
  
      protected HttpParams createParams() {
          HttpClientParams params = new HttpClientParams(null);
          
          params.setParameter(HttpMethodParams.USER_AGENT, "Jakarta Commons-HttpClient/2.1m1");
          params.setVersion(HttpVersion.HTTP_1_1);
              
          // TODO: To be removed. Provided for backward compatibility
          String agent = System.getProperties().getProperty("httpclient.useragent");
          if (agent != null) {        
              params.setParameter(HttpMethodParams.USER_AGENT, agent);
          }
          
          // TODO: To be removed. Provided for backward compatibility
          String preemptiveDefault = System.getProperties()
              .getProperty("httpclient.authentication.preemptive");
          if (preemptiveDefault != null) {
              preemptiveDefault = preemptiveDefault.trim().toLowerCase();
              if (preemptiveDefault.equals("true")) {
                  params.setParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, "on");
              } else if (preemptiveDefault.equals("false")) {
                  params.setParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, "off");
              }
          }
          
          return params;
      } 
  
  }
  
  
  
  1.1                  jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpClientParams.java
  
  Index: HttpClientParams.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpClientParams.java,v 1.1 2003/09/11 20:08:33 olegk Exp $
   * $Revision: 1.1 $
   * $Date: 2003/09/11 20:08:33 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.commons.httpclient.params;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  public class HttpClientParams extends HttpMethodParams {
  
      /** Log object for this class. */
      private static final Log LOG = LogFactory.getLog(HttpParams.class);
  
      public static final String SO_TIMEOUT = "http.socket.timeout"; 
      public static final String CONNECTION_TIMEOUT = "http.connection.timeout"; 
      public static final String CONNECTION_MANAGER_TIMEOUT = "http.connection-manager.timeout"; 
      public static final String CONNECTION_MANAGER_CLASS = "http.connection-manager.class"; 
      public static final String PREEMPTIVE_AUTHENTICATION = "http.authentication.preemptive";
      public static final String REJECT_RELATIVE_REDIRECT = "http.protocol.reject-relative-redirect"; 
  
      /**
       * 
       */
      public HttpClientParams() {
          super();
      }
  
      /**
       * @param defaults
       */
      public HttpClientParams(HttpParams defaults) {
          super(defaults);
      }
  
      public int getSoTimeout() {
          return getIntParameter(SO_TIMEOUT, 0);
      }
  
  
      public void setSoTimeout(int timeout) {
          setIntParameter(SO_TIMEOUT, timeout);
      }
  
  
      public int getConnectionTimeout() {
          return getIntParameter(CONNECTION_TIMEOUT, 0);
      }
  
  
      public void setConnectionTimeout(int timeout) {
          setIntParameter(CONNECTION_TIMEOUT, timeout);
      }
  
  
      public long getConnectionManagerTimeout() {
          return getLongParameter(CONNECTION_MANAGER_TIMEOUT, 0);
      }
  
  
      public void setConnectionManagerTimeout(long timeout) {
          setLongParameter(CONNECTION_MANAGER_TIMEOUT, timeout);
      }
  
      public Class getConnectionManagerClass() {
          return (Class) getParameter(CONNECTION_MANAGER_CLASS);
      }
  
      public void setConnectionManagerClass(Class clazz) {
          setParameter(CONNECTION_MANAGER_CLASS, clazz);
      }
      
      public boolean isAuthenticationPreemptive() {
          return getBooleanParameter(PREEMPTIVE_AUTHENTICATION, false); 
      }
  
  
      public void setAuthenticationPreemptive(boolean value) {
          setBooleanParameter(PREEMPTIVE_AUTHENTICATION, value); 
      }
  
      private static final String[] PROTOCOL_STRICTNESS_PARAMETERS = {
          REJECT_RELATIVE_REDIRECT
      };
  
  
      public void makeStrict() {
          super.makeStrict();
          setParameters(PROTOCOL_STRICTNESS_PARAMETERS, new Boolean(true));
      }
  
  
      public void makeLenient() {
          super.makeLenient();
          setParameters(PROTOCOL_STRICTNESS_PARAMETERS, new Boolean(false));
      }
  
  
      public void makeDefault() {
          super.makeDefault();
          setParameters(PROTOCOL_STRICTNESS_PARAMETERS, null);
      }
      
  }
  
  
  
  1.1                  jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpMethodParams.java
  
  Index: HttpMethodParams.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpMethodParams.java,v 1.1 2003/09/11 20:08:33 olegk Exp $
   * $Revision: 1.1 $
   * $Date: 2003/09/11 20:08:33 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.commons.httpclient.params;
  
  import org.apache.commons.httpclient.HttpVersion;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  public class HttpMethodParams extends DefaultHttpParams {
  
      /** Log object for this class. */
      private static final Log LOG = LogFactory.getLog(HttpMethodParams.class);
  
      public static final String USER_AGENT = "http.useragent"; 
      public static final String PROTOCOL_VERSION = "http.protocol.version"; 
  
      public static final String UNAMBIGUOUS_STATUS_LINE = "http.protocol.unambiguous-statusline"; 
      public static final String SINGLE_COOKIE_HEADER = "http.protocol.single-cookie-header"; 
      public static final String STRICT_TRANSFER_ENCODING = "http.protocol.strict-transfer-encoding"; 
      public static final String REJECT_HEAD_BODY = "http.protocol.reject-head-body"; 
  
      /**
       * 
       */
      public HttpMethodParams() {
          super();
      }
  
      /**
       * @param defaults
       */
      public HttpMethodParams(HttpParams defaults) {
          super(defaults);
      }
  
      public HttpVersion getVersion() { 
          Object param = getParameter(PROTOCOL_VERSION);
          if (param == null) {
              return HttpVersion.HTTP_1_1;
          }
          return (HttpVersion)param;
      }
      
      
      public void setVersion(HttpVersion version) {
          setParameter(PROTOCOL_VERSION, version);
      }
  
  
      private static final String[] PROTOCOL_STRICTNESS_PARAMETERS = {
          UNAMBIGUOUS_STATUS_LINE,
          SINGLE_COOKIE_HEADER,
          STRICT_TRANSFER_ENCODING,
          REJECT_HEAD_BODY
      };
      
      
      public void makeStrict() {
          setParameters(PROTOCOL_STRICTNESS_PARAMETERS, new Boolean(true));
      }
  
  
      public void makeLenient() {
          setParameters(PROTOCOL_STRICTNESS_PARAMETERS, new Boolean(false));
      }
  
  
      public void makeDefault() {
          setParameters(PROTOCOL_STRICTNESS_PARAMETERS, null);
      }
  
  }
  
  
  
  1.1                  jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpParams.java
  
  Index: HttpParams.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpParams.java,v 1.1 2003/09/11 20:08:33 olegk Exp $
   * $Revision: 1.1 $
   * $Date: 2003/09/11 20:08:33 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.commons.httpclient.params;
  
  /**
   * This interface represents a collection of HTTP protocol parameters. Protocol parameters
   * may be linked together to form a hierarchy. A parameter may be <tt>off</tt>, <tt>on</tt>
   * or not explicitly defined. If a parameter value has not been explicitly defined, 
   * its default value will be drawn from the upper level collection of parameters.
   *   
   * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
   * 
   * @version $Revision: 1.1 $
   *
   */
  
  public interface HttpParams {
  
      public HttpParams getDefaults();
  
      public void setDefaults(final HttpParams params);
      
      public Object getParameter(final String name);
  
      public void setParameter(final String name, final Object value);
      
      public long getLongParameter(final String name, long defaultValue); 
      
      public void setLongParameter(final String name, long value);
  
      public int getIntParameter(final String name, int defaultValue); 
      
      public void setIntParameter(final String name, int value);
  
      public double getDoubleParameter(final String name, double defaultValue); 
      
      public void setDoubleParameter(final String name, double value);
  
      public boolean getBooleanParameter(final String name, boolean defaultValue); 
      
      public void setBooleanParameter(final String name, boolean value);
  
      public boolean isParameterTrue(final String name);
          
      public boolean isParameterFalse(final String name);
  
  }
  
  
  
  1.1                  jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpParamsFactory.java
  
  Index: HttpParamsFactory.java
  ===================================================================
  package org.apache.commons.httpclient.params;
  
  
  
  public interface HttpParamsFactory {
  
      HttpParams getDefaultParams();
  
  }
  
  
  
  1.1                  jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/package.html
  
  Index: package.html
  ===================================================================
  <!-- $Id: package.html,v 1.1 2003/09/11 20:08:33 olegk Exp $ -->
  <html>
     <head>
        <title>Package Documentation for org.apache.commons.httpclient.params</title>
     </head>
     <body>
        HttpClient preferences framework.
  
        @since 2.1
     </body>
  </html>
  
  
  
  1.16      +8 -3      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/SimpleHttpConnection.java
  
  Index: SimpleHttpConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/SimpleHttpConnection.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SimpleHttpConnection.java	8 May 2003 17:33:53 -0000	1.15
  +++ SimpleHttpConnection.java	11 Sep 2003 20:08:33 -0000	1.16
  @@ -225,5 +225,10 @@
       public void flushRequestOutputStream() throws IOException {
           assertOpen();
       }
  +    
  +    public void releaseConnection() {
  +        //do nothing, as there's nothing to release
  +    }
  +
   }
   
  
  
  
  1.9       +4 -4      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnection.java
  
  Index: TestHttpConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnection.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9