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.
Dependents: oldheating gps motorhome heating
tcp/http/httpshim/httpshim.c
- Committer:
- andrewboyson
- Date:
- 2019-05-15
- Revision:
- 146:0fc66d610fd6
- Child:
- 147:a6093b52e654
File content as of revision 146:0fc66d610fd6:
#include <stdbool.h>
#include "http.h"
#include "tcp.h"
#include "tcpbuf.h"
#include "tls.h"
/*
The shim acts as the switch between TCP, TLS and HTTP.
It means HTTP does not need to know if it is talking directly to TCP as HTTP or via TLS in the form of HTTPS.
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)
{
if (secure) TlsRequest (size, pRequestStream, positionInRequestStream, pState);
else HttpRequestFunction(size, pRequestStream, positionInRequestStream, pState);
}
static bool tlsRequired;
bool HttpShimReplyPoll (char* pState, bool clientFinished, bool secure)
{
tlsRequired = secure;
if (secure) return TlsReplyPoll (pState, clientFinished);
else return HttpReplyPollFunction(pState, clientFinished);
}
void HttpShimAddChar (char c)
{
if (tlsRequired) TlsAddChar(c);
else TcpBufAddChar(c);
}
bool HttpShimBufFilled()
{
return TcpBufFilled();
}
bool HttpShimGetTrace()
{
return HttpTrace;
}