| Home Page | Recent Changes

WebConnectionPlus

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.

00001  //-----------------------------------------------------------
00002  // Ladder.WebConnectionPlus
00003  //
00004  // Custom webconnection class to allow "hanging" webadmin queries
00005  // while waiting for profile to be imported from foreign web host
00006  //-----------------------------------------------------------
00007  class WebConnectionPlus extends WebConnection;
00008  
00009  var bool bNoCleanup;
00010  var bool bPostQueryApp;
00011  
00012  function EndOfHeaders()
00013  {
00014  
00015      if(Response == None)
00016      {
00017          CreateResponseObject();
00018          Response.HTTPError(400); // Bad Request
00019          Cleanup();
00020          return;
00021      }
00022  
00023      if(Application == None)
00024      {
00025          Response.HTTPError(404); // FNF
00026          Cleanup();
00027          return;
00028      }
00029  
00030      if(Request.ContentLength != 0 && Request.RequestType == Request_POST)
00031      {
00032          RawBytesExpecting = Request.ContentLength;
00033          RawBytesExpecting -= Len(ReceivedData);
00034          CheckRawBytes();
00035      }
00036      else
00037      {
00038          if (Application.PreQuery(Request, Response))
00039          {
00040              Application.Query(Request, Response);
00041              bPostQueryApp = True;
00042          }
00043          Cleanup();
00044      }
00045  }
00046  
00047  function CheckRawBytes()
00048  {
00049      if(RawBytesExpecting <= 0)
00050      {
00051          if(!(Request.ContentType ~= "application/x-www-form-urlencoded"))
00052          {
00053              Log("WebConnection: Unknown form data content-type: "$Request.ContentType);
00054              Response.HTTPError(400); // Can't deal with this type of form data
00055          }
00056          else
00057          {
00058              Request.DecodeFormData(ReceivedData);
00059              if (Application.PreQuery(Request, Response))
00060              {
00061                Application.Query(Request, Response);
00062                bPostQueryApp = True;
00063              }
00064              ReceivedData = "";
00065          }
00066          Cleanup();
00067      }
00068  }
00069  
00070  function Cleanup()
00071  {
00072      if (bNoCleanup)
00073          return;
00074  
00075      if (bPostQueryApp && Application != None)
00076      {
00077          Application.PostQuery(Request, Response);
00078          bPostQueryApp = False;
00079      }
00080  
00081      if(Request != None)
00082          Request = None;
00083  
00084      if(Response != None)
00085      {
00086          Response.Connection = None;
00087          Response = None;
00088      }
00089  
00090      if(Application != None)
00091          Application = None;
00092      Close();
00093  }

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In