cURL / Mailing Lists / curl-users / Single Mail

curl-users

is this a bug or I do something wrong?

From: Peter Verhas <peter_at_verhas.com>
Date: Wed, 20 Mar 2002 10:59:15 +0100

It seems that if I try to upload a file from Linux to Linux using ftp and I
specify the CURLOPT_CRLF option then curlopt hangs. I faced this issue, when
I tested the CURL ScriptBasic interface, but that isa bit complex to report
a bug thus I created a C test program and it too behaved that way.

Here are the details (mainly screen copy paste):

Operating system: Linux verhaslinux 2.2.19pre17 #1 Tue Mar 13 22:37:59 EST
2001 i586 unknown

verhas_at_verhaslinux:~$ cc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000220 (Debian GNU/Linux)

verhas_at_verhaslinux:~$ curl --version
curl 7.9.5 (i586-pc-linux-gnu) libcurl 7.9.5

The FTP server installed on localhost:

ftp localhost
Connected to localhost.
220 ProFTPD 1.2.0pre10 Server (Debian) [verhaslinux.westel900.hu]
Name (localhost:verhas):

The test program (with password XXX-ed out):

verhas_at_verhaslinux:~$ cat test.c
#include <stdio.h>
#include <curl/curl.h>
main(){
  CURL *h;
  FILE *fp;

  fp = fopen("./test.c","r");
  h = curl_easy_init();

  curl_easy_setopt(h,CURLOPT_URL,"ftp://localhost/test.txt");
  curl_easy_setopt(h,CURLOPT_USERPWD,"verhas:XXXXXXXX");
  curl_easy_setopt(h,CURLOPT_UPLOAD,1);
  curl_easy_setopt(h,CURLOPT_INFILE,fp);
  curl_easy_setopt(h,CURLOPT_CRLF,1);
  curl_easy_perform(h);
  curl_easy_cleanup(h);
  fclose(fp);
  }

Command line to compile:

cc -o test test.c /usr/local/lib/libcurl.a -ldl

If I comment out the line

curl_easy_setopt(h,CURLOPT_CRLF,1);

the program works fine. If it is there the program hangs. gdb reports the
following (after pressing CRTL-C):

verhaslinux:/home/verhas# gdb test
GNU gdb 19990928
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) run
Starting program: /home/verhas/test

Program received signal SIGINT, Interrupt.
0x400b3bde in select () from /lib/libc.so.6
(gdb) backtrace
#0 0x400b3bde in select () from /lib/libc.so.6
#1 0x807420c in ?? ()
#2 0x80542d4 in Curl_perform (data=0x805f678) at transfer.c:1108
#3 0x8049842 in curl_easy_perform (curl=0x805f678) at easy.c:245
#4 0x80496ca in main ()
#5 0x40035a42 in __libc_start_main () from /lib/libc.so.6
(gdb)

Any suggestion in addition that better not to use this option in such an
environment?

Regards,
Peter
Received on 2002-03-20