bugGNU Wget - Bugs: bug #20327, Add SFTP support


bug #20327: Add SFTP support

Submitted by:  Micah Cowan <micahcowan>
Submitted on:  Tue 03 Jul 2007 07:40:33 AM UTC  
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalStatus: Confirmed
Privacy: PublicAssigned to: Micah Cowan <micahcowan>
Originator Name: Open/Closed: Open
Release: NoneOperating System: None
Reproducibility: NoneFixed Release: None
Planned Release: 2.0Regression: None
Work Required: NonePatch Included: None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Sat 31 May 2008 08:30:35 PM UTC, comment #7:

I would rather suggest you base SFTP code on an existing library, such as the libssh2.

Or possibly even consider switching entirely to libcurl (which already supports SFTP based on libssh2)...

(Yeah, as libcurl author and libssh2 project contributor I'm very biased to both the above libs)

Daniel Stenberg <bagder>
Sat 31 May 2008 07:39:42 PM UTC, comment #6:

[rakesh@rocky sftp]# ./a.out rakesh@ /home/rakesh/Desktop/new/Fedora-9-i386-DVD/Fedora-9-i386-DVD.iso
rakesh@'s password:
write: nread(4096) != nwrite(4294967295)
write: nread(4096) != nwrite(4294967295)
write: nread(4096) != nwrite(4294967295)
write: nread(4096) != nwrite(4294967295)
write: nread(4096) != nwrite(4294967295)
write: nread(4096) != nwrite(4294967295)

It breaks after 1.3 GB copied

Total size 3.4 GB

Rakesh Pandit <rakeshpandit>
Sat 31 May 2008 05:42:10 AM UTC, comment #5:

That sounds reasonable. Till then I will focus on hardening my prototype into something more mature.

Debarshi Ray <debarshiray>
Fri 30 May 2008 06:48:17 PM UTC, comment #4:

FYI, Debarshi,

I suspect that you'll find your chief difficulty to be actually rolling the code into Wget itself, whose code isn't currently flexible enough to make such a change easily.

In particular, the http_loop and ftp_loop functions, both of which are responsible to retry the download until it succeeds (or fails hard), share a lot of logic, and need to be refactored (something I'm hoping to tackle soon). Rather than roll yet another sftp_loop function, it'll probably be a little easier to wait until I can refactor it into a single url_loop function.

Micah Cowan <micahcowan>In charge of this item.
Fri 30 May 2008 05:29:22 PM UTC, comment #3:

I just tested in my LAN first :

[rpmbuild@rocky sftp]$ ./a.out rakesh@ /home/rakesh/Desktop/new/Fedora-9-i386-DVD/Fedora-9-i386-DVD.iso
rakesh@'s password:
SSH_FXP_READ: wrong request id (0) != 3
[rpmbuild@rocky sftp]$

Am I using the arguments correctly as expected?

Rakesh Pandit <rakeshpandit>
Fri 30 May 2008 02:53:46 PM UTC, comment #2:

I have a simple non-interactive SFTP downloader ready now. Even though it is not the latest, I followed draft-ietf-secsh-filexfer-02, which describes version 3 of the protocol, because that is what openssh-5.0p1 and GNOME's Gvfs are also implementing.

To use the prototype:
$ tar -xzf sftp.tar.gz
$ cd sftp
$ gcc sftp.c buffer.c utility.c
$ ./a.out <hostname> <remotefilepath>

(file #15769)

Debarshi Ray <debarshiray>
Wed 28 May 2008 08:32:32 PM UTC, comment #1:

rishi from IRC [(n=rishi@gnu-india/supporter/debarshi): Debarshi Ray] has been working on something for this.

Micah Cowan <micahcowan>In charge of this item.
Tue 03 Jul 2007 07:40:33 AM UTC, original submission:
Micah Cowan <micahcowan>In charge of this item.


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #15772:  sftp.tar.gz added by debarshiray (4KiB - application/x-gzip - Updated prototype (fixed bug while fetching bigger files))
file #15769:  sftp.tar.gz added by debarshiray (4KiB - application/x-gzip - Prototype non-interactive SFTP downloader)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by bagder (Posted a comment)
  • -unavailable- added by rakeshpandit (Posted a comment)
  • -unavailable- added by debarshiray (Updated the item)
  • -unavailable- added by micahcowan (Submitted the item)

    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 31 May 2008 01:36:10 PM UTCdebarshirayAttached File-=>Added sftp.tar.gz, #15772
    Fri 30 May 2008 02:53:46 PM UTCdebarshirayAttached File-=>Added sftp.tar.gz, #15769
    Wed 28 May 2008 08:32:32 PM UTCmicahcowanAssigned toNone=>micahcowan
    Sun 27 Jan 2008 10:28:38 AM UTCmicahcowanPlanned Release1.15=>2.0
    Fri 20 Jul 2007 02:00:41 AM UTCmicahcowanPlanned ReleaseNone=>1.15

    Back to the top

    Powered by Savane 3.1-cleanup1