This class adds HTTP, FTP and CellLocate client support for u-blox modules for the C027 and C030 boards (excepting the C030 N2xx flavour) from mbed 5.5 onwards. The HTTP, FTP and CellLocate operations are all hosted on the module, minimizing RAM consumption in the mbed MCU. It also sub-classes ublox-cellular-driver-gen to bring in SMS, USSD and modem file system support if you need to use these functions at the same time as the cellular interface.

Dependencies:   ublox-at-cellular-interface

Dependents:   example-ublox-at-cellular-interface-ext HelloMQTT ublox_new_driver_test example-ublox-at-cellular-interface-ext ... more

Files at this revision

API Documentation at this revision

Comitter:
Bilal Qamar
Date:
Mon Aug 26 16:55:43 2019 +0500
Parent:
27:12b47e78f601
Child:
29:ee96265f0867
Commit message:
HTTP Test TLS issue resolved

Changed in this revision

TESTS/unit_tests/http/main.cpp Show annotated file Show diff for this revision Revisions of this file
UbloxATCellularInterfaceExt.cpp Show annotated file Show diff for this revision Revisions of this file
UbloxATCellularInterfaceExt.h Show annotated file Show diff for this revision Revisions of this file
--- a/TESTS/unit_tests/http/main.cpp	Mon Aug 19 12:25:22 2019 +0500
+++ b/TESTS/unit_tests/http/main.cpp	Mon Aug 26 16:55:43 2019 +0500
@@ -223,9 +223,10 @@
     pDriver->httpSetTimeout(profile, HTTP_TIMEOUT);
 
     // Set up the server to talk to and TLS, using the IP address this time just for variety
-    TEST_ASSERT(pDriver->gethostbyname("amazon.com", &address) == 0);
+    TEST_ASSERT(pDriver->gethostbyname("www.amazon.com", &address) == 0);
     TEST_ASSERT(pDriver->httpSetPar(profile, UbloxATCellularInterfaceExt::HTTP_IP_ADDRESS, address.get_ip_address()));
     TEST_ASSERT(pDriver->httpSetPar(profile, UbloxATCellularInterfaceExt::HTTP_SECURE, "1"));
+    TEST_ASSERT(pDriver->httpSetPar(profile, UbloxATCellularInterfaceExt::HTTP_REQ_HEADER, "0:Host:www.amazon.com"));
 
     // Check HTTP get request
     memset(buf, 0, sizeof (buf));
@@ -235,7 +236,7 @@
                                      buf, sizeof (buf)) == NULL);
     tr_debug("Received: %s", buf);
     // This is what amazon.com returns if TLS is set
-    TEST_ASSERT(strstr(buf, "503 Service Temporarily Unavailable") != NULL);
+    TEST_ASSERT(strstr(buf, "HTTP/1.1 200 OK") != NULL);
 
     // Reset the profile and check that this now fails
     TEST_ASSERT(pDriver->httpResetProfile(profile));
@@ -247,7 +248,7 @@
                                      buf, sizeof (buf)) == NULL);
     tr_debug("Received: %s", buf);
     // This is what amazon.com returns if TLS is NOT set
-    TEST_ASSERT(strstr(buf, "301 Moved Permanently") != NULL);
+    TEST_ASSERT(strstr(buf, "HTTP/1.1 403 Forbidden") != NULL);
 
     TEST_ASSERT(pDriver->httpFreeProfile(profile));
     TEST_ASSERT(pDriver->disconnect() == 0);
--- a/UbloxATCellularInterfaceExt.cpp	Mon Aug 19 12:25:22 2019 +0500
+++ b/UbloxATCellularInterfaceExt.cpp	Mon Aug 26 16:55:43 2019 +0500
@@ -598,6 +598,11 @@
                           _at->recv("OK");
                 break;
 
+            case HTTP_REQ_HEADER:	//9
+                success = _at->send("AT+UHTTP=%d,%d,\"%s\"", httpProfile, httpOpCode, httpInPar) &&
+                _at->recv("OK");
+                break;
+
             default:
                 debug_if(_debug_trace_on, "httpSetPar: unknown httpOpCode %d\n", httpOpCode);
                 break;
--- a/UbloxATCellularInterfaceExt.h	Mon Aug 19 12:25:22 2019 +0500
+++ b/UbloxATCellularInterfaceExt.h	Mon Aug 26 16:55:43 2019 +0500
@@ -82,7 +82,8 @@
         HTTP_PASSWORD = 3,
         HTTP_AUTH_TYPE = 4,
         HTTP_SERVER_PORT = 5,
-        HTTP_SECURE = 6
+        HTTP_SECURE = 6,
+        HTTP_REQ_HEADER = 9
     } HttpOpCode;
 
     /** Type of HTTP Command.