Ticket #26 (closed defect: worksforme)

Opened 2 years ago

Last modified 2 years ago

wrong script_name on dreamhost with flup

Reported by: Randy Selzler <RSelzler@…> Owned by: sheep
Priority: Normal Milestone:
Component: Hatta Wiki Version: 1.3.3dev
Keywords: Cc: RSelzler@…

Description

I'm trying to use flup with Hatta on DreamHost, without much luck.

Radomir, do you have any idea where I'm going wrong? Here are some details for my simple test (in a Hatta page where I understand the markup, instead of Trac where I'm less confident).

bash$ # Which Hatta am I using...
bash$ hg log -r tip -R /home/rselzler2/HATTA/hatta-dev-D/
changeset:   753:29e40d23c6d1
tag:         tip
user:        sheep@wintermute
date:        Fri Jan 29 11:54:15 2010 +0100
summary:     really fix the lambdas in reindexing
bash$ # Test flup with Hatta
bash$ cd data-warp.com/poss_web/
/home/rselzler2/data-warp.com/poss_web
bash$ # What is my initial state...
bash$ ls -l
total 4
-rwxr-xr-x 1 rselzler2 pg2258840 934 2010-02-09 02:44 dispatch.fcgi*
bash$ # What is in dispatch.fcgi...
bash$ cat dispatch.fcgi 
#!/home/rselzler2/local/bin/python
# -*- coding: utf-8 -*-

#import flup
#import sys

import sys, os
from flup.server.fcgi import WSGIServer

# XXX Uncomment and edit this if hatta.py is not installed in site-packages
#sys.path.insert(0, "/path/to/dir/with/hatta/")
sys.path.insert(0, "/home/rselzler2/HATTA/hatta-dev-D/")
import hatta

config = hatta.WikiConfig(
pages_path='/home/rselzler2/data-warp.com/poss_web/pages/', # XXX Edit this!
cache_path='/home/rselzler2/data-warp.com/poss_web/cache/', # XXX Edit this!
interface='pseis.org'
)
config.parse_args()
config.parse_files()
config.sanitize()
wiki = hatta.Wiki(config)
app = wiki.application

# XXX Uncomment this, if you are using fastcgi on / on Lighttpd
#def app(env, start):
#    env['PATH_INFO'] = env['SCRIPT_NAME'] + env['PATH_INFO']
#    env['SCRIPT_NAME'] = ''
#    return wiki.application(env, start)

#flup.server.fcgi.WSGIServer(app).run() 
WSGIServer(app).run() 

Some web sites suggest executing ./dispatch.fcgi
to help troubleshoot.
I've no idea what to expect, but this is what I happen to get.

bash$ # What is the result of a simple tests...
bash$ ./dispatch.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 303 SEE OTHER
Content-Type: text/html; charset=utf-8
Location: http://localhost/+edit/Home

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
bash$  should be redirected automatically to target URL: <a href="http://localhost/+edit/Home">http://localhost/+edit/Home</a>.  If not click the link.bash$ 
bash$ 

The URL references "localhost", which seems wrong.
I was hoping for "pseis.org" (the interface parameter in dispatch.fcgi).

Regardless, Hatta seems to have executed and directory contents changed.

bash$ # What changed in my directory...
bash$ ls -l *
-rwxr-xr-x 1 rselzler2 pg2258840  934 2010-02-09 02:44 dispatch.fcgi*

cache:
total 8
-rw-r--r-- 1 rselzler2 pg2258840 6144 2010-02-09 02:48 index.sqlite3

pages:
total 0

If I browse to  http://pseis.org then I see a directory list,
instead of Hatta.
I was hoping to see Hatta display an empty Edit page for Home.

      cache/                  09-Feb-2010 02:48    -   
      dispatch.fcgi           09-Feb-2010 02:44  934   
      pages/                  09-Feb-2010 02:48    -   

If I browse to  http://pseis.org/dispatch.fcgi then I see Hatta,
which is encouraging :).
It displays an empty Edit page, titled ##Editing "dispatch.fcgi"##.
I was hoping the title would be ##Editing "Home"## :(

