Allow to build the web browser without DNS support - like i.e. the email client and the IRC client.

This commit is contained in:
oliverschmidt 2010-02-01 19:44:30 +00:00
parent 72f42bffd3
commit dbfa1efdcf
2 changed files with 14 additions and 2 deletions

View file

@ -29,7 +29,7 @@
*
* This file is part of the "contiki" web browser.
*
* $Id: webclient.c,v 1.7 2008/11/10 21:57:26 oliverschmidt Exp $
* $Id: webclient.c,v 1.8 2010/02/01 19:44:30 oliverschmidt Exp $
*
*/
@ -139,6 +139,7 @@ webclient_get(char *host, u16_t port, char *file)
/* First check if the host is an IP address. */
ipaddr = &addr[0];
#if UIP_UDP
if(uiplib_ipaddrconv(host, (unsigned char *)addr) == 0) {
ipaddr = resolv_lookup(host);
@ -146,6 +147,9 @@ webclient_get(char *host, u16_t port, char *file)
return 0;
}
}
#else /* UIP_UDP */
uiplib_ipaddrconv(host, (unsigned char *)addr);
#endif /* UIP_UDP */
conn = tcp_connect((uip_ipaddr_t *)ipaddr, htons(port), NULL);
@ -482,9 +486,11 @@ webclient_appcall(void *state)
dispatcher_markconn(conn, NULL);
init_connection();
}*/
#if UIP_UDP
if(resolv_lookup(s.host) == NULL) {
resolv_query(s.host);
}
#endif /* UIP_UDP */
webclient_get(s.host, s.port, s.file);
}
}

View file

@ -29,7 +29,7 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: www.c,v 1.10 2009/02/25 08:52:27 adamdunkels Exp $
* $Id: www.c,v 1.11 2010/02/01 19:44:30 oliverschmidt Exp $
*
*/
@ -301,6 +301,7 @@ open_url(void)
file = "/";
}
#if UIP_UDP
/* Try to lookup the hostname. If it fails, we initiate a hostname
lookup and print out an informative message on the statusbar. */
if(uiplib_ipaddrconv(host, (unsigned char *)addr) == 0) {
@ -310,6 +311,9 @@ open_url(void)
return;
}
}
#else /* UIP_UDP */
uiplib_ipaddrconv(host, (unsigned char *)addr);
#endif /* UIP_UDP */
/* The hostname we present in the hostname table, so we send out the
initial GET request. */
@ -510,6 +514,7 @@ PROCESS_THREAD(www_process, ev, data)
petsciiconv_topetscii(statustexturl, sizeof(statustexturl));
show_statustext(statustexturl);
}
#if UIP_UDP
} else if(ev == resolv_event_found) {
/* Either found a hostname, or not. */
if((char *)data != NULL &&
@ -518,6 +523,7 @@ PROCESS_THREAD(www_process, ev, data)
} else {
show_statustext("Host not found.");
}
#endif /* UIP_UDP */
} else if(ev == ctk_signal_window_close ||
ev == PROCESS_EVENT_EXIT) {
quit();