Skip to content

Commit

Permalink
2003-06-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
Browse files Browse the repository at this point in the history
	* WebConnection.cs: close the socket and connection when disposing.
	* WebRequest.cs: removed setter for RequestUri. Allow non-public ctors
	when creating instances.

	* HttpWebRequest.cs:
	* HttpWebResponse.cs:
	* FileWebRequest.cs: support serialization.

	* FileWebResponse.cs: support serialization and fixed dispose checks.

	* FileWebRequestCreator.cs:
	* HttpRequestCreator.cs: added internal .ctor.

svn path=/trunk/mcs/; revision=15644
  • Loading branch information
gonzalop committed Jun 26, 2003
1 parent 438c7d6 commit 1b462e1
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 73 deletions.
4 changes: 4 additions & 0 deletions mcs/class/System/System.Net/AuthenticationManager.cs
Expand Up @@ -17,6 +17,10 @@ public class AuthenticationManager
{
static ArrayList modules;

private AuthenticationManager ()
{
}

static void EnsureModules ()
{
if (modules != null)
Expand Down
27 changes: 21 additions & 6 deletions mcs/class/System/System.Net/ChangeLog
@@ -1,14 +1,29 @@
2003-06-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* WebConnection.cs: close the socket and connection when disposing.
* WebRequest.cs: removed setter for RequestUri. Allow non-public ctors
when creating instances.

* HttpWebRequest.cs:
* HttpWebResponse.cs:
* FileWebRequest.cs: support serialization.

* FileWebResponse.cs: support serialization and fixed dispose checks.

* FileWebRequestCreator.cs:
* HttpRequestCreator.cs: added internal .ctor.

2003-06-24 Lluis Sanchez Gual <lluis@ximian.com>

* HttpWebRequest.cs: SetWriteStream(): SendRequestHeaders should be called
before asyncWrite.SetCompleted, to make sure that the waiting thread
does not start to send more information before SendRequestHeaders has
finished.
* HttpWebRequest.cs: SetWriteStream(): SendRequestHeaders should be
called before asyncWrite.SetCompleted, to make sure that the waiting
thread does not start to send more information before
SendRequestHeaders has finished.

2003-06-22 Lluis Sanchez Gual <lluis@ximian.com>

* WebConnectionStream.cs: Only increment pendingReads if an asynchronous read
is really needed.
* WebConnectionStream.cs: Only increment pendingReads if an asynchronous
read is really needed.

2003-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>

Expand Down
2 changes: 1 addition & 1 deletion mcs/class/System/System.Net/ConnectionModes.cs
Expand Up @@ -15,7 +15,7 @@ namespace System.Net {

/// <summary>
/// </summary>
public enum ConnectionModes {
enum ConnectionModes {

/// <summary>
/// </summary>
Expand Down
41 changes: 24 additions & 17 deletions mcs/class/System/System.Net/FileWebRequest.cs
Expand Up @@ -22,29 +22,32 @@ public class FileWebRequest : WebRequest, ISerializable

private ICredentials credentials;
private string connectionGroup;
private string method;
private int timeout;
private string method = "GET";
private int timeout = 100000;

private Stream requestStream = null;
private FileWebResponse webResponse = null;
private AutoResetEvent requestEndEvent = null;
private bool requesting = false;
private bool asyncResponding = false;
private Stream requestStream;
private FileWebResponse webResponse;
private AutoResetEvent requestEndEvent;
private bool requesting;
private bool asyncResponding;

// Constructors

internal FileWebRequest (Uri uri)
{
this.uri = uri;
this.webHeaders = new WebHeaderCollection ();
this.method = "GET";
this.timeout = System.Threading.Timeout.Infinite;
}

[MonoTODO]
protected FileWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
{
throw new NotImplementedException ();
SerializationInfo info = serializationInfo;

method = info.GetString ("method");
uri = (Uri) info.GetValue ("uri", typeof (Uri));
timeout = info.GetInt32 ("timeout");
connectionGroup = info.GetString ("connectionGroup");
webHeaders = (WebHeaderCollection) info.GetValue ("webHeaders", typeof (WebHeaderCollection));
}

// Properties
Expand Down Expand Up @@ -224,7 +227,7 @@ public override WebResponse GetResponse ()
return EndGetResponse (asyncResult);
}

public WebResponse GetResponseInternal ()
WebResponse GetResponseInternal ()
{
if (webResponse != null)
return webResponse;
Expand All @@ -245,11 +248,15 @@ public WebResponse GetResponseInternal ()
return (WebResponse) this.webResponse;
}

[MonoTODO]
void ISerializable.GetObjectData (SerializationInfo serializationInfo,
StreamingContext streamingContext)
void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
{
throw new NotImplementedException ();
SerializationInfo info = serializationInfo;

info.AddValue ("method", method);
info.AddValue ("uri", uri, typeof (Uri));
info.AddValue ("timeout", timeout);
info.AddValue ("connectionGroup", connectionGroup);
info.AddValue ("webHeaders", webHeaders, typeof (WebHeaderCollection));
}

internal void Close ()
Expand Down Expand Up @@ -292,4 +299,4 @@ public override void Close()
}
}
}
}
}
4 changes: 4 additions & 0 deletions mcs/class/System/System.Net/FileWebRequestCreator.cs
Expand Up @@ -11,6 +11,10 @@ namespace System.Net
{
class FileWebRequestCreator : IWebRequestCreate
{
internal FileWebRequestCreator ()
{
}

public WebRequest Create (Uri uri)
{
return new FileWebRequest (uri);
Expand Down
43 changes: 22 additions & 21 deletions mcs/class/System/System.Net/FileWebResponse.cs
Expand Up @@ -22,8 +22,6 @@ public class FileWebResponse : WebResponse, ISerializable, IDisposable

// Constructors

protected FileWebResponse () { }

internal FileWebResponse (Uri responseUri, FileStream fileStream)
{
try {
Expand All @@ -38,57 +36,60 @@ internal FileWebResponse (Uri responseUri, FileStream fileStream)
}
}

[MonoTODO]
protected FileWebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)
{
throw new NotImplementedException ();
SerializationInfo info = serializationInfo;

responseUri = (Uri) info.GetValue ("responseUri", typeof (Uri));
contentLength = info.GetInt64 ("contentLength");
webHeaders = (WebHeaderCollection) info.GetValue ("webHeaders", typeof (WebHeaderCollection));
}

// Properties

public override long ContentLength {
get {
try { return this.contentLength; }
finally { CheckDisposed (); }
CheckDisposed ();
return this.contentLength;
}
}

public override string ContentType {
get {
try { return "binary/octet-stream"; }
finally { CheckDisposed (); }
CheckDisposed ();
return "binary/octet-stream";
}
}

public override WebHeaderCollection Headers {
get {
try { return this.webHeaders; }
finally { CheckDisposed (); }
CheckDisposed ();
return this.webHeaders;
}
}

public override Uri ResponseUri {
get {
try { return this.responseUri; }
finally { CheckDisposed (); }
CheckDisposed ();
return this.responseUri;
}
}

// Methods

[MonoTODO]
void ISerializable.GetObjectData (SerializationInfo serializationInfo,
StreamingContext streamingContext)
void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
{
try {
throw new NotImplementedException ();
} finally { CheckDisposed (); }
SerializationInfo info = serializationInfo;

info.AddValue ("responseUri", responseUri, typeof (Uri));
info.AddValue ("contentLength", contentLength);
info.AddValue ("webHeaders", webHeaders, typeof (WebHeaderCollection));
}

public override Stream GetResponseStream()
{
try { return this.fileStream; }
finally { CheckDisposed (); }
CheckDisposed ();
return this.fileStream;
}

// Cleaning up stuff
Expand Down Expand Up @@ -136,4 +137,4 @@ private void CheckDisposed ()
throw new ObjectDisposedException (GetType ().FullName);
}
}
}
}
4 changes: 4 additions & 0 deletions mcs/class/System/System.Net/HttpRequestCreator.cs
Expand Up @@ -11,6 +11,10 @@ namespace System.Net
{
class HttpRequestCreator : IWebRequestCreate
{
internal HttpRequestCreator ()
{
}

public WebRequest Create (Uri uri)
{
return new HttpWebRequest (uri);
Expand Down
46 changes: 42 additions & 4 deletions mcs/class/System/System.Net/HttpWebRequest.cs
Expand Up @@ -72,10 +72,29 @@ internal HttpWebRequest (Uri uri)
this.proxy = GlobalProxySelection.Select;
}

[MonoTODO]
protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
{
throw new NotImplementedException ();
SerializationInfo info = serializationInfo;

requestUri = (Uri) info.GetValue ("requestUri", typeof (Uri));
actualUri = (Uri) info.GetValue ("actualUri", typeof (Uri));
allowAutoRedirect = info.GetBoolean ("allowAutoRedirect");
allowBuffering = info.GetBoolean ("allowBuffering");
certificates = (X509CertificateCollection) info.GetValue ("certificates", typeof (X509CertificateCollection));
connectionGroup = info.GetString ("connectionGroup");
contentLength = info.GetInt64 ("contentLength");
webHeaders = (WebHeaderCollection) info.GetValue ("webHeaders", typeof (WebHeaderCollection));
keepAlive = info.GetBoolean ("keepAlive");
maxAutoRedirect = info.GetInt32 ("maxAutoRedirect");
mediaType = info.GetString ("mediaType");
method = info.GetString ("method");
initialMethod = info.GetString ("initialMethod");
pipelined = info.GetBoolean ("pipelined");
version = (Version) info.GetValue ("version", typeof (Version));
proxy = (IWebProxy) info.GetValue ("proxy", typeof (IWebProxy));
sendChunked = info.GetBoolean ("sendChunked");
timeout = info.GetInt32 ("timeout");
redirects = info.GetInt32 ("redirects");
}

// Properties
Expand Down Expand Up @@ -645,11 +664,30 @@ public override void Abort ()
}
}

