network/http_server/requests/root_page.c
/*******************************************************************************
* # License
* Copyright 2019 Silicon Laboratories Inc. www.silabs.com
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
#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;
}