HTTPS Request?

Discussion about any of the included sketches (i.e. WebServer), or user-generated applications.

HTTPS Request?

Postby franklovecchio » Tue Aug 17, 2010 3:49 pm

Is this possible? I'm getting a return like:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h«®­=owser sent a request tha164 xxxx
t this server could not understand.<br />
Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />
Instead use t«®­=me to access this URL, p164xxxxx
lease.<br />
<blockquote>Hint: <a href="xxxx"><b>hxxxx</b></a></blockquot129hxxxx
e></p>

Code: Select all
void printData(char* data, int len) {
  //print the data returned by the server
  //note that the data is not null-terminated, may be broken up into smaller packets, and includes the http header.
  while (len-- > 0) {
    Serial.print(*(data++));
  }
 
}

//ip address 
uint8 ip[] = {xxx,xx,xxx,xxx};

char hostname[] = "https://whatever";
uint8 ipaddr[]  = {xxx,xx,xxx,xxx};
char uri[]      = "/Sensor/"; 
char key[] = API_KEY;
const int port  = 443;

//function to combine and allocate
char *combined(char result[], size_t result_sz, const char key[], const char uri[]) {
//test to see if there is sufficient space */
  if (strlen(uri) + strlen(key) + 1 > result_sz) {
    return NULL;
  }
  strcpy(result, uri);
  strcat(result, key);
 
  return result;
}

//a get request
char lon[1024];
char *newURI = combined (lon, sizeof lon, key, uri);
GETrequest getSession(ipaddr, port, hostname, newURI);

void setup() {
  //initialize wiserver (we'll pass null for the page serving function since we don't need to serve web pages)
  WiServer.init(NULL);

  //enable serial output and ask wierver to generate log messages (optional)
  Serial.begin(57600);
  WiServer.enableVerboseMode(true);

  //have the processData function called when data is returned by the server
  getSession.setReturnFunc(printData);
}

// Time (in millis) when the data should be retrieved
long updateTime = 0;

void loop(){
 
  // Check if it's time to get an update
  //if (millis() >= updateTime) {
  getSession.submit();   
  // Get another update one min from now
  //  updateTime += 1000 * 20;
  //}

  // Run WiServer
  WiServer.server_task();

  delay(10);
}
franklovecchio
 
Posts: 9
Joined: Wed Aug 04, 2010 5:14 pm

Re: HTTPS Request?

Postby GregEigsti » Tue Aug 17, 2010 5:30 pm

I don't believe that the uIP stack (or WiShield driver) supports any form of HTTPS/SSL. I don't recall seeing any support and just did a quick grep of the library source for "ssl" and "https" which turned up nothing.

Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: HTTPS Request?

Postby franklovecchio » Tue Aug 17, 2010 7:10 pm

That's what I thought. Figured I would ask anyway :)
franklovecchio
 
Posts: 9
Joined: Wed Aug 04, 2010 5:14 pm

Re: HTTPS Request?

Postby GregEigsti » Tue Aug 17, 2010 7:43 pm

Kind of unfortunate but I imagine it would eat up lots of resources. Its only software so it could be done...
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website


Return to Sketches and Applications

Who is online

Users browsing this forum: Google [Bot] and 1 guest