TidHTTPServer POST Timeout with PHP client

Giganews Newsgroups
Subject: TidHTTPServer POST Timeout with PHP client
Posted by:  Vern Baker (javakinet…@gmail.com)
Date: 2 Mar 2007

TIdHTTP works against TIdHTTPServer with both GETs and POSTs, and
works as advertised.  However, PHP POSTs to TIdHTTPServer result in

In IdCustomHTTPServer.pas (line 825), IOHandler.ReadStream will not
return until a timeout (30 seconds) from the PHP client occurs.  At
that time, line 825 (latest overnight) is passed out of, and
processing occurs with what was POSTed from PHP.  This results in a
time exceeded message error on the PHP page.

Does the following POST need to be structured in a particular way for
Indy to recognize the post stream correctly?

    $fp = fsockopen("", 5048, $errno, $errstr, 30);

        echo "START<br />\

    //Catch any errors that may occur... the one we consistently get is
the "Connection Timeout" error.
    if (!$fp)
      echo "$errstr ($errno)<br />\
    //If we establish a connection write a simple message.
      $out = "POST /Data HTTP/1.1\r\
      $out .= "Host:\r\
      $out .= "Connection: Close\r\

      fwrite($fp, $out);

      //If we manage to write some information to the connection print
out the response on screen.
      while (!feof($fp))
        echo fgets($fp,1). "#";


    echo "END<br />\

##########...(many many many of them)...###
Fatal error: Maximum execution time of 30 seconds exceeded in c:
\program files\easyphp1-8\www\test.php on line 21

RESULT From IndyWebServer:
Note:  This is the log file created by the standard Indy examples for
writing a web server

2007/03/02-16:07:42.519: LOG IN: from
2007/03/02-16:07:43.300: COMMAND:  Post from
(VPostStream := TMemoryStream.Create;)
-- 30 seconds --
2007/03/02-16:08:12.591: HTTP COMMAND:  POST /Data received from (HTTPServerCommandGet)
2007/03/02-16:08:12.901: LOG OUT