From: quintus@... Date: 2015-11-20T19:06:07+00:00 Subject: [ruby-core:71613] [Ruby trunk - Feature #11723] [Open] CGI library should give access to raw request body 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���s [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���s 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���s 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���t want to parse query parameters myself, and since I would like a uniform handling as far as possible, it���d 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���s $stdin. Simply reading $stdin before calling CGI.new doesn���t 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/