Package: dupload
Version: 2.6.6
Severity: wishlist
Tags: patch
hello Josip Rodin.
i'm want to contribute to 'dupload' adding support to http proxy server when
upload
files with ftp method. i must to use a http proxy server in order to reach
http/ftp
servers and for that reason i would like to use 'dupload' with that feature.
i made this code against 'dupload 2.6.6' .. hope you can add to future releases.
[dupload_ftp_proxy_support-2.6.6.diff]
22a23,24
> use LWP::UserAgent;
> use HTTP::Request::Common;
58a61
> $ftp_proxy,
77a81
> sub pftp_upload($$$); # put the file to ftp site using a proxy
148a153
> $ftp_proxy = $ENV{ftp_proxy};
229,231c234,242
< p("Uploading ($method) to $fqdn:$incoming");
< p("and moving to $fqdn:$queuedir") if $queuedir;
< p("\n");
---
> if (($method eq "ftp") && ($ftp_proxy)) {
> p("Uploading ($method) to $fqdn:$incoming") if (!$queuedir);
> p("Uploading ($method) to $fqdn:$queuedir") if ($queuedir);
> p(" throught ($ftp_proxy)\n");
> } else {
> p("Uploading ($method) to $fqdn:$incoming");
> p(" and moving to $fqdn:$queuedir") if $queuedir;
> p("\n");
> }
506,509c517,518
< p "Uploading (ftp) to $host ($fqdn)\n";
< if (!$dry) {
< ftp_open($fqdn, $login, $passwd);
< $server->cwd($incoming);
---
> if ($ftp_proxy) {
> p "Uploading (ftp) to $host ($fqdn) throught ($ftp_proxy)\n";
511,512c520,527
< p "+ ftp_open($fqdn, $login, $passwd)\n";
< p "+ ftp::cwd($incoming\n";
---
> p "Uploading (ftp) to $host ($fqdn)\n";
> if (!$dry) {
> ftp_open($fqdn, $login, $passwd);
> $server->cwd($incoming);
> } else {
> p "+ ftp_open($fqdn, $login, $passwd)\n";
> p "+ ftp::cwd($incoming\n";
> }
555,558c570,579
< unless ($server->put($file, $file)) {
< $result = $server->message();
< $server->delete($file) ;
< fatal("Can't upload $file: $result");
---
> if ($ftp_proxy) {
> if (!$queuedir) {
> pftp_upload($fqdn, $incoming,
> $file);
> }
> } else {
> unless ($server->put($file, $file)) {
> $result = $server->message();
> $server->delete($file) ;
> fatal("Can't upload $file:
> $result");
> }
559a581
> # calculate time of ftp or pftp (proxied ftp)
> upload
604c626
< p", renaming";
---
> p", renaming" if (!$ftp_proxy);
607,610c629,635
< $server->rename($file, $queuedir .
$file)
< or
< $result=$server->message(),
< $server->delete($file),
---
> if ($ftp_proxy) {
> pftp_upload($fqdn, $queuedir,
> $file);
> } else {
> $server->rename($file,
> $queuedir . $file)
> or
>
> $result=$server->message(),
> $server->delete($file),
611a637
> }
714c740
< if ($method eq "ftp") {
---
> if (($method eq "ftp") && (!$ftp_proxy)) {
880a907,923
> ### put the file to ftp site using a proxy
> sub pftp_upload($$$) {
> my ($ftp_fqdn, $ftp_dir, $ftp_file) = @_;
> my $ua = LWP::UserAgent->new;
>
> $ua->proxy('ftp', $ftp_proxy);
> $ua->agent("$progname/$version ". $ua->_agent);
>
> open(FH, $ftp_file) or fatal("can't open $ftp_file");
> my $file_content;
> while (<FH>) { $file_content .= $_; }
> close(FH);
>
> my $res = $ua->request(PUT "ftp://$ftp_fqdn/$ftp_dir/$ftp_file",
> Content => $file_content);
> if (!$res->is_success) { fatal($res->status_line); }
> }
>
this code requires 'libwww-perl' package and was tested with success, here logs:
[/etc/dupload.conf]
$cfg{'salfrancl'} = {
fqdn => 'salfrancl.ipigto.rimed.cu',
method => 'ftp',
incoming => '/incoming',
dinstall_runs => 1,
};
# export ftp_proxy=http://proxy.ipigto.rimed.cu:3128/
# ./dupload --to salfrancl libsockets++_2.3.5_i386.changes
dupload note: no announcement will be sent.
Checking signatures before upload......signatures are ok
Uploading (ftp) to salfrancl.ipigto.rimed.cu:/incoming throught
(http://proxy.ipigto.rimed.cu:3128/)
[ job libsockets++_2.3.5_i386 from libsockets++_2.3.5_i386.changes
libsockets++_2.3.5_i386.deb, size ok, md5sum ok, sha1sum ok, sha256sum ok
libsockets++-dev_2.3.5_all.deb, size ok, md5sum ok, sha1sum ok, sha256sum ok
libsockets++_2.3.5.diff.gz, size ok, md5sum ok, sha1sum ok, sha256sum ok
libsockets++_2.3.5.orig.tar.gz, size ok, md5sum ok, sha1sum ok, sha256sum ok
libsockets++_2.3.5.dsc, size ok, md5sum ok, sha1sum ok, sha256sum ok
libsockets++_2.3.5_i386.changes ok ]
Uploading (ftp) to local (salfrancl.ipigto.rimed.cu) throught
(http://proxy.ipigto.rimed.cu:3128/)
[ Uploading job libsockets++_2.3.5_i386
libsockets++_2.3.5_i386.deb 279.1 kB, ok (0 s, 279.10 kB/s)
libsockets++-dev_2.3.5_all.deb 50.2 kB, ok (0 s, 50.16 kB/s)
libsockets++_2.3.5.diff.gz 2.8 kB, ok (0 s, 2.84 kB/s)
libsockets++_2.3.5.orig.tar.gz 170.5 kB, ok (0 s, 170.50 kB/s)
libsockets++_2.3.5.dsc 1.1 kB, ok (0 s, 1.09 kB/s)
libsockets++_2.3.5_i386.changes 2.1 kB, ok (0 s, 2.06 kB/s) ]
[/etc/dupload.conf]
$cfg{'salfrancl'} = {
fqdn => 'salfrancl.ipigto.rimed.cu',
method => 'ftp',
incoming => '/incoming',
queuedir => '/incoming/queue',
dinstall_runs => 1,
};
# ./dupload --to salfrancl libsockets++_2.3.5_i386.changes
dupload note: no announcement will be sent.
Checking signatures before upload......signatures are ok
Uploading (ftp) to salfrancl.ipigto.rimed.cu:/incoming/queue throught
(http://proxy.ipigto.rimed.cu:3128/)
[ job libsockets++_2.3.5_i386 from libsockets++_2.3.5_i386.changes
libsockets++_2.3.5_i386.deb, size ok, md5sum ok, sha1sum ok, sha256sum ok
libsockets++-dev_2.3.5_all.deb, size ok, md5sum ok, sha1sum ok, sha256sum ok
libsockets++_2.3.5.diff.gz, size ok, md5sum ok, sha1sum ok, sha256sum ok
libsockets++_2.3.5.orig.tar.gz, size ok, md5sum ok, sha1sum ok, sha256sum ok
libsockets++_2.3.5.dsc, size ok, md5sum ok, sha1sum ok, sha256sum ok
libsockets++_2.3.5_i386.changes ok ]
Uploading (ftp) to salfrancl (salfrancl.ipigto.rimed.cu) throught
(http://proxy.ipigto.rimed.cu:3128/)
[ Uploading job libsockets++_2.3.5_i386
libsockets++_2.3.5_i386.deb 279.1 kB, ok (0 s, 279.10 kB/s)
libsockets++-dev_2.3.5_all.deb 50.2 kB, ok (0 s, 50.16 kB/s)
libsockets++_2.3.5.diff.gz 2.8 kB, ok (0 s, 2.84 kB/s)
libsockets++_2.3.5.orig.tar.gz 170.5 kB, ok (0 s, 170.50 kB/s)
libsockets++_2.3.5.dsc 1.1 kB, ok (0 s, 1.09 kB/s)
libsockets++_2.3.5_i386.changes 2.1 kB, ok (0 s, 2.06 kB/s) ]
regards.
-- System Information:
Debian Release: 5.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages dupload depends on:
ii perl 5.10.0-19 Larry Wall's Practical Extraction
ii perl-modules [libnet-perl] 5.10.0-19 Core Perl modules
Versions of packages dupload recommends:
ii openssh-client 1:5.1p1-5 secure shell client, an rlogin/rsh
Versions of packages dupload suggests:
ii exim4-daemon-light [mail-tran 4.69-9 lightweight Exim MTA (v4) daemon
ii lintian 1.24.2.1 Debian package checker
-- no debconf information
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]