title: Supporting HTTP 100 Continue with PHP
body: <p>I'm working on a PHP webapp that accepts large POSTed file uploads from specific clients and would like to accept or reject these uploads (based on various headers and other factors, not just size) before the file is uploaded by using HTTP/1.1 100 Continue.</p>
  
  <p>Some quick background from <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.3" rel="noreferrer">HTTP/1.1 spec 8.2.3</a>:</p>
  
  <blockquote>
    <p>The purpose of the 100 (Continue) status (see section 10.1.1) is to allow a client that is sending a request message with a request body to determine if the origin server is willing to accept the request (based on the request headers) before the client sends the request body. In some cases, it might either be inappropriate or highly inefficient for the client to send the body if the server will reject the message without looking at the body. </p>
  </blockquote>
  
  <p>The problem is that Apache sees the Expect: 100-continue from the client, returns a 100 Continue and accepts the file upload all before PHP begins processing...  However I need PHP to begin processing immediately after the Expect: 100-continue.  I'm not sure if this is possible so I have two questions:</p>
  
  <ol>
  <li>Is it possible to make PHP begin processing immediately after the Expect: 100-continue?</li>
  <li>If not, what is a good alternative?</li>
  </ol>
  
  <p>I'm currently thinking of emulating 100 continue by specifying the client first send a HEAD request with the same headers as the POST.  The webapp can then return a response to continue with the POST or an error code.  Other suggestions are welcome!</p>