Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b67ce72 authored by Bjorn Bringert's avatar Bjorn Bringert Committed by Android (Google) Code Review
Browse files

Merge "Make fields in WebAddress private, add getters/setters"

parents ff4031bc eb8be973
Loading
Loading
Loading
Loading
+46 −7
Original line number Diff line number Diff line
@@ -39,13 +39,11 @@ import java.util.regex.Pattern;
 */
public class WebAddress {

    private final static String LOGTAG = "http";

    public String mScheme;
    public String mHost;
    public int mPort;
    public String mPath;
    public String mAuthInfo;
    private String mScheme;
    private String mHost;
    private int mPort;
    private String mPath;
    private String mAuthInfo;

    static final int MATCH_GROUP_SCHEME = 1;
    static final int MATCH_GROUP_AUTHORITY = 2;
@@ -122,6 +120,7 @@ public class WebAddress {
        if (mScheme.equals("")) mScheme = "http";
    }

    @Override
    public String toString() {
        String port = "";
        if ((mPort != 443 && mScheme.equals("https")) ||
@@ -135,4 +134,44 @@ public class WebAddress {

        return mScheme + "://" + authInfo + mHost + port + mPath;
    }

    public void setScheme(String scheme) {
      mScheme = scheme;
    }

    public String getScheme() {
      return mScheme;
    }

    public void setHost(String host) {
      mHost = host;
    }

    public String getHost() {
      return mHost;
    }

    public void setPort(int port) {
      mPort = port;
    }

    public int getPort() {
      return mPort;
    }

    public void setPath(String path) {
      mPath = path;
    }

    public String getPath() {
      return mPath;
    }

    public void setAuthInfo(String authInfo) {
      mAuthInfo = authInfo;
    }

    public String getAuthInfo() {
      return mAuthInfo;
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -327,10 +327,10 @@ public class RequestQueue implements RequestFeeder {

        /* Create and queue request */
        Request req;
        HttpHost httpHost = new HttpHost(uri.mHost, uri.mPort, uri.mScheme);
        HttpHost httpHost = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme());

        // set up request
        req = new Request(method, httpHost, mProxyHost, uri.mPath, bodyProvider,
        req = new Request(method, httpHost, mProxyHost, uri.getPath(), bodyProvider,
                          bodyLength, eventHandler, headers);

        queueRequest(req, false);
@@ -375,9 +375,9 @@ public class RequestQueue implements RequestFeeder {
            HttpLog.v("RequestQueue.dispatchSynchronousRequest " + uri);
        }

        HttpHost host = new HttpHost(uri.mHost, uri.mPort, uri.mScheme);
        HttpHost host = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme());

        Request req = new Request(method, host, mProxyHost, uri.mPath,
        Request req = new Request(method, host, mProxyHost, uri.getPath(),
                bodyProvider, bodyLength, eventHandler, headers);

        // Open a new connection that uses our special RequestFeeder
+2 −2
Original line number Diff line number Diff line
@@ -478,7 +478,7 @@ class BrowserFrame extends Handler {
                            .getCurrentItem();
                    if (item != null) {
                        WebAddress uri = new WebAddress(item.getUrl());
                        String schemePlusHost = uri.mScheme + uri.mHost;
                        String schemePlusHost = uri.getScheme() + uri.getHost();
                        String[] up =
                                mDatabase.getUsernamePassword(schemePlusHost);
                        if (up != null && up[0] != null) {
@@ -811,7 +811,7 @@ class BrowserFrame extends Handler {
                    }
                    WebAddress uri = new WebAddress(mCallbackProxy
                            .getBackForwardList().getCurrentItem().getUrl());
                    String schemePlusHost = uri.mScheme + uri.mHost;
                    String schemePlusHost = uri.getScheme() + uri.getHost();
                    String[] ret = getUsernamePassword();
                    // Has the user entered a username/password pair and is
                    // there some POST data
+6 −6
Original line number Diff line number Diff line
@@ -359,7 +359,7 @@ public final class CookieManager {
                    // negative means far future
                    if (cookie.expires < 0 || cookie.expires > now) {
                        // secure cookies can't be overwritten by non-HTTPS url
                        if (!cookieEntry.secure || HTTPS.equals(uri.mScheme)) {
                        if (!cookieEntry.secure || HTTPS.equals(uri.getScheme())) {
                            cookieEntry.value = cookie.value;
                            cookieEntry.expires = cookie.expires;
                            cookieEntry.secure = cookie.secure;
@@ -444,7 +444,7 @@ public final class CookieManager {
        }

        long now = System.currentTimeMillis();
        boolean secure = HTTPS.equals(uri.mScheme);
        boolean secure = HTTPS.equals(uri.getScheme());
        Iterator<Cookie> iter = cookieList.iterator();

        SortedSet<Cookie> cookieSet = new TreeSet<Cookie>(COMPARATOR);
@@ -692,7 +692,7 @@ public final class CookieManager {
     *          ended with "/"
     */
    private String[] getHostAndPath(WebAddress uri) {
        if (uri.mHost != null && uri.mPath != null) {
        if (uri.getHost() != null && uri.getPath() != null) {

            /*
             * The domain (i.e. host) portion of the cookie is supposed to be
@@ -703,12 +703,12 @@ public final class CookieManager {
             * See: http://www.ieft.org/rfc/rfc2965.txt (Section 3.3.3)
             */
            String[] ret = new String[2];
            ret[0] = uri.mHost.toLowerCase();
            ret[1] = uri.mPath;
            ret[0] = uri.getHost().toLowerCase();
            ret[1] = uri.getPath();

            int index = ret[0].indexOf(PERIOD);
            if (index == -1) {
                if (uri.mScheme.equalsIgnoreCase("file")) {
                if (uri.getScheme().equalsIgnoreCase("file")) {
                    // There is a potential bug where a local file path matches
                    // another file in the local web server directory. Still
                    // "localhost" is the best pseudo domain name.
+2 −2
Original line number Diff line number Diff line
@@ -682,7 +682,7 @@ class LoadListener extends Handler implements EventHandler {
                    if (!mAuthFailed && mUsername != null && mPassword != null) {
                        String host = mAuthHeader.isProxy() ?
                                Network.getInstance(mContext).getProxyHostname() :
                                mUri.mHost;
                                mUri.getHost();
                        HttpAuthHandlerImpl.onReceivedCredentials(this, host,
                                mAuthHeader.getRealm(), mUsername, mPassword);
                        makeAuthResponse(mUsername, mPassword);
@@ -952,7 +952,7 @@ class LoadListener extends Handler implements EventHandler {
     */
    String host() {
        if (mUri != null) {
            return mUri.mHost;
            return mUri.getHost();
        }

        return null;
Loading