Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Internet/Apache Shared Module    [ Add a report in this area ]  
Report #:  5129   Status: Reported
Early response from webpage
Project:  Delphi Build #:  4453
Version:    7.0 Submitted By:   Thomas van Rompaey
Report Type:  Basic functionality failure Date Reported:  7/10/2003 12:35:03 AM
Severity:    Critical / Show Stopper Last Updated: 7/10/2003 12:41:58 AM
Platform:    All versions Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
5.00 out of 5
Total Votes: None
We generate a PDF document in our WebSnap application and while the data for this report is being collected we want to send  some text to the client-browser so he knows the report is being generated. For example :
1. Opening report...
2. Retreiving data...
3. Applying formatting...
4. Sending report...
In ISAPI it works perfectlly to send a web response early but on Apache 1.3 the data isn't send to the browser until the last response is ready. Look for more info in the BDN article 22866.

When I create a PHP program that does this on the same server it works ok so I asume the problem is not Apache.

I have used packet-sniffing software to verify the data is send to the client in one packet over the network. (so IE6 isn't the problem)

Server: Windows 2000
WebServer: Apache 1.3.27
Client browser: IE 6
Steps to Reproduce:
1) Create a new Web server application
2) Add a action with the following code:

procedure TWebModule1.WebModule1test3Action(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
  I: Integer;
  S: string;
  // Important that this is first!
  S := 'About to send time stamps<br>';
  // Send the content early by accessing the Request
  // directly and writing to it.
  // Send some Responses and pause to simulate lengthy operations
  for I := 1 to 3 do
    // Pause for about 3 secs
    // Set another response
    S := TimeToStr(Now) + '<br>';

3) Run it on Apache

You could also try the following code because it implements HTTP1.1:

procedure TWebModule1.WebModule1testAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);

  procedure SendChunk(const Value: String; IsHTTP11: Boolean);
    if IsHTTP11 then
      Request.WriteString(IntToHex(Length(Value),0) + #13#10 + Value + #13#10)
      If Value <> '' then
  IsHTTP11: Boolean;
  IsHTTP11 := Request.ProtocolVersion = 'HTTP/1.1';
  if IsHTTP11 then


  // The first packet should be at least 256 bytes
  SendChunk(DupeString(' ', 300) + '<HTML><BODY>', IsHTTP11);

  SendChunk('Begin<BR>', IsHTTP11);
  SendChunk('Row 1<BR>', IsHTTP11);
  SendChunk('Row 2<BR>', IsHTTP11);
  SendChunk('Row 3<BR>', IsHTTP11);
  SendChunk('Row 4<BR>', IsHTTP11);
  SendChunk('Row 5<BR>', IsHTTP11);
  SendChunk('End<BR>', IsHTTP11);

  SendChunk('</BODY></HTML>', IsHTTP11);
  SendChunk('', IsHTTP11);

  Handled := True;


Server Response from: ETNACODE01