network/http_server/requests/root_page.c
/*
* EVALUATION AND USE OF THIS SOFTWARE IS SUBJECT TO THE TERMS AND
* CONDITIONS OF THE CONTROLLING LICENSE AGREEMENT FOUND AT LICENSE.md
* IN THIS SDK. IF YOU DO NOT AGREE TO THE LICENSE TERMS AND CONDITIONS,
* PLEASE RETURN ALL SOURCE FILES TO SILICON LABORATORIES.
* (c) Copyright 2018, Silicon Laboratories Inc. All rights reserved.
*/
#include "gos.h"
static const char webpage_body[] =
{
"<!DOCTYPE html>"
"<html>"
"<head>"
"<title>HTTP Server Example</title>"
"</head>"
"<body>"
"<h1>Dynamic Root Webpage</h1>"
"<p>Current time: %s</p>"
"</body>"
"</html>"
};
/*************************************************************************************************/
{
gos_result_t result;
gos_iso8601_str_t time_str;
const int len = sprintf(html_page, webpage_body, (const char*)&time_str);
if (GOS_FAILED(result, gos_hs_write_reply_header(request, "text/html", len, GOS_HS_RESPONSE_FLAG_NONE)))
{
}
{
}
return result;
}