Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Slow CGI

Posted on 1997-06-16
4
Medium Priority
?
400 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 200 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This article will show, step by step, how to integrate R code into a R Sweave document
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

877 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