cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: fixing schemes and domains on the fly

From: Yaroslav Samchuk <yarcat_at_ank-sia.com>
Date: Fri, 19 Oct 2007 14:19:17 +0300

Hey,

I made small patch adding four features:
1) url checking callback (could be used to fix current url before
it's actually used in query)
2) user-defined data passed to callback from (1)
3) Set-Cookie checking callback (could be used to fixed given cookie,
but does not allow to exclude cookie)
4) user-defined data passed to callback from (3)

Seems that for me it's working just fine atm, but I still want these
changes to be reviewed - may be I did smth completely wrong. Mostly I
wanna ensure I did not add any memory leaks.

Actually, the change I have made in 7.17.0 (http://curl.haxx.se/
download/curl-7.17.0.tar.bz2), but today I have patched the HEAD and
provided diff is a diff between HEAD and my local copy (I also have
made some tests to ensure it's compiling and works).

If my change is or seems to be ok - is it possible to include it into
sources? It will be too inconvenient to patch manually every new
libcurl release. If you have any suggestions, requests, claims, etc
(like I do have to provide/update documentation, create test cases,
etc) before this patch could be included - please tell me and I'll
try to satisfy them.

--
Best regards,
Yaroslav Samchuk
The diff: 


Usage example:

On 16.10.2007, at 17:37, Yaroslav Samchuk wrote:

> Hello,
>
> I'd like to point that links to mailman, python-powered and gnu-
> head-tiny pictures are broken (noticed during the mailing-list
> subscription process). At least they were broken for me.
>
> I have the question which basically is defined in the subject. I
> have a proxy-like application, which receives some queries,
> converts them into http requests, sends to http server, receives a
> response and sends back using originator's protocol.
>
> Everything would be nice if I wouldn't have to handle redirects on
> proxy side. The problem is that I have to handle cookies as well
> (but for the original domain only) and I have to tweak domains and
> schemes. Every domain and scheme I receive from http servers (even
> together with "Location:" header) is kind of encoded. I have to
> decode these values, patch "Set-Cookie:" to correspond to decoded
> domains, follow all redirects and only than I can return the
> response (together with all new cookies for the original domain).
>
> Do anyone have an idea what is the best place to do this? I already
> spent some time reading the code and trying to patch libCURL to
> have required callbacks, but still wanna ask creators - may be I
> have missed something and there is an at least semi-legal way to do
> this strange stuff in the library? Or may be any suggestion about
> the functions I have to patch (this would probably save me half of
> the day tomorrow)...
>
> Waiting for replay asap - I really was in need of this feature
> already yesterday :-S
> Thanks in advance.
>
> --
> Best regards,
> Yaroslav Samchuk
>

  • application/octet-stream attachment: example.c
Received on 2007-10-19