Modify

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

Description

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 "http://trac.sandbox.lt/skaityta/". 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:
!/bin/sh
exec 2>&1
echo 'tracd starting.'
exec sudo -H -u trac \

env \

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

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

The code in trac's env.py 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.

Ciao!

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
req.abs_href(): http://127.0.0.1:8000/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 http://hg.sandbox.lt/authopenid-plugin/archive/v0.1.2.tar.gz

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

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.