getHTTPRequestData() empty

427 views
Skip to first unread message

computer...@gmail.com

unread,
Aug 2, 2016, 10:02:46 AM8/2/16
to Lucee

Hi, I can't seem to get any values returned from getHTTPRequestData(). The content is always empty.

Consider the following code:

<CFSET requestData = getHTTPRequestData() />

<cfoutput>
#requestData.content#
</cfoutput>


The above is empty

Doing a cfdump also comes up empty on content

<cfdump
    var="#GetHttpRequestData()#"
    label="GetHttpResponseData() Values"/>



I read some bug in CF concerning this but I didn't think it would be applicable to Lucee.

I read somewhere changing from ajp to mod_proxy_http in my apache config. So, I went ahead and did that with the same results.

Has anyone ran into this problem? If so, how did you resolve it?

Thanks









Joseph Gooch

unread,
Aug 2, 2016, 12:01:36 PM8/2/16
to lu...@googlegroups.com
Are we talking about POST requests?  If not, that's completely normal.  GET requests do not have a body.

If we are talking about POST requests, what are you sending?  What mime type?

-G


--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/f1df4647-461f-475e-b53b-c13078bc60f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

computer...@gmail.com

unread,
Aug 2, 2016, 1:15:45 PM8/2/16
to Lucee
I'm trying to get paypal integration to work. In the past the method below worked if I remember correctly:

Paypal would make a request to an ipn.cfm page on the server as follows:

https://www.domain.tld/ipn/ipn.cfm?transaction_subject=Product Name&payment_date=15:32:25 Aug 01, 2016 PDT&txn_type=subscr_payment&subscr_id=I-123456789&last_name=Smith&residence_country=US&item_name=Product name&payment_gross=10.00&mc_currency=USD&business=som...@somedomain.tld&payment_type=instant&protection_eligibility=Ineligible&verify_sign=123456789&payer_status=unverified&payer_email=som...@somedomain.tld&txn_id=123456789&receiver_email=som...@somedomain.tld&first_name=John&payer_id=123456789&receiver_id=1234567898&payment_status=Completed&payment_fee=10.00&mc_fee=10.00&mc_gross=10.00&custom=123456789&charset=windows-1252&notify_version=3.8&ipn_track_id=123456789

The ipn.cfm page has the following code to catch the submitted request:


<CFSET requestData = getHTTPRequestData() />

The it would get the requestdata.content and post back to paypal to verify its integrity as follows:

<CFHTTP url="https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate&#requestData.content#" >
    <cfhttpparam type="header"  name="Host" value="www.paypal.com">
</CFHTTP>


If it got back the desired result:

<CFIF #CFHTTP.FileContent# is "VERIFIED">

It would create local variables:

<CFIF IsDefined("FORM.item_name")>
        <CFSET item_name=FORM.item_name>
    </CFIF>   
    <!--- check that payment_status=Completed --->
    <CFIF IsDefined("FORM.payment_status")>
        <CFSET payment_status=FORM.payment_status>
    </CFIF>
   ............

None of that works cause getHTTPRequestData() is empty

Hopefully I explained it clearly and it answers your question.

Joseph Gooch

unread,
Aug 2, 2016, 1:37:37 PM8/2/16
to lu...@googlegroups.com
What's in CGI.REQUEST_METHOD and getHTTPRequestData().method?


computer...@gmail.com

unread,
Aug 2, 2016, 1:53:05 PM8/2/16
to Lucee
CGI Request method: GET
HTTP Request Data method: GET

They are both GET. I can't control what method Paypal uses as far as I know. Like it said before, this method worked.


On Tuesday, August 2, 2016 at 1:37:37 PM UTC-4, Joseph Gooch wrote:
What's in CGI.REQUEST_METHOD and getHTTPRequestData().method?

On Tue, Aug 2, 2016 at 1:15 PM, <computer...@gmail.com> wrote:
I'm trying to get paypal integration to work. In the past the method below worked if I remember correctly:

Paypal would make a request to an ipn.cfm page on the server as follows:

https://www.domain.tld/ipn/ipn.cfm?transaction_subject=Product Name&payment_date=15:32:25 Aug 01, 2016 PDT&txn_type=subscr_payment&subscr_id=I-123456789&last_name=Smith&residence_country=US&item_name=Product name&payment_gross=10.00&mc_currency=USD&business=someone@somedomain.tld&payment_type=instant&protection_eligibility=Ineligible&verify_sign=123456789&payer_status=unverified&payer_email=som...@somedomain.tld&txn_id=123456789&receiver_email=som...@somedomain.tld&first_name=John&payer_id=123456789&receiver_id=1234567898&payment_status=Completed&payment_fee=10.00&mc_fee=10.00&mc_gross=10.00&custom=123456789&charset=windows-1252&notify_version=3.8&ipn_track_id=123456789

