JRuby

The body of POST requests is not passing through jruby-rack

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Not A Bug
  • Affects Version/s: JRuby 1.1.6
  • Fix Version/s: None
  • Component/s: JRuby-extras
  • Labels:
    None
  • Number of attachments :
    0

Description

To reproduce the problem, get this code: http://github.com/intalio/csv2xml/tree/02d4593992bd2f201ed297ef08597dd8bd59c6c1

warble it and attach the war to Tomcat.
Then try to do:
wget http://localhost:8080/csv2xml/ --post-data=http://spreadsheets.google.com/pub?key=pUUnwYG6cM0fYXYlDiPY9Tw&output=csv

The body of a POST request in the servlet is not populated.

Activity

Hide
Antoine Toulme added a comment -

Quick investigation. ServletRackEnvironment exposes the body part through getInput().

DefaultRackApplication uses getInput() to create a RubyIO object. Then it creates a to_io method that is supposed to return the input.

The servlet.rb file uses to_io and binds it to a key named rack.input (line 114).

The Request class in Rack makes use of that key like this:
def body; @env["rack.input"] end

In the end it might well be me who is missing something. From a code standpoint, it makes sense.

Show
Antoine Toulme added a comment - Quick investigation. ServletRackEnvironment exposes the body part through getInput(). DefaultRackApplication uses getInput() to create a RubyIO object. Then it creates a to_io method that is supposed to return the input. The servlet.rb file uses to_io and binds it to a key named rack.input (line 114). The Request class in Rack makes use of that key like this: def body; @env["rack.input"] end In the end it might well be me who is missing something. From a code standpoint, it makes sense.
Hide
Nick Sieger added a comment -

This is Rack behavior. If you don't specify a content type for the post body, or the content type is either 'application/x-www-form-urlencoded' or 'multipart/form-data', Rack reads the body and parses it as if it were post parameters.

If the post body is something else, specify it and the body won't be touched.

Show
Nick Sieger added a comment - This is Rack behavior. If you don't specify a content type for the post body, or the content type is either 'application/x-www-form-urlencoded' or 'multipart/form-data', Rack reads the body and parses it as if it were post parameters. If the post body is something else, specify it and the body won't be touched.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: