0

I've been serching high and low and I cant seem to find it.

When apache receives a POST / HTTP/1.1 with some data in the body field, is that data stored in memory or in a file? From what I've been able to test its not in memory.

Does the answer to this question change depending on the mime type of the data? If so, then where do file uploads ( multipart/* ) go ?

I know that such data is passed on to the destination file as STDIN for cgi, and that the answer for THOSE systems depends on the specific program there. For example python makes tempfiles. This isnt the question I'm asking. I'm specifically asking where the data is kept, between the server receiving it in the socket and handing it off at STDIN.

Thanks for your consideration!

1 Answer 1

1

For the servers I have worked with, it has been the responsibility of the application to retrieve the post data. The HTTP protocol provides a clear demarcation between the header and date. The server will process the header and hand-off the socket to the application. Where an application is spawned to service the request the socket is STDIN. It will be the application that retrieves data from the socket by reading STDIN.

The application may be started before all data has been received from the client. It should handle cases where the client closes the connection before all data has been received. When the data being transferred is large, there can be issues if the full data is read into application memory. It is often better to read file parts into a file. This would be the application's responsibility.

If the post data is smaller than the TCP window size, it is possible the data has been received before the application begins. The data would be stored in the network stack's buffers.

1
  • Apache handlers (response generators) read request bodies "through" the input filter chain. It isn't pre-fetched or spooled by the core of the server, although mod_proxy specifically can do some of that before forwarding it.
    – covener
    Aug 2, 2015 at 21:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .