Re: FTP passive mode

2011-10-27 Thread Oleksiy
 Thanks a lot to all!


   

   Patrick Monnerat wrote:
 Be also aware that, in active mode, the server connects to the client:
 this means you may have problems along the network path with:
 
 - Firewalls (reverse data port must be open).
 - NAT (the real IP address of your client may not be seen as such by the
 server).
 - Port forwarding: inbound data connection requests should be redirected
 to your client if the later is on a LAN and the server in the outside
 world.
 
 That's why the active mode is pretty much deprecated nowadays.

Mostly.  When the server is behind a firewall/NAT with port
forwarding, such as my friend's little Netgear NAS at home, depending
on the router you might have to use active mode.

(It's unfortunate if client and server are both in this situation, as
neither active nor passive modes work then.)

-- Jamie


---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

FTP passive mode

2011-10-25 Thread Oleksiy
   It is said in the docs that 

   

   CURLOPT_FTP_USE_EPSV 

   

   Pass a long. If the value is 1, it tells curl to use the EPSV command
   when doing passive FTP downloads (which it always does by default).

   


   

   And how can I connect to FTP without passive mode?

   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Re: Uploading with POST and read_callback not just a file

2011-09-20 Thread Oleksiy
   Julien Chaffraix: header and body of the post request is right, if
   they are other - nothing works. They are according to the official
   Google manual
   
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_direct_uploading.html#Sending_a_Direct_Upload_API_Request

   


   

   Daniel Stenberg: with debug-callback I found out that for some reason
   only header is sent, and body isn't

   


   

   == Info: About to connect() to uploads.gdata.youtube.com port 80 (#0)
   = Send header, 61 bytes (0x003d)
   : About to connect() to uploads.gdata.youtube.com port 80 (#0).
   == Info: Trying 74.125.39.117... = Send header, 26 bytes
   (0x001a)
   : Trying 74.125.39.117...
   == Info: connected
   = Send header, 10 bytes (0x000a)
   : connected.
   == Info: Connected to uploads.gdata.youtube.com (74.125.39.117) port
   80 (#0)
   = Send header, 68 bytes (0x0044)
   : Connected to uploads.gdata.youtube.com (74.125.39.117) port 80 (
   0040: #0).
   = Send header, 000577 bytes (0x0241)
   : GET /feeds/api/users/default/uploads HTTP/1.1
   002f: Accept: */*
   003c: Host: uploads.gdata.youtube.com
   005d: Authorization: GoogleLogin auth=D***kyPw
   014a: GData-Version: 2
   015c: X-GData-Key: key=AI3***kQQ
   01d1: Slug: video
   01de: Content-Type: multipart/related; boundary=d31fcjR2
   0214: Content-Length: 910286
   022c: Connection: close
   023f:
   == Info: HTTP 1.0, assume close after body
   = Send header, 34 bytes (0x0022)
   : HTTP 1.0, assume close after body.
   = Recv header, 26 bytes (0x001a)
   : HTTP/1.0 400 Bad Request
   = Recv header, 40 bytes (0x0028)
   : Content-Type: text/html; charset=UTF-8
   = Recv header, 23 bytes (0x0017)
   : Content-Length: 11782
   = Recv header, 37 bytes (0x0025)
   : Date: Tue, 20 Sep 2011 14:01:48 GMT
   = Recv header, 17 bytes (0x0011)
   : Server: GFE/2.0
   = Recv header, 02 bytes (0x0002)
   :
   = Recv data, 004096 bytes (0x1000)
   : !DOCTYPE html.html lang=en. meta charset=utf-8. titleE
   0040: rror 400 (Bad Request)!!1/title. style. *{margin:0;paddi

   


   


   


   


   

   

   


   

   original message was:

   


   


   

   I'm uploading a file to yutube. As file can be very large, I don't
   want to load it all in the buffer, but in parts. With this working
   pieces of code I did uploading, loading whole file into the char *
   buffer. POST request is described here -
   
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_direct_uploading.html#Sending_a_Direct_Upload_API_Request



   

   body.append(--d31fcjR2\r\n);
   body.append(Content-Type: application/atom+xml; charset=UTF-8\r\n);
   body.append(\r\n);
   body.append(?xml version=\1.0\?\r\n);
   body.append(entry xmlns=\http://www.w3.org/2005/Atom\\r\n;);
   body.append(xmlns:media=\http://search.yahoo.com/mrss/\\r\n;);
   body.append(xmlns:yt=\http://gdata.youtube.com/schemas/2007\;\r\n);
   body.append(media:group\r\n);
   body.append(media:title type=\plain\ title /media:title\r\n );
   body.append(media:description type=\plain\\r\n);
   body.append( description \r\n);
   body.append(/media:description\r\n);
   body.append(media:category\r\n);
   
body.append(scheme=\http://gdata.youtube.com/schemas/2007/categories.cat\;People\r\n);
   body.append(/media:category\r\n);
   body.append(media:keywords keywords /media:keywords\r\n );
   body.append(/media:group\r\n);
   body.append(/entry\r\n);
   body.append(--d31fcjR2\r\n);
   body.append(Content-Type: video/H264\r\n);//content type
   body.append(Content-Transfer-Encoding: binary\r\n);
   body.append(\r\n);
   body.append(buffer, size);//*file
   body.append(\r\n);

   body.append(--d31fcjR2--);



   



   curl_easy_setopt(curl, CURLOPT_URL, urlUpload);
   curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
   curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, body.length());
   curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);//setting header
   curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());//setting
   body

   ***



   To load file to a buffer by parts as I have read the manual I must use
   read_callback. Problem is that I have to send some parts of xml before
   and after the file. So I change that code to this:



   ***

   FILE *file = fopen(path, rb);

   ***



   curl_easy_setopt(curl, CURLOPT_URL, urlUpload);
   curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
   curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);//additional information,
   for debug
   //curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, body.length());
   // I have tried with and without it, passing it manually real size of
   the body
   curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);//setting header
   curl_easy_setopt(curl, 

CURLOPT_READFUNCTION

2011-09-19 Thread Oleksiy
   from manual about - ... Function pointer that should match the
   following prototype: size_t function( void *ptr, size_t size, size_t
   nmemb, void *userdata); 

   


   

   How can I set  size  and   nmemb parameters?  I'm writing in C 

   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Uploading with POST and read_callback not just a file

2011-09-19 Thread Oleksiy
   I'm uploading a file to yutube.  As file can be very large, I don't
   want to load it all in the buffer, but in parts. With this working
   pieces of code I did uploading, loading whole file into the char *
   buffer. POST request is described here -
   
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_direct_uploading.html#Sending_a_Direct_Upload_API_Request

   


   

   

   

   body.append(--d31fcjR2\r\n);

body.append(Content-Type: application/atom+xml;
   charset=UTF-8\r\n);
   body.append(\r\n);
   body.append(?xml version=\1.0\?\r\n);
   body.append(entry xmlns=\http://www.w3.org/2005/Atom\\r\n;);
   body.append(xmlns:media=\http://search.yahoo.com/mrss/\\r\n;);
   body.append(xmlns:yt=\http://gdata.youtube.com/schemas/2007\;\r\n);
   body.append(media:group\r\n);
   body.append(media:title type=\plain\ title /media:title\r\n );
   body.append(media:description type=\plain\\r\n);
   body.append( description \r\n);
   body.append(/media:description\r\n);
   body.append(media:category\r\n);

body.append(scheme=\http://gdata.youtube.com/schemas/2007/categories.cat\;People\r\n);
   body.append(/media:category\r\n);
   body.append(media:keywords keywords /media:keywords\r\n );
   body.append(/media:group\r\n);
   body.append(/entry\r\n);
   body.append(--d31fcjR2\r\n);
   body.append(Content-Type: video/H264\r\n);//content type
   body.append(Content-Transfer-Encoding: binary\r\n);
   body.append(\r\n);
body.append(buffer, size);//*file
   body.append(\r\n);

   body.append(--d31fcjR2--);

   


   

   

   


   

   curl_easy_setopt(curl, CURLOPT_URL, urlUpload);
   curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
   curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, body.length());
   curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);//setting header
   curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());//setting
   body

   

   ***

   


   

   To load file to a buffer by parts as I have read the manual I must use
   read_callback. Problem is that I have to send some parts of xml before
   and after the file. So I change that code to this:

   


   

   ***

   

   FILE *file = fopen(path, rb);

   

   ***

   


   

   curl_easy_setopt(curl, CURLOPT_URL, urlUpload);
   curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
   curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);//additional information,
   for debug
//curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, body.length());
   // I have tried with and without it, passing it manually real size of
   the body
   curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);//setting header
   curl_easy_setopt(curl, CURLOPT_READFUNCTION, ReadCallback); // use our
   own read function
curl_easy_setopt(curl, CURLOPT_READDATA, file);//specify what data
   will be uploaded

   


   

   size_t ReadCallback(void *ptr, size_t size, size_t nmemb, void
   *userdata)
   {
   FILE* file = (FILE *)userdata;
   size_t retcode;
   string body;
   if(beginning == 0)
   {
   body.append(--d31fcjR2\r\n);
   body.append(Content-Type: application/atom+xml; charset=UTF-8\r\n);
   body.append(\r\n);
   body.append(?xml version=\1.0\?\r\n);
   body.append(entry xmlns=\http://www.w3.org/2005/Atom\\r\n;);
   body.append(xmlns:media=\http://search.yahoo.com/mrss/\\r\n;);
   body.append(xmlns:yt=\http://gdata.youtube.com/schemas/2007\;\r\n);
   body.append(media:group\r\n);
   body.append(media:title type=\plain\Test
   title/media:title\r\n);//title
   body.append(media:description type=\plain\\r\n);
   body.append(Description\r\n);//description
   body.append(/media:description\r\n);
   body.append(media:category\r\n);
   
body.append(scheme=\http://gdata.youtube.com/schemas/2007/categories.cat\;People\r\n);//category
   
http://code.google.com/apis/youtube/2.0/reference.html#youtube_data_api_tag_media:category
   body.append(/media:category\r\n);
   body.append(media:keywordsara,arara/media:keywords\r\n);//keywords
   body.append(/media:group\r\n);
   body.append(/entry\r\n);
   body.append(--d31fcjR2\r\n);
   body.append(Content-Type: video/H264\r\n);//content type
   body.append(Content-Transfer-Encoding: binary\r\n);
   body.append(\r\n);
   beginning++;
   retcode = body.length();
   ptr = body;
   }
   else
   retcode = fread(ptr, size, nmemb, file);

   if(retcode == 0 and beginning == 1)
   {
   beginning++;
   body.append(\r\n);
   body.append(--d31fcjR2--);
   retcode = body.length();
   ptr = body;
   }

   return retcode;
   }

   


   


   

   And this doesn't work, I'm receiving Error 400 (Bad Request). I'm for
   sure form post body wrong

   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Cancel request in process

2011-09-14 Thread Oleksiy
   It is here -
   
http://stackoverflow.com/questions/7400127/libcurl-cancel-request-while-proceed/7401680

   

   in main.cpp

   

   you must have 

   

   #include Uploader.h

   


   

   int main()
   {
   UploadToYoutube(*path to avi file*, *YouTube login*, *YouTube
   password*  , *title of the video*, *description of the video*);
return 0;
   }

   


   

   and Uploader.h is 

   


   

   #ifndef UPLOADER_H
   #define UPLOADER_H
   void UploadToYoutube(std::string, std::string, std::string,
   std::string, std::string, int (*fun)(double));
   #endif

   


   


   


--- Оригінальне повідомлення ---
   Від кого:  Daniel Stenberg dan...@haxx.se
   Кому:  libcurl development curl-library@cool.haxx.se
   Дата: 13 вересня 2011, 23:24:22
   Тема: Re: Cancel request in process



   

   On Tue, 13 Sep 2011, Oleksiy wrote:

Please don't top-post.

   I find out that this is because I write the code in function. If I
   write all curl code in main - it works fine without errors. But when
   my code is in function in other cpp-file, when the progress_callback
   returns non-zero it crashes. When it return 0 everything is fine.

That indicates a problem in your code. The progress callback is widely 
used by 
users of every imaginable libcurl version without problems.

Can you show us a complete C program source code that we can compile and 
see 
the problem with?

-- 

  / daniel.haxx.se
---
List admin:http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html


---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Cancel request in process

2011-09-14 Thread Oleksiy
   Sorry, in h-file without last parameter

   

   void UploadToYoutube(std::string, std::string, std::string,
   std::string, std::string);

   


   

   

   It is here -
   
http://stackoverflow.com/questions/7400127/libcurl-cancel-request-while-proceed/7401680

   

   in main.cpp
   

   

   you must have 

   

   #include Uploader.h

   


   

   

   int main()
{
UploadToYoutube(*path to avi file*, *YouTube login*, *YouTube
   password*  , *title of the video*, *description of the video*);
 return 0;
}
   

   


   

   

   and Uploader.h is 

   


   

   

   #ifndef UPLOADER_H
#define UPLOADER_H
void UploadToYoutube(std::string, std::string, std::string,
   std::string, std::string, int (*fun)(double));
#endif
   

   


   

   


   

   


   

--- Оригінальне повідомлення ---
Від кого:  Daniel Stenberg dan...@haxx.se
Кому:  libcurl development curl-library@cool.haxx.se
Дата: 13 вересня 2011, 23:24:22
Тема: Re: Cancel request in process
   
   
   


   On Tue, 13 Sep 2011, Oleksiy wrote:

Please don't top-post.

   I find out that this is because I write the code in function. If I
   write all curl code in main - it works fine without errors. But when
   my code is in function in other cpp-file, when the progress_callback
   returns non-zero it crashes. When it return 0 everything is fine.

That indicates a problem in your code. The progress callback is widely 
used by 
users of every imaginable libcurl version without problems.

Can you show us a complete C program source code that we can compile and 
see 
the problem with?

-- 

  / daniel.haxx.se
---
List admin:http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html




   ---
List admin:http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Cancel request in process

2011-09-13 Thread Oleksiy
   int ProgressShow(int (*fun)(double data), double dltotal, double
   dlnow, double ultotal, double ulnow)
   {
   printf(%f / %f (%g %%)\n, ulnow, ultotal, ulnow*100.0/ultotal); 
if(ulnow*10050)
   return 1;
return 0;
   }

   


   

   int main()

   

   {

   

   //to use this callback

   

   curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);//must be to use
   progress cakkback
   curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION,
   ProgressShow);//callback function for displaying uploading progress
   curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, fun);//data sent to the
   progress callback as a first parameter

   

   }

   


   When ProgressShow  just returns 0 everything works fine. With this
   program crashed, but I receive the right output to the Eclipse console
   after crash. I'm sending a file with post request.

   
   --- Оригінальне повідомлення ---
   Від кого:  Jeff Pohlmeyer yetanotherg...@gmail.com
   Кому:  libcurl development curl-library@cool.haxx.se
   Дата: 12 вересня 2011, 21:22:40
   Тема: Re: Cancel request in process



   

   2011/9/12 Oleksiypatriot_of...@ukr.net   :

 When I return from curl_progress_callback non-zero value, it stop
 sending request, but also program is crashed. Is it mention to be?
 How can I cancel the request without crashing?

I think this does not happen in libcurl,  but you made a mistake in
some other part of your program. Please show us a small example.

 - Jeff
---
List admin:http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html


---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Cancel request in process

2011-09-13 Thread Oleksiy
   ultotal is never zero. When function is

   


   

   int ProgressShow(int (*fun)(double data), double dltotal, double
   dlnow, double ultotal, double ulnow)
   {
   printf(%f / %f (%g %%)\n, ulnow, ultotal, ulnow*100.0/ultotal); 
return 0;
   }

   


   

   everything works as it should be. The problem is when it returns
   non-zero value. In documentation it is said that it will cancel the
   request, and it dies so, but also program crashes.

   
   --- Оригінальне повідомлення ---
   Від кого:  Alan Wolfe alan.wo...@gmail.com
   Кому:  libcurl development curl-library@cool.haxx.se
   Дата: 13 вересня 2011, 11:10:35
   Тема: Re: Cancel request in process



   

   Is it a divide by zero crash?  Look what happens in your code when
   utotal is 0.



 On Sep 13, 2011 1:06 AM, Oleksiy patriot_of...@ukr.net wrote:
 
 

 int ProgressShow(int (*fun)(double data), double dltotal, double
 dlnow, double ultotal, double ulnow)
  {
  printf(%f / %f (%g %%)\n, ulnow, ultotal,
 ulnow*100.0/ultotal); 
   if(ulnow*10050)
  return 1;
   return 0;
  }

 


 

 

 int main()

 

 {

 

 //to use this callback

 

 curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);//must be to use
 progress cakkback
  curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION,
 ProgressShow);//callback function for displaying uploading
 progress
  curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, fun);//data sent to
 the progress callback as a first parameter
 

 

 }

 


  When ProgressShow  just returns 0 everything works fine. With
 this program crashed, but I receive the right output to the
 Eclipse console after crash. I'm sending a file with post request.
 

 
  --- Оригінальне повідомлення ---
  Від кого:  Jeff Pohlmeyer yetanotherg...@gmail.com
  Кому:  libcurl development curl-library@cool.haxx.se
  Дата: 12 вересня 2011, 21:22:40
  Тема: Re: Cancel request in process


 
 
 
  
   2011/9/12 Oleksiy patriot_of...@ukr.net:
  
When I return from curl_progress_callback n...

 
 
 ---
  List admin: http://cool.haxx.se/list/listinfo/curl-library
  Etiquette: http://curl.haxx.se/mail/etiquette.html
 

   ---
List admin:http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Cancel request in process

2011-09-13 Thread Oleksiy
   I find out that this is because I write the code in function. If I
   write all curl code in main - it works fine without errors. But when
   my code is in function in other cpp-file, when the progress_callback
   returns non-zero it crashes. When it return 0 everything is fine. 

   


   


--- Оригінальне повідомлення ---
   Від кого:  Oleksiy patriot_of...@ukr.net
   Кому:  Alan Wolfe alan.wo...@gmail.com
   Дата: 13 вересня 2011, 11:20:19
   Тема: Re: Cancel request in process



   

   ultotal is never zero. When function is

   


   

   

   int ProgressShow(int (*fun)(double data), double dltotal, double
   dlnow, double ultotal, double ulnow)
{
printf(%f / %f (%g %%)\n, ulnow, ultotal, ulnow*100.0/ultotal); 
 return 0;
}
   

   


   

   

   everything works as it should be. The problem is when it returns
   non-zero value. In documentation it is said that it will cancel the
   request, and it dies so, but also program crashes.

   
--- Оригінальне повідомлення ---
Від кого:  Alan Wolfe alan.wo...@gmail.com
Кому:  libcurl development curl-library@cool.haxx.se
Дата: 13 вересня 2011, 11:10:35
Тема: Re: Cancel request in process
   
   
   


   Is it a divide by zero crash?  Look what happens in your code when
   utotal is 0.



 On Sep 13, 2011 1:06 AM, Oleksiy patriot_of...@ukr.net wrote:
 
 

 int ProgressShow(int (*fun)(double data), double dltotal, double
 dlnow, double ultotal, double ulnow)
  {
  printf(%f / %f (%g %%)\n, ulnow, ultotal,
 ulnow*100.0/ultotal); 
   if(ulnow*10050)
  return 1;
   return 0;
  }

 


 

 

 int main()

 

 {

 

 //to use this callback

 

 curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);//must be to use
 progress cakkback
  curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION,
 ProgressShow);//callback function for displaying uploading
 progress
  curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, fun);//data sent to
 the progress callback as a first parameter
 

 

 }

 


  When ProgressShow  just returns 0 everything works fine. With
 this program crashed, but I receive the right output to the
 Eclipse console after crash. I'm sending a file with post request.
 

 
  --- Оригінальне повідомлення ---
  Від кого:  Jeff Pohlmeyer yetanotherg...@gmail.com
  Кому:  libcurl development curl-library@cool.haxx.se
  Дата: 12 вересня 2011, 21:22:40
  Тема: Re: Cancel request in process


 
 
 
  
   2011/9/12 Oleksiy patriot_of...@ukr.net:
  
When I return from curl_progress_callback n...

 
 
 ---
  List admin: http://cool.haxx.se/list/listinfo/curl-library
  Etiquette: http://curl.haxx.se/mail/etiquette.html
 

   ---
List admin:http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html



   ---
List admin:http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Cancel request in process

2011-09-12 Thread Oleksiy
   Hi everyone!

   

   When I return from curl_progress_callback non-zero value, it stop
   sending request, but also program is crashed. Is it mention to be? How
   can I cancel the request without crashing? 

   

   Thanks!

   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Re: Re: Error 411 (Length Required) in post request with header, but header has Content-Length:

2011-09-07 Thread Oleksiy
 Solved. My error was because there is a symbol for a new line at the end
   of the auth string that I receive from YouTube in my prev POST
   request.
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Re: Error 411 (Length Required) in post request with header, but header has Content-Length:

2011-09-04 Thread Oleksiy
 You should never need to specify the Content-Length header like
   this--libcurl 
takes care of that as necessary. In this case, you probably want
   the 
CURLOPT_POSTFIELDSIZE_LARGE option. Enable logging and you'll see
   exactly 

what headers are being sent out.

   


   

   I try with or without Content-Length in my header - result is the
   same. I'm trying to form post request as in the manual -
   
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_direct_uploading.html#Direct_uploading

   


   

   when I include CURLOPT_VERBOSE option I get such info. Maybe I form
   POST request wrong? What is the right way to send POST request with
   headers in libCurl?

   


   

   !DOCTYPE html
   html lang=en
   meta charset=utf-8
   titleError 411 (Length Required)!!1/title
   style
   *{margin:0;padding:0}html,code{font:15px/22px
   
arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{background:url(data:image/png;base64,iVBORw0KGgoNSUhEUgAAAKsAAADVCAMfHvCaGFBMVEVYn

   

   *

   

   _

   

   my file that I try to upload to YouTube in binary represantation here

   

   _

   

   *

   

   
aJDjbRA8dGsW6X6cgNmAhSEG%2FUiY%2Fsfiv02O7iVu1LunAElFTkSuQmCC);display:block;height:55px;margin:0
   0 -7px;width:150px}*  #g{margin-left:-2px}#g img{visibility:hidden}*
   html #g img{visibility:visible}*+html #g img{visibility:visible}
   /style
   a href=//www.google.com/ id=gimg
   src=//www.google.com/images/logo_sm.gif alt=Google/a
   pb411./b insThat’s an error./ins
   pPOST requests require a codeContent-length/code header.
   insThat’s all we know./ins

   succes [0]
   * About to connect() to uploads.gdata.youtube.com port 80 (#0)
   * Trying 74.125.43.116... * connected
   * Connected to uploads.gdata.youtube.com (74.125.43.116) port 80 (#0)
POST /feeds/api/users/default/uploads HTTP/1.1

   Accept: */*

   Host: uploads.gdata.youtube.com

   Authorization: GoogleLogin
   
auth=DQAAAIkAAADhpy7VDX06BTq42tjSZeID8AnKsNBAGqYowiLvWBoYHj9CuiZE1MAMt00p-Mscs4KzOpjSot9LW1oQWF_c7cXd-zflzXPj2V5b1v2SEIYHRSVhQYRjLkIwbnLldHSaH3ps_nOBkjbQ8-_uk-evI7E6E2NNA5LbLbfBubOLvsAP7HqjdGcx8Pc3YbH19FkSUxs


   GData-Version: 2

   X-GData-Key:
   
key=AI39si59VMkm6DATDmfG_Df6D23jfto3xRVfbAEMrFBv035pdRZ5AYMPsRXbGLCRXXnK5jz6KCSWSkuXOTrlDIIKWy7Le9fkQQ

   Slug: screen.avi

   Content-Type: multipart/related; boundary=d31fcjR2

   Connection: close

   Content-Length: 910273

   Expect: 100-continue



   * HTTP 1.0, assume close after body
HTTP/1.0 411 Length Required

Content-Type: text/html; charset=UTF-8

Content-Length: 11791

Date: Sun, 04 Sep 2011 11:02:46 GMT

Server: GFE/2.0

   

   * Closing connection #0

   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Error 411 (Length Required) in post request with header, but header has Content-Length:

2011-09-02 Thread Oleksiy
   I use this options:

   


   

   curl_easy_setopt(curl, CURLOPT_URL, urlUpload); 
   curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, buffer);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);

   


   

   It must be post request with header. And in header variable there is
   length

   


   

   ***
   char sizeStr[50];
   sprintf(sizeStr, Content-Length: %d, body.length());

   

   ***

   


   

   header = curl_slist_append(header, sizeStr);

   


   

   ***

   


   

   What I'm trying to di is to upload video to YouTube, I'm using their
   manual -
   
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_direct_uploading.html#Direct_uploading

   

   And I receive such error. 

   


   !DOCTYPE html
   html lang=en
   meta charset=utf-8
   titleError 411 (Length Required)!!1/title
   style
   *mane symbols here* /style
   a href=//www.google.com/ id=gimg
   src=//www.google.com/images/logo_sm.gif alt=Google/a
   pb411./b insThat’s an error./ins
   pPOST requests require a codeContent-length/code header.
   insThat’s all we know./ins

   


   

   Maybe I must use some other CURLoptions?




   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Lots of errors when try ro use self built OpenSSL and lincUrl with it

2011-08-30 Thread Oleksiy
   I haven't give up yet on libcurl with OpenSLL!

   

   I built myself OpenSSL statically with the help of INSTALL.W32 and
   
http://stackoverflow.com/questions/197444/building-libcurl-with-ssl-support-on-windows/7231376
 

   

   So I receive libeay32.lib and ssleay32.lib. Then I've built libcurl
   following the instructions in   INSTALL.W32  file in lubcurl folder
   for Visual C++. I receive libcurl.lib. Now I'm trying to use then in
   my project, but it's on MinGW with Eclipce.

   

   I try to build with

   


   

g++ -DCURL_STATICLIB -DUSE_SSLEAY -DUSE_OPENSSL -O0 -g3 -Wall -c
   -fmessage-length=0 -osrc\main.o ..\src\main.cpp

   

   g++ -L..\lib -oYTUploader.exe src\main.o -llibcurl -llibeay32
   -lssleay32 -lws2_32 -lwldap32

   


   

   but receive a lots of errors like

   


   

   ..\lib/libeay32.lib(tmp32/asn_mime.obj):(.text[_SMIME_text]+0x6):
   undefined reference to `_chkstk'
   ..\lib/libeay32.lib(tmp32/asn_mime.obj):(.text[_SMIME_text]+0xb):
   undefined reference to `__security_cookie'
   ..\lib/libeay32.lib(tmp32/asn_mime.obj):(.text[_SMIME_text]+0x63):
   undefined reference to `@__security_check_cookie@4'
   ..\lib/libeay32.lib(tmp32/asn_mime.obj):(.text[_SMIME_text]+0x19e):
   undefined reference to `@__security_check_cookie@4'
   ..\lib/libeay32.lib(tmp32/ech_ossl.obj):(.text[_ecdh_compute_key]+0x6):
   undefined reference to `_chkstk'
   ..\lib/libeay32.lib(tmp32/bio_asn1.obj):(.text[_asn1_bio_set_ex]+0x6):
   undefined reference to `_chkstk'
   ..\lib/libeay32.lib(tmp32/bio_asn1.obj):(.text[_asn1_bio_get_ex]+0x6):
   undefined reference to `_chkstk'
   ..\lib/libeay32.lib(tmp32/bio_asn1.obj):(.text[_BIO_asn1_set_prefix]+0x6):
   undefined reference to `_chkstk'
   ..\lib/libeay32.lib(tmp32/bio_asn1.obj):(.text[_BIO_asn1_get_prefix]+0x6):
   undefined reference to `_chkstk'
   ..\lib/libeay32.lib(tmp32/bio_asn1.obj):(.text[_BIO_asn1_set_suffix]+0x6):
   more undefined references to `_chkstk' follow
   
..\lib/ssleay32.lib(tmp32/ssl_lib.obj):(.text[_SSL_has_matching_session_id]+0xb):
   undefined reference to `__security_cookie'

   


   

   Can someone suggest what is wrong this time? 

   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

RE: RE: RE: RE: RE: Linker errors when statically compiled linking libcurl+openssl to my project

2011-08-26 Thread Oleksiy
   Steve Holme wrote:

   

   Mmmm very strange. I must admit I don't include SSH or RTMP support
   (at the

moment) when I build libcurl here.
   
   I use Visual Studio (and have solution and project files for .NET
   2003
   (v7.1), 2005 (v8.0), 2008 (v9.0) and 2010 (v10.0)) and have them
   configured
   to build against OpenSSL (as a DLL rather than statically) and to
   include
   NTLM support.
   

   Are you building RTMP yourself, or do you have a pre-built version?

   


   

   I didn't build   RTMP, seems that some of libs I included uses it

   


   


   

   Steve Holme wrote:


   Visual Studio uses a 2 pass linker. gnu-ld does not. The OP may have
   to 
   reorder the libs in the link-command. -lws2_32 (missing htonl@4 etc.)
   should come after all other libs referring to those functions.

   


   

   g++ -DCURL_STATICLIB -DUSE_LIBSSH2 -DHAVE_LIBSSH2 -DCURL_DISABLE_LDAP
   -DHAVE_LIBSSH2_H -DLIBSSH2_WIN32 -DLIBSSH2_LIBRARY -DUSE_SSLEAY -O0
   -g3 -Wall -c -fmessage-length=0 -osrc\CURLDown.o ..\src\CURLDown.cpp

   g++ -L../lib -oCURLDown.exe src\CURLDown.o -lcurl -lcrypto -lwinmm
   -lgdi32 -lwldap32 -leay32 -lidn -lrtmp -lssh2 -lz -lssl32 -lssl
   -lws2_32

   


   

   Now I get only one error!!

   


   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0xb45): undefined reference to
   `timeGetTime@0'

   


   


   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

RE: RE: RE: RE: RE: Linker errors when statically compiled linking libcurl+openssl to my project

2011-08-26 Thread Oleksiy
   g++ -DCURL_STATICLIB -DUSE_LIBSSH2 -DHAVE_LIBSSH2 -DCURL_DISABLE_LDAP
   -DHAVE_LIBSSH2_H -DLIBSSH2_WIN32 -DLIBSSH2_LIBRARY -DUSE_SSLEAY -O0
   -g3 -Wall -c -fmessage-length=0 -osrc\CURLDown.o ..\src\CURLDown.cpp

   
   g++ -L../lib -oCURLDown.exe src\CURLDown.o -lcurl -lcrypto -lgdi32
   -lwldap32 -leay32 -lidn -lrtmp -lssh2 -lz -lssl32 -lssl -lws2_32
   -lwinmm


   

   It built without errors!! But when I ran it's just terminated, just
   like there - http://curl.haxx.se/mail/lib-2011-08/0161.html

   

   And dependency walkers says that IESHIMS.DLL, LIBIDN-11.DLL and
   LIBSSL32 is missing

   


   


   


   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Re: Re: Problem using static libraries libcurl with OpenSSL, minGW, Eclipse

2011-08-25 Thread Oleksiy
   Gisle Vanem gvanem_at_broadpark.no  wrote:

   Oleksiy patriot_of_ua_at_ukr.net wrote: 
   
 g++ -DCURL_STATICLIB -O0 -g3 -Wall -c -fmessage-length=0
   -osrc\main.o
 ..\src\main.cpp

 g++ -L..\lib -oYTUploader.exe src\main.o -lcurl -lws2_32 -lwldap32
 -leay32 -lssleay32 -lz
 The same thing
   
Try producing a .map file then:
g++ -Wl,--print-map,--sort-common,--cref -L..\lib -oYTUploader.exe \
src\main.o -lcurl -lws2_32 -lwldap32 -leay32 -lssleay32 -lz 
   YTUploader.map
   
Study it and figure out why things are as they are.

   


   

   Can you help me? I can't figure the things out. I generated map-file,
   here it is http://pastebin.com/JxuCDXzM

   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

RE: RE: Linker errors when statically compiled linking libcurl+openssl to my project

2011-08-25 Thread Oleksiy
   Looking at rand_win.c it uses CreateDCA, CreateCompatiableDC(), 
GetDeciceCaps() etc... which are defined in gdi32.lib.

   

   
These are defined in ws2_32.lib. 
   
What libraries is your application linking against? I'm not a MinGW
   /
Eclipse user but it looks like you will need to add gdi32.lib and
   ws2_32.lib
 to your project.

   


   

   ws2_32.lib was already linked, I added  gdi32.lib. Errors decreased.
   The following remain

   

   

   g++ -DCURL_STATICLIB -DUSE_LIBSSH2 -DHAVE_LIBSSH2 -DCURL_DISABLE_LDAP
   -DHAVE_LIBSSH2_H -DLIBSSH2_WIN32 -DLIBSSH2_LIBRARY -DUSE_SSLEAY -O0
   -g3 -Wall -c -fmessage-length=0 -osrc\CURLDown.o ..\src\CURLDown.cpp

..\src\CURLDown.cpp:18: warning: 'int writer(char*, size_t, size_t,
   std::string*)' defined but not used
   g++ -L../lib -oCURLDown.exe src\CURLDown.o -lcurl -lcrypto -lws2_32
   -lwldap32 -leay32 -lidn -lrtmp -lssh2 -lz -lssl32 -lssl -lgdi32
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1b3b): undefined reference to
   `inet_addr@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1ba4): undefined reference to
   `inet_addr@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x5d1e): undefined reference to
   `htonl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x5eed): undefined reference to
   `ntohl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x6f9a): undefined reference to
   `htonl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x728d): undefined reference to
   `htonl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x732c): undefined reference to
   `htonl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x757f): undefined reference to
   `ntohl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0xb45): undefined reference to
   `timeGetTime@0'
   ../lib/librtmp.a(hashswf.o):hashswf.c:(.text+0x164): undefined
   reference to `inet_addr@4'
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Re: Re: Problem using static libraries libcurl with OpenSSL, minGW, Eclipse

