Arthur Pelicano
2007-Jun-10 17:40 UTC
[Mongrel] pb when posting to an action "render_text body, :status => 400"
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/mongrel-users/attachments/20070610/cb247c14/attachment.html
Apparently Analagous Threads
- pb when posting to an action "render_text body, :status => 400" (resolved)
- Ruby OpenID library and OpenIDLoginGenerator
- Net::HTTP.post_form got 200 but no INSERT INTO. How come? How to fix this?
- Just upgraded to 1.0.0, should render_text isn''t working for me
- Ruby OpenID 0.9.4
