Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HTTPClient by
Revision 13:be61104f4e91, committed 2012-08-05
- Comitter:
- donatien
- Date:
- Sun Aug 05 16:12:10 2012 +0000
- Parent:
- 12:89d09a6db00a
- Child:
- 14:2744e0c0e527
- Commit message:
- Fixed blocking mode
Changed in this revision
--- a/HTTPClient.cpp Sun Aug 05 15:30:07 2012 +0000
+++ b/HTTPClient.cpp Sun Aug 05 16:12:10 2012 +0000
@@ -18,10 +18,11 @@
*/
//Debug is disabled by default
-#if 0
+#if 1
//Enable debug
#include <cstdio>
-#define DBG(x, ...) std::printf("[HTTPClient : DBG]"x"\r\n", ##__VA_ARGS__);
+//#define DBG(x, ...) std::printf("[HTTPClient : DBG]"x"\r\n", ##__VA_ARGS__);
+#define DBG(x, ...)
#define WARN(x, ...) std::printf("[HTTPClient : WARN]"x"\r\n", ##__VA_ARGS__);
#define ERR(x, ...) std::printf("[HTTPClient : ERR]"x"\r\n", ##__VA_ARGS__);
@@ -470,13 +471,13 @@
if(readLen < minLen)
{
DBG("Trying to read at most %d bytes [Blocking]", minLen - readLen);
- m_sock.set_blocking(true, m_timeout);
+ m_sock.set_blocking(false, m_timeout);
ret = m_sock.receive_all(buf + readLen, minLen - readLen);
}
else
{
DBG("Trying to read at most %d bytes [Not blocking]", maxLen - readLen);
- m_sock.set_blocking(false);
+ m_sock.set_blocking(false, 0);
ret = m_sock.receive(buf + readLen, maxLen - readLen);
}
@@ -527,7 +528,7 @@
return HTTP_CLOSED; //Connection was closed by server
}
- m_sock.set_blocking(true, m_timeout);
+ m_sock.set_blocking(false, m_timeout);
int ret = m_sock.send_all(buf, len);
if(ret > 0)
{
--- a/IHTTPData.h Sun Aug 05 15:30:07 2012 +0000
+++ b/IHTTPData.h Sun Aug 05 16:12:10 2012 +0000
@@ -20,6 +20,10 @@
#ifndef IHTTPDATA_H
#define IHTTPDATA_H
+#include <cstring>
+
+using std::size_t;
+
///This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...)
class IHTTPDataOut
{
--- a/data/HTTPMap.cpp Sun Aug 05 15:30:07 2012 +0000
+++ b/data/HTTPMap.cpp Sun Aug 05 16:12:10 2012 +0000
@@ -17,14 +17,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "core/fwk.h"
-
#include "HTTPMap.h"
#include <cstring>
#include <cctype>
+#define OK 0
+
+using std::strncpy;
+
HTTPMap::HTTPMap() : m_pos(0), m_count(0)
{
--- a/data/HTTPText.cpp Sun Aug 05 15:30:07 2012 +0000
+++ b/data/HTTPText.cpp Sun Aug 05 16:12:10 2012 +0000
@@ -17,12 +17,18 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "core/fwk.h"
-
#include "HTTPText.h"
#include <cstring>
+#define OK 0
+
+using std::memcpy;
+using std::strncpy;
+using std::strlen;
+
+#define MIN(x,y) (((x)<(y))?(x):(y))
+
HTTPText::HTTPText(char* str) : m_str(str), m_pos(0)
{
m_size = strlen(str) + 1;
