FTP PUT with proxy?

Discussion in 'Perl Misc' started by dtfcalibrator@gmail.com, Jan 18, 2006.

  1. Guest

    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);
     
    , Jan 18, 2006
    #1
    1. Advertising

  2. DJ Stunks Guest

    wrote:
    > Here's where I gave up


    Funny, that's the same place I gave up.
     
    DJ Stunks, Jan 19, 2006
    #2
    1. Advertising

  3. Guest

    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
     
    , Jan 19, 2006
    #3
  4. Guest

    My solution was to use Net::FTP. No problems with that.
     
    , Jan 24, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel  Santa Cruz

    Put a file on an ftp server over ssl

    Daniel Santa Cruz, May 10, 2005, in forum: Python
    Replies:
    4
    Views:
    254
    Rick Holbert
    May 11, 2005
  2. Gabriel Rossetti
    Replies:
    3
    Views:
    555
    Jerry Hill
    Apr 25, 2008
  3. jakecjacobson

    FTP example going through a FTP Proxy

    jakecjacobson, Jan 7, 2009, in forum: Python
    Replies:
    3
    Views:
    2,093
    jakecjacobson
    Jan 8, 2009
  4. D. Buck
    Replies:
    2
    Views:
    493
    D. Buck
    Jun 29, 2004
  5. Asaf Sinai
    Replies:
    1
    Views:
    254
    Chris Davies
    Jul 4, 2006
Loading...

Share This Page