diff -aur gimp-2.6.11/plug-ins/file-uri/uri-backend-wget.c gimp-2.6.11.patched/plug-ins/file-uri/uri-backend-wget.c --- gimp-2.6.11/plug-ins/file-uri/uri-backend-wget.c 2010-07-03 00:51:59.000000000 +0200 +++ gimp-2.6.11.patched/plug-ins/file-uri/uri-backend-wget.c 2011-06-21 12:50:13.000000000 +0200 @@ -122,7 +122,7 @@ g_snprintf (timeout_str, sizeof (timeout_str), "%d", TIMEOUT); execlp ("wget", - "wget", "-v", "-e", "server-response=off", "-T", timeout_str, + "wget", "-v", "-e", "server-response=off", "--progress=dot", "-T", timeout_str, uri, "-O", tmpname, NULL); _exit (127); } @@ -131,6 +131,7 @@ FILE *input; gchar buf[BUFSIZE]; gboolean seen_resolve = FALSE; + gboolean seen_ftp = FALSE; gboolean connected = FALSE; gboolean redirect = FALSE; gboolean file_found = FALSE; @@ -182,6 +183,11 @@ _("wget exited abnormally on URI '%s'"), uri); return FALSE; } + /* with and ftp url wget have a "=> `filename.foo" */ + else if ( !seen_ftp && strstr (buf, "=> `")) + { + seen_ftp = TRUE; + } DEBUG (buf); @@ -233,6 +239,16 @@ return FALSE; } + /* on successful ftp login wget print a Logged in message */ + else if ( seen_ftp && !strstr(buf, "Logged in!")) + { + g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, + _("A network error occurred: %s"), buf); + + DEBUG (buf); + + return FALSE; + } else if (strstr (buf, "302 Found")) { DEBUG (buf); @@ -246,6 +262,37 @@ DEBUG (buf); + /* for an ftp session wget have extra output*/ + ftp_session: + if (seen_ftp) + { + if (fgets (buf, sizeof (buf), input) == NULL) + { + g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, + _("A network error occurred: %s"), buf); + + DEBUG (buf); + + return FALSE; + } + /* if there is no size output file do not exist on server */ + else if (strstr (buf, "==> SIZE") && strstr (buf, "... done")) + { + g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, + _("wget exited abnormally on URI '%s'"), uri); + + DEBUG (buf); + + return FALSE; + } + /* while no PASV line we eat other messages */ + else if (!strstr (buf, "==> PASV")) + { + DEBUG (buf); + goto ftp_session; + } + } + /* The fifth line is either the length of the file or an error */ if (fgets (buf, sizeof (buf), input) == NULL) { @@ -296,6 +343,18 @@ size = 0; } + /* on http sessions wget have Saving to: ...*/ + if (!seen_ftp) + { + if (fgets (buf, sizeof (buf), input) == NULL) + { + g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, + _("wget exited abnormally on URI '%s'"), uri); + + return FALSE; + } + } + /* Start the actual download... */ if (size > 0) {