[TYPO3-core] Status of RFC: #9046: Nested domain linking with domain record on root page

Ernesto Baschny [cron IT] ernst at cron-it.de
Wed Oct 7 19:07:19 CEST 2009


Hi,

can someone explain the "caching" problem? Tobias, Ingmar?

In my eyes, if you cache the page that has links pointing to other
domains, those links will still work. If there are links pointing to the
same domain (thus relative to the current domain), the links in the
cache also work, as they are relative (and not prepended by the
HTTP_HOST). In my understanding (haven't reviewed or tested the patch, I
must confess) the HTTP_HOST is never stored in the cache and the cached
page is independent on which HTTP_HOST was used to access the page. Why
would it be different?

Using HTTP_HOST (which comes from the user) to store *anything* is
dangerous anyways, because this can easily be exploited (e.g. to flood
the cache table).

So I find the bug in the patch is there that we use HTTP_HOST to decide
if we should prepend another domain to the URL or not. We should simply
match the PID of the sys_domain record used for the destination page
link with the sys_domain records PID from the current page. If they are
the same, the link is "relative". To decide that we don't even need to
consider the users HTTP_HOST (which only decides which page to render).

Cheers,
Ernesto

Ingmar Schlecht schrieb:
> Hi Daniel,
> 
> I think the inclusion of the domain name into the cache idintifier is
> still open. If you could find a solution to that, I think that would
> speed it up.
> 
> cheers
> Ingmar
> 
> Daniel Pšötzinger schrieb:
>> Hey
>>
>> Whats the status if this? Would really like to see it in 4.3!
>>
>> Thx
>>
>>
>> Tobias Liebig schrieb:
>>> Thanks Daniel, for testing.
>>>
>>> You're right, the patch v6 does not apply due to changes in trunk in
>>> the meanwhile.
>>>
>>> We now have two +1's, but i will not commit until the caching issue is
>>> not solved.
>>> I'll file an issue in the bugtracker and raise a thread in the
>>> dev-list for that today.
>>>
>>> regards
>>>   tobias
>>>
>>>
>>> Daniel Pšötzinger schrieb:
>>>> +1 on testing
>>>>
>>>> Also the latest patch do not work because of small adustments in trunk
>>>> I attached new onw
>>>>
>>>>> Ingmar and i had a review session during the T3CON. We discussed the
>>>>> solution, tested serveral situations.
>>>>> The attached patch fixes some issues regarding the forced domain
>>>>> mainly.
>>>>>
>>>>> i'm sure about Ingmar's +1, but we still need another +1.
>>>>>
>>>>> Further we need to fix the cache issues (see below, add domain to
>>>>> the cache identifier).
>>>>>
>>>>> So if you can help out and need any help from my side (further
>>>>> explanation or test-setup), do not hesitate to contact me.
>>>>>
>>>>>
>>>>> regards
>>>>>    tobias
>>>>>
>>>>>
>>>>>
>>>>> Tobias Liebig schrieb:
>>>>>> Hej,
>>>>>>
>>>>>> sorry for being that late on this issue!
>>>>>>
>>>>>> After some discussions we (at least Ingmar, Christopher, Dmitry and
>>>>>> some more people during the T3DD) decided for the following solution:
>>>>>>
>>>>>> * if the current page is part of the target pages rootline, the
>>>>>> target page is reachable within the current domain and thus we do
>>>>>> not need to prepend the domain to the link
>>>>>> * if not, step downwards the rootline of the *target page*
>>>>>> * search for the first domain record in the target rootline
>>>>>> * if this 'targetDomain' is not the same as the currently called
>>>>>> HTTP_HOST, prepend the link with this domain
>>>>>>
>>>>>> * the flag is_siteroot (oage properties) does not play here any
>>>>>> role anymore
>>>>>>
>>>>>>
>>>>>> Additionaly we think it makes sense to be able to force a domain
>>>>>> prepending (always prepend that domain). So i've added a 'forced'
>>>>>> flag to sys_domain, and:
>>>>>>
>>>>>> * search for a domain record which has the 'forced' flag within the
>>>>>> target page rootline
>>>>>>
>>>>>> So a subpage would be prepended with the 'forced' domain, even if
>>>>>> the page would be available within the current domain. This is
>>>>>> pretty helpful for independent subpages like in christophers example.
>>>>>>
>>>>>>
>>>>>> The attached patch implements this solution. It's created initially
>>>>>> by Oli and discussed with Ingmar. Addionally i implemented the
>>>>>> 'forced' flag in the domain record.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Known Issues:
>>>>>> * caching / domain name
>>>>>>
>>>>>> The patch takes the current domain (HTTP_HOST) into account.
>>>>>> If a page is available by multiple domains, and is cached the
>>>>>> solution may fail, if the page is delivered from cache.
>>>>>> So we need separate caches per HTTP_HOST, which can be achieved
>>>>>> easily by adding the HTTP_HOST to teh cache identifier/hash
>>>>>> I'm not that into the caching mechanism, so someone need to help out.
>>>>>> If i remember right, Dmirty told he started to implement something
>>>>>> like that for memcache caching.
>>>>>>
>>>>>>
>>>>>> * speed up by using a cache for sys_domains
>>>>>>
>>>>>> currently we do a database query on sys_domains for *each* typolink
>>>>>> on the page. I'm sure we can save some queries, if we memroize all
>>>>>> records in an array (i think sys_domain would not contain many
>>>>>> records usually).
>>>>>> But i'm not sure where to store that array. Any suggestions? (TSFE,
>>>>>> GLOBALS)
>>>>>>
>>>>>>
>>>>>> Note:
>>>>>> i'm not sure, if this is a new feature (due to the forced flag in
>>>>>> sys_domain), or more like an 'enhanced' bugfix
>>>>>>
>>>>>> Note II:
>>>>>> Before we can commit this, we should solve the caching issue!
>>>>>> For testing and reviewing the patch, you may want to turn off caching.
>>>>>>
>>>>>> regards
>>>>>>    tobias
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Christopher Hlubek schrieb:
>>>>>>> Hi,
>>>>>>>
>>>>>>> This is an SVN patch request.
>>>>>>>
>>>>>>> Type: Bugfix
>>>>>>>
>>>>>>> Branches: Trunk, TYPO3_4-2
>>>>>>>
>>>>>>> Bugtracker references:
>>>>>>> http://bugs.typo3.org/view.php?id=9046
>>>>>>>
>>>>>>>
>>>>>>> Problem:
>>>>>>>
>>>>>>> Consider the following setup with multiple domains:
>>>>>>>
>>>>>>> + root (domain A, siteroot)
>>>>>>> |
>>>>>>> +--+ Subsite (domain B, siteroot)
>>>>>>> | |
>>>>>>> | +--+ Subpage
>>>>>>> |
>>>>>>> +--+ Some Page
>>>>>>> |
>>>>>>> +--+ Other Page
>>>>>>>
>>>>>>> Even with typolinkEnableLinksAcrossDomains enabled, the links from
>>>>>>> the subsite (domain B) back to some page on domain A won't get
>>>>>>> domain A prepended.
>>>>>>>
>>>>>>>
>>>>>>> How to reproduce:
>>>>>>>
>>>>>>> Create a site with a similar page structure and multiple, nested
>>>>>>> domain records like above. Create a link from the inner domain to
>>>>>>> some page with the outer domain -> The link doesn't get the outer
>>>>>>> domain prepended.
>>>>>>>
>>>>>>> Solution:
>>>>>>> In class.tslib_content.php (5324) there is a check for every part
>>>>>>> in the rootline, if the linked page shares a root page with the
>>>>>>> current page. It does! The recently added check for is_siteroot is
>>>>>>> not considered, because it is checked after this. So these checks
>>>>>>> should be swapped to check for is_siteroot first and find the
>>>>>>> domain record on the root page.
>>>>>>>
>>>>>>> Additionally there should be another tweak to not always include
>>>>>>> the domain for pages that link between the outer domain (which
>>>>>>> will always be found). This could be accomplished by comparing the
>>>>>>> HTTP_HOST with the domain that should be prepended.
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>> Christopher


More information about the TYPO3-team-core mailing list