mod_mruby icon indicating copy to clipboard operation
mod_mruby copied to clipboard

Receive empty body on another module when read request body by mruby script.

Open miyamiyaz opened this issue 9 years ago • 2 comments

Hi, I am using Request.body to read POST request on my logging script (like below), request body is being read properly at script, but another module (mod_proxy in my case) receive empty body.

r = Apache::Request.new

if r.method_number == Apache::M_POST and r.uri == '/login'
  File.open('path/of/login/log/file', 'a') do |f|
    # mask password
    bodyMasked = r.body.gsub(/password=[^&]*/, 'password=xxx')
    # write body
    f.write("#{bodyMasked}\n")
  end
end

In my opinion, this problem is caused by ap_get_client_block() method (used by ap_mrb_get_request_body() for read request body). (ref., http://www.gossamer-threads.com/lists/apache/dev/381941)

Is this behavior correct? or bug?

miyamiyaz avatar Nov 16 '16 02:11 miyamiyaz

Sorry for my late response. Yes, it's behavior is correct. But, I want to implement non breaking post read method.

matsumotory avatar Nov 19 '16 04:11 matsumotory

Okay. Thank you for your reply.

miyamiyaz avatar Nov 20 '16 01:11 miyamiyaz