diff options
| author | Michael Brown | 2007-01-15 09:49:10 +0100 |
|---|---|---|
| committer | Michael Brown | 2007-01-15 09:49:10 +0100 |
| commit | 4e20d73bb52326261f8cf49c20d6de2edea309ee (patch) | |
| tree | 3d24466a78c4c8f53294384b76e62e871eb96def /src/tests/ftptest.c | |
| parent | Add missing include (diff) | |
| download | ipxe-4e20d73bb52326261f8cf49c20d6de2edea309ee.tar.gz ipxe-4e20d73bb52326261f8cf49c20d6de2edea309ee.tar.xz ipxe-4e20d73bb52326261f8cf49c20d6de2edea309ee.zip | |
Gave asynchronous operations approximate POSIX signal semantics. This
will enable us to cascade async operations, which is necessary in order to
properly support DNS. (For example, an HTTP request may have to redirect
to a new location and will have to perform a new DNS lookup, so we can't
just rely on doing the name lookup at the time of parsing the initial
URL).
Anything other than HTTP is probably broken right now; I'll fix the others
up asap.
Diffstat (limited to 'src/tests/ftptest.c')
| -rw-r--r-- | src/tests/ftptest.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/tests/ftptest.c b/src/tests/ftptest.c deleted file mode 100644 index fe08ec522..000000000 --- a/src/tests/ftptest.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <stdint.h> -#include <string.h> -#include <byteswap.h> -#include <console.h> -#include <vsprintf.h> -#include <gpxe/async.h> -#include <gpxe/buffer.h> -#include <gpxe/ftp.h> - -static void print_ftp_response ( char *data, size_t len ) { - unsigned int i; - char c; - - for ( i = 0 ; i < len ; i++ ) { - c = data[i]; - if ( c == '\r' ) { - /* Print nothing */ - } else if ( ( c == '\n' ) || ( c >= 32 ) || ( c <= 126 ) ) { - putchar ( c ); - } else { - putchar ( '.' ); - } - } -} - -void test_ftp ( struct sockaddr_tcpip *server, const char *filename ) { - char data[256]; - struct buffer buffer; - struct ftp_request ftp; - int rc; - - printf ( "FTP fetching %s\n", filename ); - - memset ( &buffer, 0, sizeof ( buffer ) ); - buffer.addr = virt_to_user ( data ); - buffer.len = sizeof ( data ); - - memset ( &ftp, 0, sizeof ( ftp ) ); - memcpy ( &ftp.server, server, sizeof ( ftp.server ) ); - ftp.filename = filename; - ftp.buffer = &buffer; - - rc = async_wait ( ftp_get ( &ftp ) ); - if ( rc ) { - printf ( "FTP fetch failed\n" ); - return; - } - - printf ( "FTP received %d bytes\n", buffer.fill ); - - print_ftp_response ( data, buffer.fill ); -} |
