Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HttpClient issue resolving IP
#1
I've started to try and build a Nest thermostat driver and have run into a strange issue trying to connect to the server to login.

The URL for the login is https://home.nest.com/user/login

If I enter that into my browser I get back some json indicating that I don't have credentials. I actually get data back if I have previously logged into the nest site with that browser.

When I try to do the same thing using the CQC HttpClient, I get back some text that starts with "404 Not found..." - basically html as if I was going to their normal web page.

I looked around a bit with a traffic sniffer and it looks like the browser is hitting the IP address: 23.23.120.33

The CQC version using the HttpClient is hitting IP address: 54.243.70.19 which is the IP returned if you try to ping home.nest.com.

Any idea what might be going on here?
Reply
#2
Are you using the DoSSLGET() method? You'll have to use that for an https type of URL, since that will require a secure connection.

After that, on the address thing, that would mean that this guy cannot be used without a live connection and that connecting to it would be going through their web site. That would suck.

But, presumably, once you do the SSL GET, they are validating and then doing a redirect, or just returning information which you would then use to connect to the thermo directly or something like that I guess.
Dean Roddey
Software Geek Extraordinaire
Reply
#3
I am also seeing some strange behaviour with DoSSLGET, but I am not going to point the finger at anyone but myself at the moment - just seems curious that someone else is having an issue with it. The problem is different though so there most likely is no relation at all.

Mick
Mykel Koblenz
Illawarra Smart Home
Reply
#4
Dean Roddey Wrote:Are you using the DoSSLGET() method? You'll have to use that for an https type of URL, since that will require a secure connection.

After that, on the address thing, that would mean that this guy cannot be used without a live connection and that connecting to it would be going through their web site. That would suck.

But, presumably, once you do the SSL GET, they are validating and then doing a redirect, or just returning information which you would then use to connect to the thermo directly or something like that I guess.

Yes, I tried both DoSSLGET() and DoSSLPOST() with the same results.

The API does work through their website to talk to the thermostat. The thermostat has a live long polling connection to their webserver that it maintains so it can respond pretty much immediately to changes made on the web.
Reply
#5
Just in case, check your port. The low level SSL HTTP stuff might not assume port 80 for an SSL connection, or maybe it does and that's not what their web site expects (IE may be making a choice of its own if you don't provide one.)

So try providing an explicit port, and try to see what port the browser connects on.
Dean Roddey
Software Geek Extraordinaire
Reply
#6
HTTPS is port 443 not 80.

Those IP's are Amazon's cloud that is why you are getting different IP's. They are doing DNS round-robin with a 1min TTL so you will get a different IP every minute...

Quote:Name: production-c1-public-site-29619974.us-east-1.elb.amazonaws.com
Addresses: 23.23.120.33
54.243.175.226
23.21.127.14
54.243.70.19
Aliases: home.nest.com
Wuench
My Home Theater/Automation Website

[THREAD=5957]BlueGlass CQC Config[/THREAD]
[THREAD=10624]Wuench's CQC Drivers[/THREAD]
Reply
#7
Dean Roddey Wrote:Just in case, check your port. The low level SSL HTTP stuff might not assume port 80 for an SSL connection, or maybe it does and that's not what their web site expects (IE may be making a choice of its own if you don't provide one.)

So try providing an explicit port, and try to see what port the browser connects on.

From the trace, they were both using 443 which is the HTTP SSL port.
Reply
#8
wuench Wrote:HTTPS is port 443 not 80.

Those IP's are Amazon's cloud that is why you are getting different IP's. They are doing DNS round-robin with a 1min TTL so you will get a different IP every minute...

Ok, that makes some sense now about the IPs.

Now, I wonder what is so different about the browser and the HttpClient.

Does the HttpClient set the Host: header?

I tried making the user agent the same as Chrome, but that didn't make any difference.
Reply
#9
It does set thet Host header line, to the host component of the URL.
Dean Roddey
Software Geek Extraordinaire
Reply
#10
Did a little more investigation.

Changed to a non-SSL POST just to see what was being sent.

The CQC client is sending this:

POST /user/login HTTP/1.0
Host: home.nest.com
User-Agent: Nest/3.0.1.15 (iOS) os=6.0 platform=iPad3,1
Accept: */*

The Chrome browser is sending this:

GET /user/login HTTP/1.1
Host: home.nest.com
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

I'm now wondering if it is the HTTP/1.1 that is the issue.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  4.5.20 autogen calendar questions... this is just a curiusity thing...no issue per se SomeWhatLost 3 923 10-13-2014, 08:00 PM
Last Post: Dean Roddey
  Auto-Gen Issue Two finish.06 9 1,205 08-26-2014, 08:08 AM
Last Post: Dean Roddey
  Auto Gen Issue DaveB 6 1,066 08-22-2014, 07:36 AM
Last Post: dgilpin
  916 and 920 calc issue bbrendon 9 1,284 04-07-2013, 09:51 PM
Last Post: Dean Roddey
  918 AutoGen Issue Bugman 18 1,932 04-05-2013, 12:37 PM
Last Post: Bugman
  Timed field issue karenlee 6 903 02-21-2013, 03:47 AM
Last Post: karenlee
  3.3.6 driver issue rm1759 2 1,426 08-16-2010, 11:31 AM
Last Post: rm1759
  LAST issue I've found with Zoomplayer Roscoe62 0 1,025 05-03-2009, 12:31 AM
Last Post: Roscoe62
  2.0.11 IV issue, well maybe... might be something else... SomeWhatLost 11 2,173 01-27-2007, 01:42 PM
Last Post: Dean Roddey
  2.2.7 Theatertek driver issue I am having 0 158 Less than 1 minute ago
Last Post:

Forum Jump:


Users browsing this thread: 2 Guest(s)