Apache 1.2b7 : POST Method not supported?
Jeff Watkins (jwatkins@FuturePress.com)
Sun, 9 Mar 97 02:27:46 -0800
Message-Id: <199703091018.CAA09799@terra.futurepress.com>
Subject: Apache 1.2b7 : POST Method not supported?
Date: Sun, 9 Mar 97 02:27:46 -0800
From: Jeff Watkins <jwatkins@FuturePress.com>
To: "fastcgi-developers" <fastcgi-developers@OpenMarket.com>
I just brought up my first FastCGI application and discovered the
following:
Method Not Implemented
POST to /test/index.fcgi not supported
Half the time the server doesn't seem to finish sending the error and
this hangs Netscape. Is there some tricky stuff I need to do in my
application to support POST methods? Perhaps some server setup? Any help
would be greatly appreciated. I've included what I figure to be the
relevant bits...
The following is from my httpd.conf:
AppClass /web/Production/Exploser/test/index.fcgi
AddHandler fastcgi-script .fcgi
<Location /test/index.fcgi>
SetHandler fastcgi-script
</Location>
And the following is from the main() of my FastCGI application:
#ifdef FASTCGI
while(FCGI_Accept() >= 0)
#endif
{
try
{
Server::CheckTime( "Request Accepted" );
/* Rebuild the URL
*/
const char* q= getenv("QUERY_STRING");
const char* host= getenv( "SERVER_NAME" );
const char* script= getenv( "SCRIPT_NAME" );
const char* path= getenv( "PATH_INFO" );
sprintf( URL, "http://%s%s%s%s",
(host && *host)?host:"UnknownURL.somemachine.com",
(script && *script)?script:"/",
(path && *path)?path:"",
(q && *q)?"?":"",
(q&&*q)?q:"" );
ObjRef cgi;
ObjRef env;
String cgiobject= TheServer->GetOption( "CGIObject",
kDefaultCGIObject );
String envobject= TheServer->GetOption( "EnvObject",
kDefaultEnvObject );
ObjUtils::NewInstance( envobject, List(0), env );
ObjUtils::NewInstance( cgiobject, List(0), cgi );
Server::CheckTime( "Env & CGI created" );
List ConnectArgs(4);
ConnectArgs.Set( 1, CGIData() );
ConnectArgs.Set( 2, URL );
ConnectArgs.Set( 3, "POST" );
ConnectArgs.Set( 4, env );
ConnectArgs.Set( 3, "POST" );
ConnectArgs.Set( 4, env );
Value result;
result= TheServer->RunMethodNow( cgi, "OnConnect",
ConnectArgs );
Server::CheckTime( "Connect run" );
if (!result.isa(NONE))
printf( (const char*) result.ToStr() );
else
printf( "content-type: text/plain \n\n"
"An error has occurred. Please contact the
system\n"
"administrator.\n" );
}
catch (Exception& e)
{
printf( "content-type: text/plain\n\n"
"Caught exception: %s: %s\n", gErrorStrings[e.TheErr],
(const char*)e.TheStr );
}
catch (...)
{
printf( "content-type: text/plain\n\n"
"Caught unknown exception\n" );
}
#ifdef FASTCGI
FCGI_Finish();
#endif
Server::CheckTime( "Request Complete" );
Death->ServiceAllTheDead();
Server::CheckTime( "Dead Serviced" );
}
--
Jeff Watkins
http://www.FuturePress.com/People/jwatkins/
mailto:jwatkins@FuturePress.com