Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Slow CGI

Posted on 1997-06-16
4
Medium Priority
?
396 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

715 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