cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: libcurl-7.8 PUT problem

From: Souk-Aloun Samuel <sam_at_akio-solutions.com>
Date: Tue, 12 Jun 2001 14:57:14 +0200

>
> It might help if you would show us:
>
> - Your curl command line/script
> - What happens exactly
> - Does the server respond anything?
> - What Linux version?
> - Any other details you think might help us track this down.
>
> A segfault is *never* the expected behaviour.
>
> --
> Daniel Stenberg -- curl dude -- http://curl.haxx.se/

ok, it's a little bit complicated to describe everything because I have
three different platforms and different behaviours too, so, I will focus
on a problem which is common to all platforms:

- the perl script is exiting with segfault (at perform())
- the cgi script get the correct content-length but no data
- the PUT works when I use LWP::UserAgent & HTTP::Request
- the PUT works when I use curl-7.6 & Curl::easy 1.0.2 (with the
"curl_easy_" prefix)

NB: I have the curl command working properly
/usr/local/bin/curl -u xxx:xxx -T test.xfer --url
http://koyao/upload/test.xfer -D head.out

- client platform: linux-2.4.3 (mandrake 8.0)
                   curl-7.8
                   Curl-easy-1.1.5
                   glibc-2.2.2
                   gcc-2.96
                   perl-5.600

- server platform: linux-2.2.19 (mandrake 7.2)
                   apache-1.3.14

----<the perl script>----
#!/usr/bin/perl

use strict;
use vars qw($errbuf);
use Curl::easy;
use IO::File;

my $url = "http://koyao/upload/test.xfer";
my $file = './test.xfer';
my ($user, $passwd) = ('xxx', 'xxx');

my $fh_in = new IO::File || die "error: $!\n";
$fh_in->open("<$file") || die "error: $!\n";
my $filesize = -s $file;

my $curl = Curl::easy::init();
Curl::easy::setopt($curl, Curl::easy::CURLOPT_URL, $url);
Curl::easy::setopt($curl, Curl::easy::CURLOPT_INFILE, $fh_in);
Curl::easy::setopt($curl, Curl::easy::CURLOPT_INFILESIZE, $filesize);
Curl::easy::setopt($curl, Curl::easy::CURLOPT_PUT, 1);
Curl::easy::setopt($curl, Curl::easy::CURLOPT_NOPROGRESS, 1);
Curl::easy::setopt($curl, Curl::easy::CURLOPT_MUTE, 1);
Curl::easy::setopt($curl, Curl::easy::CURLOPT_TIMEOUT, 30);
Curl::easy::setopt($curl, Curl::easy::CURLOPT_USERPWD, "$user:$passwd");
Curl::easy::setopt($curl, Curl::easy::CURLOPT_ERRORBUFFER, "errbuf");

if (Curl::easy::perform($curl) == 0) {
    my ($bytes, $realurl, $httpcode);
    Curl::easy::getinfo($curl, Curl::easy::CURLINFO_SIZE_DOWNLOAD,
$bytes);
    print "ok: $bytes bytes read\n";
    Curl::easy::getinfo($curl, Curl::easy::CURLINFO_EFFECTIVE_URL,
$realurl);
    Curl::easy::getinfo($curl, Curl::easy::CURLINFO_HTTP_CODE,
$httpcode);
    print "effective fetched url (http code: $httpcode) was: $url\n";
} else {
    print "not ok: '$errbuf'\n";
}

$fh_in->close;
Curl::easy::cleanup($curl);

----</the perl script>----

this is the same if I use "CURLOPT_UPLOAD, 1" or "CURLOPT_CUSTOMREQUEST,
'PUT'" instead of "CURLOPT_PUT, 1"
Received on 2001-06-12