HELP-How does Apache server passes an XML document to a CGI?

T

Terry Jones

I am trying to setup an Apache web server to accept XML document and
use a CGI to process the content of the XML file. My questions are:

* When a client performs a POST to the server; assume that the content
of the post is an XML file, where does Apache place the file?
* How do I setup Apache so that when it receives an XML file, it will
invoke a particular CGI so that the XML file can be consumed?
* Is there a way to configure Apache so that it does NOT use disk
space to store the received XML file, instead, keep it in memory and
pass it to my XML file?

Thanks for any lead.
 
M

Martin Honnen

Terry said:
I am trying to setup an Apache web server to accept XML document and
use a CGI to process the content of the XML file. My questions are:

* When a client performs a POST to the server; assume that the content
of the post is an XML file, where does Apache place the file?

I don't think Apache places the body of an HTTP POST request anywhere,
if you POST data to whatever.php for instance then your PHP script is
called by Apache and it is then up to the PHP script to process the
request body (for instance in PHP 5 by reading the stream php://input).
 
P

Peter Flynn

Terry said:
I am trying to setup an Apache web server to accept XML document and
use a CGI to process the content of the XML file. My questions are:

* When a client performs a POST to the server; assume that the content
of the post is an XML file, where does Apache place the file?

It doesn't (or rather, it may do some temporary invisible store-to-disk,
but not anywhere you can get at it externally). What happens is that the
file arrives as a MIME message-part in the POST. Think of it as roughly
equivalent to an email attachment. The job of your script is to handle
it and *then* do something with it (which may include saving to disk).
* How do I setup Apache so that when it receives an XML file, it will
invoke a particular CGI so that the XML file can be consumed?

It's the other way round: it's your script that does the receiving in
the first place. Google for cgi file upload to find some code.
* Is there a way to configure Apache so that it does NOT use disk
space to store the received XML file, instead, keep it in memory and
pass it to my XML file?

That's in effect what it does.

///Peter
 
N

Nick Kew

Peter said:
Terry Jones wrote:




It doesn't (or rather, it may do some temporary invisible store-to-disk,
but not anywhere you can get at it externally).

Apache doesn't, unless you tell it to. But if the XML is a file upload,
then CGI libraries typically put them in a tempfile, as CGI doesn't do
asynchronous input. If the OP wants to avoid tempfiles, then he'll
have to RTFM for his CGI library (and make sure file uploads are
limited to a size he can buffer in memory without DOSing himself).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top