Opened 6 years ago

Closed 6 years ago

#3107 closed defect (fixed)

_get_trust_root() not quite right.

Reported by: docwhat Owned by: dalius
Priority: normal Component: AuthOpenIdPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


The _get_trust_root() method doesn't always work right. Attached is the simple fix for just the case I ran into. (I set TRAC_BASE_URL and it caused href() and abs_href() to return non-overlapping parts of the URL).

The correct solution is probably to normalize the URL somehow. I think the openid library has something for that.

Attachments (1)

get_trust_root.patch (459 bytes) - added by docwhat 6 years ago.
Simple patch

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by docwhat

Simple patch

comment:1 Changed 6 years ago by dalius

What is your base_url? I have trac site running with base_url "". I am asking because I want to understand what exactly problem you have.

comment:2 Changed 6 years ago by anonymous

No worries!

Due to spam blocking, I've had to munge all links. I'm adding a single space character to break it up.

I'm using supervise to manage tracd, here's my run script:
exec 2>&1
echo 'tracd starting.'
exec sudo -H -u trac \

env \

PYTHON_EGG_CACHE=/trac/.egg_cache/ \
TRAC_ENV_INDEX_TEMPLATE=/trac/templates/top_index.html \
tracd \
--port 9123 \
--hostname \
--env-parent-dir=/trac/projects \
--base-path / \
--protocol http

Without the patch I included I get the following values for
req.href() == '/itsalltext'
req.abs_href() == 'http'
returned base_url == 'http :

The code in trac's don't make it clear to me what abs_href vs. href is supposed to do. On the plus side, it looks like you can actually use req.base_url directly.


comment:3 Changed 6 years ago by dalius

  • Resolution set to fixed
  • Status changed from new to closed

That's what actually you should expect from those functions (or something similar):
req.href(): /trac_test

Result in your case looks very unclear. I have created fix for plugin if it is affect by such situation. Get newest plugin version from trac or

base_url is possible solution as well but I'm not sure about that yet because base_url might point to project. That will conflict with absolute_trust_root option of this plugin.

P.S. Thank you for "It's all text". I'm using very small number of FireFox add-ons and this one is I like very much.

Add Comment

Modify Ticket

as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from dalius. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.