cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl produces 0byte files for some refered links

From: Wei Weng <wweng_at_acedsl.com>
Date: Tue, 14 Oct 2008 14:40:12 -0400

Jan wrote:
> Wei,
> sorry for the late response.
>
> i checked my 0byte files carefully and i found out that most of them are
> redirects to https. my current libcurl build (windows) has no ssl
> support, so thats the problem.
> one url keeps me wondering:
> http://www.youtube.com/?hl=en&tab=n1 <http://www.youtube.com/?hl=en&tab=n1>
> when i use this one with your function i get a:
> HTTP/1.1 400 Bad Request
> but why? in firefox the redirect is working fine...
>
> --
> Jan
>

Jan, you should probably try to get this thing work with curl (executable)
first then wrap it with libcurl calls.

This is the output of "liveHttpHeaders" addon for firefox3. You should
definitely try to fill in the user-agent field as a start.

http://www.youtube.com/?hl=en&tab=n1

GET /?hl=en&tab=n1 HTTP/1.1
Host: www.youtube.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3)
Gecko/2008092510 Ubuntu/8.04 (hardy) Firefox/3.0.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,zh-cn;q=0.7,zh;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: VISITOR_INFO1_LIVE=Z5-lgtZOG-c; PREF=qvdm=2&gl=US&hl=en&f1=20;
__utma=27069237.2193309479148165400.1218425944.1223504474.1223616256.3;
__utmz=27069237.1218425944.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
watched_video_id_list_xxturboweixx=6a8c0d6c69c35e386b38e2d8fdb043b0WwUAAABzCwAAAE9lNXBrWGtTbVp3cwsAAABRZWh4anViNWx5b3MLAAAAbGNxV0tVUUVWbGNzCwAAADlnbzM4TWdaNHc4cwsAAABybzNQUzdwdFlSUQ==;
__utmv=27069237.yva_autoplay;
GEO=16cba5173a23a25e7709fa5934917bf8cwwAAAAyVVNCckMvAHhe8kg=;
use_hitbox=72c46ff6cbcdb7c5585c36411b6b334edAEAAAAw

HTTP/1.x 303 See Other
Date: Tue, 14 Oct 2008 18:36:49 GMT
Server: Apache
Expires: Tue, 27 Apr 1971 19:44:06 EST
Cache-Control: no-cache
Location: http://www.youtube.com/?tab=n1
Keep-Alive: timeout=300
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

HTH

Thanks
Wei
Received on 2008-10-14