Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 75628
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: daxim [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: parameters POSTDATA and XForms:Model for POST Content-Type application/xml
$ perl -MCGI -E'say CGI->VERSION' 3.59 When POSTing a request with Content-Type: application/xml, the method param('POSTDATA') returns undef, instead the data end up under the undocumented parameter 'XForms:Model'. I expect param('POSTDATA') to always return the raw request body.
Subject: Re: [rt.cpan.org #75628] parameters POSTDATA and XForms:Model for POST Content-Type application/xml
Date: Mon, 12 Mar 2012 08:11:14 -0400
To: bug-CGI.pm [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
I agree, the undocumented behavior with Xforms:Model is not ideal. Could you research the specs related to Xforms, and provide related references spec here, along with recommendations on when and how we should be using Xforms for best spec compatibility? Mark
I repeat, the problem which this bug report is about is that param('POSTDATA') returns undef. I expect param('POSTDATA') to always return the raw request body. I don't care at all about XForms. That spec can FOADIAF because it hijacks a generic content-type.
Subject: Re: [rt.cpan.org #75628] parameters POSTDATA and XForms:Model for POST Content-Type application/xml
Date: Mon, 12 Mar 2012 08:30:00 -0400
To: bug-CGI.pm [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Show quoted text
> I repeat, the problem which this bug report is about is that > param('POSTDATA') returns undef. I expect param('POSTDATA') to always > return the raw request body. > > I don't care at all about XForms. That spec can FOADIAF because it > hijacks a generic content-type.
The way to convince me that that this is a bug is to use primary sources as references to show that some spec is being violated, or that the code is inconsistent with the documentation. Simply wishing it behaved differently that you expected is not enough. Mark
Show quoted text
> the code is inconsistent with the documentation.
The code makes an additional exception which is not in the documentation: * Quoting <https://metacpan.org/module/CGI#HANDLING-NON-URLENCODED- Show quoted text
ARGUMENTS>:
If POSTed data is not of type application/x-www-form-urlencoded or multipart/form-data, then the POSTed data will not be processed, but instead be returned as-is in a parameter named POSTDATA. * Quoting code comments, line 574 (the actual code does what the comments imply, no need to also paste that): # Process XForms postings. We know that we have XForms in the # following cases: # method eq 'POST' && content-type eq 'application/xml' # method eq 'POST' && content-type =~ /multipart\/related.+start=/ Also, this is obviously an overly broad assumption. Since application/xml is the generic MIME type for XML, only a miniscule amount of documents sent as application/xml are actually XForms. The following restores consistency with the documentation. diff --git a/lib/CGI.pm b/lib/CGI.pm index 6084f0f..2794133 100644 --- a/lib/CGI.pm +++ b/lib/CGI.pm @@ -20,7 +20,7 @@ use Carp 'croak'; # The revision is no longer being updated since moving to git. $CGI::revision = '$Id: CGI.pm,v 1.266 2009/07/30 16:32:34 lstein Exp $'; -$CGI::VERSION='3.59'; +$CGI::VERSION='3.60_01'; # HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES. # UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING. @@ -657,6 +657,7 @@ sub init { $query_string = $ENV{'QUERY_STRING'} if defined $ENV{'QUERY_STRING'}; $query_string ||= $ENV{'REDIRECT_QUERY_STRING'} if defined $ENV{'REDIRECT_QUERY_STRING'}; } + $self->param($meth . 'DATA', $self->param('XForms:Model')); last METHOD; }
From: henrik.pauli [...] gmail.com
On Hétf 2012. Márc 12 08:30:14, mark@summersault.com wrote: Show quoted text
> > I repeat, the problem which this bug report is about is that > > param('POSTDATA') returns undef. I expect param('POSTDATA') to always > > return the raw request body. > > > > I don't care at all about XForms. That spec can FOADIAF because it > > hijacks a generic content-type.
> > The way to convince me that that this is a bug is to use primary sources > as references to show that some spec is being violated, or that the code > is inconsistent with the documentation. > > Simply wishing it behaved differently that you expected is not enough. > > Mark
I'm with Daxim here. 1) the documentation does *not* mention the whole XForms shenanigans. This is the gravest part of the issue, and thanks to that I've spent the last few days banging my head to my desk because there was no bug on my side that should have caused empty postdata. 2) XForms "support" (that you fill XForms:Model) doesn't appear to interfere with normal postdata support. If you expect the XForms-using people to mess with XForms:Model, then by all means they should do that, and chances are they won't want to touch postdata; and vice versa, we, the rest of the people who just want, say, and XML-RPC, we don't want to touch XForms:Model. The data in both are the same -- the source code comments themselves say that X:M contains the XML data untouched. Simply, the two fields should point to the same data string and everything will be happy.
This issue has been copied to: https://github.com/leejo/CGI.pm/issues/95 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.
commit 1a1c7e180d4cae3f85f54b11961e7963353738c4 Author: Lee Johnson <lee@givengain.ch> Date: Sat Sep 20 15:14:45 2014 +0100 resolve #95 [rt.cpan.org #75628] - XForms:Model data is now available through the POSTDATA/PUTDATA param, add test to check this Changes | 3 ++- lib/CGI.pm | 2 ++ t/rt-75628.t | 27 +++++++++++++++++++++++++++ t/rt_75628.txt | 17 +++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-)