For a question in forum this is a working example, there will be the example that is not working
Fork of eth_v13 by
Diff: html.h
- Revision:
- 3:79dc3337d9da
- Parent:
- 2:8f5bacfef390
- Child:
- 4:a10e3d1bdb17
diff -r 8f5bacfef390 -r 79dc3337d9da html.h --- a/html.h Tue Mar 18 22:51:18 2014 +0000 +++ b/html.h Fri Mar 21 00:18:33 2014 +0000 @@ -1,11 +1,51 @@ #ifndef HTML_H_ #define HTML_H_ +/* const char html_head[] = "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nPragma: no-cache\r\n\r\n" \ "<html>\r\n<body>\r\n" \ "<title>Karl's W5100 web server (ATmega644p)</title>\r\n" \ "<h2>Karl's ATmega644p web server using Wiznet W5100 chip</h2>\r\n"; +*/ -const char html_foot[] ="<br /><hr>\r\n"; +const char html_head[] = "<html>\r\n<body>\r\n" \ + "<title>Karl's W5100 web server (ATmega644p)</title>\r\n" \ + "<h2>Karl's ATmega644p web server using Wiznet W5100 chip</h2>\r\n"; + +const char html_foot[] ="<br /><hr></html>\r\n"; + + +const char c_HTTP_200_OK[] = "HTTP/1.0 200 OK\r\n"; +const char c_HTTP_404_NotFound[] = "HTTP/1.0 404 Not Found\r\n"; + +/* Cache Control */ +const char c_HTTP_CacheControl_NoCache[] = "Pragma: no-cache\r\nExpires: Fri, 01 Jan 1990 00:00:00 GMT\r\nCache-Control: no-cache, must-revalidate\r\n"; + +/* Content Types */ +const char c_HTTP_Content_HTML[] = "Content-Type: text/html\r\n"; +const char c_HTTP_Content_Javascript[] = "Content-Type: text/javascript\r\n"; +const char c_HTTP_Content_Bmp[] = "Content-Type: image/bmp\r\n"; +const char c_HTTP_Content_Ico[] = "Content-Type: image/ico\r\n"; +const char c_HTTP_Content_Jpeg[] = "Content-Type: image/jpeg\r\n"; +const char c_HTTP_Content_Gif[] = "Content-Type: image/gif\r\n"; +const char c_HTTP_Content_Png[] = "Content-Type: image/png\r\n"; + +/* Content Length */ +const char c_HTTP_Content_Length[] = "Content-Length: "; + +/* Empty Line */ +const char c_HTTP_EmptyLine[] = "\r\n"; + +/* File Extensions */ +const char c_HTTP_FileExtension_Htm[] = "htm"; +const char c_HTTP_FileExtension_Js[] = "js"; +const char c_HTTP_FileExtension_Bmp[] = "bmp"; +const char c_HTTP_FileExtension_Ico[] = "ico"; +const char c_HTTP_FileExtension_Jpg[] = "jpg"; +const char c_HTTP_FileExtension_Gif[] = "gif"; +const char c_HTTP_FileExtension_Png[] = "png"; + +const char c_HTTP_Page_404[] = "<html><body><div id=\"title\" style=\"width: 800px; margin: 0 auto; text-align:center\"><h1>TheUno WebServer - Error 404</h1></div><br /><div id=\"text\" style=\"width: 800px; margin: 0 auto; text-align:center\"><p>The page requested was not found. Please click <a href=\"index.htm\">this link</a> to return on the main page of the WebServer.</p></div></body></html>\r\n"; + #endif \ No newline at end of file