diff --git a/src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs b/src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs index a873a1dfe24..675d7c063cc 100644 --- a/src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs +++ b/src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs @@ -82,6 +82,9 @@ public class ConnectionConfiguration : IConnectionConfigurationValues, IHideO #endif bool IConnectionConfigurationValues.KeepRawResponse { get{ return _keepRawResponse; } } + private bool _automaticProxyDetection = true; + bool IConnectionConfigurationValues.AutomaticProxyDetection { get { return _automaticProxyDetection; } } + private int _maximumAsyncConnections; int IConnectionConfigurationValues.MaximumAsyncConnections { get{ return _maximumAsyncConnections; } } @@ -284,12 +287,12 @@ protected void ConnectionStatusDefaultHandler(IElasticsearchResponse status) /// /// Global callback for every response that NEST receives, useful for custom logging. /// - public T SetConnectionStatusHandler(Action handler) - { - handler.ThrowIfNull("handler"); - this._connectionStatusHandler = handler; - return (T) this; - } + public T SetConnectionStatusHandler(Action handler) + { + handler.ThrowIfNull("handler"); + this._connectionStatusHandler = handler; + return (T)this; + } } } diff --git a/src/Elasticsearch.Net/Connection/HttpConnection.cs b/src/Elasticsearch.Net/Connection/HttpConnection.cs index 4bf7640b2f7..ebe5c244b43 100644 --- a/src/Elasticsearch.Net/Connection/HttpConnection.cs +++ b/src/Elasticsearch.Net/Connection/HttpConnection.cs @@ -146,7 +146,10 @@ private void SetProxyIfNeeded(HttpWebRequest myReq) proxy.Credentials = credentials; myReq.Proxy = proxy; } - //myReq.Proxy = null; + if(!this.ConnectionSettings.AutomaticProxyDetection) + { + myReq.Proxy = null; + } } private void SetBasicAuthorizationIfNeeded(HttpWebRequest myReq) diff --git a/src/Elasticsearch.Net/Connection/IConnectionConfiguration.cs b/src/Elasticsearch.Net/Connection/IConnectionConfiguration.cs index 713c082743b..5414115d0b2 100644 --- a/src/Elasticsearch.Net/Connection/IConnectionConfiguration.cs +++ b/src/Elasticsearch.Net/Connection/IConnectionConfiguration.cs @@ -65,5 +65,6 @@ public interface IConnectionConfiguration : IHideObjectMembers /// Global callback for every response that NEST receives, useful for custom logging. /// T SetConnectionStatusHandler(Action handler); + } } diff --git a/src/Elasticsearch.Net/Connection/IConnectionConfigurationValues.cs b/src/Elasticsearch.Net/Connection/IConnectionConfigurationValues.cs index ec14ee8c9dc..c5171cc8a1f 100644 --- a/src/Elasticsearch.Net/Connection/IConnectionConfigurationValues.cs +++ b/src/Elasticsearch.Net/Connection/IConnectionConfigurationValues.cs @@ -24,6 +24,7 @@ public interface IConnectionConfigurationValues bool TraceEnabled { get; } bool UsesPrettyResponses { get; } bool KeepRawResponse { get; } + bool AutomaticProxyDetection { get; } /// /// Instead of following a c/go like error checking on response.IsValid always throw an ElasticsearchServerException