Yesterday was 14 hours of trial-error and I have bruises
around the head and shoulders to show for it.

Change History

comment:1 Changed 2 years ago by sheep

It looks like it's failing to get the SCRIPT_NAME and PATH_INFO from the request correctly for some reason. Something similar to why the "XXX" part was added in that dispatcher, except that the other way around. I suppose you can force the SCRIPT_NAME to "/dispatch.fcgi" and remove that part from the beginning of PATH_INFO... Something like:

def app(env, start):
    script_name = '/dispatch.fcgi'
    env['SCRIPT_NAME'] = script_name
    env['PATH_INFO'] = env['PATH_INFO'][len(script_name):]
    return wiki.application(env, start)

But this is a hack, I'd rather want to know why flup fails... -- Radomir Dopieralski

comment:2 Changed 2 years ago by Randy

Okay, I put those 5 lines in and tried it again...
The message printed by executing ./dispatch.fcgi changed:

bash$ ./dispatch.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 303 SEE OTHER
Content-Type: text/html; charset=utf-8
Location: http://localhost/dispatch.fcgi/+edit/Home

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
bash$  should be redirected automatically to target URL: <a href="http://localhost/dispatch.fcgi/+edit/Home">http://localhost/dispatch.fcgi/+edit/Home</a>.  If not click the link.bash$ 

If I browse to  http://pseis.org then, I see the directory listing.

If I browse to  http://pseis.org/dispatch.fcgi then
Firefox displays an error...

Redirect Loop

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.

Does this provide a useful clue?

FYI

I installed flup 1.0.2 (instead of the newest 1.0.3) using

easy_install ~/PADM/stash/Flup/flup-1.0.2-py2.5.egg

The 1.0.3 version kept failing with...

AttributeError: 'CGIRequest' object has no attribute '_timeout'

-- Randy

comment:3 Changed 2 years ago by sheep

Sorry, I moved it here, it should be easier to talk about it.

OK, it looks like now it gets wrong PATH_INFO, so it redirects every time.
Out of curiosity, have you tried visiting http://pseis.org/dispatch.fcgi/ with the original script (yes, with a slash at the end)?

Can you paste the full traceback with flup 1.0.3? That might give me some idea why it fails...

Do you have access to logs on that server? If not, maybe we could use some hacked logger, like:

def app(env, start):
    f = open("/home/rselzler2/data-warp.com/poss_web/dispatch.log", "a")
    f.write("SCRIPT_NAME='%s'\n" % env['SCRIPT_NAME'])
    f.write("PATH_INFO='%s'\n" % env['PATH_INFO'])
    f.close()
    return wiki.application(env, start)

and then try it with various urls:

http://pseis.org/dispatch.fcgi
http://pseis.org/dispatch.fcgi/
http://pseis.org/dispatch.fcgi/aaa
http://pseis.org/dispatch.fcgi/aaa/bbb

comment:4 Changed 2 years ago by sheep

By the way, also try calling it "index.fcgi", maybe it would work.

comment:5 Changed 2 years ago by Randy Selzler <RSelzler@…>

That's one more rabbit you pulled out of Hatta's hat.

I removed the 5 lines and added a "/" to the URL... and it works !!!

That's another 6-pack of your favorite that I owe you.


Yes, I do have access to the server logs.

Are you interested in the other tests that you mentioned?
If not, lets close the ticket.
-- Randy

comment:6 Changed 2 years ago by sheep

Yes, it would be great to make it work without the slash, and to do that I would need to see what's happening with those two variables. Please try it if you have the time.

comment:7 Changed 2 years ago by Randy Selzler <RSelzler@…>

  • Cc RSelzler@… added