[MonoTODO]
void ISerializable.GetObjectData (SerializationInfo serializationInfo,
StreamingContext streamingContext)
{
throw new NotImplementedException ();
SerializationInfo info = serializationInfo;

info.AddValue ("requestUri", requestUri, typeof (Uri));
info.AddValue ("actualUri", actualUri, typeof (Uri));
info.AddValue ("allowAutoRedirect", allowAutoRedirect);
info.AddValue ("allowBuffering", allowBuffering);
info.AddValue ("certificates", certificates, typeof (X509CertificateCollection));
info.AddValue ("connectionGroup", connectionGroup);
info.AddValue ("contentLength", contentLength);
info.AddValue ("webHeaders", webHeaders, typeof (WebHeaderCollection));
info.AddValue ("keepAlive", keepAlive);
info.AddValue ("maxAutoRedirect", maxAutoRedirect);
info.AddValue ("mediaType", mediaType);
info.AddValue ("method", method);
info.AddValue ("initialMethod", initialMethod);
info.AddValue ("pipelined", pipelined);
info.AddValue ("version", version, typeof (Version));
info.AddValue ("proxy", proxy, typeof (IWebProxy));
info.AddValue ("sendChunked", sendChunked);
info.AddValue ("timeout", timeout);
info.AddValue ("redirects", redirects);
}

