/** @return HTTP authentication realm or null if none. */
 String realm() {
   if (mAuthHeader == null) {
     return null;
   } else {
     return mAuthHeader.getRealm();
   }
 }
  /** Uses user-supplied credentials to restar a request. */
  void handleAuthResponse(String username, String password) {
    if (Config.LOGV) {
      Log.v(
          LOGTAG,
          "LoadListener.handleAuthResponse: url: "
              + mUrl
              + " username: "******" password: "
              + password);
    }

    // create and queue an authentication-response
    if (username != null && password != null) {
      if (mAuthHeader != null && mRequestHandle != null) {
        mAuthHeader.setUsername(username);
        mAuthHeader.setPassword(password);

        int scheme = mAuthHeader.getScheme();
        if (scheme == HttpAuthHeader.BASIC) {
          // create a basic response
          boolean isProxy = mAuthHeader.isProxy();

          mRequestHandle.setupBasicAuthResponse(isProxy, username, password);
        } else {
          if (scheme == HttpAuthHeader.DIGEST) {
            // create a digest response
            boolean isProxy = mAuthHeader.isProxy();

            String realm = mAuthHeader.getRealm();
            String nonce = mAuthHeader.getNonce();
            String qop = mAuthHeader.getQop();
            String algorithm = mAuthHeader.getAlgorithm();
            String opaque = mAuthHeader.getOpaque();

            mRequestHandle.setupDigestAuthResponse(
                isProxy, username, password, realm, nonce, qop, algorithm, opaque);
          }
        }
      }
    }
  }