Add first implementation of http server module.
[bertos.git] / bertos / hw / hw_http.c
1 /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2011 Develer S.r.l. (http://www.develer.com/)
30  * All Rights Reserved.
31  * -->
32  *
33  * \brief Simple Http server error pages.
34  *
35  * \author Daniele Basile <asteix@develer.com>
36  */
37
38 #include "hw_http.h"
39
40 const char http_file_not_found[] = "\
41 <!DOCTYPE html PUBLIC \"-//IETF//DTD HTML 2.0//EN\"> \
42 <html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"> \
43 <title>404 Not Found</title></head><body><img src=\"bertos_logo_jpg.jpg\"><h1>404 Not Found</h1>\
44 <p>The requested URL was not found on this server.</p><hr>\
45 <address>BeRTOS simple HTTP server</address></body></html>";
46
47 const size_t http_file_not_found_len = sizeof(http_file_not_found);
48
49 const char http_sd_not_present[] = " \
50 <!DOCTYPE html PUBLIC \"-//IETF//DTD HTML 2.0//EN\">  \
51 <html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">  \
52 <title>BeRTOS simple HTTP Server</title></head><body><img src=\"bertos_logo_jpg.jpg\"> \
53 <h1>BeRTOS simple HTTP Server</h1><p>Simple Http server, the site's pages are stored on SD card, check it if is present.</p><hr>\
54 <a href=\"http://www.bertos.org\">www.BeRTOS.org</a></body></html> \
55 ";
56 const size_t http_sd_not_present_len = sizeof(http_sd_not_present);