From 085b7d88987d7bd12ab45dd8a503d6c0ce170fc4 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 29 Apr 2015 18:21:35 +0200 Subject: [PATCH 01/23] Set WWW_CONF_MAX_URLLEN to maximum value by default. WWW_CONF_MAX_URLLEN is used as length for the 'editurl' textentry widget. The CTK code for handling that widget uses a single byte so the length can't be > 255. Thus WWW_CONF_MAX_URLLEN can't be > 255 as well. --- apps/webbrowser/www.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/webbrowser/www.h b/apps/webbrowser/www.h index d7ffd6fd6..2b6e5f33e 100644 --- a/apps/webbrowser/www.h +++ b/apps/webbrowser/www.h @@ -44,7 +44,7 @@ #define WWW_CONF_HISTORY_SIZE 10 #endif #ifndef WWW_CONF_MAX_URLLEN -#define WWW_CONF_MAX_URLLEN 300 +#define WWW_CONF_MAX_URLLEN 255 #endif #ifndef WWW_CONF_PAGEATTRIB_SIZE #define WWW_CONF_PAGEATTRIB_SIZE 2000 From 40417a2bcdd02e37e5a970fd47e393c7ac355d03 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sat, 2 May 2015 00:11:59 +0200 Subject: [PATCH 02/23] Skip HTTP header fields to long to parse. Nowadays many HTTP server set cookies which may easily result in HTTP header fields longer than our 'httpheaderline' buffer. It doesn't hurt if we can't parse them but we need to be able to skip them and continue to parse the following header fields. --- apps/webbrowser/webclient.c | 78 +++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/apps/webbrowser/webclient.c b/apps/webbrowser/webclient.c index 08c6ed211..790085cd8 100644 --- a/apps/webbrowser/webclient.c +++ b/apps/webbrowser/webclient.c @@ -63,11 +63,11 @@ struct webclient_state { uint16_t port; char host[40]; - char file[WWW_CONF_MAX_URLLEN]; + char file[WWW_CONF_MAX_URLLEN - 10]; // URL - "http:///" uint16_t getrequestptr; uint16_t getrequestleft; - char httpheaderline[200]; + char httpheaderline[WWW_CONF_MAX_URLLEN + 10]; // URL + "Location: " uint16_t httpheaderlineptr; char mimetype[32]; @@ -327,13 +327,12 @@ parse_headers(uint16_t len) char *cptr; static unsigned char i; - while(len > 0 && s.httpheaderlineptr < sizeof(s.httpheaderline)) { + while(len > 0) { s.httpheaderline[s.httpheaderlineptr] = *(char *)uip_appdata; uip_appdata = (char *)uip_appdata + 1; --len; if(s.httpheaderline[s.httpheaderlineptr] == ISO_nl) { - /* We have an entire HTTP header line in s.httpheaderline, so - we parse it. */ + /* We reached the end of an HTTP header line. */ if(s.httpheaderline[0] == ISO_cr) { /* This was the last header line (i.e., and empty "\r\n"), so we are done with the headers and proceed with the actual @@ -342,46 +341,51 @@ parse_headers(uint16_t len) return len; } - s.httpheaderline[s.httpheaderlineptr - 1] = 0; - /* Check for specific HTTP header fields. */ - if(casecmp(s.httpheaderline, http_content_type, - sizeof(http_content_type) - 1) == 0) { - /* Found Content-type field. */ - cptr = strchr(s.httpheaderline, ';'); - if(cptr != NULL) { - *cptr = 0; - } - strncpy(s.mimetype, s.httpheaderline + - sizeof(http_content_type) - 1, sizeof(s.mimetype)); - } else if(casecmp(s.httpheaderline, http_location, - sizeof(http_location) - 1) == 0) { - cptr = s.httpheaderline + - sizeof(http_location) - 1; - - if(strncmp(cptr, http_http, 7) == 0) { - cptr += 7; - for(i = 0; i < s.httpheaderlineptr - 7; ++i) { - if(*cptr == 0 || - *cptr == '/' || - *cptr == ' ' || - *cptr == ':') { - s.host[i] = 0; - break; - } - s.host[i] = *cptr; - ++cptr; + if(s.httpheaderlineptr < sizeof(s.httpheaderline) - 1) { + /* We have an entire HTTP header line in s.httpheaderline, so + we parse it. */ + s.httpheaderline[s.httpheaderlineptr - 1] = 0; + /* Check for specific HTTP header fields. */ + if(casecmp(s.httpheaderline, http_content_type, + sizeof(http_content_type) - 1) == 0) { + /* Found Content-type field. */ + cptr = strchr(s.httpheaderline, ';'); + if(cptr != NULL) { + *cptr = 0; } + strncpy(s.mimetype, s.httpheaderline + + sizeof(http_content_type) - 1, sizeof(s.mimetype)); + } else if(casecmp(s.httpheaderline, http_location, + sizeof(http_location) - 1) == 0) { + cptr = s.httpheaderline + + sizeof(http_location) - 1; + + if(strncmp(cptr, http_http, 7) == 0) { + cptr += 7; + for(i = 0; i < s.httpheaderlineptr - 7; ++i) { + if(*cptr == 0 || + *cptr == '/' || + *cptr == ' ' || + *cptr == ':') { + s.host[i] = 0; + break; + } + s.host[i] = *cptr; + ++cptr; + } + } + strncpy(s.file, cptr, sizeof(s.file)); + /* s.file[s.httpheaderlineptr - i] = 0;*/ } - strncpy(s.file, cptr, sizeof(s.file)); - /* s.file[s.httpheaderlineptr - i] = 0;*/ } - /* We're done parsing, so we reset the pointer and start the next line. */ s.httpheaderlineptr = 0; } else { - ++s.httpheaderlineptr; + if(s.httpheaderlineptr < sizeof(s.httpheaderline) - 1) { + ++s.httpheaderlineptr; + } } } return len; From 05d98ffca3320d38a2474201a4b2d1397d01664f Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sat, 2 May 2015 00:17:53 +0200 Subject: [PATCH 03/23] Adjusted some Win32 config values. --- platform/win32/contiki-conf.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/platform/win32/contiki-conf.h b/platform/win32/contiki-conf.h index 9c2e81be7..0441bebd9 100644 --- a/platform/win32/contiki-conf.h +++ b/platform/win32/contiki-conf.h @@ -56,11 +56,8 @@ typedef long s32_t; typedef unsigned short uip_stats_t; -#define UIP_CONF_MAX_CONNECTIONS 40 -#define UIP_CONF_MAX_LISTENPORTS 40 #define UIP_CONF_LLH_LEN 14 #define UIP_CONF_BUFFER_SIZE 1514 -#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN #define UIP_CONF_TCP_SPLIT 1 #define UIP_CONF_LOGGING 1 #define UIP_CONF_UDP_CHECKSUMS 1 @@ -77,6 +74,8 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_IP_FORWARD 1 #endif +#define RESOLV_CONF_SUPPORTS_MDNS 0 +#define RESOLV_CONF_SUPPORTS_RECORD_EXPIRATION 0 #include #define ctk_arch_isprint isprint From a9c6d59da312b08b429d9469de0c32f6635c7cc4 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sat, 2 May 2015 00:37:46 +0200 Subject: [PATCH 04/23] Avoid compiler warning because of unused variable. --- core/net/ip/uip-nameserver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/net/ip/uip-nameserver.c b/core/net/ip/uip-nameserver.c index 6ced6b91e..3a3933be9 100644 --- a/core/net/ip/uip-nameserver.c +++ b/core/net/ip/uip-nameserver.c @@ -57,7 +57,9 @@ typedef struct uip_nameserver_record { } uip_nameserver_record; /** \brief Initialization flag */ +#if UIP_NAMESERVER_POOL_SIZE > 1 static uint8_t initialized = 0; +#endif /** \name List and memory block * @{ From a56af59f4095df4d5657b62750e704ebea52daca Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 24 May 2015 15:45:45 +0200 Subject: [PATCH 05/23] Avoid randomly "eating" blanks. At the time do_word() is called s.word[s.wordlen] is undefined. So it doesn't make sense to make decisions based on its value - and in fact I don't see why it was necessary/desirable in the first place. --- apps/webbrowser/htmlparser.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c index 725aae433..f955b2f3d 100644 --- a/apps/webbrowser/htmlparser.c +++ b/apps/webbrowser/htmlparser.c @@ -305,9 +305,7 @@ do_word(void) { if(s.wordlen > 0) { if(s.majorstate == MAJORSTATE_LINK) { - if(s.word[s.wordlen] != ISO_space) { - add_char(ISO_space); - } + add_char(ISO_space); } else if(s.majorstate == MAJORSTATE_DISCARD) { s.wordlen = 0; } else { From a9f88a05d67840e43b775b953bb9483a28c5334a Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 24 May 2015 19:00:39 +0200 Subject: [PATCH 06/23] Don't render consecutive blanks inside links. --- apps/webbrowser/htmlparser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c index f955b2f3d..bb59477b1 100644 --- a/apps/webbrowser/htmlparser.c +++ b/apps/webbrowser/htmlparser.c @@ -305,7 +305,9 @@ do_word(void) { if(s.wordlen > 0) { if(s.majorstate == MAJORSTATE_LINK) { - add_char(ISO_space); + if(s.word[s.wordlen - 1] != ISO_space) { + add_char(ISO_space); + } } else if(s.majorstate == MAJORSTATE_DISCARD) { s.wordlen = 0; } else { From 980d055f727f95d1a8f7f889d60bb7ea87ce06fb Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 24 May 2015 19:40:35 +0200 Subject: [PATCH 07/23] Allow for attributes in
  • tags. parse_tag() is called both for attributes inside a tag and the end of the tag itself. For most tags parse_tag() doesn't distinguish both cases. This means that the "tag action" is additionally triggered for every tag attribute. When the tag "action" is setting some state this doesn't hurt. For many tags the "tag action" is to render a newline. Superfluous newlines are sort of acceptable to keep the code as small as possible. However the
  • "tag action" is to render a newline followed by an asterisk - and superfluous asterisks are ugly so we check for
  • if parse_tag() was called for the end of the tag itself. --- apps/webbrowser/htmlparser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c index bb59477b1..7ca5f7575 100644 --- a/apps/webbrowser/htmlparser.c +++ b/apps/webbrowser/htmlparser.c @@ -390,9 +390,11 @@ parse_tag(void) newline(); break; case TAG_LI: - newline(); - add_char(ISO_asterisk); - add_char(ISO_space); + if(s.tagattr[0] == 0) { + newline(); + add_char(ISO_asterisk); + add_char(ISO_space); + } break; case TAG_SCRIPT: case TAG_STYLE: From 4a6909d16ac9b5af490412629faf8c41742a8c1d Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 25 May 2015 13:43:11 +0200 Subject: [PATCH 08/23] Remove RDC config from retro definitiions. After the modularization of the Contiki libraries this isn't necessary anymore. --- cpu/6502/6502def.h | 1 - 1 file changed, 1 deletion(-) diff --git a/cpu/6502/6502def.h b/cpu/6502/6502def.h index 1d7b5c440..441768153 100644 --- a/cpu/6502/6502def.h +++ b/cpu/6502/6502def.h @@ -72,7 +72,6 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_LLH_LEN 14 #define RESOLV_CONF_SUPPORTS_MDNS 0 #define RESOLV_CONF_SUPPORTS_RECORD_EXPIRATION 0 -#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 1 #define LOADER_CONF_ARCH "lib/unload.h" From a8837e230cee765de8e3ae91f4638ec53305f344 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 25 May 2015 16:13:24 +0200 Subject: [PATCH 09/23] Removed support for tag. Framesets aren't used nowadays anymore so it seems reasonable to remove support for them in order to save some space. --- apps/webbrowser/html-strings | 1 - apps/webbrowser/html-strings.c | 3 --- apps/webbrowser/html-strings.h | 1 - apps/webbrowser/htmlparser.c | 46 ++++++++++------------------------ 4 files changed, 13 insertions(+), 38 deletions(-) diff --git a/apps/webbrowser/html-strings b/apps/webbrowser/html-strings index e56d8f600..e319dc651 100644 --- a/apps/webbrowser/html-strings +++ b/apps/webbrowser/html-strings @@ -9,7 +9,6 @@ html_a "a\0" html_body "body\0" html_br "br\0" html_form "form\0" -html_frame "frame\0" html_h1 "h1\0" html_h2 "h2\0" html_h3 "h3\0" diff --git a/apps/webbrowser/html-strings.c b/apps/webbrowser/html-strings.c index 51fc3f1cd..5743f1a03 100644 --- a/apps/webbrowser/html-strings.c +++ b/apps/webbrowser/html-strings.c @@ -31,9 +31,6 @@ const char html_br[4] = const char html_form[6] = /* "form\0" */ {0x66, 0x6f, 0x72, 0x6d, 00, }; -const char html_frame[7] = -/* "frame\0" */ -{0x66, 0x72, 0x61, 0x6d, 0x65, 00, }; const char html_h1[4] = /* "h1\0" */ {0x68, 0x31, 00, }; diff --git a/apps/webbrowser/html-strings.h b/apps/webbrowser/html-strings.h index cf09c0107..5bcf03978 100644 --- a/apps/webbrowser/html-strings.h +++ b/apps/webbrowser/html-strings.h @@ -9,7 +9,6 @@ extern const char html_a[3]; extern const char html_body[6]; extern const char html_br[4]; extern const char html_form[6]; -extern const char html_frame[7]; extern const char html_h1[4]; extern const char html_h2[4]; extern const char html_h3[4]; diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c index 7ca5f7575..b3c46574e 100644 --- a/apps/webbrowser/htmlparser.c +++ b/apps/webbrowser/htmlparser.c @@ -119,9 +119,6 @@ G * (
    ,

    , ), the

  • tag (but does not even try to #define ISO_eq 0x3d #define ISO_gt 0x3e -#define ISO_rbrack 0x5b -#define ISO_lbrack 0x5d - #define MINORSTATE_NONE 0 #define MINORSTATE_TEXT 1 /* Parse normal text */ #define MINORSTATE_EXTCHAR 2 /* Check for semi-colon */ @@ -196,33 +193,31 @@ static const char *tags[] = { html_br, #define TAG_FORM 10 html_form, -#define TAG_FRAME 11 - html_frame, -#define TAG_H1 12 +#define TAG_H1 11 html_h1, -#define TAG_H2 13 +#define TAG_H2 12 html_h2, -#define TAG_H3 14 +#define TAG_H3 13 html_h3, -#define TAG_H4 15 +#define TAG_H4 14 html_h4, -#define TAG_IMG 16 +#define TAG_IMG 15 html_img, -#define TAG_INPUT 17 +#define TAG_INPUT 16 html_input, -#define TAG_LI 18 +#define TAG_LI 17 html_li, -#define TAG_P 19 +#define TAG_P 18 html_p, -#define TAG_SCRIPT 20 +#define TAG_SCRIPT 19 html_script, -#define TAG_SELECT 21 +#define TAG_SELECT 20 html_select, -#define TAG_STYLE 22 +#define TAG_STYLE 21 html_style, -#define TAG_TR 23 +#define TAG_TR 22 html_tr, -#define TAG_LAST 24 +#define TAG_LAST 23 last, }; @@ -370,8 +365,6 @@ parse_tag(void) static char *tagattrparam; static unsigned char size; - static char dummy; - PRINTF(("Parsing tag '%s' '%s' '%s'\n", s.tag, s.tagattr, s.tagattrparam)); switch(find_tag(s.tag)) { @@ -386,7 +379,6 @@ parse_tag(void) case TAG_TR: case TAG_SLASHDIV: case TAG_SLASHH: - dummy = 0; newline(); break; case TAG_LI: @@ -410,18 +402,6 @@ parse_tag(void) case TAG_BODY: s.majorstate = s.lastmajorstate = MAJORSTATE_BODY; break; - case TAG_FRAME: - if(strncmp(s.tagattr, html_src, sizeof(html_src)) == 0 && s.tagattrparam[0] != 0) { - switch_majorstate(MAJORSTATE_BODY); - newline(); - add_char(ISO_rbrack); - do_word(); - htmlparser_link((char *)html_frame, (unsigned char)strlen(html_frame), s.tagattrparam); - PRINTF(("Frame [%s]\n", s.tagattrparam)); - add_char(ISO_lbrack); - newline(); - } - break; case TAG_IMG: if(strncmp(s.tagattr, html_alt, sizeof(html_alt)) == 0 && s.tagattrparam[0] != 0) { add_char(ISO_lt); From 9b9b92be06db68ac24ea0a5b25753e84c5ac62ce Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 25 May 2015 16:46:23 +0200 Subject: [PATCH 10/23] Improved parsing of tag is found. --- apps/webbrowser/htmlparser.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c index b3c46574e..b66307965 100644 --- a/apps/webbrowser/htmlparser.c +++ b/apps/webbrowser/htmlparser.c @@ -137,7 +137,7 @@ G * (
    ,

    , ), the

  • tag (but does not even try to #define MAJORSTATE_LINK 2 #define MAJORSTATE_FORM 3 #define MAJORSTATE_DISCARD 4 - +#define MAJORSTATE_SCRIPT 5 struct htmlparser_state { @@ -303,7 +303,7 @@ do_word(void) if(s.word[s.wordlen - 1] != ISO_space) { add_char(ISO_space); } - } else if(s.majorstate == MAJORSTATE_DISCARD) { + } else if(s.majorstate >= MAJORSTATE_DISCARD) { s.wordlen = 0; } else { s.word[s.wordlen] = '\0'; @@ -363,11 +363,17 @@ static void parse_tag(void) { static char *tagattrparam; + static unsigned char tag; static unsigned char size; + tag = find_tag(s.tag); + if(s.majorstate == MAJORSTATE_SCRIPT && tag != TAG_SLASHSCRIPT) { + return; + } + PRINTF(("Parsing tag '%s' '%s' '%s'\n", s.tag, s.tagattr, s.tagattrparam)); - switch(find_tag(s.tag)) { + switch(tag) { case TAG_P: case TAG_H1: case TAG_H2: @@ -389,6 +395,8 @@ parse_tag(void) } break; case TAG_SCRIPT: + switch_majorstate(MAJORSTATE_SCRIPT); + break; case TAG_STYLE: case TAG_SELECT: switch_majorstate(MAJORSTATE_DISCARD); From cdd289a7ff22dfde2ee970168bad439dd9c4a891 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 25 May 2015 18:18:44 +0200 Subject: [PATCH 11/23] Ignore fragment-only links. We don't handle URLs with fragments exactly ;-) well - meaning we send the fragment part to the server and we don't display the document starting at the anchor tag. Instead of adding the missing capabilities and thus adding lots of code I instead opted to simply ignore fragment-only links. This approach is based on the practical knowledge that fragments are primarily used for intra-document navigation - and are as such fragment-only links. And as we ignore them anyway when displaying the document it's more ergonomic to not have those links in the first place. --- apps/webbrowser/www.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index 8e1331c75..3acea84b5 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -170,11 +170,12 @@ static struct inputattrib *currptr; #define ISO_nl 0x0a #define ISO_space 0x20 +#define ISO_hash 0x23 #define ISO_ampersand 0x26 -#define ISO_plus 0x2b +#define ISO_plus 0x2b #define ISO_slash 0x2f #define ISO_eq 0x3d -#define ISO_questionmark 0x3f +#define ISO_questionmark 0x3f /* The state of the rendering code. */ static char *webpageptr; @@ -886,7 +887,11 @@ htmlparser_word(char *word, unsigned char wordlen) void htmlparser_link(char *text, unsigned char textlen, char *url) { - add_pagewidget(text, textlen, url, CTK_WIDGET_HYPERLINK, 0); + if(url[0] == ISO_hash) { + htmlparser_word(text, textlen); + } else { + add_pagewidget(text, textlen, url, CTK_WIDGET_HYPERLINK, 0); + } } /*-----------------------------------------------------------------------------------*/ #if WWW_CONF_FORMS From 8b0a7a697f5bc5fb2733592270c1a1f1174d1f5a Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Tue, 26 May 2015 16:45:52 +0200 Subject: [PATCH 12/23] Filter excessive newlines. The way our HTML parser triggers newlines is a guess at best. On the other hand our screen estate is severely limited. Instead of trying to (further) improve the way we translate tags to newlines it seems more reasonable to simply never render more than two successive empty lines. --- apps/webbrowser/www.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index 3acea84b5..0d2dd6ab0 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -182,6 +182,7 @@ static char *webpageptr; static unsigned char x, y; static unsigned char loading; static unsigned short firsty, pagey; +static unsigned char newlines; static unsigned char count; static char receivingmsgs[4][23] = { @@ -278,6 +279,7 @@ start_loading(void) loading = 1; x = y = 0; pagey = 0; + newlines = 0; webpageptr = webpage; clear_page(); @@ -732,6 +734,8 @@ add_pagewidget(char *text, unsigned char size, char *attrib, unsigned char type, char *wptr; static unsigned char maxwidth; + newlines = 0; + if(!loading) { return; } @@ -838,6 +842,10 @@ htmlparser_newline(void) { char *wptr; + if(++newlines > 2) { + return; + } + if(pagey < firsty) { ++pagey; x = 0; @@ -864,6 +872,8 @@ htmlparser_newline(void) void htmlparser_word(char *word, unsigned char wordlen) { + newlines = 0; + if(loading) { if(wordlen + 1 > WWW_CONF_WEBPAGE_WIDTH - x) { htmlparser_newline(); From 448fa88ad81c7337ad61450dbc45d99575bc35cd Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 4 Jun 2015 22:00:52 +0200 Subject: [PATCH 13/23] Fixed handling of empty URLs. The code to trim spaces from the end of the URL behaved undefined if the URL was empty. That scenario is far from hypothetic as i.e. pressing the 'back' button with no (more) entry in the history yields an empty URL. --- apps/webbrowser/www.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index 0d2dd6ab0..f9624bc49 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -308,10 +308,13 @@ open_url(void) static uip_ipaddr_t addr; /* Trim off any spaces in the end of the url. */ - urlptr = url + strlen(url) - 1; - while(*urlptr == ' ' && urlptr > url) { - *urlptr = 0; - --urlptr; + urlptr = url + strlen(url); + while(urlptr > url) { + if(*(urlptr - 1) == ' ') { + *--urlptr = 0; + } else { + break; + } } /* Don't even try to go further if the URL is empty. */ From e93f9da7af8bc7ec9488b6905606d99f34fd5ea9 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 4 Jun 2015 22:39:16 +0200 Subject: [PATCH 14/23] Adjusted coding style. --- apps/webbrowser/www.c | 76 +++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index f9624bc49..d97c793e3 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -778,49 +778,49 @@ add_pagewidget(char *text, unsigned char size, char *attrib, unsigned char type, wptr[size + border] = ' '; switch(type) { - case CTK_WIDGET_HYPERLINK: { - struct linkattrib *linkptr = - (struct linkattrib *)add_pageattrib(sizeof(struct linkattrib) /* incl 1 attrib char */ + attriblen); - if(linkptr != NULL) { - CTK_HYPERLINK_NEW(&linkptr->hyperlink, x, y + 3, size, wptr, linkptr->url); - strcpy(linkptr->url, attrib); - CTK_WIDGET_SET_FLAG(&linkptr->hyperlink, CTK_WIDGET_FLAG_MONOSPACE); - CTK_WIDGET_ADD(&mainwindow, &linkptr->hyperlink); - } - break; + case CTK_WIDGET_HYPERLINK: { + struct linkattrib *linkptr = + (struct linkattrib *)add_pageattrib(sizeof(struct linkattrib) /* incl 1 attrib char */ + attriblen); + if(linkptr != NULL) { + CTK_HYPERLINK_NEW(&linkptr->hyperlink, x, y + 3, size, wptr, linkptr->url); + strcpy(linkptr->url, attrib); + CTK_WIDGET_SET_FLAG(&linkptr->hyperlink, CTK_WIDGET_FLAG_MONOSPACE); + CTK_WIDGET_ADD(&mainwindow, &linkptr->hyperlink); } + break; + } #if WWW_CONF_FORMS - case CTK_WIDGET_BUTTON: { - struct submitattrib *submitptr = - (struct submitattrib *)add_pageattrib(sizeof(struct submitattrib) /* incl 1 attrib char */ + attriblen); - if(submitptr != NULL) { - CTK_BUTTON_NEW((struct ctk_button *)&submitptr->button, x, y + 3, size, wptr); - add_forminput((struct inputattrib *)submitptr); - submitptr->formptr = formptr; - strcpy(submitptr->name, attrib); - CTK_WIDGET_SET_FLAG(&submitptr->button, CTK_WIDGET_FLAG_MONOSPACE); - CTK_WIDGET_ADD(&mainwindow, &submitptr->button); - } - break; + case CTK_WIDGET_BUTTON: { + struct submitattrib *submitptr = + (struct submitattrib *)add_pageattrib(sizeof(struct submitattrib) /* incl 1 attrib char */ + attriblen); + if(submitptr != NULL) { + CTK_BUTTON_NEW((struct ctk_button *)&submitptr->button, x, y + 3, size, wptr); + add_forminput((struct inputattrib *)submitptr); + submitptr->formptr = formptr; + strcpy(submitptr->name, attrib); + CTK_WIDGET_SET_FLAG(&submitptr->button, CTK_WIDGET_FLAG_MONOSPACE); + CTK_WIDGET_ADD(&mainwindow, &submitptr->button); } - case CTK_WIDGET_TEXTENTRY: { - struct textattrib *textptr = - (struct textattrib *)add_pageattrib(sizeof(struct textattrib) /* incl 1 attrib char */ + attriblen - + (size ? WWW_CONF_MAX_INPUTVALUELEN : strlen(text)) + 1); - if(textptr != NULL) { - CTK_TEXTENTRY_NEW((struct ctk_textentry *)&textptr->textentry, x, y + 3, size, 1, - textptr->name + attriblen + 1, WWW_CONF_MAX_INPUTVALUELEN); - add_forminput((struct inputattrib *)textptr); - textptr->formptr = formptr; - strcpy(textptr->textentry.text, text); - strcpy(textptr->name, attrib); - if(size) { - CTK_WIDGET_SET_FLAG(&textptr->textentry, CTK_WIDGET_FLAG_MONOSPACE); - CTK_WIDGET_ADD(&mainwindow, &textptr->textentry); - } + break; + } + case CTK_WIDGET_TEXTENTRY: { + struct textattrib *textptr = + (struct textattrib *)add_pageattrib(sizeof(struct textattrib) /* incl 1 attrib char */ + attriblen + + (size ? WWW_CONF_MAX_INPUTVALUELEN : strlen(text)) + 1); + if(textptr != NULL) { + CTK_TEXTENTRY_NEW((struct ctk_textentry *)&textptr->textentry, x, y + 3, size, 1, + textptr->name + attriblen + 1, WWW_CONF_MAX_INPUTVALUELEN); + add_forminput((struct inputattrib *)textptr); + textptr->formptr = formptr; + strcpy(textptr->textentry.text, text); + strcpy(textptr->name, attrib); + if(size) { + CTK_WIDGET_SET_FLAG(&textptr->textentry, CTK_WIDGET_FLAG_MONOSPACE); + CTK_WIDGET_ADD(&mainwindow, &textptr->textentry); } - break; } + break; + } #endif /* WWW_CONF_FORMS */ } } From 2f2295c182c771af8c24dfda0007b2f3099d6d54 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 5 Jun 2015 15:11:57 +0200 Subject: [PATCH 15/23] Correctly initialize 'wordlen'. --- apps/webbrowser/htmlparser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c index b66307965..020fc513b 100644 --- a/apps/webbrowser/htmlparser.c +++ b/apps/webbrowser/htmlparser.c @@ -148,7 +148,7 @@ struct htmlparser_state { unsigned char tagattrptr; char tagattrparam[WWW_CONF_MAX_URLLEN + 1]; unsigned char tagattrparamptr; - unsigned char lastchar, quotechar; + unsigned char quotechar; unsigned char majorstate, lastmajorstate; char linkurl[WWW_CONF_MAX_URLLEN + 1]; @@ -249,7 +249,7 @@ htmlparser_init(void) { s.majorstate = s.lastmajorstate = MAJORSTATE_DISCARD; s.minorstate = MINORSTATE_TEXT; - s.lastchar = 0; + s.wordlen = 0; #if WWW_CONF_FORMS s.formaction[0] = 0; #endif /* WWW_CONF_FORMS */ From e6903e4e7e0b3b037b95aa875d7e8f7ba7a1f365 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 5 Jun 2015 15:44:09 +0200 Subject: [PATCH 16/23] Recognize HTTPS. Although we for sure don't support HTTPS we need to recognize it. Nowadays it has become pretty usual to redirect HTTP URLs to HTTPS URLs in order to force privacy (thanks, NSA !). So far our redirection handler didn't recognize an HTTPS URL as abslute URLs and therefore appended it to the curent URL. This led to an endless redirection loop. Now we recognize the HTTPS redirection and generate a minimal document on the fly to inform the user of (for us unrachable) the redirection target. HTML links with HTTPS URLs are treated just like fragment-only links meaning that they get simply completely ignored. --- apps/webbrowser/http-strings | 2 ++ apps/webbrowser/http-strings.c | 6 ++++++ apps/webbrowser/http-strings.h | 2 ++ apps/webbrowser/webclient.c | 24 +++++++++++++++++------- apps/webbrowser/www.c | 3 ++- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/apps/webbrowser/http-strings b/apps/webbrowser/http-strings index 24ddb4f90..ff6a87545 100644 --- a/apps/webbrowser/http-strings +++ b/apps/webbrowser/http-strings @@ -1,4 +1,5 @@ http_http "http://" +http_https "https://" http_200 "200 " http_301 "301 " http_302 "302 " @@ -10,3 +11,4 @@ http_location "location: " http_host "Host: " http_crnl "\r\n" http_html ".html" +http_redirect "Redirect to " diff --git a/apps/webbrowser/http-strings.c b/apps/webbrowser/http-strings.c index aa4d45ece..72ce2c644 100644 --- a/apps/webbrowser/http-strings.c +++ b/apps/webbrowser/http-strings.c @@ -1,6 +1,9 @@ const char http_http[8] = /* "http://" */ {0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, }; +const char http_https[9] = +/* "https://" */ +{0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, }; const char http_200[5] = /* "200 " */ {0x32, 0x30, 0x30, 0x20, }; @@ -34,3 +37,6 @@ const char http_crnl[3] = const char http_html[6] = /* ".html" */ {0x2e, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_redirect[19] = +/* "Redirect to " */ +{0x3c, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x20, 0x74, 0x6f, 0x20, }; diff --git a/apps/webbrowser/http-strings.h b/apps/webbrowser/http-strings.h index 8b9bee66e..184dcf330 100644 --- a/apps/webbrowser/http-strings.h +++ b/apps/webbrowser/http-strings.h @@ -1,4 +1,5 @@ extern const char http_http[8]; +extern const char http_https[9]; extern const char http_200[5]; extern const char http_301[5]; extern const char http_302[5]; @@ -10,3 +11,4 @@ extern const char http_location[11]; extern const char http_host[7]; extern const char http_crnl[3]; extern const char http_html[6]; +extern const char http_redirect[19]; diff --git a/apps/webbrowser/webclient.c b/apps/webbrowser/webclient.c index 790085cd8..5d2ce0254 100644 --- a/apps/webbrowser/webclient.c +++ b/apps/webbrowser/webclient.c @@ -49,7 +49,7 @@ #define HTTPFLAG_NONE 0 #define HTTPFLAG_OK 1 #define HTTPFLAG_MOVED 2 -#define HTTPFLAG_ERROR 3 +#define HTTPFLAG_HTTPS 3 #define ISO_nl 0x0a @@ -359,8 +359,10 @@ parse_headers(uint16_t len) sizeof(http_location) - 1) == 0) { cptr = s.httpheaderline + sizeof(http_location) - 1; - - if(strncmp(cptr, http_http, 7) == 0) { + + if(strncmp(cptr, http_https, sizeof(http_https) - 1) == 0) { + s.httpflag = HTTPFLAG_HTTPS; + } else if(strncmp(cptr, http_http, 7) == 0) { cptr += 7; for(i = 0; i < s.httpheaderlineptr - 7; ++i) { if(*cptr == 0 || @@ -407,7 +409,7 @@ newdata(void) } if(len > 0 && s.state == WEBCLIENT_STATE_DATA && - s.httpflag != HTTPFLAG_MOVED) { + s.httpflag == HTTPFLAG_OK) { webclient_datahandler((char *)uip_appdata, len); } } @@ -445,7 +447,6 @@ webclient_appcall(void *state) return; } - /* The acked() and newdata() functions may alter the uip_appdata ptr, so we need to store it in the "dataptr" variable so that we can restore it before the senddata() function is called. */ @@ -478,10 +479,18 @@ webclient_appcall(void *state) if(uip_closed()) { tcp_markconn(uip_conn, NULL); - if(s.httpflag != HTTPFLAG_MOVED) { + switch(s.httpflag) { + case HTTPFLAG_HTTPS: + /* Send some info to the user. */ + webclient_datahandler((char *)http_redirect, sizeof(http_redirect) - 1); + webclient_datahandler(s.file, strlen(s.file)); + webclient_datahandler((char *)http_crnl, sizeof(http_crnl) - 1); + /* FALLTHROUGH */ + case HTTPFLAG_OK: /* Send NULL data to signal EOF. */ webclient_datahandler(NULL, 0); - } else { + break; + case HTTPFLAG_MOVED: /* conn = uip_connect(uip_conn->ripaddr, s.port); if(conn != NULL) { dispatcher_markconn(conn, NULL); @@ -493,6 +502,7 @@ webclient_appcall(void *state) } #endif /* UIP_UDP */ webclient_get(s.host, s.port, s.file); + break; } } } diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index d97c793e3..2722f842c 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -900,7 +900,8 @@ htmlparser_word(char *word, unsigned char wordlen) void htmlparser_link(char *text, unsigned char textlen, char *url) { - if(url[0] == ISO_hash) { + /* No link for https or fragment-only as we would't be able to handle it anyway. */ + if(url[0] == ISO_hash || strncmp(url, http_https, sizeof(http_https) - 1) == 0) { htmlparser_word(text, textlen); } else { add_pagewidget(text, textlen, url, CTK_WIDGET_HYPERLINK, 0); From f6b315a17f689e85fa1b6a376b4e230fdaf13be2 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 5 Jun 2015 15:10:21 +0200 Subject: [PATCH 17/23] Fixed history handling. - The wraparound handling when using the history with the 'back' button is actually depending on history_last being unsigned (which is the default for cc65) so define it explicitly as unsigned to make it work on other targets too. - As there's no 'forward' button it doesn't make sense to keep history entries after using them with the 'back' button. Clearing them on use on the other hand avoids an "infinite history". --- apps/webbrowser/www.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index 2722f842c..47900de51 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -125,7 +125,7 @@ static struct ctk_button wgetyesbutton = #if WWW_CONF_HISTORY_SIZE > 0 /* The char arrays that hold the history of visited URLs. */ static char history[WWW_CONF_HISTORY_SIZE][WWW_CONF_MAX_URLLEN]; -static char history_last; +static unsigned char history_last; #endif /* WWW_CONF_HISTORY_SIZE > 0 */ struct linkattrib { @@ -516,10 +516,12 @@ PROCESS_THREAD(www_process, ev, data) firsty = 0; start_loading(); --history_last; + /* Note: history_last is unsigned ! */ if(history_last > WWW_CONF_HISTORY_SIZE) { history_last = WWW_CONF_HISTORY_SIZE - 1; } memcpy(url, history[(int)history_last], WWW_CONF_MAX_URLLEN); + *history[(int)history_last] = 0; open_url(); CTK_WIDGET_FOCUS(&mainwindow, &backbutton); #endif /* WWW_CONF_HISTORY_SIZE > 0 */ From c5103bf99785779ee645067b145c671a60a8366f Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 5 Jun 2015 16:59:16 +0200 Subject: [PATCH 18/23] Removed some redundant redrawing. --- apps/webbrowser/www.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index 47900de51..c1475dcb0 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -382,7 +382,6 @@ open_url(void) } else { show_statustext("Connecting..."); } - redraw_window(); } /*-----------------------------------------------------------------------------------*/ /* set_link(link): @@ -678,8 +677,6 @@ webclient_connected(void) { start_loading(); - clear_page(); - show_statustext("Request sent..."); set_url(webclient_hostname(), webclient_port(), webclient_filename()); From 1d934db6549a8c103fe64e5b618cad3858cd07b2 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 5 Jun 2015 17:27:08 +0200 Subject: [PATCH 19/23] Reduce overlap on "scroll". When using the 'down' button on a certain number of lines curently displayed at the bottom of the screen is redisplayed at the top of the screen. Given our usually small screen size and often large pages requiring many 'down' operations the number 'four' seems too generous so lets reduce it to 'two'. --- apps/webbrowser/www.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index c1475dcb0..0aa433e85 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -525,7 +525,7 @@ PROCESS_THREAD(www_process, ev, data) CTK_WIDGET_FOCUS(&mainwindow, &backbutton); #endif /* WWW_CONF_HISTORY_SIZE > 0 */ } else if(w == (struct ctk_widget *)&downbutton) { - firsty = pagey + WWW_CONF_WEBPAGE_HEIGHT - 4; + firsty = pagey + WWW_CONF_WEBPAGE_HEIGHT - 2; start_loading(); open_url(); CTK_WIDGET_FOCUS(&mainwindow, &downbutton); From e8b4befd1ee7aa6a7816bc080c2483343d603347 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 7 Jun 2015 00:23:44 +0200 Subject: [PATCH 20/23] Further improved parsing of tag. --- apps/webbrowser/htmlparser.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c index 020fc513b..5e606d08e 100644 --- a/apps/webbrowser/htmlparser.c +++ b/apps/webbrowser/htmlparser.c @@ -367,6 +367,8 @@ parse_tag(void) static unsigned char size; tag = find_tag(s.tag); + /* If we are inside a . */ if(s.majorstate == MAJORSTATE_SCRIPT && tag != TAG_SLASHSCRIPT) { return; } @@ -562,6 +564,15 @@ parse_word(char *data, uint8_t dlen) } break; case MINORSTATE_TAG: + /* If we are inside a we mustn't mistake a JavaScript + equation with a '<' as a tag. So we check for the very next + character to be a '/' as we're only interested in parsing + the . */ + if(s.majorstate == MAJORSTATE_SCRIPT && data[0] != ISO_slash) { + s.minorstate = MINORSTATE_TEXT; + break; + } + /* We are currently parsing within the name of a tag. We check for the end of a tag (the '>' character) or whitespace (which indicates that we should parse a tag attr argument From 47bf797864c07bf2f64bfea5a7ec56d45445e83e Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 7 Jun 2015 00:29:29 +0200 Subject: [PATCH 21/23] Added support for form with multiple submit buttons. Forms with multiple submit buttons are rather rare but nevertheless the most popular web page (www.google.com) contains one with the two submit buttons "Google Search" and "I'm Feeling Lucky". So we want to support that - incl. the usual feature to the interpret first button as default button used when the user presses the ENTER key. --- apps/webbrowser/www.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index 0aa433e85..3e84c7cb9 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -196,7 +196,7 @@ PROCESS(www_process, "Web browser"); AUTOSTART_PROCESSES(&www_process); -static void CC_FASTCALL formsubmit(struct formattrib *form); +static void CC_FASTCALL formsubmit(struct inputattrib *trigger); /*-----------------------------------------------------------------------------------*/ /* make_window() @@ -564,9 +564,8 @@ PROCESS_THREAD(www_process, ev, data) #if WWW_CONF_FORMS } else { /* Assume form widget. */ - struct inputattrib *input = (struct inputattrib *) - (((char *)w) - offsetof(struct inputattrib, widget)); - formsubmit(input->formptr); + formsubmit((struct inputattrib *) + (((char *)w) - offsetof(struct inputattrib, widget))); #endif /* WWW_CONF_FORMS */ } } else if(ev == ctk_signal_hyperlink_activate) { @@ -964,23 +963,36 @@ add_query(char delimiter, char *string) } /*-----------------------------------------------------------------------------------*/ static void CC_FASTCALL -formsubmit(struct formattrib *form) +formsubmit(struct inputattrib *trigger) { - struct inputattrib *inputptr; + struct inputattrib *input; + struct formattrib *form = trigger->formptr; char delimiter = ISO_questionmark; set_link(form->action); - for(inputptr = form->nextptr; inputptr != NULL; inputptr = inputptr->nextptr) { + /* No button pressed so prepare to look for default button. */ + if(trigger->widget.type == CTK_WIDGET_TEXTENTRY) { + trigger = NULL; + } + + for(input = form->nextptr; input != NULL; input = input->nextptr) { char *name; char *value; - if(inputptr->widget.type == CTK_WIDGET_BUTTON) { - name = ((struct submitattrib *)inputptr)->name; - value = ((struct submitattrib *)inputptr)->button.text; + if(input->widget.type == CTK_WIDGET_TEXTENTRY) { + name = ((struct textattrib *)input)->name; + value = ((struct textattrib *)input)->textentry.text; } else { - name = ((struct textattrib *)inputptr)->name; - value = ((struct textattrib *)inputptr)->textentry.text; + /* Consider first button as default button. */ + if(trigger == NULL) { + trigger = input; + } + if(input != trigger) { + continue; + } + name = ((struct submitattrib *)input)->name; + value = ((struct submitattrib *)input)->button.text; } add_query(delimiter, name); From 3e33a4d3553c652bd73e9e601de1b21d2dc57bd4 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 8 Jun 2015 14:29:34 +0200 Subject: [PATCH 22/23] Made server variant of HTTP strings a superset of the client variant again. --- apps/webserver/http-strings | 3 ++- apps/webserver/http-strings.c | 6 ++++++ apps/webserver/http-strings.h | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/webserver/http-strings b/apps/webserver/http-strings index 4178cae2f..07d4eac8c 100644 --- a/apps/webserver/http-strings +++ b/apps/webserver/http-strings @@ -1,4 +1,5 @@ http_http "http://" +http_https "https://" http_200 "200 " http_301 "301 " http_302 "302 " @@ -32,4 +33,4 @@ http_gif ".gif" http_jpg ".jpg" http_text ".text" http_txt ".txt" - +http_redirect "Redirect to " diff --git a/apps/webserver/http-strings.c b/apps/webserver/http-strings.c index f1c55e621..40667d24c 100644 --- a/apps/webserver/http-strings.c +++ b/apps/webserver/http-strings.c @@ -1,6 +1,9 @@ const char http_http[8] = /* "http://" */ {0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, }; +const char http_https[9] = +/* "https://" */ +{0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, }; const char http_200[5] = /* "200 " */ {0x32, 0x30, 0x30, 0x20, }; @@ -100,3 +103,6 @@ const char http_text[6] = const char http_txt[5] = /* ".txt" */ {0x2e, 0x74, 0x78, 0x74, }; +const char http_redirect[19] = +/* "Redirect to " */ +{0x3c, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x20, 0x74, 0x6f, 0x20, }; diff --git a/apps/webserver/http-strings.h b/apps/webserver/http-strings.h index 01fc8cd9d..58ae13be8 100644 --- a/apps/webserver/http-strings.h +++ b/apps/webserver/http-strings.h @@ -1,4 +1,5 @@ extern const char http_http[8]; +extern const char http_https[9]; extern const char http_200[5]; extern const char http_301[5]; extern const char http_302[5]; @@ -32,3 +33,4 @@ extern const char http_gif[5]; extern const char http_jpg[5]; extern const char http_text[6]; extern const char http_txt[5]; +extern const char http_redirect[19]; From adc744ef30260ed2be0682d7905173090389e2d4 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 14 Jun 2015 15:24:38 +0200 Subject: [PATCH 23/23] Avoid compiler warning because of unused variable. (reverted from commit a9c6d59da312b08b429d9469de0c32f6635c7cc4) --- core/net/ip/uip-nameserver.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/net/ip/uip-nameserver.c b/core/net/ip/uip-nameserver.c index 3a3933be9..6ced6b91e 100644 --- a/core/net/ip/uip-nameserver.c +++ b/core/net/ip/uip-nameserver.c @@ -57,9 +57,7 @@ typedef struct uip_nameserver_record { } uip_nameserver_record; /** \brief Initialization flag */ -#if UIP_NAMESERVER_POOL_SIZE > 1 static uint8_t initialized = 0; -#endif /** \name List and memory block * @{