2011-08-25 Thread Oleksiy
   As I was told on StackOverflow, maybe the openssl-libs I link against
   seem to be import-libraries.

   


   

   That means they only contain the information your code needs to call
   functions and then load and call the corresponding functions from the
   dll.

   

   So the problem is: although you link to static libs, the libs then
   load and use dynamic dlls. They are no real static libs.

   


   

   I downloaded them from
   http://www.shininglightpro.com/download/Win32OpenSSL-1_0_0d.exe , used
   .a-files in folder called MinGW. Maybe I took wrong files from wrong
   place? I need static OpenSSL libs

   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

RE: RE: RE: RE: Linker errors when statically compiled linking libcurl+openssl to my project

2011-08-25 Thread Oleksiy
I just had to check MSDN for this one - and it says this function is
   defined
in winmm.lib.
   
I'm not too familiar with librtmp, so I just downloaded the source
   for it
and checked out it's makefile which includes the following when
   building
with mingw:
   
-lws2_32 -lwinmm -lgdi32
   
Can you add -winmm and see if that decreases the number of errors by
   1? If
not, then there is something else going wrong (as the unresolved
   externals
for ws2_32 have got me baffled at the minute)!

   


   

   Looks like this changes nothing :(

   


   

   g++ -DCURL_STATICLIB -DUSE_LIBSSH2 -DHAVE_LIBSSH2 -DCURL_DISABLE_LDAP
   -DHAVE_LIBSSH2_H -DLIBSSH2_WIN32 -DLIBSSH2_LIBRARY -DUSE_SSLEAY -O0
   -g3 -Wall -c -fmessage-length=0 -osrc\CURLDown.o ..\src\CURLDown.cpp

..\src\CURLDown.cpp:18: warning: 'int writer(char*, size_t, size_t,
   std::string*)' defined but not used
   g++ -L../lib -oCURLDown.exe src\CURLDown.o -lcurl -lcrypto -lws2_32
   -lwinmm -lgdi32 -lwldap32 -leay32 -lidn -lrtmp -lssh2 -lz -lssl32
   -lssl
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1b3b): undefined reference to
   `inet_addr@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1ba4): undefined reference to
   `inet_addr@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x5d1e): undefined reference to
   `htonl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x5eed): undefined reference to
   `ntohl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x6f9a): undefined reference to
   `htonl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x728d): undefined reference to
   `htonl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x732c): undefined reference to
   `htonl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x757f): undefined reference to
   `ntohl@4'
   ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0xb45): undefined reference to
   `timeGetTime@0'

   ../lib/librtmp.a(hashswf.o):hashswf.c:(.text+0x164): undefined
   reference to `inet_addr@4'

   


   
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Problem using static libraries libcurl with OpenSSL, minGW, Eclipse

