+int http_searchContentType(const char *name)
+{
+ if (!name)
+ return 0;
+
+ const char *ext = get_ext(name);
+ LOG_INFO("Ext: %s\n", !ext ? "none" : ext);
+
+ if (!ext)
+ return 0;
+
+ if (!strcmp(ext, "ico"))
+ return HTTP_CONTENT_JPEG;
+
+ for (int i = 0; i < HTTP_CONTENT_CNT; i++)
+ {
+ if (!strcmp(ext, http_content_type[i].key))
+ return i;
+ }
+
+ return 0;
+}
+
+
+/**
+ * Send on \param client socket the 200 Ok http header with
+ * select \param content_type
+ */
+void http_sendOk(struct netconn *client, int content_type)
+{
+ ASSERT(content_type < HTTP_CONTENT_CNT);
+
+ netconn_write(client, http_html_hdr_200, sizeof(http_html_hdr_200) - 1, NETCONN_COPY);
+ netconn_write(client, http_content_type[content_type].content,
+ strlen(http_content_type[content_type].content), NETCONN_COPY);
+}
+
+
+/**
+ * Send on \param client socket the 404 File not found http header with
+ * select \param content_type
+ */
+void http_sendFileNotFound(struct netconn *client, int content_type)
+{
+ ASSERT(content_type < HTTP_CONTENT_CNT);
+
+ netconn_write(client, http_html_hdr_404, sizeof(http_html_hdr_404) - 1, NETCONN_COPY);
+ netconn_write(client, http_content_type[content_type].content,
+ strlen(http_content_type[content_type].content), NETCONN_COPY);
+}
+
+/**
+ * Send on \param client socket the 500 internal server error http header with
+ * select \param content_type
+ */
+void http_sendInternalErr(struct netconn *client, int content_type)
+{
+ ASSERT(content_type < HTTP_CONTENT_CNT);
+
+ netconn_write(client, http_html_hdr_500, sizeof(http_html_hdr_500) - 1, NETCONN_COPY);
+ netconn_write(client, http_content_type[content_type].content,
+ strlen(http_content_type[content_type].content), NETCONN_COPY);
+}
+