Got modem to work with MedSentry website. Includes minor change to a library file.
Fork of HTTPClient-SSL by
Diff: HTTPClient.cpp
- Revision:
- 42:2f464f96c204
- Parent:
- 41:236fa1143e5a
- Child:
- 46:369da903fca9
--- a/HTTPClient.cpp Fri Jan 23 20:42:31 2015 +0000 +++ b/HTTPClient.cpp Mon Feb 09 21:37:04 2015 +0000 @@ -113,14 +113,10 @@ HTTPClient::HTTPClient() : m_basicAuthUser(NULL), m_basicAuthPassword(NULL), m_httpResponseCode(0) { - set_time(1421106306); + m_sock = &_m_sock; + // CyaSSL_Debugging_ON() ; //Turn on if the CyaSSL library isn't working, turns on debug printf's - CyaSSL_Init(); //Initialize CyaSSL - - m_sock = &_m_sock; - // CyaSSL_Debugging_ON() ; //Turn on if the CyaSSL library isn't working, for debug printf's - - peerMethod = VERIFY_PEER; + peerMethod = VERIFY_NONE; ctx = 0 ; ssl = 0 ; SSLver = 3 ; @@ -132,12 +128,18 @@ HTTPClient::~HTTPClient() { - free((void *)m_basicAuthPassword); - m_basicAuthPassword = NULL; - free((void *)m_basicAuthUser); - m_basicAuthUser = NULL; - free((void *)certificates); - certificates = NULL; + if(m_basicAuthPassword) { + free((void *)m_basicAuthPassword); + m_basicAuthPassword = NULL; + } + if(m_basicAuthUser) { + free((void *)m_basicAuthUser); + m_basicAuthUser = NULL; + } + if(certificates) { + free((void *)certificates); + certificates = NULL; + } } HTTPResult HTTPClient::basicAuth(const char* user, const char* password) //Basic Authentification @@ -244,11 +246,7 @@ } void HTTPClient::setPeerVerification(SSLMethod method) { - if(method != VERIFY_NONE && method != VERIFY_PEER) { - ERR("That is not an acceptable verification choice"); - } else { - peerMethod = method; - } + peerMethod = method; } @@ -700,10 +698,6 @@ } - if(m_sock->is_connected()) { - m_sock->close(); - } - m_sock->close(true); cyassl_free() ; DBG("Completed HTTP transaction"); @@ -882,14 +876,6 @@ *port=0; } char* pathPtr = strchr(hostPtr, '/'); - if(pathPtr == NULL) { - pathPtr = strchr(hostPtr, '#'); - if(pathPtr != NULL) { - pathPtr++; - } else { - pathPtr = (char *)(url + strlen(url)); - } - } if( hostLen == 0 ) { hostLen = pathPtr - hostPtr; @@ -899,8 +885,6 @@ WARN("Host str is too small (%d >= %d)", maxHostLen, hostLen + 1); return HTTP_PARSE; } - memcpy(host, hostPtr, hostLen); - host[hostLen] = '\0'; size_t pathLen; char* fragmentPtr = strchr(hostPtr, '#'); @@ -914,6 +898,8 @@ WARN("Path str is too small (%d >= %d)", maxPathLen, pathLen + 1); return HTTP_PARSE; } + memcpy(host, hostPtr, hostLen); + host[hostLen] = '\0'; memcpy(path, pathPtr, pathLen); path[pathLen] = '\0';