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
http/httpsame.c
- Committer:
- andrewboyson
- Date:
- 2020-04-02
- Revision:
- 136:be1d42268b5d
- Parent:
- 130:9a5b8fe308f1
File content as of revision 136:be1d42268b5d:
#include <stdbool.h>
#include <ctype.h>
#include "http.h"
bool HttpSameStr(const char* pa, const char* pb)
{
if (!pa || !pb) return false; //Handle NULL references
while(true)
{
if ( *pa != *pb) return false; //If they are not the same return false
if (!*pa) return true; //If finished return true;
pa++;
pb++;
}
}
bool HttpSameStrCaseInsensitive(const char* pa, const char* pb)
{
if (!pa || !pb) return false; //Handle NULL references
while(true)
{
if ( toupper(*pa) != toupper(*pb)) return false; //If they are not the same return false
if (!*pa) return true; //If finished return true;
pa++;
pb++;
}
}
bool HttpSameDate(const char* date, const char* time, const char* pOtherDate)
{
if (!pOtherDate) return false; //Not the same if no lastModified
char pFileDate[HTTP_DATE_LENGTH];
HttpDateFromDateTime(date, time, pFileDate);
return HttpSameStr(pFileDate, pOtherDate);
}