computer...@gmail.com

unread,
Aug 2, 2016, 1:56:57 PM8/2/16
to Lucee
So if during GET getHTTPRequestData() is always empty, how would I get the submitted data by Paypal?

Joseph Gooch

unread,
Aug 2, 2016, 1:57:41 PM8/2/16
to lu...@googlegroups.com
It worked... when?

GetHTTPRequestData has never returned anything in content for a GET request.  It can't.  GET requests by HTTP definition do not have a content body.

If you want the parameters passed from a GET request - see CGI.QUERY_STRING

If you're going from samples here:

Notice how all the variables are pulled from FORM scope.  (assuming a POST request)

You either need to modify your code to use a method to pull the appropriate data from the appropriate place, or determine why paypal is now using GET instead of POST.
-G



On Tue, Aug 2, 2016 at 1:53 PM, <computer...@gmail.com> wrote:
CGI Request method: GET
HTTP Request Data method: GET

They are both GET. I can't control what method Paypal uses as far as I know. Like it said before, this method worked.


On Tuesday, August 2, 2016 at 1:37:37 PM UTC-4, Joseph Gooch wrote:
What's in CGI.REQUEST_METHOD and getHTTPRequestData().method?

On Tue, Aug 2, 2016 at 1:15 PM, <computer...@gmail.com> wrote:
I'm trying to get paypal integration to work. In the past the method below worked if I remember correctly:

Paypal would make a request to an ipn.cfm page on the server as follows:

https://www.domain.tld/ipn/ipn.cfm?transaction_subject=Product Name&payment_date=15:32:25 Aug 01, 2016 PDT&txn_type=subscr_payment&subscr_id=I-123456789&last_name=Smith&residence_country=US&item_name=Product name&payment_gross=10.00&mc_currency=USD&business=som...@somedomain.tld&payment_type=instant&protection_eligibility=Ineligible&verify_sign=123456789&payer_status=unverified&payer_email=som...@somedomain.tld&txn_id=123456789&receiver_email=som...@somedomain.tld&first_name=John&payer_id=123456789&receiver_id=1234567898&payment_status=Completed&payment_fee=10.00&mc_fee=10.00&mc_gross=10.00&custom=123456789&charset=windows-1252&notify_version=3.8&ipn_track_id=123456789

Joseph Gooch

unread,
Aug 2, 2016, 1:59:09 PM8/2/16
to lu...@googlegroups.com
If they're using a GET request, see CGI.QUERY_STRING and CGI.PATH_INFO.

-G


On Tue, Aug 2, 2016 at 1:56 PM, <computer...@gmail.com> wrote:
So if during GET getHTTPRequestData() is always empty, how would I get the submitted data by Paypal?


On Tuesday, August 2, 2016 at 1:53:05 PM UTC-4, computer...@gmail.com wrote:
CGI Request method: GET
HTTP Request Data method: GET

They are both GET. I can't control what method Paypal uses as far as I know. Like it said before, this method worked.


On Tuesday, August 2, 2016 at 1:37:37 PM UTC-4, Joseph Gooch wrote:
What's in CGI.REQUEST_METHOD and getHTTPRequestData().method?

On Tue, Aug 2, 2016 at 1:15 PM, <computer...@gmail.com> wrote:
I'm trying to get paypal integration to work. In the past the method below worked if I remember correctly:

Paypal would make a request to an ipn.cfm page on the server as follows:

https://www.domain.tld/ipn/ipn.cfm?transaction_subject=Product Name&payment_date=15:32:25 Aug 01, 2016 PDT&txn_type=subscr_payment&subscr_id=I-123456789&last_name=Smith&residence_country=US&item_name=Product name&payment_gross=10.00&mc_currency=USD&business=som...@somedomain.tld&payment_type=instant&protection_eligibility=Ineligible&verify_sign=123456789&payer_status=unverified&payer_email=som...@somedomain.tld&txn_id=123456789&receiver_email=som...@somedomain.tld&first_name=John&payer_id=123456789&receiver_id=1234567898&payment_status=Completed&payment_fee=10.00&mc_fee=10.00&mc_gross=10.00&custom=123456789&charset=windows-1252&notify_version=3.8&ipn_track_id=123456789

Joseph Gooch

unread,
Aug 2, 2016, 2:03:13 PM8/2/16
to lu...@googlegroups.com
Everything I'm seeing here:

