dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnetlib ChangeLog System/Net/HttpWebRequest.cs ...


From: Radek Polak
Subject: [dotgnu-pnet-commits] pnetlib ChangeLog System/Net/HttpWebRequest.cs ...
Date: Sat, 28 Feb 2009 23:19:27 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnetlib
Changes by:     Radek Polak <radekp>    09/02/28 23:19:27

Modified files:
        .              : ChangeLog 
        System/Net     : HttpWebRequest.cs HttpWebResponse.cs 
        System.Xml     : XmlTextWriter.cs 

Log message:
        various http fixes to make basic web services working

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2565&r2=1.2566
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System/Net/HttpWebRequest.cs?cvsroot=dotgnu-pnet&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System/Net/HttpWebResponse.cs?cvsroot=dotgnu-pnet&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Xml/XmlTextWriter.cs?cvsroot=dotgnu-pnet&r1=1.35&r2=1.36

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2565
retrieving revision 1.2566
diff -u -b -r1.2565 -r1.2566
--- ChangeLog   27 Feb 2009 13:55:06 -0000      1.2565
+++ ChangeLog   28 Feb 2009 23:19:25 -0000      1.2566
@@ -1,3 +1,13 @@
+2009-03-01  Radek Polak  <address@hidden>
+
+       * System.Xml/XmlTextWriter.cs: Fix missing separator when writing 
prefix.
+
+       * System/Net/HttpWebRequest.cs: Send header after request stream is 
closed
+       in case when content length is not specified. Implement http status 100.
+       Don't throw exceptions on TODO method.
+
+       * System/Net/HttpWebResponse.cs: Don't throw exceptions on TODO method.
+
 2009-02-27  Radek Polak  <address@hidden>
 
        * System.Windows.Forms/StatusBar.cs: Draw icon in panel.

Index: System/Net/HttpWebRequest.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System/Net/HttpWebRequest.cs,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- System/Net/HttpWebRequest.cs        5 Oct 2004 14:01:50 -0000       1.26
+++ System/Net/HttpWebRequest.cs        28 Feb 2009 23:19:26 -0000      1.27
@@ -178,7 +178,7 @@
                if(outStream==null)
                {
                        if(preAuthenticate) AddHttpAuthHeaders(null);
-                       outStream=new HttpStream(this);
+                       outStream=new HttpStream(this, contentLength < 0);
                }
                return outStream;
        }
@@ -194,7 +194,7 @@
                if(outStream==null)
                {
                        if(preAuthenticate) AddHttpAuthHeaders(null);
-                       outStream=new HttpStream(this);
+                       outStream=new HttpStream(this, false);
                        outStream.Flush();
                        // which is the response stream as well 
                }
@@ -383,12 +383,10 @@
        {
                get
                {
-                       throw new NotImplementedException("CookieContainer");
+                       return null;
                }
-
                set
                {
-                       throw new NotImplementedException("CookieContainer");
                }
        }
 #endif // !ECMA_COMPAT
@@ -796,18 +794,31 @@
                private HttpWebRequest request;
                private Stream underlying=null;
                private long contentLength=Int64.MaxValue;
+               private Stream netStream;
 
-               public HttpStream(HttpWebRequest req) 
-                       : this(req, HttpStream.OpenStream(req))
+               public HttpStream(HttpWebRequest req, bool computeContentLength)
+                       : this(req, HttpStream.OpenStream(req), 
computeContentLength)
                {
                }
 
-               public HttpStream(HttpWebRequest req, Stream underlying)
+               public HttpStream(HttpWebRequest req, Stream underlying,
+                                                 bool computeContentLength)
                {
                        this.request=req;
                        this.underlying=underlying;
+
+                       // If sendHeaderOnClose is set, then we use memory 
stream as
+                       // underlying stream so that we can compute content 
length.
+                       if(computeContentLength)
+                       {
+                               netStream = underlying;
+                               this.underlying = new MemoryStream();
+                       }
+                       else
+                       {
                        SendHeaders();
                }
+               }
 
                ~HttpStream()
                {
@@ -862,7 +873,19 @@
 
                public override void Close()
                {
-                       /* Nothing */
+                       underlying.Flush();
+
+                       MemoryStream ms = underlying as MemoryStream;
+                       if(ms == null)
+                       {
+                               return;
+                       }
+
+                       // Update content length and send reqest over network.
+                       request.ContentLength = ms.Length;
+                       underlying = netStream;
+                       SendHeaders();
+                       ms.WriteTo(netStream);
                }
 
                public override bool CanRead 
@@ -1185,6 +1208,13 @@
                        HttpStatusCode code=response.StatusCode;
                        switch(code)
                        {
+                               case HttpStatusCode.Continue:
+                               {
+                                       // Drop this response so that real one 
can be read.
+                                       request.response = null;
+                                       return request;
+                               }
+
                                case HttpStatusCode.OK:
                                {
                                        if(http==HttpAuthState.Trying) 
http=HttpAuthState.OK;

Index: System/Net/HttpWebResponse.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System/Net/HttpWebResponse.cs,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- System/Net/HttpWebResponse.cs       6 Aug 2005 12:30:37 -0000       1.12
+++ System/Net/HttpWebResponse.cs       28 Feb 2009 23:19:26 -0000      1.13
@@ -201,11 +201,10 @@
        {
                get
                {
-                       throw new NotImplementedException("Cookies");
+                       return null;
                }
                set
                {
-                               throw new NotImplementedException("Cookies");
                }
        }
 #endif // !ECMA_COMPAT

Index: System.Xml/XmlTextWriter.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System.Xml/XmlTextWriter.cs,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- System.Xml/XmlTextWriter.cs 20 Oct 2006 10:22:37 -0000      1.35
+++ System.Xml/XmlTextWriter.cs 28 Feb 2009 23:19:26 -0000      1.36
@@ -478,7 +478,7 @@
                                // Write the prefix declaration, if needed.
                                if(needPrefixDecl)
                                {
-                                       writer.Write("xmlns:");
+                                       writer.Write(" xmlns:");
                                        writer.Write(scope.prefix);
                                        writer.Write('=');
                                        writer.Write(quoteChar);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]