Fix for HTTP return status code 1.0 in http_tls

Dependencies:   ublox-at-cellular-interface

Files at this revision

API Documentation at this revision

Comitter:
fahim.alavi@u-blox.com
Date:
Mon Jan 28 12:45:09 2019 +0500
Parent:
16:00ba752520bb
Child:
18:071ae6c6e581
Commit message:
Get data size of received data as parameter

Changed in this revision

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
ublox-at-cellular-interface.lib Show annotated file Show diff for this revision Revisions of this file
--- a/UbloxATCellularInterfaceExt.cpp	Mon Nov 12 18:35:20 2018 +0500
+++ b/UbloxATCellularInterfaceExt.cpp	Mon Jan 28 12:45:09 2019 +0500
@@ -617,7 +617,7 @@
                                                                               const char *sendStr,
                                                                               int httpContentType,
                                                                               const char *httpCustomPar,
-                                                                              char *buf, int len)
+                                                                              char *buf, int len, int *read_size)
 {
     bool atSuccess = false;
     bool success = false;
@@ -694,6 +694,7 @@
 
         if (atSuccess) {
             Timer timer;
+            int read_length = 0;
 
             at_set_timeout(1000);
             _httpProfiles[httpProfile].pending = true;
@@ -709,8 +710,14 @@
                         // Leave a short delay to make sure the file has been written
                         wait_ms(100);
                         // HTTP command successfully executed
-                        if (readFile(rspFile, buf, len) >= 0) {
+                        read_length = readFile(rspFile, buf, len);
+
+                        if (read_length >= 0) {
                             success = true;
+
+                            if(read_size != NULL) {
+                                *read_size = *read_size + read_length;
+                            }
                         }
                     } else {
                         // Retrieve the error class and code
--- a/UbloxATCellularInterfaceExt.h	Mon Nov 12 18:35:20 2018 +0500
+++ b/UbloxATCellularInterfaceExt.h	Mon Jan 28 12:45:09 2019 +0500
@@ -203,6 +203,7 @@
      * @param httpCustomPar   the parameter for a user defined HTTP Content-Type.
      * @param buf             the buffer to read into.
      * @param len             the size of the buffer to read into.
+     * @param read_size       Zero initialized variable address
      * @return                NULL if successful, otherwise a pointer to
      *                        a Error struct containing the error class and error
      *                        code, see section Appendix A.B of
@@ -211,7 +212,7 @@
     Error * httpCommand(int httpProfile, HttpCmd httpCmd, const char* httpPath,
                         const char* rspFile, const char* sendStr,
                         int httpContentType, const char* httpCustomPar,
-                        char* buf, int len);
+                        char* buf, int len, int *read_size = NULL);
 
     /**********************************************************************
      * PUBLIC: FTP
--- a/ublox-at-cellular-interface.lib	Mon Nov 12 18:35:20 2018 +0500
+++ b/ublox-at-cellular-interface.lib	Mon Jan 28 12:45:09 2019 +0500
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface/#2b30a056ae54
+https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface/