Activeresource-2.3.2 HTTPHeaderSyntaxError


#1

Hi,

I’m upgrading my app from 2.2.2 to 2.3.2 and am having a problem with
ActiveResource.

class FooResource < ActiveResource::Base
  self.site = "whatever"
  self.element_name = "foo"
end

FooResource.create(:bar => 'baz')

raises:

Net::HTTPHeaderSyntaxError: wrong Content-Length format
  from /usr/local/lib/ruby/1.8/net/http.rb:1334:in `content_length'
  from /usr/local/lib/ruby/1.8/net/http.rb:2210:in `read_body_0'
  from /usr/local/lib/ruby/1.8/net/http.rb:2173:in `read_body'
  from /usr/local/lib/ruby/1.8/net/http.rb:846:in `post'
  from /usr/local/lib/ruby/1.8/net/http.rb:1053:in `request'
  from /usr/local/lib/ruby/1.8/net/http.rb:2136:in `reading_body'
  from /usr/local/lib/ruby/1.8/net/http.rb:1052:in `request'
  from /usr/local/lib/ruby/1.8/net/http.rb:1037:in `request'
  from /usr/local/lib/ruby/1.8/net/http.rb:543:in `start'
  from /usr/local/lib/ruby/1.8/net/http.rb:1035:in `request'
  from /usr/local/lib/ruby/1.8/net/http.rb:845:in `post'
  from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/

active_resource/connection.rb:149:in send' from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/ active_resource/connection.rb:149:inrequest’
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/core_ext/benchmark.rb:17:in ms' from /usr/local/lib/ruby/1.8/benchmark.rb:308:inrealtime’
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/core_ext/benchmark.rb:17:in ms' from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/ active_resource/connection.rb:149:inrequest’
from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/
active_resource/connection.rb:134:in post' from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/ active_resource/base.rb:995:increate’
from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/
active_resource/base.rb:796:in save_without_validation' from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/ active_resource/validations.rb:248:insave’
from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/
active_resource/base.rb:465:in create' from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/ active_resource/base.rb:465:intap’
from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/
active_resource/base.rb:465:in `create’
from (irb):6>>

I’m using ruby 1.8.7p160 on OSX, also tried different ruby versions.
This is working fine with rails 2.2.2. Has anyone dealt with this
problem before?

Thanks,
Christian


#2

Turns out that Rails 2.3.2 (specifically Rack) is incompatible with
Mongrel 1.0.1. Updating to the latest Mongrel gem 1.1.5 solved the
problem.

Christian