src/java.base/share/classes/sun/net/www/protocol/http/BasicAuthentication.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 57956 e0b8b019d2f5
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
57956
e0b8b019d2f5 8229997: Apply java.io.Serial annotations in java.base
darcy
parents: 57838
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5464
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5464
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5464
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5464
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5464
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.net.www.protocol.http;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.net.URL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.net.URI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.net.URISyntaxException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.net.PasswordAuthentication;
57838
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    32
import java.nio.ByteBuffer;
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    33
import java.nio.CharBuffer;
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    34
import java.nio.charset.Charset;
5464
8c4deb1b4a45 6947917: Error in basic authentication when user name and password are long
chegar
parents: 4157
diff changeset
    35
import java.io.IOException;
8c4deb1b4a45 6947917: Error in basic authentication when user name and password are long
chegar
parents: 4157
diff changeset
    36
import java.io.OutputStream;
57838
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    37
import java.util.Arrays;
15258
dd5001103120 8006153: HTTP protocol handler authenication should use Base64 API
chegar
parents: 7668
diff changeset
    38
import java.util.Base64;
42351
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    39
import java.util.Objects;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import sun.net.www.HeaderParser;
57838
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    41
import static java.nio.charset.StandardCharsets.UTF_8;
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    42
import static java.nio.charset.StandardCharsets.ISO_8859_1;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * BasicAuthentication: Encapsulate an http server authentication using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * the "basic" scheme.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * @author Bill Foote
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
class BasicAuthentication extends AuthenticationInfo {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
57956
e0b8b019d2f5 8229997: Apply java.io.Serial annotations in java.base
darcy
parents: 57838
diff changeset
    54
    @java.io.Serial
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    private static final long serialVersionUID = 100L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    /** The authentication string for this host, port, and realm.  This is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        a simple BASE64 encoding of "login:password".    */
57838
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    59
    final String auth;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * Create a BasicAuthentication
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public BasicAuthentication(boolean isProxy, String host, int port,
42351
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    65
                               String realm, PasswordAuthentication pw,
57838
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    66
                               boolean isUTF8, String authenticatorKey) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
42351
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    68
              AuthScheme.BASIC, host, port, realm,
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    69
              Objects.requireNonNull(authenticatorKey));
57838
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    70
        this.auth = authValueFrom(pw, isUTF8);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        this.pw = pw;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * Create a BasicAuthentication
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    public BasicAuthentication(boolean isProxy, String host, int port,
42351
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    78
                               String realm, String auth,
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    79
                               String authenticatorKey) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
42351
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    81
              AuthScheme.BASIC, host, port, realm,
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    82
              Objects.requireNonNull(authenticatorKey));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        this.auth = "Basic " + auth;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * Create a BasicAuthentication
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    public BasicAuthentication(boolean isProxy, URL url, String realm,
57838
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    90
                               PasswordAuthentication pw, boolean isUTF8,
42351
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    91
                               String authenticatorKey) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
42351
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    93
              AuthScheme.BASIC, url, realm,
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
    94
              Objects.requireNonNull(authenticatorKey));
57838
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    95
        this.auth = authValueFrom(pw, isUTF8);
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    96
        this.pw = pw;
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    97
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
57838
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
    99
    private static String authValueFrom(PasswordAuthentication pw, boolean isUTF8) {
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   100
        String plain = pw.getUserName() + ":";
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   101
        char[] password = pw.getPassword();
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   102
        CharBuffer cbuf = CharBuffer.allocate(plain.length() + password.length);
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   103
        cbuf.put(plain).put(password).flip();
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   104
        Charset charset = isUTF8 ? UTF_8 : ISO_8859_1;
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   105
        ByteBuffer buf = charset.encode(cbuf);
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   106
        ByteBuffer enc = Base64.getEncoder().encode(buf);
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   107
        String ret = "Basic " + new String(enc.array(), enc.position(), enc.remaining(), ISO_8859_1);
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   108
        Arrays.fill(buf.array(), (byte) 0);
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   109
        Arrays.fill(enc.array(), (byte) 0);
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   110
        Arrays.fill(cbuf.array(), (char) 0);
78844dceede6 8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication
michaelm
parents: 47216
diff changeset
   111
        return ret;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * Create a BasicAuthentication
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    public BasicAuthentication(boolean isProxy, URL url, String realm,
42351
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
   118
                               String auth, String authenticatorKey) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
42351
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
   120
              AuthScheme.BASIC, url, realm,
85ed90be0ae1 8169495: Add a method to set an Authenticator on a HttpURLConnection.
dfuchs
parents: 25859
diff changeset
   121
              Objects.requireNonNull(authenticatorKey));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        this.auth = "Basic " + auth;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * @return true if this authentication supports preemptive authorization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     */
4157
558590fb3b49 6893238: Move NTLM and SPNEGO implementations into separate packages
chegar
parents: 3952
diff changeset
   128
    @Override
558590fb3b49 6893238: Move NTLM and SPNEGO implementations into separate packages
chegar
parents: 3952
diff changeset
   129
    public boolean supportsPreemptiveAuthorization() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * Set header(s) on the given connection. This will only be called for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * definitive (i.e. non-preemptive) authorization.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @param conn The connection to apply the header(s) to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @param p A source of header values for this connection, if needed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @param raw The raw header values for this connection, if needed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * @return true if all goes well, false if no headers were set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
4157
558590fb3b49 6893238: Move NTLM and SPNEGO implementations into separate packages
chegar
parents: 3952
diff changeset
   141
    @Override
558590fb3b49 6893238: Move NTLM and SPNEGO implementations into separate packages
chegar
parents: 3952
diff changeset
   142
    public boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        conn.setAuthenticationProperty(getHeaderName(), getHeaderValue(null,null));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * @return the value of the HTTP header this authentication wants set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     */
4157
558590fb3b49 6893238: Move NTLM and SPNEGO implementations into separate packages
chegar
parents: 3952
diff changeset
   150
    @Override
558590fb3b49 6893238: Move NTLM and SPNEGO implementations into separate packages
chegar
parents: 3952
diff changeset
   151
    public String getHeaderValue(URL url, String method) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        /* For Basic the authorization string does not depend on the request URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
         * or the request method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        return auth;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * For Basic Authentication, the security parameters can never be stale.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * In other words there is no possibility to reuse the credentials.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * They are always either valid or invalid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     */
4157
558590fb3b49 6893238: Move NTLM and SPNEGO implementations into separate packages
chegar
parents: 3952
diff changeset
   163
    @Override
558590fb3b49 6893238: Move NTLM and SPNEGO implementations into separate packages
chegar
parents: 3952
diff changeset
   164
    public boolean isAuthorizationStale (String header) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @return the common root path between npath and path.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * This is used to detect when we have an authentication for two
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * paths and the root of th authentication space is the common root.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    static String getRootPath(String npath, String opath) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        int index = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        int toindex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        /* Must normalize so we don't get confused by ../ and ./ segments */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            npath = new URI (npath).normalize().getPath();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            opath = new URI (opath).normalize().getPath();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        } catch (URISyntaxException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            /* ignore error and use the old value */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        while (index < opath.length()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            toindex = opath.indexOf('/', index+1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            if (toindex != -1 && opath.regionMatches(0, npath, 0, toindex+1))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                index = toindex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                return opath.substring(0, index+1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        /*should not reach here. If we do simply return npath*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        return npath;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    }
15258
dd5001103120 8006153: HTTP protocol handler authenication should use Base64 API
chegar
parents: 7668
diff changeset
   196
}