*Ek#ujpG>gZ None SendTextCleanupUWebCoreSystem HTTPHeader HTTPError HTTPResponseSendStandardHeadersQueryCreateResponseObjectDecodeFormDataCheckRawBytes RedirectGetApplication GetHexDigitClose SendBinary EndOfHeadersIpDrv ProcessGetInit ProcessPostFailAuthenticationListenEngineProcessHeaderString ReceivedLine BeginPlay DestroyedTimer GainedChild LostChild ImageServer ListenPortMaxConnectionsGetVariableNumberGetVariableCount Request_POST Request_GET WebServerIncludeBinaryFile IncludeUHTM ClearSubstWebConnectionNone IncludePathSubst HelloWebDefaultApplicationWebApplication WebRequest GetVariable AddVariable DecodeBase64 ReceivedTextIpAddrToString GetLocalIP BindPort AcceptedClosed WebResponse AcceptClass LevelInfo ScriptText LinkStateLevel InternetLinkTcpLinkIpAddrCActorEngineVersion bEnabled Filename ServerNameRequest Response ApplicationRawBytesExpectingTextOwnerClassBDChDynamicLoadObjectApplicationPaths ReturnValuetValue ServerURLApplicationObjectsConnectionCountApplicationClassEnumURISubURIReplacementMapL Connection bSentTextbSentResponseURL VariablebClear Password ReceivedDataTitlebNoCRLF FunctionRealmStructHeader StrPropertyStructProperty ErrorNumDataClassProperty ContentTypeObjectProperty ERequestTypeCountPackage UsernameContentLength RequestType VariableMap TextBufferEncodedi VariableName Applications DefaultValueObjectSNumber BoolProperty IntPropertyTokenPath BytePropertyImageNoneNoneNoneNoneNoneNoneNoneNoneNoneNoneSendCachedFileGetHTTPExpirationExpirationSecondsLoadParsedUHTMCharSetOffsetSecondsbCacheGz>6 Q$9<,s7Ps7Ocs7Ocs7s7s7s7/]../WebYHJ4D<,YYYY$YRB3 x<,YY+@YYYY@YY@YY1YY@YYYY( YFy) Oc2! x x x x x x xE]UTServerAdmin.UTServerAdminEUTServerAdmin.UTImageServerX] /ServerAdminX /images#"P$"\"Q?YYYY'@YY YY=YYYYYI}- s72!Q$9DDQ$9D xQ$9Q$9DDD xQ$9DDOcDDQ$9DDOcDDQ$9OcQ$9OcOcDYY"YYYY @YY2YY@YY YYYYYY@YY9@YY, @@YY@YYYYYYYYA@YY@YYYYYYb@YYnYdY@YY-@YY8@YY>YY*@YY/YY7YY?YYqL0 )L)M)FYV@YY@YY @@YY!YYC@@YY:@YY0@YY]@YY@YY@YYcYYYY`Z6 )Z)WY|@YYQS  Y;@YYYYYYYYZ@YY@@YYHYYI@YYOJ%)J)I)HYM@YYF@YY@YY^T&o)TY\Q+)QY@YYPS*6)SY@YY{@YYb@YYYY@YYYYYYYW@YY@YY#YY@YY@U5- )U)bY@YYG7)GYNYYx@YY@YY('YL@YYk_>];-2Can't send headers - already called SendText()pp_, ,  Y -r*   Tr*  0%:*:$0}    YfaF}a HTTP/1.1 400 Bad Request400 Bad Request

400 Bad Request

If you got this error from a standard web browser, please mail jack@epicgames.com and submit a bug report. yHTTP/1.1 401 UnauthorizedppWWW-authenticate: basic realm="N"401 Unauthorized

401 Unauthorized

 HTTP/1.1 404 Object Not Found404 File Not Found

404 File Not Found

