From df0397f33469f9e3ed1d54cedd5fe6282881e3fc Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 15 Jan 2007 09:58:26 +0000 Subject: Update TFTP and FTP to take the same temporary URI scheme as HTTP --- src/usr/fetch.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/usr') diff --git a/src/usr/fetch.c b/src/usr/fetch.c index 71304bb21..45031049c 100644 --- a/src/usr/fetch.c +++ b/src/usr/fetch.c @@ -35,6 +35,7 @@ #include #include #include +#include /** * Fetch file @@ -73,15 +74,17 @@ int fetch ( const char *uri_string, userptr_t *data, size_t *len ) { int ( * download ) ( struct uri *uri, struct buffer *buffer, struct async *parent ); -#if 0 - server.sin.sin_port = htons ( TFTP_PORT ); - udp_connect ( &tftp.udp, &server.st ); - tftp.filename = filename; - tftp.buffer = &buffer; - aop = tftp_get ( &tftp ); -#else - download = http_get; -#endif + if ( ! uri->scheme ) { + download = tftp_get; + } else { + if ( strcmp ( uri->scheme, "http" ) == 0 ) { + download = http_get; + } else if ( strcmp ( uri->scheme, "ftp" ) == 0 ) { + download = ftp_get; + } else { + download = tftp_get; + } + } async_init_orphan ( &async ); if ( ( rc = download ( uri, &buffer, &async ) ) != 0 ) -- cgit v1.2.3-55-g7522