In CF 11 (Developer Edition), non-POST-type requests with data to CFC files seem to get stuck in ColdFusion. I don't believe I've changed anything in CF administration that could affect this, and as far as I can tell I haven't done anything to IIS that would break it either. The issue occurs with both of the CF applications that I'm working on.
Requests to CFMs that contain data work using any of the CRUD methods (GET, POST, PUT, DELETE), and the IIS handlers are setup to accept all methods for both CFMs and CFCs.
Can anyone else verify whether this issue with requests to CFCs exists in their environment?
Example curl requests:
- # Requests to CFC with data
- curl -d 'test=123' -X 'GET' 'http://localhost/myapplication/component.cfc?method=test' # NO RESPONSE (TIMEOUT)
- curl -d 'test=123' -X 'PUT' 'http://localhost/myapplication/component.cfc?method=test' # NO RESPONSE (TIMEOUT)
- curl -d 'test=123' -X 'DELETE' 'http://localhost/myapplication/component.cfc?method=test' # NO RESPONSE (TIMEOUT)
- curl -d 'test=123' -X 'POST' 'http://localhost/myapplication/component.cfc?method=test' # Works fine
You complicate things with too many flags. You could just do something like
curl --data "myData=someData" "http://localhost/myapplication/component.cfc?method=test&myArg=123"
This is not "[complicating] things with too many flags". These types of requests are a requirement for many client-side APIs expecting a server-side RESTful implementation. These cURL requests are identical to browser XHR CRUD requests, sans a few headers. This issue occurs identically in browser requests in my tests. The CF 11 handler for IIS does not seem to generate a response for requests to CFCs when those requests contain certain elements.
Another example I'm running into right now is POST requests containing JSON in the payload (include the "Content-Type: application/json" header for server to parse as JSON) for CFCs fail to generate a response when the "onRequestStart" function (application.cfc) returns false. This differs from requests for CFMs which, just as one would expect, return an empty response when "onRequestStart" returns false -- unless the "onRequestStart" function induces output, of course.
The ideal resolution would perhaps be to provide CFMs to interface with components and then direct the AJAX requests toward the CFMs. Project restrictions prevent me from doing that though.
Why do such requests cause the CF 11 handler to fail to generate a response, and is there a clean way to resolve this?