THRIFT-4217 HttpClient should support gzip and deflate
Client: C#
Patch: Jens Geyer
diff --git a/lib/csharp/src/Net35/ExtensionsNet35.cs b/lib/csharp/src/Net35/ExtensionsNet35.cs
new file mode 100644
index 0000000..73a4232
--- /dev/null
+++ b/lib/csharp/src/Net35/ExtensionsNet35.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+#if (!NET45)
+namespace Thrift
+{
+ static class StreamExtensionsNet35
+ {
+ // CopyTo() has been added in 4.0
+ public static long CopyTo(this Stream source, Stream target)
+ {
+ byte[] buffer = new byte[8192]; // multiple of 4096
+ long nTotal = 0;
+ while (true)
+ {
+ int nRead = source.Read(buffer, 0, buffer.Length);
+ if (nRead <= 0) // done?
+ return nTotal;
+
+ target.Write(buffer, 0, nRead);
+ nTotal += nRead;
+ }
+ }
+ }
+
+}
+#endif
+