tracker issue : CF-3763348

select a category, or use search below
(searches all categories and all time range)
Title:

Problem with CF11 and HTTP

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): David Byers / David Byers (David Byers)

Created: 05/20/2014

Components: Net Protocols, HTTP

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: English / Mac 10.9

Vote Count: 2

Listed in the version 11.0.03.292480 Issues Fixed doc
I've run into a problem (I think) with http in ColdFusion 11 and I'm wondering if this is a known issue. I'm doing a pretty straightforward HTTP call to the Google Places API in order to retrieve a JSON packet of information.

I've got this script running on two Ubuntu VMs (Parallels on my Mac).
One running Ubuntu 12.04 running CF10 update 13.
One running Ubuntu 14.04 running CF11.

The CF10 request returns the JSON packet as expected, but the CF11 request returns a 404 response from Google.

Have you heard of any problems with http() in CF11?

Here's my code.  The values for "reference" and "api Key" are variables, but I've hard coded them here if you wanted to test it.

<cfscript>
	// Set up an HTTP service //
	variables.HTTP = new http();

	// Set the method, character set and the URL //
	variables.HTTP.setMethod('GET');
	variables.HTTP.setCharSet('UTF-8');
	variables.HTTP.setURL('https://maps.googleapis.com/maps/api/place/details/json');

	// Add the reference //
	variables.HTTP.addParam(
		type='url',
		name='reference',
		value='CoQBdwAAACTLpBJRqdorlL1nGkNWOyx2KerLJI96cY9r_3TGa03vW9DRxnzFmO9sDZcOfB_q8z0px3ZVPucHhxENiM_OSWL5UcKYShONSt1j64btdIoSrfAC1i4iT0mLzauve0DTSeTNKk6HqvyegC25mgvxkwXxRDXwj8DKUUhVvU3EYnLMEhCcbOIGQcnAtvfju-ZzJKzRGhT7tQedKCpZoD8IYPfcvSs36mBzmA'
	);

	// Add the Google API Key //
	variables.HTTP.addParam(
		type='url',
		name='key',
		value='AIzaSyBNu5eNqIhmumwmlnbBVxtcln4lhXuc5JM'
	);

	// Add the sensor parameter //
	variables.HTTP.addParam(
		type='url',
		name='sensor',
		value='false'
	);

	// Send the request to Google //
	variables.Response = variables.HTTP.send().getPrefix();

	writeOutput(variables.Response.fileContent);
</cfscript>

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3763348

External Customer Info:
External Company:  
External Customer Name: myScreenNameWasTaken
External Customer Email:  
External Test Config: Parallels Virtual Machines running on a MacBook Pro.



1 x Ubuntu 12.04 running ColdFusion 10 updater 13

1 x Ubuntu 14.04 running ColdFusion 11

Attachments:

Comments:

I have analyzed the cause for the issue. The issue is happening because of the host header. In ColdFusion 10 if the HTTP/HTTPS request is happening over default ports (80 and 443) the host header won’t include the port information in the host header. But in ColdFusion 11 the host header includes the port information for default ports as well. This is valid according to the HTTP 1.1 spec. New Apache HTTPComponents version changed this behavior. The maps.googleapis.com returning 404 for the request when the host header contains the default port 443 along with the host name. The google maps server should accept such host header. http://stackoverflow.com/questions/22649403/defined-behavior-for-explicit-default-port-in-https-host-header Host = "Host" ":" host [ ":" port ] ; Section 3.2.2 A "host" without any trailing port information implies the default port for the service requested (e.g., "80" for an HTTP URL). For example, a request on the origin server for <http://www.w3.org/pub/WWW/> would properly include: GET /pub/WWW/ HTTP/1.1 Host: www.w3.org A client MUST include a Host header field in all HTTP/1.1 request messages When I added the host header manually without the default port information it worked in ColdFusion 11. Workaround: variables.HTTP.addParam( type="header", name="Host", value="maps.googleapis.com" ); I will raise a bug with Apache HC as well to not to include the default port information in the host header and update the ticket for the same.
Comment by S V.
12058 | May 26, 2014 05:02:33 AM GMT
This bug directly affects our ability to communicate with a third party http server.
Vote by External U.
12061 | June 03, 2014 07:54:32 PM GMT
We are working with several 3rd party APIs that this is affecting. We cannot upgrade to CF11 until this is fixed. Adding a HOST header has not worked for us.
Vote by External U.
12062 | July 29, 2014 10:38:28 AM GMT
Tried for both port numbers, port 80 and 443. Its working as expected.
Comment by Akhila K.
12059 | September 02, 2014 02:14:15 AM GMT
Hi all, I've verified this is fixed in CF11 Update 3. Prior to this update, CF11 always sent host:port (and Google returned 404). In Update 3, it omits :port if port is 80 or 443 (and Google no longer returns 404). Thanks!, -Aaron
Comment by External U.
12060 | November 02, 2014 10:47:50 PM GMT