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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing an HTTP connection in Perl CGI script

Status
Not open for further replies.

Frank1234

Programmer
Nov 27, 2001
2
US
How do I close an HTTP connection before my script finishes. I want it to keep processing data after it has sent a reply to the client. Apache normally closes the connection only after the script finishes. I tried unbuffering and closing STDOUT to no avail.
 
I was waiting to see if anyone else had done this trick. No chimers having chimed in, I take a guess....

I don't know if this will achieve the desired effect, but....... I would try separating the code into two chunks (one file with two parts). The first would be the chunk that would do all of the web response work. Then, it would launch the second chunk via an 'exec'. My hope would be that the web server would see the initial process close and thus the connection would close..... meanwhile... the child created by the 'exec' would go on it's merry way doing what ever you like. Like I said/wrote, I have not tried this, but, it is the first place I thought I would start playing.

I don't have time to try it today. I'll try to get back to it and if it works I'll post a little code. If you are new to Tek-Tips, please use descriptive titles, check the FAQs,
and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top