I’m trying to get a response from a POST from a Google Fusion query, and have been unable to get an https request to go through. I can GET queries just fine, but when I try to POST a ClientLogin (to get an authentication key from google), I get “= ERR: ?-Cmd” for each line/portion of the request. encodeUrl replaces " " with “%20”, and network.SendRequest opens a connection on the given port and sends the data, then reads the response.
I am using a Netduino with WiFly board, have tried every encoding and header and format combination I can think of. Anyone have any thoughts on what I’m missing?
//this is the call that fails
string loginPost = “POST /accounts/ClientLogin HTTP/1.0\r\nContent-type: application/x-www-form-urlencoded\r\naccountType=GOOGLE&Email=” + username + “&Passwd=” + password + “&service=fusiontables&source=netduino\r\n”;
HttpResponse response = _network.SendRequest(“www.google.com”, 443, encodeUrl(loginPost));
//and the debug response is
open www.google.com 443
open www.google.com 443
Connect to 74.125.225.16:443
POST%20/accounts/ClientLogin%20HTTP/1.0
Content-type:%20application/x-www-form-urlencoded
accountType=GOOGLE&Email=xxxxx&Passwd=xxxxx&service=fusiontables&source=netduino
= POST%20/accounts/ClientLogin%20HTTP/1.0
= ERR: ?-Cmd
= <2.21>
= Content-type:%20application/x-www-form-urlencoded
= ERR: ?-Cmd
= <2.21>
= accountType=GOOGLE&Email=xxxxx&Passwd=xxxxx&service=fusiontables&source=netduino
= ERR: ?-Cmd
= <2.21>
//this GET succeeds in getting data
string get = “GET /fusiontables/api/query/?sql=SELECT%20UserName,%20Tag,%20Allowed%20FROM%20631234 HTTP/1.1\r\nUser-Agent: netduino\r\nHost: www.google.com\r\n”;
HttpResponse response = _network.SendRequest(“www.google.com”, 80, get);
//the debug response is
open www.google.com 80
Connect to 74.125.225.16:80
GET /fusiontables/api/query/?sql=SELECT%20UserName,%20Tag,%20Allowed%20FROM%20631234 HTTP/1.1
User-Agent: netduino
Host: www.google.com
= HTTP/1.1 200 OK
= Via: 1.1 xxxxx
= Connection: Keep-Alive
= Proxy-Connection: Keep-Alive
= Transfer-Encoding: chunked
= Expires: Sat, 09 Apr 2011 00:28:51 GMT
= Date: Sat, 09 Apr 2011 00:28:51 GMT
= Content-Type: text/plain; charset=UTF-8
= Server: GSE
= Cache-Control: private, max-age=0
= X-Content-Type-Options: nosniff
= X-Frame-Options: SAMEORIGIN
= X-XSS-Protection: 1; mode=block
=
4a
UserName,Tag,Allowed
dotTag,17002D370D,1
cardTag,2600D87E87,0