diff --git a/apps/webbrowser/html-strings b/apps/webbrowser/html-strings index e3c43c93b..5e10d41d4 100644 --- a/apps/webbrowser/html-strings +++ b/apps/webbrowser/html-strings @@ -1,5 +1,6 @@ html_slasha "/a\0" html_slashcenter "/center\0" +html_slashdiv "/div\0" html_slashform "/form\0" html_slashh "/h\0" html_slashscript "/script\0" diff --git a/apps/webbrowser/html-strings.c b/apps/webbrowser/html-strings.c index 6292280e6..cb4b05629 100644 --- a/apps/webbrowser/html-strings.c +++ b/apps/webbrowser/html-strings.c @@ -4,6 +4,9 @@ const char html_slasha[4] = const char html_slashcenter[9] = /* "/center\0" */ {0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 00, }; +const char html_slashdiv[6] = +/* "/div\0" */ +{0x2f, 0x64, 0x69, 0x76, 00, }; const char html_slashform[7] = /* "/form\0" */ {0x2f, 0x66, 0x6f, 0x72, 0x6d, 00, }; diff --git a/apps/webbrowser/html-strings.h b/apps/webbrowser/html-strings.h index 21c6c129d..b10a78c59 100644 --- a/apps/webbrowser/html-strings.h +++ b/apps/webbrowser/html-strings.h @@ -1,5 +1,6 @@ extern const char html_slasha[4]; extern const char html_slashcenter[9]; +extern const char html_slashdiv[6]; extern const char html_slashform[7]; extern const char html_slashh[4]; extern const char html_slashscript[9]; diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c index c33640191..79e2724c6 100644 --- a/apps/webbrowser/htmlparser.c +++ b/apps/webbrowser/htmlparser.c @@ -179,53 +179,55 @@ static const char *tags[] = { html_slasha, #define TAG_SLASHCENTER 1 html_slashcenter, -#define TAG_SLASHFORM 2 +#define TAG_SLASHDIV 2 + html_slashdiv, +#define TAG_SLASHFORM 3 html_slashform, -#define TAG_SLASHH 3 +#define TAG_SLASHH 4 html_slashh, -#define TAG_SLASHSCRIPT 4 +#define TAG_SLASHSCRIPT 5 html_slashscript, -#define TAG_SLASHSELECT 5 +#define TAG_SLASHSELECT 6 html_slashselect, -#define TAG_SLASHSTYLE 6 +#define TAG_SLASHSTYLE 7 html_slashstyle, -#define TAG_A 7 +#define TAG_A 8 html_a, -#define TAG_BODY 8 +#define TAG_BODY 9 html_body, -#define TAG_BR 9 +#define TAG_BR 10 html_br, -#define TAG_CENTER 10 +#define TAG_CENTER 11 html_center, -#define TAG_FORM 11 +#define TAG_FORM 12 html_form, -#define TAG_FRAME 12 +#define TAG_FRAME 13 html_frame, -#define TAG_H1 13 +#define TAG_H1 14 html_h1, -#define TAG_H2 14 +#define TAG_H2 15 html_h2, -#define TAG_H3 15 +#define TAG_H3 16 html_h3, -#define TAG_H4 16 +#define TAG_H4 17 html_h4, -#define TAG_IMG 17 +#define TAG_IMG 18 html_img, -#define TAG_INPUT 18 +#define TAG_INPUT 19 html_input, -#define TAG_LI 19 +#define TAG_LI 20 html_li, -#define TAG_P 20 +#define TAG_P 21 html_p, -#define TAG_SCRIPT 21 +#define TAG_SCRIPT 22 html_script, -#define TAG_SELECT 22 +#define TAG_SELECT 23 html_select, -#define TAG_STYLE 23 +#define TAG_STYLE 24 html_style, -#define TAG_TR 24 +#define TAG_TR 25 html_tr, -#define TAG_LAST 25 +#define TAG_LAST 26 last, }; @@ -239,12 +241,25 @@ iswhitespace(char c) c == ISO_ht); } /*-----------------------------------------------------------------------------------*/ +#if WWW_CONF_FORMS +static void +init_input(void) +{ + s.inputtype = HTMLPARSER_INPUTTYPE_NONE; + s.inputname[0] = s.inputvalue[0] = 0; + s.inputvaluesize = 20; /* De facto default size */ +} +#endif /* WWW_CONF_FORMS */ +/*-----------------------------------------------------------------------------------*/ void htmlparser_init(void) { s.majorstate = s.lastmajorstate = MAJORSTATE_DISCARD; s.minorstate = MINORSTATE_TEXT; s.lastchar = 0; +#if WWW_CONF_FORMS + s.formaction[0] = s.formname[0] = 0; +#endif /* WWW_CONF_FORMS */ } /*-----------------------------------------------------------------------------------*/ static char CC_FASTCALL @@ -325,7 +340,7 @@ find_tag(char *tag) do { tagc = tag[i]; - if(tagc == 0 && + if((tagc == 0 || tagc == ISO_slash) && tags[first][i] == 0) { return first; } @@ -376,6 +391,7 @@ parse_tag(void) /* FALLTHROUGH */ case TAG_BR: case TAG_TR: + case TAG_SLASHDIV: case TAG_SLASHH: /* parse_char(ISO_nl);*/ dummy = 0; @@ -457,7 +473,7 @@ parse_tag(void) PRINTF(("Form name '%s'\n", s.tagattrparam)); strncpy(s.formname, s.tagattrparam, WWW_CONF_MAX_FORMNAMELEN - 1); } - s.inputname[0] = s.inputvalue[0] = 0; + init_input(); break; case TAG_SLASHFORM: switch_majorstate(MAJORSTATE_BODY); @@ -483,7 +499,7 @@ parse_tag(void) s.formname, s.formaction); break; } - s.inputtype = HTMLPARSER_INPUTTYPE_NONE; + init_input(); } else { PRINTF(("Input '%s' '%s'\n", s.tagattr, s.tagattrparam)); if(strncmp(s.tagattr, html_type, sizeof(html_type)) == 0) { 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 279f882bc..06726e90a 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -325,7 +325,7 @@ open_url(void) /* The hostname we present in the hostname table, so we send out the initial GET request. */ if(webclient_get(host, 80, file) == 0) { - show_statustext("Out of memory error."); + show_statustext("Out of memory error"); } else { show_statustext("Connecting..."); } @@ -534,7 +534,7 @@ PROCESS_THREAD(www_process, ev, data) resolv_lookup((char *)data) != NULL) { open_url(); } else { - show_statustext("Host not found."); + show_statustext("Host not found"); } #endif /* UIP_UDP */ } else if(ev == ctk_signal_window_close || @@ -602,7 +602,7 @@ webclient_timedout(void) void webclient_closed(void) { - show_statustext("Stopped."); + show_statustext("Stopped"); petsciiconv_topetscii(webpageptr - x, x); CTK_WIDGET_FOCUS(&mainwindow, &downbutton); redraw_window(); @@ -638,12 +638,13 @@ 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); redraw_window(); } else { + show_statustext("Cannot display web page"); uip_abort(); #if WWW_CONF_WITH_WGET ctk_dialog_open(&wgetdialog); @@ -656,7 +657,7 @@ webclient_datahandler(char *data, uint16_t len) if(data == NULL) { loading = 0; - show_statustext("Done."); + show_statustext("Done"); petsciiconv_topetscii(webpageptr - x, x); CTK_WIDGET_FOCUS(&mainwindow, &urlentry); redraw_window(); 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]; diff --git a/core/net/tcpip.c b/core/net/tcpip.c index 4b178a1db..fc6db0ad2 100644 --- a/core/net/tcpip.c +++ b/core/net/tcpip.c @@ -284,7 +284,7 @@ void tcp_attach(struct uip_conn *conn, void *appstate) { - register uip_tcp_appstate_t *s; + uip_tcp_appstate_t *s; s = &conn->appstate; s->p = PROCESS_CURRENT(); @@ -298,7 +298,7 @@ void udp_attach(struct uip_udp_conn *conn, void *appstate) { - register uip_udp_appstate_t *s; + uip_udp_appstate_t *s; s = &conn->appstate; s->p = PROCESS_CURRENT(); @@ -394,7 +394,7 @@ eventhandler(process_event_t ev, process_data_t data) } { - register struct uip_conn *cptr; + struct uip_conn *cptr; for(cptr = &uip_conns[0]; cptr < &uip_conns[UIP_CONNS]; ++cptr) { if(cptr->appstate.p == p) { @@ -406,7 +406,7 @@ eventhandler(process_event_t ev, process_data_t data) #endif /* UIP_TCP */ #if UIP_UDP { - register struct uip_udp_conn *cptr; + struct uip_udp_conn *cptr; for(cptr = &uip_udp_conns[0]; cptr < &uip_udp_conns[UIP_UDP_CONNS]; ++cptr) { @@ -697,7 +697,7 @@ tcpip_poll_tcp(struct uip_conn *conn) void tcpip_uipcall(void) { - register uip_udp_appstate_t *ts; + uip_udp_appstate_t *ts; #if UIP_UDP if(uip_conn != NULL) { @@ -712,7 +712,7 @@ tcpip_uipcall(void) #if UIP_TCP { static unsigned char i; - register struct listenport *l; + struct listenport *l; /* If this is a connection request for a listening port, we must mark the connection with the right process ID. */