Below is a huge cut-n-paste of tests (I didn't see a way to attach it as a file).

bash$ # Initial directory and state
bash$ pwd
/home/rselzler2/data-warp.com/poss_web
bash$ ls -l
total 4
-rwxr-xr-x 1 rselzler2 pg2258840 1449 2010-02-10 05:59 dispatch.fcgi*
bash$ # What is in dispatch.fcgi...
bash$ cat dispatch.fcgi
#!/home/rselzler2/local/bin/python
# -*- coding: utf-8 -*-

#import flup
#import sys

import sys, os
from flup.server.fcgi import WSGIServer

# XXX Uncomment and edit this if hatta.py is not installed in site-packages
#sys.path.insert(0, "/path/to/dir/with/hatta/")
sys.path.insert(0, "/home/rselzler2/HATTA/hatta-dev-D/")
import hatta

config = hatta.WikiConfig(
pages_path='/home/rselzler2/data-warp.com/poss_web/pages/', # XXX Edit this!
cache_path='/home/rselzler2/data-warp.com/poss_web/cache/', # XXX Edit this!
interface='pseis.org'
)
config.parse_args()
config.parse_files()
config.sanitize()
wiki = hatta.Wiki(config)
app = wiki.application

# XXX Uncomment this, if you are using fastcgi on / on Lighttpd
#def app(env, start):
# envPATH_INFO = envSCRIPT_NAME + envPATH_INFO
# envSCRIPT_NAME =
# return wiki.application(env, start)

# XXX Uncomment this, if you are using fastcgi on / on Lighttpd
#def app(env, start):
# script_name='/dispatch.fcgi'
# envSCRIPT_NAME = script_name
# envPATH_INFO = envPATH_INFO[len(script_name):]
# return wiki.application(env, start)

def app(env, start):

f = open("/home/rselzler2/data-warp.com/poss_web/dispatch.log", "a")
f.write("SCRIPT_NAME='%s'\n" % envSCRIPT_NAME)
f.write("PATH_INFO='%s'\n" % envPATH_INFO)
f.close()
return wiki.application(env, start)

#flup.server.fcgi.WSGIServer(app).run()
WSGIServer(app).run()
bash$ # Which Hatta am I using...
bash$ hg log -r tip -R /home/rselzler2/HATTA/hatta-dev-D/
changeset: 753:29e40d23c6d1
tag: tip
user: sheep@wintermute
date: Fri Jan 29 11:54:15 2010 +0100
summary: really fix the lambdas in reindexing

bash$ # What is the result of a simple tests...
bash$ ./dispatch.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 303 SEE OTHER
Content-Type: text/html; charset=utf-8
Location:  http://localhost/+edit/Home

<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 3.2 FinalEN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
bash$ should be redirected automatically to target URL: <a href=" http://localhost/+edit/Home"> http://localhost/+edit/Home</a>. If not click the link.bash$
bash$
bash$ # What changed in my directory...
bash$ ls -l *
-rwxr-xr-x 1 rselzler2 pg2258840 1449 2010-02-10 05:59 dispatch.fcgi*
-rw-rw-r-- 1 rselzler2 pg2258840 28 2010-02-10 06:02 dispatch.log

cache:
total 8
-rw-r--r-- 1 rselzler2 pg2258840 6144 2010-02-10 06:02 index.sqlite3

pages:
total 0
bash$ # What does dispatch.log contain...
bash$ cat dispatch.log
SCRIPT_NAME=
PATH_INFO=

bash$ # What does the error log contain...
bash$ cat /home/rselzler2/logs/pseis.org/http/error.log
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/robots.txt
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/scripts.js
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
bash$
bash$ # What happens when I browse to  http://pseis.org/dispatch.fcgi
bash$ # ... Firefox renders Hatta Edit "dispatch.fcgi" (text box is empty)
bash$ # What changed in my directory...
bash$ ls -l *
-rwxr-xr-x 1 rselzler2 pg2258840 1449 2010-02-10 05:59 dispatch.fcgi*
-rw-rw-r-- 1 rselzler2 pg2258840 336 2010-02-10 06:07 dispatch.log

cache:
total 8
-rw-r--r-- 1 rselzler2 pg2258840 6144 2010-02-10 06:07 index.sqlite3

pages:
total 0
bash$ # What does dispatch.log contain...
bash$ cat dispatch.log
SCRIPT_NAME=
PATH_INFO=

SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/dispatch.fcgi'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/dispatch.fcgi'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
bash$ # What does the error log contain...
bash$ cat /home/rselzler2/logs/pseis.org/http/error.log
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/robots.txt
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/scripts.js
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
bash$ # What happens when I browse to  http://pseis.org/dispatch.fcgi/ (WITH a "/")
bash$ # ... Firefox renders Hatta Edit "Home" (text box is empty) "Home" is GOOD !!!
bash$ # What changed in my directory...
bash$ ls -l *
-rwxr-xr-x 1 rselzler2 pg2258840 1449 2010-02-10 05:59 dispatch.fcgi*
-rw-rw-r-- 1 rselzler2 pg2258840 622 2010-02-10 06:09 dispatch.log

cache:
total 8
-rw-r--r-- 1 rselzler2 pg2258840 6144 2010-02-10 06:07 index.sqlite3

pages:
total 0
bash$ # Enter some text in Edit text box and save it...
bash$ # The Home page is displayed with the new text...
bash$ # What changed in my directory...
bash$ ls -l *
-rwxr-xr-x 1 rselzler2 pg2258840 1449 2010-02-10 05:59 dispatch.fcgi*
-rw-rw-r-- 1 rselzler2 pg2258840 908 2010-02-10 06:13 dispatch.log

cache:
total 8
-rw-r--r-- 1 rselzler2 pg2258840 6144 2010-02-10 06:13 index.sqlite3

pages:
total 4
-rw-r--r-- 1 rselzler2 pg2258840 44 2010-02-10 06:13 Home
bash$ # What does dispatch.log contain...
bash$ cat dispatch.log
SCRIPT_NAME=
PATH_INFO=

SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/dispatch.fcgi'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/dispatch.fcgi'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/Home'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/Home'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
bash$ # What does the error log contain...
bash$ cat /home/rselzler2/logs/pseis.org/http/error.log
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/robots.txt
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/scripts.js
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
bash$ # What happens when I browse to  http://pseis.org/dispatch.fcgi/aaa (no trailing slash)
bash$ # ... Firefox renders Hatta Edit Editing "aaa" (empty as expected)
bash$ # What changed in my directory...
bash$ ls -l *
-rwxr-xr-x 1 rselzler2 pg2258840 1449 2010-02-10 05:59 dispatch.fcgi*
-rw-rw-r-- 1 rselzler2 pg2258840 1196 2010-02-10 06:15 dispatch.log

cache:
total 8
-rw-r--r-- 1 rselzler2 pg2258840 6144 2010-02-10 06:13 index.sqlite3

pages:
total 4
-rw-r--r-- 1 rselzler2 pg2258840 44 2010-02-10 06:13 Home
bash$ # Enter some text in Edit text box and save it...
bash$ # The page is displayed with the new text...
bash$ # What changed in my directory...
bash$ ls -l *
-rwxr-xr-x 1 rselzler2 pg2258840 1449 2010-02-10 05:59 dispatch.fcgi*
-rw-rw-r-- 1 rselzler2 pg2258840 1484 2010-02-10 06:17 dispatch.log

cache:
total 8
-rw-r--r-- 1 rselzler2 pg2258840 6144 2010-02-10 06:17 index.sqlite3

pages:
total 8
-rw-r--r-- 1 rselzler2 pg2258840 24 2010-02-10 06:17 aaa
-rw-r--r-- 1 rselzler2 pg2258840 44 2010-02-10 06:13 Home
bash$ # What does dispatch.log contain...
bash$ cat dispatch.log
SCRIPT_NAME=
PATH_INFO=

SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/dispatch.fcgi'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/dispatch.fcgi'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/Home'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/Home'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
bash$ # What does the error log contain...
bash$ cat /home/rselzler2/logs/pseis.org/http/error.log
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/robots.txt
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/scripts.js
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
bash$ # What happens when I browse to  http://pseis.org/dispatch.fcgi/aaa/bbb (reg file aaa is used as directory to bbb)
bash$ # ... Firefox renders a 404 error page
bash$ # ... Not Found
bash$ # ... The requested URL /dispatch.fcgi/+edit/aaa/bbb was not found on this server.
bash$ # ... Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
bash$ # What does dispatch.log contain...
bash$ cat dispatch.log
SCRIPT_NAME=
PATH_INFO=

SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/dispatch.fcgi'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/dispatch.fcgi'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/Home'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/Home'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/aaa/bbb'
bash$ # What does the error log contain...
bash$ cat /home/rselzler2/logs/pseis.org/http/error.log
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/robots.txt
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/scripts.js
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
[Wed Feb 10 06:19:21 2010] [error] [client 72.192.119.192] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
bash$ # What happens when I browse to  http://pseis.org/dispatch.fcgi/ccc/ddd (new ccc dir and ddd page)
bash$ # ... Firefox renders a 404 error page
bash$ # ... Not Found
bash$ # ... The requested URL /dispatch.fcgi/+edit/ccc/ddd was not found on this server
bash$ # ... Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
bash$ # The -D subdirectory option was not enabled for Hatta I guess
bash$ # What does dispatch.log contain...
bash$ cat dispatch.log
SCRIPT_NAME=
PATH_INFO=

SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/dispatch.fcgi'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/dispatch.fcgi'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/Home'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/Home'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+edit/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/aaa'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/pygments.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/style.css'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/+download/scripts.js'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/aaa/bbb'
SCRIPT_NAME='/dispatch.fcgi'
PATH_INFO='/ccc/ddd'
bash$ # What does the error log contain...
bash$ cat /home/rselzler2/logs/pseis.org/http/error.log
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/robots.txt
[Wed Feb 10 02:00:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/scripts.js
[Wed Feb 10 02:01:30 2010] [error] [client 65.55.207.72] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
[Wed Feb 10 06:19:21 2010] [error] [client 72.192.119.192] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
[Wed Feb 10 06:22:44 2010] [error] [client 72.192.119.192] File does not exist: /home/rselzler2/data-warp.com/poss_web/missing.html
bash$
bash$

comment:8 Changed 2 years ago by sheep

Thanks a lot, this gives me much better insight in what is going on. Seems like when you visit the fcgi script without the trailing slash, it reports SCRIPT_NAME and PATH_INFO to be identical. I guess I can test for that...

comment:9 Changed 2 years ago by sheep

But then, if you call your script "wiki.fcgi" and try to visit to visit page "wiki.fcgi" you will be sent to the home page instead :/

comment:10 follow-up: ↓ 11 Changed 2 years ago by sheep

I think I'm getting somewhere, could you do a similar test, but add a third variable, REQUEST_URI? If that is provided, I would be able to reconstruct the broken PATH_INFO.

comment:11 in reply to: ↑ 10 Changed 2 years ago by Randy Selzler <RSelzler@…>

Replying to sheep:

I think I'm getting somewhere, could you do a similar test, but add a third variable, REQUEST_URI? If that is provided, I would be able to reconstruct the broken PATH_INFO.


Would you like the whole suite of tests again or a subset?
-- Randy

comment:12 Changed 2 years ago by sheep

Just the dispatch.log file is enough, with visits to "dispatch.fcgi", "dispatch.fcgi/", and "dispatch.fcgi/something", thank you.

By the way, werkzeug already has a fixer for this case! Can you try this?


#!/usr/bin/python
# -*- coding: utf-8 -*-

import flup
import sys
# XXX Uncomment and edit this if hatta.py is not installed in site-packages
#sys.path.insert(0, "/path/to/dir/with/hatta/")
import hatta

config = hatta.WikiConfig(
    pages_path='/path/to/pages/', # XXX Edit this!
    cache_path='/path/to/cache/', # XXX Edit this!
)
config.parse_args()
config.parse_files()
config.sanitize()
wiki = hatta.Wiki(config)

import werkzeug
app = werkzeug.contrib.fixers.PathInfoFromRequestUriFix(wiki.application)

flup.server.fcgi.WSGIServer(app).run()

Last edited 2 years ago by sheep (previous) (diff)

comment:13 Changed 2 years ago by Randy Selzler <RSelzler@…>

Radomir

Check your email for account and test info.

--Randy

comment:14 Changed 2 years ago by sheep

  • Status changed from new to closed
  • Resolution set to worksforme
Note: See TracTickets for help on using tickets.