cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [RFC PATCH] Support for overriding open function for file: URLs

From: Mike Crowe <mac_at_mcrowe.com>
Date: Thu, 15 Dec 2011 14:24:52 +0000

On Mon, Dec 12, 2011 at 11:38:57AM -0800, Dan Fandrich wrote:
> On Mon, Dec 12, 2011 at 05:05:06PM +0000, Mike Crowe wrote:
> > I'd like to be able to change the actual path opened when libcurl
> > handles file:/// URLs. It seems that the easiest way to do this would
> > be to support an alternative function that is called by file_connect
> > when it wants to open a file. This patch does this and if the general
> > approach is acceptable I'll knock it into better shape. But, before
> > that I have a few questions:
>
> This seems to be trivial to implement by rewriting the URL in the
> application before setting CURLOPT_URL. Is there any reason that
> approach can't be used instead?

You are probably correct. The only time I think this might not work is
if CURLOPT_REDIR_PROTOCOLS includes CURLPROTO_FILE and someone
redirects to a file:/// URL. That isn't important in my case.

When I set off down this path I thought that libcurl's URL parsing for
file:/// URLs would be more involved and I wanted to avoid
duplication. It turned out to be quite simple.

Thanks for your help.

Mike.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-12-15