[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/Net HttpWebRequest.cs, 1.15, 1
From: |
Gopal.V <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/Net HttpWebRequest.cs, 1.15, 1.16 HttpWebResponse.cs, 1.5, 1.6 |
Date: |
Fri, 18 Jul 2003 16:12:34 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/Net
In directory subversions:/tmp/cvs-serv32179/System/Net
Modified Files:
HttpWebRequest.cs HttpWebResponse.cs
Log Message:
Speed up Http classes by using ContentLength instead of EOF markers
Index: HttpWebRequest.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/HttpWebRequest.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** HttpWebRequest.cs 31 May 2003 10:10:45 -0000 1.15
--- HttpWebRequest.cs 18 Jul 2003 20:12:32 -0000 1.16
***************
*** 188,191 ****
--- 188,192 ----
this.haveResponse=true; // I hope this is correct
}
+ (outStream as HttpStream).ContentLength=response.ContentLength;
return this.response;
}
***************
*** 621,624 ****
--- 622,626 ----
private HttpWebRequest request;
private Stream underlying=null;
+ private long contentLength=Int64.MaxValue;
public HttpStream(HttpWebRequest req)
***************
*** 642,651 ****
public override int Read(byte[] buffer, int offset, int count)
{
! return underlying.Read(buffer, offset, count);
}
public override int ReadByte()
{
! return underlying.ReadByte();
}
--- 644,658 ----
public override int Read(byte[] buffer, int offset, int count)
{
! if(contentLength<=0) return -1;
! int retval = underlying.Read(buffer, offset, count);
! contentLength-=retval;
! return retval;
}
public override int ReadByte()
{
! int retval = underlying.ReadByte();
! contentLength-=1;
! return retval;
}
***************
*** 711,714 ****
--- 718,736 ----
{
underlying.Position = value;
+ }
+ }
+
+ public long ContentLength
+ {
+ set
+ {
+ if(value<=0)
+ {
+ contentLength=Int64.MaxValue;
+ }
+ else
+ {
+ contentLength=value;
+ }
}
}
Index: HttpWebResponse.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/HttpWebResponse.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** HttpWebResponse.cs 9 May 2003 18:57:33 -0000 1.5
--- HttpWebResponse.cs 18 Jul 2003 20:12:32 -0000 1.6
***************
*** 169,173 ****
get
{
! return Int64.Parse(headers["Content-Length"]);
}
}
--- 169,175 ----
get
{
! String contentLength=headers["Content-Length"];
! if(contentLength==null) return 0;
! else return Int64.Parse(contentLength);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/Net HttpWebRequest.cs, 1.15, 1.16 HttpWebResponse.cs, 1.5, 1.6,
Gopal.V <address@hidden> <=