I am trying to perform a multipart post from one rails application to another using the following code:
require 'rest_client'
RestClient.post 'http://localhost:3000/users', { "user[fist_name]" => "foo", "user[profile_image]" => File.new('/test.png') })
My client app throws the time out exception and the server throws the exception shown below.
Fri Sep 18 13:39:31 -0700 2009: Error reading HTTP body: #<RuntimeError: Socket read returned insufficient data: 281>
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/http_request.rb:107:in `read_socket'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/http_request.rb:77:in `read_body'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/http_request.rb:55:in `initialize'
Rails server accepts multipart requests from browser and regular(non multipart) requests from client Rails app.
PS: I got the same exception when I used technoweenie_rest-client in my client app.
PPS: I am using Rails 2.3.2, ruby 1.8.6, Mongrel on Windows XP.