Andrew Boyson / net

Dependents:   oldheating gps motorhome heating

Revision:
159:3ebef2d02f7f
Parent:
157:b0bdb77e27f3
Child:
163:f063e374cf2a
--- a/tcp/tcpsend.c	Sat Sep 07 18:57:57 2019 +0000
+++ b/tcp/tcpsend.c	Tue Sep 24 18:16:12 2019 +0000
@@ -6,12 +6,12 @@
 #include     "net.h"
 #include  "action.h"
 #include     "tcp.h"
-#include  "tcpbuf.h"
 #include  "tcphdr.h"
 #include     "tcb.h"
 #include     "ip4.h"
 #include    "dhcp.h"
-#include "httpshim.h"
+#include    "http.h"
+#include   "https.h"
 #include     "led.h"
 #include "tcpsend.h"
 #include "mstimer.h"
@@ -38,23 +38,22 @@
 {
     switch (port)
     {
-        case  80: return HttpShimGetTrace(false);
-        case 443: return HttpShimGetTrace(true );
+        case  80: return HttpGetTrace();
+        case 443: return HttpsGetTrace();
         default:  return false;
     }    
 }
 
-static bool addAppData(int *pDataLength, void* pPacket, int connection, uint16_t port, uint32_t start, int mss, bool clientFinished)
+static bool addAppData(int *pDataLength, void* pPacket, int connection, uint16_t port, uint32_t windowPositionInStream, int windowSize, bool clientFinished)
 {
-    uint8_t* pData = (uint8_t*)pPacket + TcpHdrSizeGet();
-    TcpBufStart(start, mss, pData);
+    uint8_t* pWindow = (uint8_t*)pPacket + TcpHdrSizeGet();
     bool finished = false;
+    *pDataLength = windowSize;
     switch (port)
     {
-        case  80: finished = HttpShimPoll(false, connection, clientFinished); break;
-        case 443: finished = HttpShimPoll(true,  connection, clientFinished); break;
+        case  80: finished =  HttpResponse(connection, clientFinished, pDataLength, (char*)pWindow, windowPositionInStream); break;
+        case 443: finished = HttpsResponse(connection, clientFinished, pDataLength,        pWindow, windowPositionInStream); break;
     }
-    *pDataLength = TcpBufLength();
     return finished;
 }
 static int preparePacket(void* pPacket, struct tcb* pTcb, int dataLength, int* pSize)