cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl - resolve http requst on terminal but not in my program

From: Sachin Gole <svgole_at_gmail.com>
Date: Fri, 12 Sep 2008 17:16:22 +0530

hi,

Thanks to all for kind reply.

As per mailing discussion. I added user agent by following way.

Started wireshark utility and tried following on terminal

>curl "http://mt1.google.com/mt?x=92&y=200&zoom=8" -o "file1"

in wireshark, i found

User Agent : curl/7.19.0 (arm-unknown-linux-gnueabi) libcurl/7.19.0
OpenSSL/0.9.8g zlib/1.2.3

Now, in my program i added

 curl_easy_setopt(curl,CURLOPT_USERAGENT,"curl/7.19.0
(arm-unknown-linux-gnueabi) libcurl/7.19.0 OpenSSL/0.9.8g zlib/1.2.3\r\n");

  struct curl_slist* headers = 0;
  headers = curl_slist_append(headers, url);
  curl_easy_setopt(curl, CURLOPT_HEADER, headers);

with above option, Now i am able to download requested file, with following
reply

---------------------------------------------------------------------------------------------------------

* About to connect() to proxy 172.18.1.16 port 80 (#0)
* Trying 172.18.1.16... * connected
* Connected to 172.18.1.16 (172.18.1.16) port 80 (#0)
> GET http://mt1.google.com/mt?x=736&y=1605&zoom=5 HTTP/1.1
User-Agent: curl/7.19.0 (arm-unknown-linux-gnueabi) libcurl/7.19.0
OpenSSL/0.9.8g zlib/1.2.3

Host: mt1.google.com
Pragma: no-cache
Accept: */*
Proxy-Connection: Keep-Alive

< HTTP/1.1 200 OK
< Content-Type: image/png
< Expires: Fri, 11 Sep 2009 13:10:04 GMT
< Last-Modified: Fri, 17 Dec 2004 04:58:08 GMT
< Date: Thu, 11 Sep 2008 13:10:04 GMT
< Server: Keyhole Server 2.4
< Content-length: 26034
< Proxy-Connection: Keep-Alive
< Connection: Keep-Alive
< Age: 81008
<
* Connection #0 to host 172.18.1.16 left intact

------------------------------------------------------------------------------------------------

facing new problem, i am not able to open the file. couldnt open.

it is also not showing file type. it is unknown. but size of file is
correct.

do i am missing something in http header ?

Thanks,
Sachin Gole.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2008-09-12