php gzipstream,c# – 在WebRequest中发送gzip数据?
我有大量的數(shù)據(jù)(?100k),我的C#應(yīng)用??程序發(fā)送到我的Apache服務(wù)器,安裝了mod_gzip.我試圖使用System.IO.Compression.GZipStream gzip數(shù)據(jù).
PHP收到原始的gzip壓縮數(shù)據(jù),所以Apache并不像我所期望的那樣解壓縮它.我錯(cuò)過(guò)了什么嗎?
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”適用于客戶端提供的標(biāo)題.
總結(jié)
以上是生活随笔為你收集整理的php gzipstream,c# – 在WebRequest中发送gzip数据?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 鸿雁作者是谁啊?
- 下一篇: mysql 脑裂的问题,DRBD脑裂问题