A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.
Dependents: oldheating gps motorhome heating
Diff: tcp/http/httpshim/httpshim.c
- Revision:
- 147:a6093b52e654
- Parent:
- 146:0fc66d610fd6
- Child:
- 154:ba9879b19d9f
--- a/tcp/http/httpshim/httpshim.c Wed May 15 15:33:15 2019 +0000 +++ b/tcp/http/httpshim/httpshim.c Fri May 17 15:01:32 2019 +0000 @@ -11,18 +11,23 @@ It means TCP does not need to know if it is talking directly to HTTP or via TLS. */ -void HttpShimRequest(int size, char* pRequestStream, uint32_t positionInRequestStream, char* pState, bool secure) +void HttpShimRequest(int size, char* pRequestStream, uint32_t positionInRequestStream, char* pWebState, char* pTlsState, bool secure) { - if (secure) TlsRequest (size, pRequestStream, positionInRequestStream, pState); - else HttpRequestFunction(size, pRequestStream, positionInRequestStream, pState); + if (secure) TlsRequest (pTlsState, pWebState, size, pRequestStream, positionInRequestStream); + else HttpRequestFunction( pWebState, size, pRequestStream, positionInRequestStream); } static bool tlsRequired; -bool HttpShimReplyPoll (char* pState, bool clientFinished, bool secure) +int HttpShimPoll (bool clientFinished, char* pWebState, char* pTlsState, bool secure) { tlsRequired = secure; - if (secure) return TlsReplyPoll (pState, clientFinished); - else return HttpReplyPollFunction(pState, clientFinished); + if (tlsRequired) return TlsPoll (pTlsState, pWebState, clientFinished); + else return HttpPollFunction( pWebState, clientFinished); +} +bool HttpShimReply(char* pWebState, char* pTlsState) +{ + if (tlsRequired) return TlsReply (pTlsState, pWebState); + else return HttpReplyFunction( pWebState); } void HttpShimAddChar (char c) {