curl-library
Libcurl suggestions
Date: Sun, 7 Dec 2003 19:18:45 -0500
These are just some of the things I'd really like to see in libcurl. I
definately need them for my project, and I'm sure other's need them for
other projects.
1.) CURLOPT_URLENCODE
If specified this will force libcurl to automatically URL Encode the URL.
Encoding a URL isn't as simple as running it through curl_escape. For
example, curl_escape will encode the :// part of the http://. This means I
must first split the URL apart, do the escaping, then rejoin it. It seems
stupid to do all that when the splitting apart is already done by libcurl
internally, why not just allow it to encode the URL for the user? I'm sure
this is something that many people would find useful since it would simplify
getting files from a URL.
2.) CURLOPT_DISABLEPROTOCOLS
Basically this is a runtime version of things like --disable-telnet. You
specify an slist that contains the names of the protocols you want disabled.
This is useful because, while --disable-telnet does the same thing, what if
Program1 wants just telnet:// and Program2 wants just http://, why should
there need to be two seperate libraries compiled? It seems to me that doing
this at runtime is the way to go. And yes, this could be done rather easily
in the client application (which is how I currently do it), it seems like it
should be in the library itself.
3.) curl_getfilename(CURL *curl);
Getting the filename can be rather difficult. You need to be very familiar
with the URL scheme. Meaning you need to know where the file is located in
the URL itself. Why should the client programmer need to have intimate
knowledge of the URLs? Isn't that what the library is supposed to handle? In
my program, the user specifies a url, say http://www.blah.com/file.txt, I
want to download that and save it as file.txt. In that URL it is easy to
parse, but the URL can be more complex. I might have a query string for
example. And for all I know, maybe in version 7.20.0 curl will have support
for fake:// which uses something completely different maybe,
fake://host.com/download,file.txt. When I created my program, fake:// didn't
exist, but when 7.20.0 is released, maybe it does. Now I need to go edit my
program. If however curl had a function to get the filename, I would not
need to edit my program since curl would know when I request the file, if it
is a fake:// url, that the file is actually after the download,. It seems to
me as though this is a common enough thing to want to do to warrant having a
function to retrieve it.
Does anyone else think such features would be useful, or is this something
that only I need?
Dominick Meglio
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-08