* the cases where SD is not present or page not found, using embedded pages.
* Quering from browser the /status page, the server return a json dictionary where are store
* some board status info, like board temperature, up-time, etc.
* the cases where SD is not present or page not found, using embedded pages.
* Quering from browser the /status page, the server return a json dictionary where are store
* some board status info, like board temperature, up-time, etc.
netconn_write(client, http_html_hdr_500, sizeof(http_html_hdr_500) - 1, NETCONN_NOCOPY);
}
netconn_write(client, http_html_hdr_500, sizeof(http_html_hdr_500) - 1, NETCONN_NOCOPY);
}
-static void get_fileName(const char *revc_buf, size_t recv_len, char *name, size_t len)
+void http_getPageName(const char *revc_buf, size_t recv_len, char *page_name, size_t len)
- char *p = strstr(revc_buf, "GET");
- if (p)
- {
- //Find the end of the page request.
- char *stop = strstr(revc_buf, "HTTP");
- if (!stop)
- {
- LOG_ERR("Bad GET request\n");
- name[0] = '\0';
- return;
- }
- //skip the "/" in get string request
- p += sizeof("GET") + 1;
-
- while (p != stop)
- {
- if ((size_t)i == len || (size_t)i >= recv_len)
+ if (revc_buf && (recv_len > sizeof("GET /")))
+ {
+ if (*revc_buf++ == 'G' &&
+ *revc_buf++ == 'E' && *revc_buf++ == 'T')
- get_fileName(rx_buf, len, req_string, sizeof(req_string));
+ http_getPageName(rx_buf, len, req_string, sizeof(req_string));
LOG_INFO("Search %s\n", req_string);
if (req_string[0] == '\0')
LOG_INFO("Search %s\n", req_string);
if (req_string[0] == '\0')