[ruby-core:71613] [Ruby trunk - Feature #11723] [Open] CGI library should give access to raw request body

From: quintus@...
Date: 2015-11-20 19:06:07 UTC
List: ruby-core #71613
Issue #11723 has been reported by Marvin Gテシlker.

----------------------------------------
Feature #11723: CGI library should give access to raw request body
https://bugs.ruby-lang.org/issues/11723

* Author: Marvin Gテシlker
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Hi everyone,

I was trying to write a little CGI script that simply stencils out e-mail autoconfig as defined by Microsoft窶冱 [autodiscover protocol](https://technet.microsoft.com/en-us/library/cc511507%28v=office.14%29.aspx), however, that protocol requires the client to transmit its request as XML data via POST. Ruby窶冱 CGI library appears to assume that one only ever needs HTML form data in POST requests, at least I see no obvious way from the documentation to gain access to the raw request body as it was written on $stdin as per [section 4.2 of RFC 3857](https://tools.ietf.org/html/rfc3875#section-4.2). I have thus to resort to handling everything manually with the CGI library, which is unfortunate, since I wanted to use the same CGI script for Mozilla窶冱 e-mail [autoconfig protocol](https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration) as well, which works by doing a GET request with a query parameter (`?emailaddress=`) against a similar endpoint. Since I don窶冲 want to parse query parameters myself, and since I would like a uniform handling as far as possible, it窶囘 be nice to have a method CGI.request_body that simply grants access to a copy of the content that the web server wrote on Ruby窶冱 $stdin.

Simply reading $stdin before calling CGI.new doesn窶冲 work, because the cgi library than sends a SIGTERM to the running Ruby process itself (why does it do that instead of raising an exception?).

Greetings
Marvin



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next