Code:
LOCAL void ICACHE_FLASH_ATTR HttpSendWithHeader(struct espconn * WifiScanConfigConnection, unsigned char * LFormatedHTMLPage)
{
//os_printf("Attaching header and sending\r\n");
os_memset(FormatedHTMLPageWithHttpHeader, 0, HTMLSIZE);
os_sprintf(FormatedHTMLPageWithHttpHeader, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\nConnection: close\r\n\r\n", os_strlen(LFormatedHTMLPage));
os_strcat(FormatedHTMLPageWithHttpHeader, LFormatedHTMLPage);
espconn_send(WifiScanConfigConnection, (uint8*)FormatedHTMLPageWithHttpHeader, os_strlen(FormatedHTMLPageWithHttpHeader));
os_printf("HTTP Response sent bytes: %d\r\n", os_strlen(LFormatedHTMLPage));
}
Code:
LOCAL void ICACHE_FLASH_ATTR HttpSendWithHeader(struct espconn * WifiScanConfigConnection, unsigned char * LFormatedHTMLPage)
{
//os_printf("Attaching header and sending\r\n");
os_memset(FormatedHTMLPageWithHttpHeader, 0, HTMLSIZE);
os_sprintf(FormatedHTMLPageWithHttpHeader, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\nConnection: keep-alive\r\n\r\n", os_strlen(LFormatedHTMLPage));
//os_strcat(FormatedHTMLPageWithHttpHeader, LFormatedHTMLPage);
espconn_set_keepalive(WifiScanConfigConnection, ESPCONN_KEEPCNT, NULL);
espconn_send(WifiScanConfigConnection, (uint8*)FormatedHTMLPageWithHttpHeader, os_strlen(FormatedHTMLPageWithHttpHeader));
os_printf("HTTP HEADER Response sent bytes: %d\r\n", os_strlen(FormatedHTMLPageWithHttpHeader));
espconn_send(WifiScanConfigConnection, (uint8*)LFormatedHTMLPage, os_strlen(LFormatedHTMLPage));
os_printf("HTTP BODY Response sent bytes: %d\r\n", os_strlen(LFormatedHTMLPage));
//espconn_disconnect(WifiScanConfigConnection);
}
Statistics: Posted by AgentSmithers — Tue Mar 06, 2018 5:14 pm