void CheckRequestStarted ()
Expand Down
41 changes: 20 additions & 21 deletions mcs/class/System/System.Net/HttpWebResponse.cs
Expand Up @@ -27,7 +27,6 @@ public class HttpWebResponse : WebResponse, ISerializable, IDisposable
Version version;
HttpStatusCode statusCode;
string statusDescription;
bool chunked;
long contentLength = -1;
string contentType;

Expand All @@ -53,19 +52,18 @@ internal HttpWebResponse (Uri uri, string method, WebConnectionData data, bool c
}
}

[MonoTODO("Check this out and update if needed")] //Gon
protected HttpWebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)
{
uri = (Uri) serializationInfo.GetValue ("uri", typeof (Uri));
webHeaders = (WebHeaderCollection) serializationInfo.GetValue ("webHeaders",
typeof (WebHeaderCollection));
cookieCollection = (CookieCollection) serializationInfo.GetValue ("cookieCollection",
typeof (CookieCollection));
method = serializationInfo.GetString ("method");
version = (Version) serializationInfo.GetValue ("version", typeof (Version));
statusCode = (HttpStatusCode) serializationInfo.GetValue ("statusCode", typeof (HttpStatusCode));
statusDescription = serializationInfo.GetString ("statusDescription");
chunked = serializationInfo.GetBoolean ("chunked");
SerializationInfo info = serializationInfo;

uri = (Uri) info.GetValue ("uri", typeof (Uri));
contentLength = info.GetInt64 ("contentLength");
contentType = info.GetString ("contentType");
method = info.GetString ("method");
statusDescription = info.GetString ("statusDescription");
cookieCollection = (CookieCollection) info.GetValue ("cookieCollection", typeof (CookieCollection));
version = (Version) info.GetValue ("version", typeof (Version));
statusCode = (HttpStatusCode) info.GetValue ("statusCode", typeof (HttpStatusCode));
}

// Properties
Expand Down Expand Up @@ -227,15 +225,16 @@ public override Stream GetResponseStream ()
void ISerializable.GetObjectData (SerializationInfo serializationInfo,
StreamingContext streamingContext)
{
CheckDisposed ();
serializationInfo.AddValue ("uri", uri);
serializationInfo.AddValue ("webHeaders", webHeaders);
serializationInfo.AddValue ("cookieCollection", cookieCollection);
serializationInfo.AddValue ("method", method);
serializationInfo.AddValue ("version", version);
serializationInfo.AddValue ("statusCode", statusCode);
serializationInfo.AddValue ("statusDescription", statusDescription);
serializationInfo.AddValue ("chunked", chunked);
SerializationInfo info = serializationInfo;

info.AddValue ("uri", uri);
info.AddValue ("contentLength", contentLength);
info.AddValue ("contentType", contentType);
info.AddValue ("method", method);
info.AddValue ("statusDescription", statusDescription);
info.AddValue ("cookieCollection", cookieCollection);
info.AddValue ("version", version);
info.AddValue ("statusCode", statusCode);
}


Expand Down

0 comments on commit 1b462e1

Please sign in to comment.