From: Jake Farrell Date: Fri, 18 May 2012 00:33:54 +0000 (+0000) Subject: THRIFT-1159:THttpClient->Flush() issue (connection thru proxy) X-Git-Tag: 0.9.1~363 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=5e022aa6865918d56616b9ef026337bd766ce04a;p=common%2Fthrift.git THRIFT-1159:THttpClient->Flush() issue (connection thru proxy) Client: csharp Patch: Joshua Samuel + Alex Gaas Resolve HttpClient flush issues with proxy. git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1339934 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/csharp/src/Transport/THttpClient.cs b/lib/csharp/src/Transport/THttpClient.cs index 106f840d..c875a43c 100644 --- a/lib/csharp/src/Transport/THttpClient.cs +++ b/lib/csharp/src/Transport/THttpClient.cs @@ -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 customHeaders = new Dictionary(); + 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;