2011-08-12 Thread Oleksiy
 I downloaded compiled static libs of OpenSSL, from here -
   http://www.shininglightpro.com/download/Win32OpenSSL-1_0_0d.exe , this
   link is on the official cUrl site in Download page. I downloaded Zlib
   and compiled them, then I compiled libcurl with 
   mingw32-make mingw32-ssl-zlib

   I changed in all makefile.m32 pathes to the Zlib and OpenSSL files.
   All went fine, I recieved libcurl.a and libcurldll.a. I added into lib
   folder of my project libcurl.a and libeay32.a, libssleay32.a and
   libz.a. I built project - it says that everything is fine. I run - and
   it just terminated. I'm using MinGW and Eclipse.

   It is compiled with this:
   g++ -DCURL_STATICLIB -O0 -g3 -Wall -c -fmessage-length=0 -osrc\main.o
   ..\src\main.cpp

   g++ -L..\lib -oYTUploader.exe src\main.o -lcurl -lcurldll -lws2_32
   -lwldap32 -leay32 -lssleay32 -lz

   I run DependencyWalker, and it says that it's missing ieshims.dll,
   libeay32.dll and ssleay32.dll. But WHY? Why it want OpenSSL dll, I'm
   using static linking! I built static libCurl library, with static libs
   of OpenSSL. About ieshims.dll I also can't get why it needs it! Help,
   please, I have no idea what is wrong! I compiled cUrl according to the
   instruction, everything should be fine..
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Re: Re: Problem using static libraries libcurl with OpenSSL, minGW, Eclipse

2011-08-12 Thread Oleksiy
 g++ -DCURL_STATICLIB -O0 -g3 -Wall -c -fmessage-length=0 -osrc\main.o
   ..\src\main.cpp

   g++ -L..\lib -oYTUploader.exe src\main.o -lcurl -lws2_32 -lwldap32
   -leay32 -lssleay32 -lz
   The same thing 
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html