jruby / jruby-rack

Rack for JRuby and Java appservers
MIT License
397 stars 137 forks source link

fix https://github.com/jruby/jruby-rack/issues/153 #159

Closed patcheng closed 10 years ago

patcheng commented 11 years ago

Fixes https://github.com/jruby/jruby-rack/issues/153

with OPTIONS methods, no filter/servlet was actually handling so the status code was left untouched (as 200).

but 200 was considered handled, so the request is not passed to Ruby at all.

kares commented 11 years ago

Thanks Patrick, I do not re-call what it has been exactly but when I wanted to change this it turned out not as such a good idea ... also I'm not sure if it ain't break other servers. Did you investigate TC for HTTP OPTIONS behaviour ?

patcheng commented 11 years ago

Looking at http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java Looks like the DefaultServlet handles the request, but does not call setStatus(). Which is the behavior I am seeing.

I was testing an app with https://github.com/cyu/rack-cors enabled. Without the fix, nothing happens. With the fix, rack-cors kicks in and everything is good.

I just tested the fix without rack-cors, and it returns whether our rails app responds, which unfortunately happens to the wrong thing.

I switch our app to use the RakeServlet, again, without rack-cors, and it returns the same wrong thing as well.

So with the fix, Filter now seems to behave like Servlet. But the change in behavior might expose issues in the app that were previously masked. :(

kares commented 10 years ago

now obsolete due commits referenced in https://github.com/jruby/jruby-rack/issues/153