Hi,

I'm trying to do a little openid-server in rails.

I encounter a very strange problem for me, you can see all the story in the
openid mailing-list :

http://lists.openidenabled.com/pipermail/dev/2007-May/000666.html
http://lists.openidenabled.com/pipermail/dev/2007-June/000700.html

In short, the problem is :
the server has to do a  "render_text body, :status => 400"  to respond to a
post from a consumer.  (this is from the openid server example)

This is working fine with webrick, but not in mongrel 1.0.1 on osx where the
consumer get :
Net::HTTPBadResponse: wrong status line: "HTTP/1.1 0 "

If someone wants to try, just make a rails app :
rails test
script/generate controller test index

and in the test_controller define the action 'index' like that :

class TestController < ApplicationController
 def index
   render_text "test", :status => 400
 end
end


you can know test this with irb (supposing the server is running on port
3000) :
require 'uri'
require 'net/http'

url = "http://localhost:3000/test";
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
resp = http.post(uri.request_uri,"test")
=> Net::HTTPBadResponse: wrong status line: "HTTP/1.1 0 "

if you do the same with webrick it works :
=> #<Net::HTTPOK 200 OK  readbody=true>

(I'm not sure webrick is right saying HTTP OK, when we asked to respond a
400 status, but it does not break the consumer client !)


I didn't find anything on this problem on google.
I'm a newbie in ruby and rails, and a total newbie with mongrel, so I hope
this is not trivial.
If it is, sorry for this mail !

Any help or suggestions would be much appreciated.

Thanks,
  Arthur
_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to