Opened 13 years ago

Last modified 13 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.



Change History (8)

comment:1 by Elrond, 13 years ago

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



comment:2 by Elrond, 13 years ago

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 by Christopher Allan Webber, 13 years ago

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 by Elrond, 13 years ago

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



comment:5 by Elrond, 13 years ago

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 by Elrond, 13 years ago

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

Comments welcome!



comment:7 by Christopher Allan Webber, 13 years ago

Milestone: 0.2.00.1.0
Status: FeedbackClosed
Merged!



comment:8 by Will Kahn-Greene, 13 years ago

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

Note: See TracTickets for help on using tickets.