On Mon, 31 Oct 2011, Felipe Monteiro de Carvalho wrote:

Hello,

So I advanced my CGI using HTTP GET so far, but I'd like to migrate to
HTTP POST. But I always get this error message in the apache logs:

Premature end of script headers: openpoker3.cgi, referer:
http://localhost:8080/cgi-bin/openpoker3.cgi?module=MainPage

The request doesn't even get to my handler in the CGI =(

Here is my JavaScript which initiates the communication:

 SendSyncRequestViaGet = function(RequestURL, RequestContent)
 {
   var request = new XMLHttpRequest();
   request.open('GET', RequestURL+"&data="+RequestContent, false);
   request.setRequestHeader('Content-Type', 'text/html');
   request.send("");
   //debugDiv.innerHTML = debugDiv.innerHTML + "after send<br>";
   return request.responseText;
 }

 SendSyncRequestViaPost = function(RequestURL, RequestContent)
 {
   var request = new XMLHttpRequest();
   request.open('POST', RequestURL, false);
   request.setRequestHeader('Content-Type', 'text/html');
   request.setRequestHeader("Content-length", RequestContent.length);
   request.setRequestHeader("Connection", "close");
   debugDiv.innerHTML = debugDiv.innerHTML + "before send<br>";
   request.send(RequestContent);
   debugDiv.innerHTML = debugDiv.innerHTML + "after send<br>";
   return request.responseText;
 }

 var lobbyTimer;

 function lobbyTimerCallback()
 {
   // Load all Lobby table data
   var tableInnerHTML =
SendSyncRequestViaPost("openpoker3.cgi?module=PokerServer","00_FFFFFFFFFFFFFFFF_0000002E_00000000_");

Where is the action ? If you specify a module, then you must specify an action 
as well.

What you can try to do is to create an OnShowException handler for the 
application, and see what that prints.
(normally you should get a normal error page in case of an error, not the 
'premature end of script headers')

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to