Author: jfarrell
Date: Fri May 18 00:33:54 2012
New Revision: 1339934
URL: http://svn.apache.org/viewvc?rev=1339934&view=rev
Log:
THRIFT-1159:THttpClient->Flush() issue (connection thru proxy)
Client: csharp
Patch: Joshua Samuel + Alex Gaas
Resolve HttpClient flush issues with proxy.
Modified:
thrift/trunk/lib/csharp/src/Transport/THttpClient.cs
Modified: thrift/trunk/lib/csharp/src/Transport/THttpClient.cs
URL:
http://svn.apache.org/viewvc/thrift/trunk/lib/csharp/src/Transport/THttpClient.cs?rev=1339934&r1=1339933&r2=1339934&view=diff
==============================================================================
--- thrift/trunk/lib/csharp/src/Transport/THttpClient.cs (original)
+++ thrift/trunk/lib/csharp/src/Transport/THttpClient.cs Fri May 18 00:33:54
2012
@@ -32,13 +32,21 @@ namespace Thrift.Transport
private readonly Uri uri;
private Stream inputStream;
private MemoryStream outputStream = new MemoryStream();
- private int connectTimeout = 0;
- private int readTimeout = 0;
+
+ // Timeouts in milliseconds
+ private int connectTimeout = 30000;
+
+ private int readTimeout = 30000;
+
private IDictionary<String, String> customHeaders = new
Dictionary<string, string>();
+ private HttpWebRequest connection = null;
+ private IWebProxy proxy = WebRequest.DefaultWebProxy;
+
public THttpClient(Uri u)
{
uri = u;
+ connection = CreateRequest();
}
public int ConnectTimeout
@@ -65,6 +73,14 @@ namespace Thrift.Transport
}
}
+ public IWebProxy Proxy
+ {
+ set
+ {
+ proxy = value;
+ }
+ }
+
public override bool IsOpen
{
get
@@ -192,7 +208,7 @@ namespace Thrift.Transport
}
#if !SILVERLIGHT
- connection.Proxy = null;
+ connection.Proxy = proxy;
#endif
return connection;