wolf SSL / Mbed 2 deprecated Example--Dropbox

Dependencies:   EthernetInterface HTTPClient SDFileSystem mbed-rtos mbed wolfSSL

Fork of SimpleDropbox by wolf SSL

Files at this revision

API Documentation at this revision

Comitter:
wolfSSL
Date:
Tue Jul 21 23:25:17 2015 +0000
Parent:
2:a325d3d7d2a0
Commit message:
Dropbox example with wolfSSL

Changed in this revision

HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
dropbox.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
wolfSSL.lib Show annotated file Show diff for this revision Revisions of this file
--- a/HTTPClient.lib	Sat Feb 07 19:19:13 2015 +0000
+++ b/HTTPClient.lib	Tue Jul 21 23:25:17 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/wolfSSL/code/HTTPClient/#a9ecee69c6b5
+http://mbed.org/users/wolfSSL/code/HTTPClient/#77082c88748a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Tue Jul 21 23:25:17 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/SDFileSystem/#7b35d1709458
--- a/dropbox.cpp	Sat Feb 07 19:19:13 2015 +0000
+++ b/dropbox.cpp	Tue Jul 21 23:25:17 2015 +0000
@@ -36,7 +36,9 @@
 
     http.setHeader(HeaderLines) ;
     http.setLocationBuf(location, LOCATION_SIZE) ;
-
+    http.dumpReqHeader(true) ;
+    http.dumpResHeader(true) ;
+    
     ret = http.get(url, buff, size) ;
     if (ret != HTTP_REDIRECT) {
         printf("++ Err = %d - HTTP ret = %d ++\n",
@@ -44,6 +46,9 @@
         return ret ;
     }
 
+    printf("\nHTTP GET: %s\n\n", location) ;
+    http.dumpReqHeader(false) ;
+    http.dumpResHeader(false) ;
     ret = http.get(location, buff, size) ;
     if (ret != HTTP_OK) {
         printf("++ Err = %d - HTTP ret = %d ++\n",
--- a/main.cpp	Sat Feb 07 19:19:13 2015 +0000
+++ b/main.cpp	Tue Jul 21 23:25:17 2015 +0000
@@ -2,7 +2,8 @@
 #include "EthernetInterface.h"
 #include "HTTPClient.h"
 
-#define SHARED_LINK "https://www.dropbox.com/s/m856g2irwzb68uv/test.txt?dl=0"
+#include <SDFileSystem.h>
+SDFileSystem sdCard(PTE3, PTE1, PTE2, PTE4, "sd");
 
 extern HTTPResult dropbox_get(const char *url, char *buff, int size) ;
 
@@ -13,7 +14,9 @@
 int main()
 {
     HTTPResult ret ;
-
+    FILE *fp ;
+    char sharedLink[256] ;
+    
     eth.init(); //Use DHCP
     printf("Dropbox Shared Link, Starting,...\n") ;
 
@@ -21,11 +24,16 @@
         if(eth.connect() == 0)break ;
         printf("Retry\n") ;
     }
-    printf("HTTP Client, IP Address is %s\n", eth.getIPAddress());
 
-    printf("Shared Link: %s\n", SHARED_LINK);
+    fp = fopen("/sd/sharedLink.txt", "r");
+    if (fp == NULL) {
+        printf("Cannot open \"sharedLink.txt\"\n") ;
+        return false ;
+    }
+    fgets(sharedLink, sizeof(sharedLink), fp) ;
+    printf("Shared Link: %s\n", sharedLink);
     memset(recvBuff, '\0', sizeof(recvBuff)) ;
-    ret = dropbox_get(SHARED_LINK, recvBuff, sizeof(recvBuff));
+    ret = dropbox_get(sharedLink, recvBuff, sizeof(recvBuff));
     if (ret == HTTP_OK) {
         printf("Result: %s\n", recvBuff);
     } else {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wolfSSL.lib	Tue Jul 21 23:25:17 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/wolfSSL/code/wolfSSL/#28278596c2a2