php gzipstream,c# – 在WebRequest中发送gzip数据?
我有大量的數據(?100k),我的C#應用??程序發送到我的Apache服務器,安裝了mod_gzip.我試圖使用System.IO.Compression.GZipStream gzip數據.
PHP收到原始的gzip壓縮數據,所以Apache并不像我所期望的那樣解壓縮它.我錯過了什么嗎?
System.Net.WebRequest req = WebRequest.Create(this.Url);
req.Method = this.Method; // "post"
req.Timeout = this.Timeout;
req.ContentType = "application/x-www-form-urlencoded";
req.Headers.Add("Content-Encoding: gzip");
System.IO.Stream reqStream = req.GetRequestStream();
GZipStream gz = new GZipStream(reqStream, CompressionMode.Compress);
System.IO.StreamWriter sw = new System.IO.StreamWriter(gz, Encoding.ASCII);
sw.Write( large_amount_of_data );
sw.Close();
gz.Close();
reqStream.Close()
System.Net.WebResponse resp = req.GetResponse();
// (handle response...)
我不完全確定“Content-Encoding:gzip”適用于客戶端提供的標題.
總結
以上是生活随笔為你收集整理的php gzipstream,c# – 在WebRequest中发送gzip数据?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 鸿雁作者是谁啊?
- 下一篇: mysql 脑裂的问题,DRBD脑裂问题