Fix for HTTP return status code 1.0 in http_tls
Dependencies: ublox-at-cellular-interface
Revision 28:4427f2e6bbab, committed 2019-08-26
- 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
--- 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.