Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > FTP PUT with proxy?

Reply
Thread Tools

FTP PUT with proxy?

 
 
dtfcalibrator@gmail.com
Guest
Posts: n/a
 
      01-18-2006
I've been struggling with this forever now. Hopefully someone can help

Lets say you have the following:

proxy server: my.proxy.com
proxy username: proxyuser
proxy password: proxypassword
ftp server: my.ftp.com
ftp username: ftpuser
ftp password: ftppassword
file to PUT: myTextFile.txt


I've been trying to use LWP::UserAgent, HTTP::Headers, and
HTTP::Request without any real success.

Here's where I gave up (I'm not working on proxy auth yet):
use File::stat;
use LWP::UserAgent;

$stats = stat("myTextFile.txt");
$fileSize = $stats->size;
$ua = LWP::UserAgent->new;
$ua->proxy(['http', 'ftp'], 'http://my.proxy.com');
$header = HTTP::Headers->new;
$header->authorization_basic("ftpuser", "ftppassword");
open(FH, "myTextFile.txt");
read(FH, $buf, $fileSize);
$req = HTTP::Request->new("PUT", "ftp://my.ftp.com/myTextFile.txt",
$header);
$req->content($buf);
$response = $ua->request($req);

 
Reply With Quote
 
 
 
 
DJ Stunks
Guest
Posts: n/a
 
      01-19-2006

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Here's where I gave up


Funny, that's the same place I gave up.

 
Reply With Quote
 
 
 
 
usenet@DavidFilmer.com
Guest
Posts: n/a
 
      01-19-2006
(E-Mail Removed) wrote:
> I've been struggling with this forever now.


I feel your pain. I've got a proxy server at work that hates me and
conspires to cause problems with LWP (and ncftp and wcftp and lynx) no
matter how many configuration settings I futz around with.

However, cURL (http://curl.haxx.se/) seems to punch through just fine
(I actually use cURL to pull down my CPAN updates using the CPAN.pm
module).

There's a nice CPAN interface module to libcurl:

http://search.cpan.org/~crisb/WWW-Curl-3.02/Easy.pm.in

(but this is a rare instance when I wouldn't object to using a system
command from Perl).

--
http://DavidFilmer.com

 
Reply With Quote
 
dtfcalibrator@gmail.com
Guest
Posts: n/a
 
      01-24-2006
My solution was to use Net::FTP. No problems with that.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why does the following with Queue, q.put('\x02', True) not put itin the queue? Gabriel Rossetti Python 3 04-25-2008 03:41 PM
'Undifined commands' on FTP Server, when using FTP 'put' and 'quit' in Client Asaf Sinai Perl Misc 1 07-04-2006 01:02 PM
Put a file on an ftp server over ssl Daniel Santa Cruz Python 4 05-11-2005 01:14 PM
Net::FTP problems getting files from Windows FTP server, but not Linux FTP Server. D. Buck Perl Misc 2 06-29-2004 02:05 PM
FTP put via ASP using Visual Basic TRB_NV ASP General 3 01-10-2004 08:14 AM



Advertisments