The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall
Legacy:WebConnectionPlus
From Unreal Wiki, The Unreal Engine Documentation Site
UT2003 :: Object >> Actor >> Info >> InternetInfo >> InternetLink >> TcpLink >> WebConnection >> WebConnectionPlus (Ladder1.46)
This functionality provided by this class (keeping the connection open after a query()) will be integrated into UT2003 as of the next patch, so this class will no longer be necessary.
-
//-----------------------------------------------------------
-
// Ladder.WebConnectionPlus
-
//
-
// Custom webconnection class to allow "hanging" webadmin queries
-
// while waiting for profile to be imported from foreign web host
-
//-----------------------------------------------------------
-
class WebConnectionPlus extends WebConnection;
-
-
var bool bNoCleanup;
-
var bool bPostQueryApp;
-
-
function EndOfHeaders()
-
{
-
-
if(Response == None)
-
{
-
CreateResponseObject();
-
Response.HTTPError(400); // Bad Request
-
Cleanup();
-
return;
-
}
-
-
if(Application == None)
-
{
-
Response.HTTPError(404); // FNF
-
Cleanup();
-
return;
-
}
-
-
if(Request.ContentLength != 0 && Request.RequestType == Request_POST)
-
{
-
RawBytesExpecting = Request.ContentLength;
-
RawBytesExpecting -= Len(ReceivedData);
-
CheckRawBytes();
-
}
-
else
-
{
-
if (Application.PreQuery(Request, Response))
-
{
-
Application.Query(Request, Response);
-
bPostQueryApp = True;
-
}
-
Cleanup();
-
}
-
}
-
-
function CheckRawBytes()
-
{
-
if(RawBytesExpecting <= 0)
-
{
-
if(!(Request.ContentType ~= "application/x-www-form-urlencoded"))
-
{
-
Log("WebConnection: Unknown form data content-type: "$Request.ContentType);
-
Response.HTTPError(400); // Can't deal with this type of form data
-
}
-
else
-
{
-
Request.DecodeFormData(ReceivedData);
-
if (Application.PreQuery(Request, Response))
-
{
-
Application.Query(Request, Response);
-
bPostQueryApp = True;
-
}
-
ReceivedData = "";
-
}
-
Cleanup();
-
}
-
}
-
-
function Cleanup()
-
{
-
if (bNoCleanup)
-
return;
-
-
if (bPostQueryApp && Application != None)
-
{
-
Application.PostQuery(Request, Response);
-
bPostQueryApp = False;
-
}
-
-
if(Request != None)
-
Request = None;
-
-
if(Response != None)
-
{
-
Response.Connection = None;
-
Response = None;
-
}
-
-
if(Application != None)
-
Application = None;
-
Close();
-
}