commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpMethodBase.java Authenticator.java
Date Fri, 12 Jul 2002 06:02:52 GMT
dion        2002/07/11 23:02:52

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpMethodBase.java Authenticator.java
  Log:
  Fix for bug 8135 by Jeffrey Dever
  
  Revision  Changes    Path
  1.30      +12 -7     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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- HttpMethodBase.java	12 Jul 2002 01:51:41 -0000	1.29
  +++ HttpMethodBase.java	12 Jul 2002 06:02:52 -0000	1.30
  @@ -111,6 +111,7 @@
    * @author Rodney Waldhoff
    * @author Sean C. Sullivan
    * @author <a href="mailto:dion@apache.org">dIon Gillard</a>
  + * @author <a href="mailto:jsdever@sympatico.ca">Jeff Dever</a>
    * @version $Revision$ $Date$
    */
   public abstract class HttpMethodBase implements HttpMethod {
  @@ -521,9 +522,12 @@
                       boolean authenticated = false;
                       try {
                           authenticated = Authenticator.authenticate(this,state);
  -                    } catch(HttpException e) {
  -                        // ignored
  +                    } catch (HttpException httpe) {
  +                        log.warn(httpe.getMessage());
  +                    } catch (UnsupportedOperationException uoe) {
  +                        log.warn(uoe.getMessage());
                       }
  +
                       if (!authenticated) {
                           // won't be able to authenticate to this challenge
                           // without additional information
  @@ -591,7 +595,8 @@
                                   url = new URL(currentUrl, location.getValue());
                               } else {
                                   if (log.isDebugEnabled()) {
  -                                    log.debug("building url from :" + location.getValue());
  +                                    log.debug("building url from :" + location.getValue()
+
  +                                        ", strict = " + isStrictMode());
                                   }
                                   url = new URL(location.getValue());
                               }                            
  
  
  
  1.14      +21 -10    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Authenticator.java
  
  Index: Authenticator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Authenticator.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Authenticator.java	10 Jul 2002 02:29:32 -0000	1.13
  +++ Authenticator.java	12 Jul 2002 06:02:52 -0000	1.14
  @@ -74,6 +74,7 @@
    * </p>
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
    * @author Rodney Waldhoff
  + * @author <a href="mailto:jsdever@sympatico.ca">Jeff Dever</a>
    * @version $Revision$ $Date$
    */
   class Authenticator {
  @@ -102,6 +103,7 @@
        * {@link HttpMethod}, if possible.
        *
        * @see HttpState#setCredentials(String, Credentials) HttpState.setCredentials
  +     * @see #authenticate(HttpMethod,HttpState,Header,String)
        *
        * @param method a {@link HttpMethod} which requires authentication
        * @param state a {@link HttpState} object providing {@link Credentials}
  @@ -110,7 +112,9 @@
        * @throws UnsupportedOperationException when the given challenge type is not supported
        * @return true if only if a response header was added
        */
  -    static boolean authenticate(HttpMethod method, HttpState state) throws HttpException
{
  +    static boolean authenticate(HttpMethod method, HttpState state) 
  +        throws HttpException, UnsupportedOperationException {
  +
           log.debug("Authenticator.authenticate(HttpMethod, HttpState)");
   
           Header challengeHeader = method.getResponseHeader(WWW_AUTH);
  @@ -124,6 +128,7 @@
        * {@link HttpMethod}, if possible.
        *
        * @see HttpState#setProxyCredentials(String, Credentials) HttpState.setProxyCredentials
  +     * @see #authenticate(HttpMethod,HttpState,Header,String)
        *
        * @param method a {@link HttpMethod} which requires authentication
        * @param state a {@link HttpState} object providing {@link Credentials}
  @@ -132,7 +137,9 @@
        * @throws UnsupportedOperationException when the given challenge type is not supported
        * @return true if only if a response header was added
        */
  -    static boolean authenticateProxy(HttpMethod method, HttpState state) throws HttpException
{
  +    static boolean authenticateProxy(HttpMethod method, HttpState state) 
  +        throws HttpException, UnsupportedOperationException {
  +
           log.debug("Authenticator.authenticateProxy(HttpMethod, HttpState)");
   
           Header challengeHeader = method.getResponseHeader(PROXY_AUTH);
  @@ -144,17 +151,21 @@
        * Add requisite authentication credentials to the given
        * {@link HttpMethod}, if possible, using the given response header
        *
  +     * Currently only <b>Basic</b> authentication is supported.
  +     *
        * @param method the {@link HttpMethod http method} to add the authentication
        *      details to
        * @param challengeHeader the header the web server created to challenge the
        *      credentials
  +     * @param state a {@link HttpState} object providing {@link Credentials}
        * @param respHeader the response header to add (e.g. proxy or standard)
  +     *
        * @throws HttpException when an error occurs parsing the challenge
  +     * @throws UnsupportedOperationException when the given challenge type is not supported
  +     * @return true if only if a response header was added
        */
  -    private static boolean authenticate(HttpMethod method, HttpState state,
  -                                        Header challengeHeader,
  -                                        String respHeader)
  -                                        throws HttpException {
  +    private static boolean authenticate(HttpMethod method, HttpState state, Header challengeHeader,
String respHeader)
  +        throws HttpException, UnsupportedOperationException {
   
           String challenge = challengeHeader.getValue();
           if(null == challenge) { return false; }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message