curl-users
Debug the script that uses curl to upload stuff.
Date: Wed, 17 Sep 2008 02:47:35 -0400
Dear All:
This is what I do. :)
First, make sure you read the doc. http://curl.haxx.se/docs/httpscripting.html
1: install a packet sniffer, you can use wireshark on linux, and httplook on
windows. (Although there is also the win32 version of wireshark, it is an
overkill for a simple purpose of sniffing http packets only)
2: turn on the packet sniffer. (for wireshark you need to also set up filter)
Do a upload from the browser/application that works, and also the script that
you are debugging. Simplify the problem down to a single curl command. Save
the sniffed packet data respectively. I use follow tcp stream in wireshark
then save. I think httplook has a even simpler interface.
3: check the packet file, make sure all the field is included in your curl
command. Also check cookies and user agent, a lot of problems come from
missing cookies or incorrect user agents.
4: if it still doesn't work, try to imitate the headers from the
browser/application that works completely in your curl command. Sometimes the
web server does whacky things and reject perfectly fine http request.
5: ...Profit!...
Happy coding!
Thanks
Wei
-------------------------------------------------------------------
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-17