ruby - How to completely stop the rails action from responding any kind of HTTP status? -
rails 3.2.13. jruby 1.7.15. ruby 1.9.3 interpreter
is there way kill rails action responding @ all? want avoid kind of response being sent anonymous hacker. there constraint check before index , if constraint check fails, index method ideally should stop responding. small part on rest api in effort kill action sending http status back.
any constructive suggestion welcomed.
i.e.
def index # kill method, not send response @ all. not 500 error end
thank help.
although rest api should send valid http response, can suppress output closing underlying output stream. exposed via rack's hijacking api (assuming server supports it):
def index if env['rack.hijack?'] env['rack.hijack'].call io = env['rack.hijack_io'] io.close end end
this results in empty reply, i.e. server closes connection without sending data:
$ curl -v http://localhost:3000/ * connected localhost port 3000 > / http/1.1 > user-agent: curl/7.37.1 > host: localhost:3000 > accept: */* > * empty reply server * connection #0 host localhost left intact curl: (52) empty reply server
Comments
Post a Comment