Allow to build the web browser without DNS support - like i.e. the email client and the IRC client.
This commit is contained in:
parent
72f42bffd3
commit
dbfa1efdcf
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the "contiki" web browser.
|
* 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. */
|
/* First check if the host is an IP address. */
|
||||||
ipaddr = &addr[0];
|
ipaddr = &addr[0];
|
||||||
|
#if UIP_UDP
|
||||||
if(uiplib_ipaddrconv(host, (unsigned char *)addr) == 0) {
|
if(uiplib_ipaddrconv(host, (unsigned char *)addr) == 0) {
|
||||||
ipaddr = resolv_lookup(host);
|
ipaddr = resolv_lookup(host);
|
||||||
|
|
||||||
|
@ -146,6 +147,9 @@ webclient_get(char *host, u16_t port, char *file)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else /* UIP_UDP */
|
||||||
|
uiplib_ipaddrconv(host, (unsigned char *)addr);
|
||||||
|
#endif /* UIP_UDP */
|
||||||
|
|
||||||
conn = tcp_connect((uip_ipaddr_t *)ipaddr, htons(port), NULL);
|
conn = tcp_connect((uip_ipaddr_t *)ipaddr, htons(port), NULL);
|
||||||
|
|
||||||
|
@ -482,9 +486,11 @@ webclient_appcall(void *state)
|
||||||
dispatcher_markconn(conn, NULL);
|
dispatcher_markconn(conn, NULL);
|
||||||
init_connection();
|
init_connection();
|
||||||
}*/
|
}*/
|
||||||
|
#if UIP_UDP
|
||||||
if(resolv_lookup(s.host) == NULL) {
|
if(resolv_lookup(s.host) == NULL) {
|
||||||
resolv_query(s.host);
|
resolv_query(s.host);
|
||||||
}
|
}
|
||||||
|
#endif /* UIP_UDP */
|
||||||
webclient_get(s.host, s.port, s.file);
|
webclient_get(s.host, s.port, s.file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki desktop environment
|
* 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 = "/";
|
file = "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UIP_UDP
|
||||||
/* Try to lookup the hostname. If it fails, we initiate a hostname
|
/* Try to lookup the hostname. If it fails, we initiate a hostname
|
||||||
lookup and print out an informative message on the statusbar. */
|
lookup and print out an informative message on the statusbar. */
|
||||||
if(uiplib_ipaddrconv(host, (unsigned char *)addr) == 0) {
|
if(uiplib_ipaddrconv(host, (unsigned char *)addr) == 0) {
|
||||||
|
@ -310,6 +311,9 @@ open_url(void)
|
||||||
return;
|
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
|
/* The hostname we present in the hostname table, so we send out the
|
||||||
initial GET request. */
|
initial GET request. */
|
||||||
|
@ -510,6 +514,7 @@ PROCESS_THREAD(www_process, ev, data)
|
||||||
petsciiconv_topetscii(statustexturl, sizeof(statustexturl));
|
petsciiconv_topetscii(statustexturl, sizeof(statustexturl));
|
||||||
show_statustext(statustexturl);
|
show_statustext(statustexturl);
|
||||||
}
|
}
|
||||||
|
#if UIP_UDP
|
||||||
} else if(ev == resolv_event_found) {
|
} else if(ev == resolv_event_found) {
|
||||||
/* Either found a hostname, or not. */
|
/* Either found a hostname, or not. */
|
||||||
if((char *)data != NULL &&
|
if((char *)data != NULL &&
|
||||||
|
@ -518,6 +523,7 @@ PROCESS_THREAD(www_process, ev, data)
|
||||||
} else {
|
} else {
|
||||||
show_statustext("Host not found.");
|
show_statustext("Host not found.");
|
||||||
}
|
}
|
||||||
|
#endif /* UIP_UDP */
|
||||||
} else if(ev == ctk_signal_window_close ||
|
} else if(ev == ctk_signal_window_close ||
|
||||||
ev == PROCESS_EVENT_EXIT) {
|
ev == PROCESS_EVENT_EXIT) {
|
||||||
quit();
|
quit();
|
||||||
|
|
Loading…
Reference in a new issue