You've already forked linux-packaging-mono
Imported Upstream version 5.12.0.220
Former-commit-id: c477e03582759447177c6d4bf412cd2355aad476
This commit is contained in:
parent
8bd104cef2
commit
8fc30896db
@ -39,6 +39,8 @@ using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Net
|
||||
@ -60,16 +62,28 @@ namespace System.Net
|
||||
Stream stream;
|
||||
|
||||
// Constructors
|
||||
|
||||
internal HttpWebResponse (Uri uri, string method, WebConnectionData data, CookieContainer container)
|
||||
|
||||
internal HttpWebResponse (Uri uri, string method, HttpStatusCode status, WebHeaderCollection headers)
|
||||
{
|
||||
this.uri = uri;
|
||||
this.method = method;
|
||||
webHeaders = data.Headers;
|
||||
version = data.Version;
|
||||
statusCode = (HttpStatusCode) data.StatusCode;
|
||||
statusDescription = data.StatusDescription;
|
||||
stream = data.stream;
|
||||
this.statusCode = status;
|
||||
this.statusDescription = HttpStatusDescription.Get (status);
|
||||
this.webHeaders = headers;
|
||||
version = HttpVersion.Version10;
|
||||
contentLength = -1;
|
||||
}
|
||||
|
||||
internal HttpWebResponse (Uri uri, string method, WebResponseStream stream, CookieContainer container)
|
||||
{
|
||||
this.uri = uri;
|
||||
this.method = method;
|
||||
this.stream = stream;
|
||||
|
||||
webHeaders = stream.Headers ?? new WebHeaderCollection ();
|
||||
version = stream.Version;
|
||||
statusCode = stream.StatusCode;
|
||||
statusDescription = stream.StatusDescription ?? HttpStatusDescription.Get (statusCode);
|
||||
contentLength = -1;
|
||||
|
||||
try {
|
||||
@ -86,12 +100,12 @@ namespace System.Net
|
||||
}
|
||||
|
||||
string content_encoding = webHeaders ["Content-Encoding"];
|
||||
if (content_encoding == "gzip" && (data.request.AutomaticDecompression & DecompressionMethods.GZip) != 0) {
|
||||
stream = new GZipStream (stream, CompressionMode.Decompress);
|
||||
if (content_encoding == "gzip" && (stream.Request.AutomaticDecompression & DecompressionMethods.GZip) != 0) {
|
||||
this.stream = new GZipStream (stream, CompressionMode.Decompress);
|
||||
webHeaders.Remove (HttpRequestHeader.ContentEncoding);
|
||||
}
|
||||
else if (content_encoding == "deflate" && (data.request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) {
|
||||
stream = new DeflateStream (stream, CompressionMode.Decompress);
|
||||
else if (content_encoding == "deflate" && (stream.Request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) {
|
||||
this.stream = new DeflateStream (stream, CompressionMode.Decompress);
|
||||
webHeaders.Remove (HttpRequestHeader.ContentEncoding);
|
||||
}
|
||||
}
|
||||
@ -154,6 +168,8 @@ namespace System.Net
|
||||
|
||||
if (contentType == null)
|
||||
contentType = webHeaders ["Content-Type"];
|
||||
if (contentType == null)
|
||||
contentType = string.Empty;
|
||||
|
||||
return contentType;
|
||||
}
|
||||
@ -263,17 +279,6 @@ namespace System.Net
|
||||
return (value != null) ? value : "";
|
||||
}
|
||||
|
||||
internal void ReadAll ()
|
||||
{
|
||||
WebConnectionStream wce = stream as WebConnectionStream;
|
||||
if (wce == null)
|
||||
return;
|
||||
|
||||
try {
|
||||
wce.ReadAll ();
|
||||
} catch {}
|
||||
}
|
||||
|
||||
public override Stream GetResponseStream ()
|
||||
{
|
||||
CheckDisposed ();
|
||||
@ -310,12 +315,9 @@ namespace System.Net
|
||||
|
||||
public override void Close ()
|
||||
{
|
||||
if (stream != null) {
|
||||
Stream st = stream;
|
||||
stream = null;
|
||||
if (st != null)
|
||||
st.Close ();
|
||||
}
|
||||
var st = Interlocked.Exchange (ref stream, null);
|
||||
if (st != null)
|
||||
st.Close ();
|
||||
}
|
||||
|
||||
void IDisposable.Dispose ()
|
||||
|
Reference in New Issue
Block a user