Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cgi and page refresh

Status
Not open for further replies.

icrf

Programmer
Joined
Dec 4, 2001
Messages
1,300
Location
US
I help run a BBS that's perl/cgi based. One script(threadmachine.cgi) obtains and displays the posts for a given thread with a submit post form at the bottom.

When a new post is submitted, the form action is another script(bbs.cgi) that actually adds the post to the thread data. bbs.cgi's normal (non-error) output is simply "Location: threadmachine.cgi\n\n". When run, the script should detect new posts and refresh the page accordingly. The problem is it doesn't refresh.

What I can figure out to this point is since the browser is at threadmachine.cgi, and the only output of bbs.cgi is the location line telling the browser to go back to where it essentially still is, it doesn't refresh at all. The location line in the browser actually displays bbs.cgi, something it should never really see at all.

However, it sporadically works correctly with no setting changes at all. If the browser is set to cache nothing and always get new documents, it works fine every time.

The only thing I can think of is to make an html page with the meta-refresh headers to redirect back to threadmachine, but I'd like some other way to convince the brower that it really does need to query the script again. Any ideas? ----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
icrf,

Did you ever get this one worked out?

Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Have you tryed to add a dummy parameter that change each time ?

Example:

threadmachine.cgi?dummy=123456

Note: you can use a random or time function to generate the parameter.

Regards. Clarissa
 
I just ended up not outputting a redirect, but a short html page with meta-refresh headers. Has worked alright for a year, but I've long wanted to try the redirect again and see. It seemed, at the time, to be limited to Opera6, but I can't say that for sure.

About a week ago we left earthlink for another service provider ( with whom, first impressions are great. Noticable increased RTT due to Hong Kong server location, but is really negligible in the grand scheme of things). The biggest change (outside of a $20/mo to $5/mo price drop) is database support.

The point of all this rambling is to say we're rewriting everything, using lots of modules, writing modules ourselves, cascading style sheets, the whole shebang. A complete, clean, reengineering of the system. So in the coming weeks, I'll likely hit that problem again and see what happens. I'll keep the random name/value pair in mind, and try to remember to report back.

----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
[digging up old thread] I moved the site over to running Invision Power Board, a PHP message board. In one particular case (fast reply posting) us Opera folks (yes, it turned out to be an Opera-only problem, so far as I could tell) ran into the same page not redirecting behavior. After much digging, there's an admin option to change the type of header printed. While I haven't tried it in Perl, here's the line in PHP that gets changed with the admin option (-savvy titles are from IPB's admin panel, despite their names, the OS of hosting service or client had nothing to do with it, only the client's browser):

Old method:
Unix-savvy: @header("Location: ".$url);

New method:
Windows-savvy: @header("Refresh: 0;url=".$url);

So in theory, changing the way the redirect header gets printed in Perl should cause the same behavior change. From looking, it doesn't appear that CGI.pm's header() method supports this alternate kind of header (probably isn't compliant to standards), so it'll have to be manually generated.

Again, I haven't tested this in Perl, but since it fixed a similar problem in PHP, I think it will work. The problem behavior was too intermittent to test easily, hence, my leaving this open-ended. I guess it's more of an update in case anyone using search comes across this post.

Have fun, best of luck.

Andrew

----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top