HttpServer Library for "mbed-os" which added a snapshot handler.

Dependents:   GR-PEACH-webcam GR-Boards_WebCamera GR-Boards_WebCamera GR-Boards_WebCamera

Fork of HttpServer_snapshot by Renesas

Revision:
11:0700755d64ae
Parent:
9:d117d5f84994
Child:
13:d3571c244759
--- a/HTTPRequestHandler.cpp	Tue Apr 19 02:21:29 2016 +0000
+++ b/HTTPRequestHandler.cpp	Fri Oct 28 06:15:29 2016 +0000
@@ -28,11 +28,11 @@
 #define HTTP_REQUEST_TIMEOUT 5000
 
 //HTTPRequestHandler::HTTPRequestHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket) : NetService(),
-//   m_pTCPSocketConnection(pTCPSocketConnection), m_reqHeaders(), m_respHeaders(),
+//   m_pTCPSocket(pTCPSocket), m_reqHeaders(), m_respHeaders(),
 //   m_rootPath(rootPath), m_path(path), m_errc(200),
 //   m_watchdog(), m_timeout(0),**/ m_closed(false), m_headersSent(false) //OK
-HTTPRequestHandler::HTTPRequestHandler(const char* rootPath, const char* path, TCPSocketConnection* pTCPSocketConnection) :
-    m_pTCPSocketConnection(pTCPSocketConnection), m_reqHeaders(), m_respHeaders(),
+HTTPRequestHandler::HTTPRequestHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket) :
+    m_pTCPSocket(pTCPSocket), m_reqHeaders(), m_respHeaders(),
     m_rootPath(rootPath), m_path(path), m_errc(200), m_closed(false), m_headersSent(false)
 {
 #ifdef _DEBUG_REQUEST_HANDLER
@@ -95,7 +95,7 @@
 
 int HTTPRequestHandler::readData(char* buf, int len)
 {
-    return m_pTCPSocketConnection->receive(buf, len);
+    return m_pTCPSocket->recv(buf, len);
 }
 
 string& HTTPRequestHandler::rootPath() //const
@@ -126,7 +126,7 @@
         m_headersSent = true;
         writeHeaders();
     }
-    return m_pTCPSocketConnection->send((char *)buf, len);
+    return m_pTCPSocket->send((char *)buf, len);
 }
 /**
 void HTTPRequestHandler::setTimeout(int ms)
@@ -161,7 +161,7 @@
 {
     //Response line
     sprintf(line, "HTTP/1.1 %d MbedInfo\r\n", m_errc); //Not a violation of the standard not to include the descriptive text
-    m_pTCPSocketConnection->send(line, strlen(line));
+    m_pTCPSocket->send(line, strlen(line));
 
     map<string,string>::iterator it;
     while( !m_respHeaders.empty() ) {
@@ -170,10 +170,10 @@
 #ifdef _DEBUG_REQUEST_HANDLER
         printf("\r\n+++(HTTPRequestHandler)%s", line);
 #endif
-        m_pTCPSocketConnection->send(line, strlen(line));
+        m_pTCPSocket->send(line, strlen(line));
         m_respHeaders.erase(it);
     }
-    m_pTCPSocketConnection->send("\r\n",2); //End of head
+    m_pTCPSocket->send("\r\n",2); //End of head
 }
 
 int HTTPRequestHandler::readLine(char* str, int maxLen)
@@ -181,7 +181,7 @@
     int ret;
     int len = 0;
     for(int i = 0; i < maxLen - 1; i++) {
-        ret = m_pTCPSocketConnection->receive(str, 1);
+        ret = m_pTCPSocket->recv(str, 1);
         if(ret <= 0) {
             break;
         }