public HttpCommandExecutor(Uri addressOfRemoteServer, TimeSpan timeout)
{
if (addressOfRemoteServer == null)
{
throw new ArgumentNullException("addressOfRemoteServer", "You must specify a remote address to connect to");
}
if (!addressOfRemoteServer.AbsoluteUri.EndsWith("/", StringComparison.OrdinalIgnoreCase))
{
addressOfRemoteServer = new Uri(addressOfRemoteServer.ToString() + "/");
}
this.remoteServerUri = addressOfRemoteServer;
this.serverResponseTimeout = timeout;
// In the .NET Framework, HttpWebRequest responses with an error code are limited
// to 64k by default. Since the remote server error responses include a screenshot,
// they can frequently exceed this size. This only applies to the .NET Framework;
// Mono does not implement the property.
if (Type.GetType("Mono.Runtime", false, true) == null)
{
HttpWebRequest.DefaultMaximumErrorResponseLength = -1;
}
}