From 4938877dd9fc87c16b04248000cf1d6bb70b3446 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Tue, 19 Feb 2013 00:25:36 +0100 Subject: [PATCH] Lifted restrictions on accepted MIME type. The "normal" web is moving forward quickly reducing the interoperability of the Contiki web browser to nearly zero. The Mobile Web fits the capabilities of the Contiki web browser much better. Modern smartphones don't need the Mobile Web anymore but there are large areas in world with rather low end mobile phones and limited mobile bandwidth where the Mobile Web will be necessary for quite some time. From that perspective it is reasonable to increase the Contiki web browser's interoperability with the Mobie Web - namely WAP 2.0 aka XHTML MP. XHTML MP is delivered as MIME types 'application/vnd.wap.xhtml+xml' or 'application/xhtml+xml'. Therefore we (try to) parse the document if the MIME type contains the substring 'html' (which is true 'text/html' too). --- apps/webbrowser/http-strings | 3 +-- apps/webbrowser/http-strings.c | 7 ++----- apps/webbrowser/http-strings.h | 1 - apps/webbrowser/www.c | 2 +- apps/webserver/http-strings | 3 +-- apps/webserver/http-strings.c | 7 ++----- apps/webserver/http-strings.h | 1 - 7 files changed, 7 insertions(+), 17 deletions(-) diff --git a/apps/webbrowser/http-strings b/apps/webbrowser/http-strings index ea5ebc1e0..2bba32dc8 100644 --- a/apps/webbrowser/http-strings +++ b/apps/webbrowser/http-strings @@ -6,9 +6,8 @@ http_get "GET " http_10 "HTTP/1.0" http_11 "HTTP/1.1" http_content_type "content-type: " -http_texthtml "text/html" http_location "location: " -http_host "host: " +http_host "Host: " http_crnl "\r\n" http_index_html "/index.html" http_404_html "/404.html" diff --git a/apps/webbrowser/http-strings.c b/apps/webbrowser/http-strings.c index 968a71851..3407105c3 100644 --- a/apps/webbrowser/http-strings.c +++ b/apps/webbrowser/http-strings.c @@ -22,15 +22,12 @@ const char http_11[9] = const char http_content_type[15] = /* "content-type: " */ {0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, }; -const char http_texthtml[10] = -/* "text/html" */ -{0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, }; const char http_location[11] = /* "location: " */ {0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, }; const char http_host[7] = -/* "host: " */ -{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, }; +/* "Host: " */ +{0x48, 0x6f, 0x73, 0x74, 0x3a, 0x20, }; const char http_crnl[3] = /* "\r\n" */ {0xd, 0xa, }; diff --git a/apps/webbrowser/http-strings.h b/apps/webbrowser/http-strings.h index f197bba2b..5c2cf9396 100644 --- a/apps/webbrowser/http-strings.h +++ b/apps/webbrowser/http-strings.h @@ -6,7 +6,6 @@ extern const char http_get[5]; extern const char http_10[9]; extern const char http_11[9]; extern const char http_content_type[15]; -extern const char http_texthtml[10]; extern const char http_location[11]; extern const char http_host[7]; extern const char http_crnl[3]; diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index 1b8b27ea3..06726e90a 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -638,7 +638,7 @@ void webclient_datahandler(char *data, uint16_t len) { if(len > 0) { - if(strcmp(webclient_mimetype(), http_texthtml) == 0) { + if(strstr(webclient_mimetype(), http_html + 1) != 0) { count = (count + 1) & 3; show_statustext(receivingmsgs[count]); htmlparser_parse(data, len); diff --git a/apps/webserver/http-strings b/apps/webserver/http-strings index 579faee74..7a3d51c03 100644 --- a/apps/webserver/http-strings +++ b/apps/webserver/http-strings @@ -6,9 +6,8 @@ http_get "GET " http_10 "HTTP/1.0" http_11 "HTTP/1.1" http_content_type "content-type: " -http_texthtml "text/html" http_location "location: " -http_host "host: " +http_host "Host: " http_crnl "\r\n" http_index_htm "/index.htm" http_index_html "/index.html" diff --git a/apps/webserver/http-strings.c b/apps/webserver/http-strings.c index 4e22787ea..5c02fedef 100644 --- a/apps/webserver/http-strings.c +++ b/apps/webserver/http-strings.c @@ -22,15 +22,12 @@ const char http_11[9] = const char http_content_type[15] = /* "content-type: " */ {0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, }; -const char http_texthtml[10] = -/* "text/html" */ -{0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, }; const char http_location[11] = /* "location: " */ {0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, }; const char http_host[7] = -/* "host: " */ -{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, }; +/* "Host: " */ +{0x48, 0x6f, 0x73, 0x74, 0x3a, 0x20, }; const char http_crnl[3] = /* "\r\n" */ {0xd, 0xa, }; diff --git a/apps/webserver/http-strings.h b/apps/webserver/http-strings.h index 35af562d4..01fc8cd9d 100644 --- a/apps/webserver/http-strings.h +++ b/apps/webserver/http-strings.h @@ -6,7 +6,6 @@ extern const char http_get[5]; extern const char http_10[9]; extern const char http_11[9]; extern const char http_content_type[15]; -extern const char http_texthtml[10]; extern const char http_location[11]; extern const char http_host[7]; extern const char http_crnl[3];