[Mono-devel-list] [PATCH] A server can send "100 Continue" and immediately after "200 OK"

Yaacov Akiba Slama ya at slamail.org
Mon Jan 26 08:46:18 EST 2004


Hello Gonzallo,

Here a new version of the patch which :

1) Handles the ContinueDelegate call ;
2) Doesn't hang when using it against a web service deployed on MS 
IIS/ASP.NET.

The patch is 136 lines long, but when using diff -ub, the patch a lot 
shorter :

--- WebConnection.cs    2004-01-26 15:04:53.000000000 +0200
+++ WebConnection.cs    2004-01-26 15:14:56.000000000 +0200
@@ -269,7 +269,8 @@
             int pos = 0;
             string line = null;
             bool lineok = false;
-           
+            bool isContinue = false;
+            do {
             if (readState == ReadState.None) {
                 lineok = ReadLine (buffer, ref pos, max, ref line);
                 if (!lineok)
@@ -326,10 +329,21 @@
                     foreach (string s in headers)
                         Data.Headers.Add (s);
 
+                        if (Data.StatusCode == (int) 
HttpStatusCode.Continue) {
+                            if (pos >= max)
+                                return pos;
+                            if (Data.request.ExpectContinue)
+                                Data.request.DoContinueDelegate 
(Data.StatusCode, Data.Headers);
+                            readState = ReadState.None;
+                            isContinue = true;
+                        }
+                        else {
                     readState = ReadState.Content;
                     return pos;
                 }
             }
+                }
+            } while (isContinue == true);
 
             return -1;
         }

Thanks a lot,
Yaacov Akiba Slama

Gonzalo Paniagua Javier wrote:

>El jue, 22-01-2004 a las 21:23, Yaacov Akiba Slama escribió:
>  
>
>>Hello,
>>
>>When a server (for instance a web service) answers, it can send in the 
>>same packet both the status "HTTP/1.1 100 Continue" and the answer 
>>itself (which begins with "HTTP/1.1 200 OK").
>>
>>Without the patch, the client is waiting indefinitely for an answer 
>>which was already received.
>>    
>>
>
>With that patch, if ContinueDelegate is specified, it will not be called
>and the 100 response can also have headers after it. Can you fix that?
>
>-Gonzalo
>
>  
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff-WebConnection-20040126
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040126/c6aa7ff7/attachment.pl 


More information about the Mono-devel-list mailing list