Permalink
Browse files

Fixes HTTP.post_form (http://ironruby.codeplex.com/WorkItem/View.aspx…

…?WorkItemId=1353). Socket#write was not flushing the data, and so a later read could block since the endpoint would not send any response
  • Loading branch information...
1 parent fd79351 commit 74d580cebe5dc74dbf6ce67399159dfc8ce8686b Shri Borde committed Jul 23, 2009
Showing with 9 additions and 28 deletions.
  1. +0 −14 Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/critical_tags.txt
  2. +1 −1 Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/ftp/get_tags.txt
  3. +1 −1 ...rnal.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/ftp/getbinaryfile_tags.txt
  4. +1 −1 ...xternal.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/ftp/retrbinary_tags.txt
  5. +0 −2 ...al.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/http/http/get_print_tags.txt
  6. +0 −1 ...xternal.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/http/http/lock_tags.txt
  7. +0 −1 ...al.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/http/http/post_form_tags.txt
  8. +0 −1 ...xternal.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/http/http/post_tags.txt
  9. +0 −1 ...nal.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/http/http/propfind_tags.txt
  10. +0 −1 ...al.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/http/http/proppatch_tags.txt
  11. +0 −1 ...External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/http/http/put_tags.txt
  12. +0 −1 ...rnal.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/http/http/request_tags.txt
  13. +0 −1 ...LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/http/http/send_request_tags.txt
  14. +0 −1 ...ernal.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/net/http/http/unlock_tags.txt
  15. +6 −0 Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/socket/SocketStream.cs
@@ -44,20 +44,6 @@ core\thread\critical_tags.txt:0:critical:Thread.critical= can be mismatched
core\thread\raise_tags.txt:0:critical:Thread#raise on another thread re-raises active exception
core\thread\critical_tags.txt:0:unstable:Thread.critical= does not change status of other existing threads
language\method_tags.txt:0:critical:Calling a method fails with both lambda and block argument
-library\net\ftp\get_tags.txt:0:critical:Net::FTP#get (binary mode)
-library\net\ftp\getbinaryfile_tags.txt:0:critical:Net::FTP#getbinaryfile
-library\net\ftp\retrbinary_tags.txt:0:critical:Net::FTP#retrbinary
-library\net\http\http\get_print_tags.txt:0:critical:Net::HTTP.get_print when passed URI it prints the body of the specified uri to $stdout
-library\net\http\http\get_print_tags.txt:0:critical:Net::HTTP.get_print when passed host, path, port it prints the body of the specified uri to $stdout
-library\net\http\http\lock_tags.txt:0:critical:Net::HTTP#lock sends a LOCK request to the passed path and returns the response
-library\net\http\http\post_form_tags.txt:0:critical:Net::HTTP.post_form when passed URI POSTs the passed form data to the given uri
-library\net\http\http\post_tags.txt:0:critical:Net::HTTP#post
-library\net\http\http\propfind_tags.txt:0:critical:Net::HTTP#propfind
-library\net\http\http\proppatch_tags.txt:0:critical:Net::HTTP#proppatch
-library\net\http\http\put_tags.txt:0:critical:Net::HTTP#put
-library\net\http\http\request_tags.txt:0:critical:Net::HTTP#request
-library\net\http\http\send_request_tags.txt:0:critical:Net::HTTP#send_request
-library\net\http\http\unlock_tags.txt:0:critical:Net::HTTP#unlock
library\resolv\get_address_tags.txt:0:critical:Resolv#getaddress
library\resolv\get_addresses_tags.txt:0:critical:Resolv#getaddresses
library\resolv\get_name_tags.txt:0:critical:Resolv#getname
@@ -1,4 +1,4 @@
-critical:Net::FTP#get (binary mode)
+fails:Net::FTP#get (binary mode)
fails:Net::FTP#get (text mode) sends the RETR command to the server
fails:Net::FTP#get (text mode) returns nil
fails:Net::FTP#get (text mode) saves the contents of the passed remote file to the passed local file
@@ -1 +1 @@
-critical:Net::FTP#getbinaryfile
+fails:Net::FTP#getbinaryfile
@@ -1 +1 @@
-critical:Net::FTP#retrbinary
+fails:Net::FTP#retrbinary
@@ -1,2 +0,0 @@
-critical:Net::HTTP.get_print when passed URI it prints the body of the specified uri to $stdout
-critical:Net::HTTP.get_print when passed host, path, port it prints the body of the specified uri to $stdout
@@ -1 +0,0 @@
-critical:Net::HTTP#lock sends a LOCK request to the passed path and returns the response
@@ -1 +0,0 @@
-critical:Net::HTTP.post_form when passed URI POSTs the passed form data to the given uri
@@ -1 +0,0 @@
-critical:Net::HTTP#send_request
@@ -49,10 +49,15 @@ internal class SocketStream : System.IO.Stream {
}
public override void Flush() {
+ if (_internalWriteBuffer.Count == 0) {
+ return;
+ }
+
byte[] bufferedData = _internalWriteBuffer.ToArray();
int bytesSent = _socket.Send(bufferedData);
if (bytesSent < bufferedData.Length) {
// TODO: Resend the rest
+ System.Diagnostics.Debug.Assert(false, "Partial data sent");
}
_internalWriteBuffer.Clear();
}
@@ -119,6 +124,7 @@ internal class SocketStream : System.IO.Stream {
Flush();
}
}
+ Flush();
}
}
}

0 comments on commit 74d580c

Please sign in to comment.