The URL you requested was not found.  Yl 0 =r* *$  ,Rz &   &1~   ~ ?  &  ;w*zp / YsH%|, rw *  .* >* * Yo]8h]-?' YmZr* *$,Rz& &1~ ~? &>w*zp/r*;(p; / YrI{zy7|,GET yZ|,POST yyw*  YdYYd[3![ YuX$ XY YOYYB<8! p <3%}<  Rz &,   &~ , = z &,   =::$ %  ~ , c Y6 JX-CWebserver is not enabled. Set bEnabled to True in Advanced Options.a  %6 , z 661 6 ,w1*  * 1  .  >  c     ez8:7!97 ~!: !! phttp://!phttp://8,,Ppp:S,;, Yg %|/application/x-www-form-urlencodedpWebConnection: Unknown form data content-type: /       Ya4+[-2 -2'9-V 4Ypp4, ,  YjE V"E(~-% (- ::$WebServer: Too many connections - closing down Listen. YvD!cYwD(u(- ::$WebServer: Listening again - connections have been closed. Y@YYw%r A%, { "} z%" &}%"z%"&/A%" * Y~5m HTTP/1.1 302 Document MovedpLocation: 5Document Movedpp

Object Moved

This document may be found here. YYYYYtNw**4w***Fw** Yh) \ <z))text/html?-?HTTP/1.1 200 OKpServer: UnrealEngine UWeb Web Server Build pContent-Type: )-bpCache-Control: max-age=S]Expires:a]Connection: Close Yi c 0* *  Y@YYK!|,Authorization: Basic `,'~:'9':'&|,Content-Length: 0J,|,Content-Type: /, YC\ YE=8a YA& 5 %%c}&+&&+ ^+ p  Y d& ?{%@%&%& %Y = % & p =Y 8% p 쒐,&&&&Y  p +{%@%& Y<.aA( Y}+class WebServer expands TcpLink; var config string Applications[10]; var config string ApplicationPaths[10]; var config int ListenPort; var config int MaxConnections; var config string ServerName; var config bool bEnabled; var config int DefaultApplication; var config int ExpirationSeconds; // How long images can be cached .. default is 24 hours var string ServerURL; var WebApplication ApplicationObjects[10]; var int ConnectionCount; function BeginPlay() { local int i; local class ApplicationClass; local IpAddr l; local string s; if(!bEnabled) { Log("Webserver is not enabled. Set bEnabled to True in Advanced Options."); Destroy(); return; } Super.BeginPlay(); for(i=0;i<10;i++) { if(Applications[i] == "") break; ApplicationClass = class(DynamicLoadObject(Applications[i], class'Class')); if(ApplicationClass != None) { ApplicationObjects[i] = New(None) ApplicationClass; ApplicationObjects[i].Level = Level; ApplicationObjects[i].WebServer = Self; ApplicationObjects[i].Path = ApplicationPaths[i]; ApplicationObjects[i].Init(); } } if(ServerName == "") { GetLocalIP(l); s = IpAddrToString(l); i = InStr(s, ":"); if(i != -1) s = Left(s, i); ServerURL = "http://"$s; } else ServerURL = "http://"$ServerName; if(ListenPort != 80) ServerURL = ServerURL $ ":"$string(ListenPort); BindPort( ListenPort ); Listen(); } event Destroyed() { local int i; for(i=0;i<10;i++) if(ApplicationObjects[i] != None) { ApplicationObjects[i].Cleanup(); ApplicationObjects[i].Level = None; ApplicationObjects[i].WebServer = None; ApplicationObjects[i] = None; } Super.Destroyed(); } event GainedChild( Actor C ) { Super.GainedChild(C); ConnectionCount++; // if too many connections, close down listen. if(MaxConnections > 0 && ConnectionCount > MaxConnections && LinkState == STATE_Listening) { Log("WebServer: Too many connections - closing down Listen."); Close(); } } event LostChild( Actor C ) { Super.LostChild(C); ConnectionCount--; // if closed due to too many connections, start listening again. if(ConnectionCount <= MaxConnections && LinkState != STATE_Listening) { Log("WebServer: Listening again - connections have been closed."); Listen(); } } function WebApplication GetApplication(string URI, out string SubURI) { local int i, l; SubURI = ""; for(i=0;i<10;i++) { if(ApplicationPaths[i] != "") { l = Len(ApplicationPaths[i]); if(Left(URI, l) == ApplicationPaths[i] && (Len(URI) == l || Mid(URI, l, 1) == "/")) { SubURI = Mid(URI, l); return ApplicationObjects[i]; } } } return None; } Y1class WebResponse expands Object native noexport; var private native const int ReplacementMap[5]; // TMap! var const config string IncludePath; var localized string CharSet; var WebConnection Connection; var bool bSentText; // used to warn headers already sent var bool bSentResponse; // uhtm including native final function Subst(string Variable, string Value, optional bool bClear); native final function ClearSubst(); native final function IncludeUHTM(string Filename); native final function IncludeBinaryFile(string Filename); native final function string LoadParsedUHTM(string Filename); // For templated web items, uses Subst too native final function string GetHTTPExpiration(optional int OffsetSeconds); event SendText(string Text, optional bool bNoCRLF) { if(!bSentText) { SendStandardHeaders(); bSentText = True; } if(bNoCRLF) Connection.SendText(Text); else Connection.SendText(Text$Chr(13)$Chr(10)); } event SendBinary(int Count, byte B[255]) { Connection.SendBinary(Count, B); } function SendCachedFile(string Filename, optional string ContentType) { if(!bSentText) { SendStandardHeaders(ContentType, true); bSentText = True; } IncludeUHTM(Filename); } function FailAuthentication(string Realm) { HTTPError(401, Realm); } function HTTPResponse(string Header) { HTTPHeader(Header); bSentResponse = True; } function HTTPHeader(string Header) { if(bSentText) Log("Can't send headers - already called SendText()"); Connection.SendText(Header$Chr(13)$Chr(10)); } function HTTPError(int ErrorNum, optional string Data) { switch(ErrorNum) { case 400: HTTPResponse("HTTP/1.1 400 Bad Request"); SendText("400 Bad Request

400 Bad Request

If you got this error from a standard web browser, please mail jack@epicgames.com and submit a bug report."); break; case 401: HTTPResponse("HTTP/1.1 401 Unauthorized"); HTTPHeader("WWW-authenticate: basic realm=\""$Data$"\""); SendText("401 Unauthorized

401 Unauthorized

"); break; case 404: HTTPResponse("HTTP/1.1 404 Object Not Found"); SendText("404 File Not Found

404 File Not Found

The URL you requested was not found."); break; default: break; } } function SendStandardHeaders( optional string ContentType, optional bool bCache ) { if(ContentType == "") ContentType = "text/html"; if(!bSentResponse) HTTPResponse("HTTP/1.1 200 OK"); HTTPHeader("Server: UnrealEngine UWeb Web Server Build "$Connection.Level.EngineVersion); HTTPHeader("Content-Type: "$ContentType); if (bCache) { HTTPHeader("Cache-Control: max-age="$Connection.WebServer.ExpirationSeconds); HTTPHeader("Expires:"@GetHTTPExpiration(Connection.WebServer.ExpirationSeconds)); } HTTPHeader("Connection: Close"); HTTPHeader(""); } function Redirect(string URL) { HTTPResponse("HTTP/1.1 302 Document Moved"); HTTPHeader("Location: "$URL); SendText("Document Moved"); SendText("

Object Moved

This document may be found here."); } YM$class WebRequest expands Object native noexport; enum ERequestType { Request_GET, Request_POST }; var string URI; var string Username; var string Password; var int ContentLength; var string ContentType; var ERequestType RequestType; var private native const int VariableMap[5]; // TMultiMap! native final function string DecodeBase64(string Encoded); native final function AddVariable(string VariableName, string Value); native final function string GetVariable(string VariableName, optional string DefaultValue); native final function int GetVariableCount(string VariableName); native final function string GetVariableNumber(string VariableName, int Number, optional string DefaultValue); function ProcessHeaderString(string S) { local int i; if(Left(S, 21) ~= "Authorization: Basic ") { S = DecodeBase64(Mid(S, 21)); i = InStr(S, ":"); if(i != -1) { Username = Left(S, i); Password = Mid(S, i+1); } } else if(Left(S, 16) ~= "Content-Length: ") ContentLength = Int(Mid(S, 16)); else if(Left(S, 14) ~= "Content-Type: ") ContentType = Mid(S, 14); } function DecodeFormData(string Data) { local string Token[2], ch; local int i; local int t; t = 0; for(i=0;i 0) { RawBytesExpecting -= Len(Text); CheckRawBytes(); return; } // remove a LF which arrived in a new packet // and thus didn't get cleaned up by the code below if(Left(ReceivedData, 1) == Chr(10)) ReceivedData = Mid(ReceivedData, 1); i = InStr(ReceivedData, Chr(13)); while(i != -1) { S = Left(ReceivedData, i); i++; // check for any LF following the CR. if(Mid(ReceivedData, i, 1) == Chr(10)) i++; ReceivedData = Mid(ReceivedData, i); ReceivedLine(S); if(LinkState != STATE_Connected) return; if(RawBytesExpecting > 0) { CheckRawBytes(); return; } i = InStr(ReceivedData, Chr(13)); } } function ReceivedLine(string S) { if(S == "") EndOfHeaders(); else { if(Left(S, 4) ~= "GET ") ProcessGet(S); else if(Left(S, 5) ~= "POST ") ProcessPost(S); else if(Request != None) { Request.ProcessHeaderString(S); } } } function ProcessGet(string S) { local int i; if(Request == None) CreateResponseObject(); Request.RequestType = Request_GET; S = Mid(S, 4); while(Left(S, 1) == " ") S = Mid(S, 1); i = InStr(S, " "); if(i != -1) S = Left(S, i); i = InStr(S, "?"); if(i != -1) { Request.DecodeFormData(Mid(S, i+1)); S = Left(S, i); } Application = WebServer.GetApplication(S, Request.URI); if(Application != None && Request.URI == "") { // Response.Redirect(WebServer.ServerURL$S$"/"); Response.Redirect(S$"/"); Cleanup(); } else if(Application == None && Webserver.DefaultApplication != -1) { // Response.Redirect(WebServer.ServerURL$Webserver.ApplicationPaths[Webserver.DefaultApplication]$"/"); Response.Redirect(Webserver.ApplicationPaths[Webserver.DefaultApplication]$"/"); Cleanup(); } } function ProcessPost(string S) { local int i; if(Request == None) CreateResponseObject(); Request.RequestType = Request_POST; S = Mid(S, 5); while(Left(S, 1) == " ") S = Mid(S, 1); i = InStr(S, " "); if(i != -1) S = Left(S, i); i = InStr(S, "?"); if(i != -1) { Request.DecodeFormData(Mid(S, i+1)); S = Left(S, i); } Application = WebServer.GetApplication(S, Request.URI); if(Application != None && Request.URI == "") { // Response.Redirect(WebServer.ServerURL$S$"/"); Response.Redirect(S$"/"); Cleanup(); } } function CreateResponseObject() { Request = new(None) class'WebRequest'; Response = new(None) class'WebResponse'; Response.Connection = Self; } 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 { Application.Query(Request, Response); 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); Application.Query(Request, Response); ReceivedData = ""; } Cleanup(); } } function Cleanup() { if(Request != None) Request = None; if(Response != None) { Response.Connection = None; Response = None; } if(Application != None) Application = None; Close(); } YDeZqe 0% 1& "2, +3, 44, =5, F6, O7, X8, a9, jA, sB, |C, D, E, F, % YYYg@@YY. YP  Yiclass WebApplication expands Object; // Set by the webserver var LevelInfo Level; var WebServer WebServer; var string Path; function Init(); function Cleanup(); function Query(WebRequest Request, WebResponse Response); YTYYYYB dO{9test{:testHelloWeb  >/form.html-
'*

4

 h/submit.html+Thanks for submitting the form.
9ppTestEdit was "^TestEdit"

%You selected these items:
$Oselecter&e$%2pp"Kselecter$"
$ (/include.html%3variable1This is variable 1%3variable2This is variable 2%3variable3This is variable 3Ptestinclude.html 9pHello web! The current level is .H
Click this link to go to a test form YF class ImageServer expands WebApplication; /* Usage: [UWeb.WebServer] Applications[0]="UWeb.ImageServer" ApplicationPaths[0]="/images" bEnabled=True http://server.ip.address/images/test.jpg */ event Query(WebRequest Request, WebResponse Response) { local string Image; Image = Mid(Request.URI, 1); if( Right(Caps(Image), 4) == ".JPG" || Right(Caps(Image), 5) == ".JPEG" ) { Response.SendStandardHeaders("image/jpeg", true); } else if( Right(Caps(Image), 4) == ".GIF" ) { Response.SendStandardHeaders("image/gif", true); } else if( Right(Caps(Image), 4) == ".BMP" ) { Response.SendStandardHeaders("image/bmp", true); } else { Response.HTTPError(404); return; } Response.IncludeBinaryFile( "images/"$Image ); } VY"W|a xDQ$9Q$9Q$9Q$9Q$9YYoclass HelloWeb expands WebApplication; /* Usage: This is a sample web application, to demonstrate how to program for the web server. [UWeb.WebServer] Applications[0]="UWeb.HelloWeb" ApplicationPaths[0]="/hello" bEnabled=True http://server.ip.address/hello */ event Query(WebRequest Request, WebResponse Response) { local int i; if(Request.Username != "test" || Request.Password != "test") { Response.FailAuthentication("HelloWeb"); return; } switch(Request.URI) { case "/form.html": Response.SendText("

"); Response.SendText(""); Response.SendText("

"); Response.SendText(""); Response.SendText("

"); break; case "/submit.html": Response.SendText("Thanks for submitting the form.
"); Response.SendText("TestEdit was \""$Request.GetVariable("TestEdit")$"\"

"); Response.SendText("You selected these items:
"); for(i=Request.GetVariableCount("selecter")-1;i>=0;i--) Response.SendText("\""$Request.GetVariableNumber("selecter", i)$"\"
"); break; case "/include.html": Response.Subst("variable1", "This is variable 1"); Response.Subst("variable2", "This is variable 2"); Response.Subst("variable3", "This is variable 3"); Response.IncludeUHTM("testinclude.html"); break; default: Response.SendText("Hello web! The current level is "$Level.Title); Response.SendText("
Click this link to go to a test form"); break; } } YB\ "\&ez,.JPGz,.JPEG# image/jpeg'z,.GIF# image/gif'z,.BMP# image/bmp'#  #Rpimages/ Y@YXU1[ xDDQ$9DQ$9Q$9Q$9Q$9Q$9Q$9Q$9Q$9Q$9Q$9Q$9Q$9DQ$9DQ$9DQ$9Q$9Q$9Q$9Q$9PQ$9YY3,Y@YYhYYf@YYc@YYe^[)^YYY@YYp`Z){,-2 c'-2'P` YR_]u)_Y@YY@YY@Y|SsSoSK|SySHSG|SESSSASJS@NByCSNooo o!S`oWosmsISwSDStqFyRo<o=o8o>|F(4WB+MY,Nh,3Ww,LN.N\.lHk.iHy.sCG/lU/Zc/]q/)Q@0OQ4H`4)n4rC}4jCK5lCY5-gg5yCN;iC\;\j;ex;OG<CU<Pc<Mq<mH@=aN=X\=sHj=ydx=NF>CU>yac>vr>C@?^N?~x\?k?V|?#J@$X@Cf@xu@~CAs_QAfaA0%oAuQTBzhcBEqBsdBLNC}]CkkC2yCrQHDrHVD)dDgtD6"BEybdE sEJQFwG_FvGnF3j}F`BKGKFZGKIiGKDxG%%GH3ilH3[{HhvJI&XI+wIPKVJ*dJRKCKODQK^D`KunoK@[}Kp{KLpTZL@DiLopxLMFMkrUM5"cMfrEN7SNhuqN^F@OMOOz]OUdOnsO`aQ\ATf]\lC`)oagXbrf@qh)@i-iicVj8ejldm EPsYUv Enw!sy^Yr{M@|VM~OYcyYqN@ YN 9gKY`Hn v= V ]v<,SA4I,A4K2HA4Y$SA4{AlxgYY_YY/m|XA4uuBMjBNzB nIA4R w"NIA4{WB lR`Y~1TL,`\z_HKWKf[ u~`UxcZ:q] kYK^YYg