Fixed custom headers and Basic authorization, added support for redirection, functional file download interface can be used for SW updates and more.

Dependents:   Sample_HTTPClient Sample_HTTPClient LWM2M_NanoService_Ethernet LWM2M_NanoService_Ethernet ... more

Fork of HTTPClient by Vincent Wochnik

More recent changes - added iCal processing.

Derivative of a derivative, however this one works when it comes to supplying Basic authorization to access a protected resource. Some additional changes to the debug interface to clean it up for consistency with many other components I have.

Files at this revision

API Documentation at this revision

Comitter:
WiredHome
Date:
Sun Apr 16 20:55:07 2017 +0000
Parent:
40:bcb19f8dbba3
Child:
42:ab259a9d1d36
Commit message:
Correct a memory leak that occurred when basic auth credentials were used.

Changed in this revision

HTTPClient.cpp Show annotated file Show diff for this revision Revisions of this file
data/HTTPiCal.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/HTTPClient.cpp	Tue Mar 14 02:59:32 2017 +0000
+++ b/HTTPClient.cpp	Sun Apr 16 20:55:07 2017 +0000
@@ -17,7 +17,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-//#include "Utility.h"            // private memory manager
+#include "Utility.h"            // private memory manager
 #ifndef UTILITY_H
 #define swMalloc malloc         // use the standard
 #define swFree free
@@ -62,6 +62,10 @@
 
 HTTPClient::~HTTPClient()
 {
+    if (m_basicAuthUser)
+        swFree(m_basicAuthUser);
+    if (m_basicAuthPassword)
+        swFree(m_basicAuthPassword);
     if (m_location) // if any redirection was involved, clean up after it.
         swFree(m_location);
     m_location = NULL;      // this step isn't necessary...
--- a/data/HTTPiCal.cpp	Tue Mar 14 02:59:32 2017 +0000
+++ b/data/HTTPiCal.cpp	Sun Apr 16 20:55:07 2017 +0000
@@ -1,5 +1,11 @@
 #include "HTTPiCal.h"
 
+#include "Utility.h"            // private memory manager
+#ifndef UTILITY_H
+#define swMalloc malloc         // use the standard
+#define swFree free
+#endif
+
 //#define DEBUG "iCal"
 #include <cstdio>
 #if (defined(DEBUG) && !defined(TARGET_LPC11U24))
@@ -15,7 +21,7 @@
 #endif
 
 HTTPiCal::HTTPiCal(int count) {
-    EventList = (Event_T *)malloc(count * sizeof(Event_T));
+    EventList = (Event_T *)swMalloc(count * sizeof(Event_T));
     if (EventList) {
         EventSpaceCount = count;
         EventCount = 0;
@@ -27,7 +33,7 @@
 
 HTTPiCal::~HTTPiCal() {
     if (EventList)
-        free(EventList);
+        swFree(EventList);
 }
 
 void HTTPiCal::SetTimeWindow(time_t StartTime, time_t EndTime) {