ssl_access (http->https)

Dependencies:   CyaSSL EthernetInterface mbed-rtos mbed

Fork of ssl_access by shinichi satoh

Revision:
5:962734db89e5
Parent:
2:29a1370416cb
Child:
6:498ff8506b32
--- a/main.cpp	Mon Dec 08 05:18:20 2014 +0000
+++ b/main.cpp	Mon Dec 08 13:17:25 2014 +0000
@@ -37,7 +37,7 @@
 
 EthernetInterface eth;
 
-main()
+void net_main(void const *av)
 {
     char server_ip[20] ;
 
@@ -99,7 +99,7 @@
     printf("SSL Connected\n") ;
     ***/
 
-    char msg[] = "GET / HTTP/1.0\r\nConnection: Close\r\n\r\n" ;
+    char msg[] = "GET /congrats.html  HTTP/1.0\r\nConnection: Close\r\n\r\n" ;
     // const char msg[] = "Hello World\r\n" ;
 
     if (
@@ -117,8 +117,7 @@
         if (n >= 0) {
             buf[n] = 0;
             printf("%s", buf);
-        } else
-            err_sys("CyaSSL_read failed");
+        } else break ;
     } while(n > 0) ;
     puts("=== === === ===") ;
     /*** SSL    CyaSSL_free(ssl) ; ***/
@@ -126,3 +125,14 @@
     /*** SSL    CyaSSL_CTX_free(ctx) ; ***/
     eth.disconnect();
 }
+
+main()
+{
+ 
+#define STACK_SIZE 20000
+    Thread t(net_main, NULL, osPriorityNormal, STACK_SIZE);
+ 
+    while (true) {
+        Thread::wait(1000);
+    }
+}