internal virtual HttpClientConnection GetConnection(HttpRoute route, object state ) { lock (this) { Asserts.Check(!this.shutdown, "Connection manager has been shut down"); if (this.log.IsDebugEnabled()) { this.log.Debug("Get connection for route " + route); } Asserts.Check(!this.leased, "Connection is still allocated"); if (!LangUtils.Equals(this.route, route) || !LangUtils.Equals(this.state, state)) { CloseConnection(); } this.route = route; this.state = state; CheckExpiry(); if (this.conn == null) { this.conn = this.connFactory.Create(route, this.connConfig); } this.leased = true; return(this.conn); } }
/// <summary>Tests if the authentication scopes match.</summary> /// <remarks>Tests if the authentication scopes match.</remarks> /// <returns> /// the match factor. Negative value signifies no match. /// Non-negative signifies a match. The greater the returned value /// the closer the match. /// </returns> public virtual int Match(Apache.Http.Auth.AuthScope that) { int factor = 0; if (LangUtils.Equals(this.scheme, that.scheme)) { factor += 1; } else { if (this.scheme != AnyScheme && that.scheme != AnyScheme) { return(-1); } } if (LangUtils.Equals(this.realm, that.realm)) { factor += 2; } else { if (this.realm != AnyRealm && that.realm != AnyRealm) { return(-1); } } if (this.port == that.port) { factor += 4; } else { if (this.port != AnyPort && that.port != AnyPort) { return(-1); } } if (LangUtils.Equals(this.host, that.host)) { factor += 8; } else { if (this.host != AnyHost && that.host != AnyHost) { return(-1); } } return(factor); }
public override bool Equals(object @object) { if (this == @object) { return(true); } if (@object is NameValuePair) { Org.Apache.Http.Message.BasicNameValuePair that = (Org.Apache.Http.Message.BasicNameValuePair )@object; return(this.name.Equals(that.name) && LangUtils.Equals(this.value, that.value)); } return(false); }
public override bool Equals(object o) { if (this == o) { return(true); } if (o is Apache.Http.Auth.BasicUserPrincipal) { Apache.Http.Auth.BasicUserPrincipal that = (Apache.Http.Auth.BasicUserPrincipal)o; if (LangUtils.Equals(this.username, that.username)) { return(true); } } return(false); }
public override bool Equals(object o) { if (this == o) { return(true); } if (o is Apache.Http.Auth.UsernamePasswordCredentials) { Apache.Http.Auth.UsernamePasswordCredentials that = (Apache.Http.Auth.UsernamePasswordCredentials )o; if (LangUtils.Equals(this.principal, that.principal)) { return(true); } } return(false); }
public override bool Equals(object o) { if (this == o) { return(true); } if (o is Apache.Http.Auth.NTCredentials) { Apache.Http.Auth.NTCredentials that = (Apache.Http.Auth.NTCredentials)o; if (LangUtils.Equals(this.principal, that.principal) && LangUtils.Equals(this.workstation , that.workstation)) { return(true); } } return(false); }
/// <summary>Compares this tracked route to another.</summary> /// <remarks>Compares this tracked route to another.</remarks> /// <param name="o">the object to compare with</param> /// <returns> /// <code>true</code> if the argument is the same tracked route, /// <code>false</code> /// </returns> public sealed override bool Equals(object o) { if (o == this) { return(true); } if (!(o is Apache.Http.Conn.Routing.RouteTracker)) { return(false); } Apache.Http.Conn.Routing.RouteTracker that = (Apache.Http.Conn.Routing.RouteTracker )o; return((this.connected == that.connected) && (this.secure == that.secure) && (this .tunnelled == that.tunnelled) && (this.layered == that.layered) && LangUtils.Equals (this.targetHost, that.targetHost) && LangUtils.Equals(this.localAddress, that.localAddress ) && LangUtils.Equals(this.proxyChain, that.proxyChain)); }
public override bool Equals(object @object) { if (this == @object) { return(true); } if (@object is HeaderElement) { Org.Apache.Http.Message.BasicHeaderElement that = (Org.Apache.Http.Message.BasicHeaderElement )@object; return(this.name.Equals(that.name) && LangUtils.Equals(this.value, that.value) && LangUtils.Equals(this.parameters, that.parameters)); } else { return(false); } }
/// <seealso cref="object.Equals(object)">object.Equals(object)</seealso> public override bool Equals(object o) { if (o == null) { return(false); } if (o == this) { return(true); } if (!(o is Apache.Http.Auth.AuthScope)) { return(base.Equals(o)); } Apache.Http.Auth.AuthScope that = (Apache.Http.Auth.AuthScope)o; return(LangUtils.Equals(this.host, that.host) && this.port == that.port && LangUtils .Equals(this.realm, that.realm) && LangUtils.Equals(this.scheme, that.scheme)); }
/// <summary>Compares this route to another.</summary> /// <remarks>Compares this route to another.</remarks> /// <param name="obj">the object to compare with</param> /// <returns> /// <code>true</code> if the argument is the same route, /// <code>false</code> /// </returns> public sealed override bool Equals(object obj) { if (this == obj) { return(true); } if (obj is Apache.Http.Conn.Routing.HttpRoute) { Apache.Http.Conn.Routing.HttpRoute that = (Apache.Http.Conn.Routing.HttpRoute)obj; return((this.secure == that.secure) && (this.tunnelled == that.tunnelled) && (this .layered == that.layered) && LangUtils.Equals(this.targetHost, that.targetHost) && LangUtils.Equals(this.localAddress, that.localAddress) && LangUtils.Equals(this .proxyChain, that.proxyChain)); } else { // Do the cheapest tests first return(false); } }