NuMaker WiFi TCP Example

Revision:
21:662058dda3b1
Parent:
20:41c819860b4d
Child:
22:6d0bb671f937
diff -r 41c819860b4d -r 662058dda3b1 main.cpp
--- a/main.cpp	Mon May 13 20:16:52 2019 +0800
+++ b/main.cpp	Tue May 14 10:48:08 2019 +0800
@@ -140,12 +140,20 @@
         printf("HTTP: Connected to %s:%d\r\n", HTTP_SERVER_NAME, HTTP_SERVER_PORT);
 
         // We are constructing GET command like this:
+#ifndef USE_HTTP_1_1
         // GET http://www.ifconfig.io/method HTTP/1.0\n\n
-        
         strcpy(buffer, "GET http://");
         strcat(buffer, HTTP_SERVER_NAME);
         strcat(buffer, HTTP_SERVER_FILE_PATH);
-        strcat(buffer, " HTTP/1.0\n\n");
+        strcat(buffer, " HTTP/1.0\n\n");       
+#else
+       // GET /method HTTP/1.1\r\nHost: ifconfig.io\r\nConnection: close\r\n\r\n"
+        strcpy(buffer, "GET ");
+        strcat(buffer, HTTP_SERVER_FILE_PATH);   
+        strcat(buffer, " HTTP/1.1\r\nHost: ");
+        strcat(buffer, HTTP_SERVER_NAME);
+        strcat(buffer, "\r\nConnection: close\r\n\r\n");
+#endif
         
         // Send GET command
         sock.send(buffer, strlen(buffer));