Legacy:WebConnectionPlus - Unreal Wiki

# 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.

1. //-----------------------------------------------------------
2. // Ladder.WebConnectionPlus
3. //
4. // Custom webconnection class to allow "hanging" webadmin queries
5. // while waiting for profile to be imported from foreign web host
6. //-----------------------------------------------------------
7. class WebConnectionPlus extends WebConnection;
9. var bool bNoCleanup;
10. var bool bPostQueryApp;
12. function EndOfHeaders()
13. {
15. if(Response == None)
16. {
17. CreateResponseObject();
18. Response.HTTPError(400); // Bad Request
19. Cleanup();
20. return;
21. }
23. if(Application == None)
24. {
25. Response.HTTPError(404); // FNF
26. Cleanup();
27. return;
28. }
30. if(Request.ContentLength != 0 && Request.RequestType == Request_POST)
31. {
32. RawBytesExpecting = Request.ContentLength;
33. RawBytesExpecting -= Len(ReceivedData);
34. CheckRawBytes();
35. }
36. else
37. {
38. if (Application.PreQuery(Request, Response))
39. {
40. Application.Query(Request, Response);
41. bPostQueryApp = True;
42. }
43. Cleanup();
44. }
45. }
47. function CheckRawBytes()
48. {
49. if(RawBytesExpecting <= 0)
50. {
51. if(!(Request.ContentType ~= "application/x-www-form-urlencoded"))
52. {
53. Log("WebConnection: Unknown form data content-type: "$Request.ContentType);
54. Response.HTTPError(400); // Can't deal with this type of form data
55. }
56. else
57. {
58. Request.DecodeFormData(ReceivedData);
59. if (Application.PreQuery(Request, Response))
60. {
61. Application.Query(Request, Response);
62. bPostQueryApp = True;
63. }
64. ReceivedData = "";
65. }
66. Cleanup();
67. }
68. }
70. function Cleanup()
71. {
72. if (bNoCleanup)
73. return;
75. if (bPostQueryApp && Application != None)
76. {
77. Application.PostQuery(Request, Response);
78. bPostQueryApp = False;
79. }
81. if(Request != None)
82. Request = None;
84. if(Response != None)
85. {
86. Response.Connection = None;
87. Response = None;
88. }
90. if(Application != None)
91. Application = None;
92. Close();
93. }

##### Views

- Legacy
- Discussion
- Current revision

##### Search