+/**
+ * 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);
+}
+
+static http_handler_t cgi_search(const char *name, HttpCGI *table)
+{
+ if (!table)
+ return NULL;
+
+ int i = 0;
+ const char *ext = get_ext(name);
+
+ while(table[i].name)
+ {
+ if (ext && table[i].type == CGI_MATCH_EXT)
+ {
+
+ if (!strcmp(table[i].name, ext))
+ {
+ LOG_INFO("Match ext: %s\n", ext);
+ break;
+ }
+ }
+ else if (table[i].type == CGI_MATCH_NAME)
+ {
+
+ if (strstr(name, table[i].name) != NULL)
+ {
+ LOG_INFO("Match string: %s\n", name);
+ break;
+ }
+ }
+ else /* (table[i].type == CGI_MATCH_WORD) */
+ {
+
+ if (!strcmp(table[i].name, name))
+ {
+ LOG_INFO("Word match: %s\n", name);
+ break;
+ }
+ }
+
+ i++;
+ }
+
+ return table[i].handler;
+}
+
+static char req_string[80];
+
+/**
+ * Http polling function.
+ *
+ * Call this functions to process each client connections.
+ *
+ */
+void http_poll(struct netconn *server)