Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


cgi and page refresh

cgi and page refresh

cgi and page refresh

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

RE: cgi and page refresh


Did you ever get this one worked out?


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 ...

RE: cgi and page refresh

Have you tryed to add a dummy parameter that change each time ?



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

Regards. Clarissa

RE: cgi and page refresh

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 (http://icdsoft.com/, 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

RE: cgi and page refresh

[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.


...but I'm just a C man trying to see the light

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close