summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorMichael Brown2007-01-15 10:58:26 +0100
committerMichael Brown2007-01-15 10:58:26 +0100
commitdf0397f33469f9e3ed1d54cedd5fe6282881e3fc (patch)
tree91bef77876d4799fcd0cdaa260fb11805a72baa6 /src/usr
parentProtocol's get() method no longer takes ownership of the URI. HTTP is the (diff)
downloadipxe-df0397f33469f9e3ed1d54cedd5fe6282881e3fc.tar.gz
ipxe-df0397f33469f9e3ed1d54cedd5fe6282881e3fc.tar.xz
ipxe-df0397f33469f9e3ed1d54cedd5fe6282881e3fc.zip
Update TFTP and FTP to take the same temporary URI scheme as HTTP
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/fetch.c21
1 files changed, 12 insertions, 9 deletions
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 <gpxe/dhcp.h>
#include <gpxe/tftp.h>
#include <gpxe/http.h>
+#include <gpxe/ftp.h>
/**
* 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 )