cURL / Mailing Lists / curl-library / Single Mail

curl-library

Upload via proxy

From: raoul cridlig <rcridlig_at_yahoo.fr>
Date: Thu, 20 Dec 2001 17:09:08 +0100 (CET)

Hi all,

I can upload via proxy with curl bin, but not with my
code,
and I don't understand why...

It works with upload without proxy,
download with and without proxy...

Here is my code:

I call these 2 functions in my main function:
curl = init_lib();
set_profile(name,pwd,log);
set_URL("192.168.200.1",remotfilename,url,log);
setProxy(curl,proxy,port, "", ""); /*no login nor
pwd*/
ftpPut(curl,"/home/toto",toto,url);
end_lib(curl);
 
int ftpPut(CURL *curl, char *locpath, char *locfile,
char *remotURL)
{
  FILE *fd_src;
  char buf_2[BUF_LGTH] = "RNTO ";
  char ur[URI_LGTH] = "";
  struct curl_slist *headerlist = NULL;
 
  strcat(ur, remotURL);
  strcat(buf_2, locfile);
  curl_global_init(CURL_GLOBAL_ALL);
  fd_src = fopen(locpath, "r");
  headerlist = curl_slist_append(headerlist, buf_2);
  curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ;
  curl_easy_setopt(curl, CURLOPT_URL, ur);
  curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE);
  curl_easy_setopt(curl, CURLOPT_POSTQUOTE,
headerlist);
  curl_easy_setopt(curl, CURLOPT_INFILE, fd_src);
  res = curl_easy_perform(curl);
  curl_slist_free_all(headerlist);
  fclose(fd_src);
  return res;
}

void setProxy(CURL *curl, char *proxy, int port, char
*login, char *pwd)
{
  /* My proxy doesn't need user and passwd */
  curl_easy_setopt(curl, CURLOPT_PROXY, proxy);
  curl_easy_setopt(curl, CURLOPT_PROXYPORT, port);
}

So what's wrong ?????????????,

Thanx

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Courrier : http://courrier.yahoo.fr
Received on 2001-12-20