Solved

Slow CGI

Posted on 1997-06-16
4
376 Views
Last Modified: 2013-12-25
Hi,
I have recently made a CGI script that have a very slow answer time (it executes a lot of queries on a remote mainframe) and the Microsoft IE3 have a strange behavior with this CGI (and possible others). When I click the
Submit button I don't get the Hourglass cursor nor the message "Web site found. Waiting for reply" at the status bar. I know that it works because in few minutes I have the answer but I'm afraid that my users could click the
submit button twice or more expecting some kind of message or cursor changing. What can be
done to solve this problem?
In this case, how do I send an intemediate page with some message like "Please wait... Processing" ?
I recently bought some CD's on the Internet and when I pressed the Submit button (for processing my invoice and the Credit Card), a page containing "Wait, processing your credit card" came on the screen and after a while that page was substituted with the answer of my Invoice. I’m sure that there was no <META HTTP-EQUIV="Refresh"> because the data was posted and there was no Javascript. That CGI technic is what I’m looking for.

I'm using VB5 with the MS IIS3.0 web server (NT4 SP3).

Thanks.
0
Comment
Question by:gorcutt
  • 2
4 Comments
 
LVL 4

Expert Comment

by:feenix
ID: 1828269
One way to do it could be to make two CGI-bins. The first would
print the Wait-page and use meta refresh to load the second
CGI. That way the user would get an immediate response and
it would be very easy to implement, too.
0
 

Author Comment

by:gorcutt
ID: 1828270
I know that there must be another way. I can't post from one page linked to a CGI with the "meta refresh" (without any JScript or VBscript).
Thanks anyway.

0
 
LVL 2

Accepted Solution

by:
mkornell earned 50 total points
ID: 1828271
More than likely, the example you are referring to was do using a multipart reponse.  The cgi script sends a Content-type header of "Content-type: multipart/x-mixed-replace;boundary=<boundary string>".  Then, it can send multiple pages back to the browser, each separated by the <boundary string>.  Ideally, the browser is supposed to display each page when it receives it.  Your cgi output would look like:

HTTP/1.1 200 OK
Content-type: multipart/x-mixed-replace;boundary=--boundary--

--boundary--
Content-type:text/html

<HTML><BODY><P>Please wait...</P></BODY></HTML>

--boundary--
Content-type:text/html

<HTML>
<BODY>
<P>OK, the answer is 42</P>
</BODY>
</HTML>

and ends.

There would the processing delay between the 1st and 2nd parts of the response (I forget whether it needs to be before or after the bondary string), and the browser should display the 1st part while waiting for the second.

To do this, the script must _NOT_ be buffered by the web server -- i.e. it must run as nph.  I've never done that with IIS, so you'd have to check the docs to see how, if it is even possible.

Caveat: this method does require that the browser supports multipart responses.  I believe Netscape does, but my current browser, IE4, doesn't.  Don't know about IE3.There is another way, which is probably easier to do, and would have a better chance of being supported by all browsers:

1) create a cgi-bin (cgi1) that stores the information the user posts into the Session object.  cgi1 returns to the user the wait page and uses meta refresh to call cgi2

2) create cgi-bin cgi2 that reads the values stored in the Session object, does the processing, and returns the answer.

This is much easier, as the scripts don't have to run as nph, and you don't need to bother with trying to figure out the correct HTTP headers to send.

HTH,
--mark;
0
 

Author Comment

by:gorcutt
ID: 1828272
I'm going to try both. I think the solution is quite near.
Thanks


0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now