Indicates that paypal should be sending you a POST request.  If they're not you'll have to take that up with them.

Or you have something in between that's converting a POST to a GET - I've never seen an application proxy do that so that seems unlikely.

-G

Joseph Gooch

unread,
Aug 2, 2016, 2:04:32 PM8/2/16
to lu...@googlegroups.com

computer...@gmail.com

unread,
Aug 2, 2016, 2:54:47 PM8/2/16
to Lucee
there is something wrong. I used postman for Chrome and specified a POST method and still GetHTTPRequestData is empty. I verified that both CGI Request Method and HTTP Request Data Methods were POST:

CGI Request method: POST
HTTP Request Data method: POST

The funny thing is that this works perfectly on another website with the exact same code. I wonder if Mura CMS is somehow messing with this. This is a custom app within MURA CMS. I will try posting something there too. Any ideas? Do I need to adjust something in application.cfc? I think I read something about that somewhere.



On Tuesday, August 2, 2016 at 1:57:41 PM UTC-4, Joseph Gooch wrote:
It worked... when?

GetHTTPRequestData has never returned anything in content for a GET request.  It can't.  GET requests by HTTP definition do not have a content body.

If you want the parameters passed from a GET request - see CGI.QUERY_STRING

If you're going from samples here:

Notice how all the variables are pulled from FORM scope.  (assuming a POST request)

You either need to modify your code to use a method to pull the appropriate data from the appropriate place, or determine why paypal is now using GET instead of POST.
-G


On Tue, Aug 2, 2016 at 1:53 PM, <computer...@gmail.com> wrote:
CGI Request method: GET
HTTP Request Data method: GET

They are both GET. I can't control what method Paypal uses as far as I know. Like it said before, this method worked.


On Tuesday, August 2, 2016 at 1:37:37 PM UTC-4, Joseph Gooch wrote:
What's in CGI.REQUEST_METHOD and getHTTPRequestData().method?

On Tue, Aug 2, 2016 at 1:15 PM, <computer...@gmail.com> wrote:
I'm trying to get paypal integration to work. In the past the method below worked if I remember correctly:

Paypal would make a request to an ipn.cfm page on the server as follows:

https://www.domain.tld/ipn/ipn.cfm?transaction_subject=Product Name&payment_date=15:32:25 Aug 01, 2016 PDT&txn_type=subscr_payment&subscr_id=I-123456789&last_name=Smith&residence_country=US&item_name=Product name&payment_gross=10.00&mc_currency=USD&business=someone@somedomain.tld&payment_type=instant&protection_eligibility=Ineligible&verify_sign=123456789&payer_status=unverified&payer_email=som...@somedomain.tld&txn_id=123456789&receiver_email=som...@somedomain.tld&first_name=John&payer_id=123456789&receiver_id=1234567898&payment_status=Completed&payment_fee=10.00&mc_fee=10.00&mc_gross=10.00&custom=123456789&charset=windows-1252&notify_version=3.8&ipn_track_id=123456789

Joseph Gooch

unread,
Aug 2, 2016, 4:21:12 PM8/2/16
to Lucee
All I can verify is that Lucee works. :)

Given this index.cfm:
<form method="post">
 
<input type="text" name="myvar" value="SomeValue" />
 
<input type="submit" name='Submit' value="Go" />
</form>


<cfdump var="#GetHTTPRequestData()#" />
<cfdump var="#GetHTTPRequestData().content#" />


And:
box server start cfengine=lucee@5


The first request will be a GET request, and have a blank content variable. (Correct)  Click go.
The page will reload from a POST request.. and show content. (see screenshot)

