Skip to content

Added AutomaticProxyDetection to Connectionconfiguration #666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ public class ConnectionConfiguration<T> : 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; } }

Expand Down Expand Up @@ -284,12 +287,12 @@ protected void ConnectionStatusDefaultHandler(IElasticsearchResponse status)
/// <summary>
/// Global callback for every response that NEST receives, useful for custom logging.
/// </summary>
public T SetConnectionStatusHandler(Action<IElasticsearchResponse> handler)
{
handler.ThrowIfNull("handler");
this._connectionStatusHandler = handler;
return (T) this;
}
public T SetConnectionStatusHandler(Action<IElasticsearchResponse> handler)
{
handler.ThrowIfNull("handler");
this._connectionStatusHandler = handler;
return (T)this;
}
}
}

5 changes: 4 additions & 1 deletion src/Elasticsearch.Net/Connection/HttpConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ public interface IConnectionConfiguration<out T> : IHideObjectMembers
/// Global callback for every response that NEST receives, useful for custom logging.
/// </summary>
T SetConnectionStatusHandler(Action<IElasticsearchResponse> handler);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public interface IConnectionConfigurationValues
bool TraceEnabled { get; }
bool UsesPrettyResponses { get; }
bool KeepRawResponse { get; }
bool AutomaticProxyDetection { get; }

/// <summary>
/// Instead of following a c/go like error checking on response.IsValid always throw an ElasticsearchServerException
Expand Down