in reply to Saving .cgi Output; Passing File As Argument?

Are the results different if the user-supplied parameters are different? Perhaps you could use a proxy front-end module from your web server to provide this function. I believe that Apache mod_rewrite has an example of this for automatically generating files in a cache.

Alternatively, you could save the output, before sending it to the client, as a file based on some unique, per-request generated file name. Do not base the file name on any unsanitized data, or it could become an avenue for exploitation.

A third option might be to store the response text in a blob field in a database.

Each option has benefits and drawbacks, but without further information, it is difficult to even recommend an approach to take.

--MidLifeXis

  • Comment on Re: Saving .cgi Output; Passing File As Argument?

Replies are listed 'Best First'.
Re^2: Saving .cgi Output; Passing File As Argument?
by Ragged Robin (Initiate) on Oct 20, 2014 at 18:20 UTC
    Thanks for the reply, the users upload a .dat file which gets extracted and parsed and the script spits out a bunch of information based on the content. Since they do have to upload files to the server and it has to be extracted, I have the files uploaded and named based on a sequential counter so that each are unique and I know how many of times it's been used (I have the script delete the files at the end of the script)--the trouble is I don't know how to save the output at all other than brute-force doubling every print statement and pushing it to a file.

      How about, instead of printing at every step, collecting the data to print, and then printing to both locations destinations in a single location?

      Update: minor wording change

      --MidLifeXis