cURL / Mailing Lists / curl-library / Single Mail

curl-library

file upload using libcurl fails for filenames containing '#'

From: Thomas Falkenberg <TFALKEN_at_de.ibm.com>
Date: Thu, 21 Jul 2011 10:02:56 +0200

Hello,

I have the following problem in uploading files to a remote site using
libcurl:
If the file, I wish to upload, contains a hash sign ('#'), the system
ignores any character after the '#' and stores the file under a wrong
filename.
I use AIX 6.1 TL 06 SP 02 as operating system.
My curl Version is 7.21.3-1 .
I use the actual RPM version from
http://www.perzl.org/aix/index.php?n=Main.Curl .

Here an example perl program:

#!/usr/bin/perl -w
use strict;
use lib "/usr/local/site_perl/aix";
use lib "/usr/local/site_perl/common";
use WWW::Curl::Easy;
my $curl = WWW::Curl::Easy->new();
$curl->setopt(CURLOPT_FTP_RESPONSE_TIMEOUT,30000);
$curl->setopt(CURLOPT_CONNECTTIMEOUT, 10000);
$curl->setopt(CURLOPT_LOW_SPEED_LIMIT, 1000);
$curl->setopt(CURLOPT_LOW_SPEED_TIME, 180);
$curl->setopt(CURLOPT_USERPWD,"xxxxxxxx:yyyyyyyy");
$curl->duphandle();
my $infile = "/tmp/32864.724.724.22.savf";
open (my $fh,"$infile");
$curl->setopt(CURLOPT_INFILE,$fh);
$curl->setopt(CURLOPT_URL,"ftp://<hostname>:21/QSYS.LIB/PMR32864AA.LIB/
ABC#22.SAVF");
$curl->setopt(CURLOPT_VERBOSE,1);
$curl->setopt(CURLOPT_UPLOAD,1);
$curl->setopt(CURLOPT_NOPROGRESS,1);
my $rc = $curl->perform();
print "Return-Code: $rc\n";
my $msg = $curl->errbuf();
print "ERR: $msg\n";
$msg = $curl->getinfo(CURLINFO_EFFECTIVE_URL);
print "CURLINFO_EFFECTIVE_URL: $msg\n";
$msg = $curl->getinfo(CURLINFO_RESPONSE_CODE);
print "CURLINFO_RESPONSE_CODE: $msg\n";

And this is the result:

* About to connect() to <hostname> port 21 (#0)
* Trying <ip>... * connected
* Connected to <hostname> (<ip>) port 21 (#0)
< 220-QTCP at <hostname>.
< 220 Connection will close if idle more than 20 minutes.
> USER xxxxxxxx
< 331 Enter password.
> PASS yyyyyyyy
< 230 xxxxxxxx logged on.
> PWD
< 257 "QGPL" is current library.
* Entry path is 'QGPL'
> SYST
< 215 OS/400 is the remote operating system. The TCP/IP version is
"V6R1M0".
> SITE NAMEFMT 1
< 250 Now using naming format "1".
> PWD
< 257 "/QSYS.LIB/QGPL.LIB" is current library.
* Entry path is '/QSYS.LIB/QGPL.LIB'
> CWD QSYS.LIB
< 250 "/QSYS.LIB" is current library.
> CWD PMR32864AA.LIB
< 250 "/QSYS.LIB/PMR32864AA.LIB" is current library.
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||62290|).
* Trying <ip>... * connected
* Connecting to <ip> (<ip>) port 62290
> TYPE I
< 200 Representation type is binary IMAGE.
> STOR ABC
< 501 Unknown extension in database file name.
* Failed FTP upload: 501
* Remembering we are in dir "QSYS.LIB/PMR32864AA.LIB/"
* Connection #0 to host <hostname> left intact
Return-Code: 25
ERR: Failed FTP upload: 501
CURLINFO_EFFECTIVE_URL:
ftp://<hostname>:21/QSYS.LIB/PMR32864AA.LIB/ABC#22.SAVF
CURLINFO_RESPONSE_CODE: 501
> QUIT
< 221 QUIT subcommand received.
* Closing connection #0

Mit freundlichen Grüßen / Kind regards
 
Thomas Falkenberg
E-Mail: tfalken_at_de.ibm.com

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-07-21