Opened 11 years ago

Last modified 11 years ago

#257 closed defect (FIXED)

request.path_info sometimes used incorrectly

Reported by: Elrond Owned by: Christopher Allan Webber
Priority: minor Milestone: 0.1.0
Component: programming Keywords:
Cc: Parent Tickets:

Description

When running mediagoblin in a subpath, like /mediagoblin/, then
some things are a little complex.

For ``/mediagoblin/u/elrond/`` ``request.path_info`` becomes
``/u/elrond/``.


-  This is good, when trying to match routes. Simple, fine, job
   done.
-  This is BAD, when generating URLs like "request.path\_info +
   foo" for the browser, because the browser will only see
   ``/u/elrond/foo``. Which is wrong. Problem.

I know, that the environ has SCRIPT\_NAME ("``/mediagoblin``" in
this case), but it's not entirely clear, on how to procede from
here.

Assigning to Chris, as he created most of the base infrastructure
and surely has comments.



Subtickets

Change History (8)

comment:1 Changed 11 years ago by Elrond

If mediagoblin wants to support subdir hosting for 0.1.0, then this
bug should be targetted for 0.1.0.



comment:2 Changed 11 years ago by Elrond

One possible, simple way to help this issue:

::

    request.long_path = environ["SCRIPT_NAME"] + request.path_info
    # or
    request.long_path = environ["SCRIPT_URL"]

And then ``request.long_path`` can be used in many places to mean
the long, useful URL to reach the current page (without query
params).

In reality, I think, no places (except routing) need
request.path\_info. So maybe it should be banned somehow?



comment:3 Changed 11 years ago by Christopher Allan Webber

Just to be sure, you changed how this was "mounted" via paste, is
that correct? Or was it via fastcgi, or some other thing?



comment:4 Changed 11 years ago by Elrond

plain fastcgi: My main webserver serves my main site. And it
redirects /mediagoblin/ via fcgi to GMG.



comment:5 Changed 11 years ago by Elrond

Milestone: 0.2.0
Owner: changed from Christopher Webber to Elvenlord Elrond
I volunteered to take care of this.
Especially, as I understand the problem quite well and have an idea
on how to fix it.



comment:6 Changed 11 years ago by Elrond

Owner: changed from Elvenlord Elrond to Christopher Webber
Status: NewFeedback
Branch: misc/i592\_use\_full\_path

Comments welcome!



comment:7 Changed 11 years ago by Christopher Allan Webber

Milestone: 0.2.00.1.0
Status: FeedbackClosed
Merged!



comment:8 Changed 11 years ago by Will Kahn-Greene

The original url for this bug was http://bugs.foocorp.net/issues/592 .

Note: See TracTickets for help on using tickets.