Re: Store_url_rewrite for squid 3+

From: Eliezer Croitoru <eliezer_at_ngtech.co.il>
Date: Wed, 05 Sep 2012 09:56:20 +0300

On 9/5/2012 8:00 AM, Amos Jeffries wrote:
> On 5/09/2012 4:10 p.m., Eliezer Croitoru wrote:
>> I'm reading some code (will take a while) to maybe get a functional
>> store_url_rewrite for squid3+.
>>
>> Actually i was thinking about it a lot and the process should be very
>> simple:
>> use some stdin+stdout like for url_rewrite interface for starter.
>
> Yes. The redirect.cc interface can be used. The caller code runs
> *_access checks and provides a callback function which uses the
> resulting URL to do things to store keys.
>
>> i think this is can be done pretty fast if someone knows the current
>> code.
>> it's kind of replicate the url_rewrite and change all the directives
>> names from url_rewrite to store_url_rewrite and let someone write the
>> functions.
>>
>> how is this as a starter to maybe make it work?
>
> Exactly what I was planning. Just a lack of store code knowledge getting
> in the way.
>
>>
>> It should be done before the request is being done and i think that
>> before url_rewrite helper.
>
> At the point where cache key is being decided I think. Which is just
> before HIT lookup. After adaptations like url_rewrite.
>
>>
>> the next step after that is to take the "to be cached" entry and
>> change the the key of the stored object. as it will be stored at in
>> the cache and not like the old store_url_rewrite that was saved in a
>> formart of old+new url.
>>
>> how about just start with the basics of putting the whole redirector
>> as in with store_url_rewrite?
>>
>> how hard can it be?
>
> Want to give it a try?
Well I would like to but it seems i'm lacking of knowledge in c\c++ and
squid structure.
I do recognize that there is a language there with some structure since
I did wrote using java and ruby.
(just wrote a small proxy for specific protocol that peers two tcp
incoming connections after verification of identity and it seems to rock)

I was thinking to start with creating a store_url_rewrite (fake) that
will debug and all but will not do any changes except logging.
If I\we can make this stage it will benefit anyone who will want to
integrate some new interface for squid.

So I started playing with the sources but since squid is a big puzzle
for me I dont know where and what I should put or look for pieces of
code related to the redirect.cc .
what I did as a starter is to take redirect.cc (3.2.1)and change all the
methods names I could find\think off to a "srewriter" syntax such as:
redirectRegisterWithCacheManager();
to
srewriteRegisterWithCacheManager();

file and diff attached.

after that I tried to find anything related to redirect.cc in the
makefiles and have seen:
at:
./src/Makefile.am
./src/Makefile.in

so i suppose i should add to every place of redirect.cc also srewrite.cc
(but i'm dont know...)

I didnt made any changed to the srewrite.cc that will make it "harmless"
and "fake" yet.

now the hard part for me is: how would I find any redirect.cc in the
rest of squid and make sure to add the needed code for srewrite.cc?

I can parse the srewrite.cc but since I dont know any of the code
structure I wouldnt know what to extract and look for.

I noticed kinkie did pretty things while parsing the code.

I took a peer at the old store_url_rewrite and it seems to be divided
into "client_side_storeurl_rewrite.c", "store_rewrite.c"
and has some struct in structs.h for children concurrency and command.

On 3.2.1 it's seems to be organized better and only in couple files such
as the redirect.cc and others.

any leads,?

Eliezer

-- 
Eliezer Croitoru
https://www1.ngtech.co.il
IT consulting for Nonprofit organizations
eliezer <at> ngtech.co.il


Received on Wed Sep 05 2012 - 06:56:33 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 06 2012 - 12:00:07 MDT