The content variable should be parsed in the servlet layer (it works even if CF doesn't know what the content is - i.e. uploading JSON, or other mime types) so if it's a POST (and content was provided) it should be present.  (And that's what I'm seeing)

I don't think CFML code could change that variable - but a Servlet Filter could.  It could be something in your environment.

Perhaps others can chime in.

-G
Screen Shot 2016-08-02 at 4.17.05 PM.png

b...@deverus.com

unread,
Dec 13, 2016, 2:55:51 PM12/13/16
to Lucee
This is legitimately an issue. It is very difficult to reproduce, but about 5%-ish of requests posted into one of my apps ends up having nothing in the getHTTPRequestData.content. This post provided a decent work around: http://stackoverflow.com/questions/23758116/coldfusion-ajax-json-empty-request-body/24819650#24819650?newreg=2bd57b8db5304938a5e221c13f165483.

This is the stack I am running
CFML engine: Lucee 5.1.0.34
OS: linux
Servlet: Tomcat + nginx
Framework: Coldbox 4.3

The Content-Type of the post is "application/json"

This is a pretty staggering bug imo. Has anyone else seen some of this behavior?

Zac Spitzer

unread,
Dec 13, 2016, 7:28:37 PM12/13/16
to lu...@googlegroups.com
does it happen with all browsers?

https://www.domain.tld/ipn/ipn.cfm?transaction_subject=Product Name&payment_date=15:32:25 Aug 01, 2016 PDT&txn_type=subscr_payment&subscr_id=I-123456789&last_name=Smith&residence_country=US&item_name=Product name&payment_gross=10.00&mc_currency=USD&business=someone@somedomain.tld&payment_type=instant&protection_eligibility=Ineligible&verify_sign=123456789&payer_status=unverified&payer_email=someone@somedomain.tld&txn_id=123456789&receiver_email=someone@somedomain.tld&first_name=John&payer_id=123456789&receiver_id=1234567898&payment_status=Completed&payment_fee=10.00&mc_fee=10.00&mc_gross=10.00&custom=123456789&charset=windows-1252&notify_version=3.8&ipn_track_id=123456789

--
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.

To post to this group, send email to lu...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Zac Spitzer
+61 405 847 168

Sean Daniels

unread,
Dec 14, 2016, 11:48:06 AM12/14/16
to lu...@googlegroups.com
Ben, I am using the exact same stack as you and I am seeing the same behavior as well. I have a 3rd party system sending push notifications to my app using POST and application/json.

If I call getHTTPRequestData().content in my handler it's always empty. If I call it earlier in my request lifecycle it contains the JSON body.

So for now as a workaround I set up a preProcess interceptor in my app and in there I add getHTTPRequestData().content to the private request collection:

prc.requestbody = getHTTPRequestData().content;

I suspect somewhere in the ColdBox lifecycle the content is being reset, but i have not had the time to try to pinpoint where/when. The workaround is adequate for me at the moment.

- Sean

Dominic Watson

unread,
Dec 14, 2016, 7:42:06 PM12/14/16
to lu...@googlegroups.com
We encountered this same bug with Preside. We found that we could always get the HTTP body at the start of the request in Application.cfc$onRequestStart(), but that later on in the request it was lost. We worked around it with:

public boolean function onRequestStart( required string targetPage ) {
    _readHttpBodyNowBecauseLuceeSeemsToBeSporadicallyBlankingItFurtherDownTheRequest();
    ...
}

private void function _readHttpBodyNowBecauseLuceeSeemsToBeSporadicallyBlankingItFurtherDownTheRequest() {
    request.http = { body = ToString( GetHttpRequestData().content ) };
}

Then later we can refer to request.http.body.

HTH

Dominic

--

You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.

To post to this group, send email to lu...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom

T: +44 [0] 845 260 0726 W: www.pixl8.co.uk E: in...@pixl8.co.uk

Follow us on: Facebook Twitter LinkedIn
CONFIDENTIAL AND PRIVILEGED - This e-mail and any attachment is intended solely for the addressee, is strictly confidential and may also be subject to legal, professional or other privilege or may be protected by work product immunity or other legal rules. If you are not the addressee please do not read, print, re-transmit, store or act in reliance on it or any attachments. Instead, please email it back to the sender and then immediately permanently delete it. Pixl8 Interactive Ltd Registered in England. Registered number: 04336501. Registered office: 8 Spur Road, Cosham, Portsmouth, Hampshire, PO6 3EB

Julian Halliwell

unread,
Dec 15, 2016, 3:52:05 AM12/15/16
to lu...@googlegroups.com
I can't seem to find a ticket for this on Jira. Probably a good idea
to raise one.

Julian Halliwell

unread,
Dec 15, 2016, 4:21:40 AM12/15/16
to lu...@googlegroups.com
Just as a side note: we use FW/1 and haven't experienced any problems
with GetHttpRequestData().

On 15 December 2016 at 00:42, Dominic Watson <dominic...@pixl8.co.uk> wrote:
>
> We encountered this same bug with Preside.
>

Dominic Watson

unread,
Dec 15, 2016, 4:23:57 AM12/15/16
to lu...@googlegroups.com
I had thought it was raised but apparently not. There is more than one thread in the Railo list. Here is the one in which this solution was put forward:

https://groups.google.com/forum/#!msg/railo/EjspSjpALqg/j7CxnA2CfG4J;context-place=searchin/railo/request$20body$20%7Csort:relevance

I've raised a JIRA: https://luceeserver.atlassian.net/browse/LDEV-1119


--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages