Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

LibHTTP4.HttpUtil

Extends
Object

HttpUtil
Miscelaneous static functions. Part of [[LibHTTP]].
Contains various algorithms, under which [[Base64]] encoding and [[MD5]] hash generation.
[[MD5]] code by Petr Jelinek ( http://wiki.beyondunreal.com/wiki/MD5 )

Dcoumentation and Information: http://wiki.beyondunreal.com/wiki/LibHTTP

Authors: Michiel 'El Muerte' Hendriks <elmuerte@drunksnipers.com>

Copyright 2003, 2004 Michiel "El Muerte" Hendriks
Released under the Lesser Open Unreal Mod License
http://wiki.beyondunreal.com/wiki/LesserOpenUnrealModLicense

Core.Object
|   
+-- LibHTTP4.HttpUtil

Constants Summary
TOKEN_HASH="#"
TOKEN_PATH="/"
TOKEN_PORT=":"
TOKEN_PROTOCOL="://"
TOKEN_QUERY="?"
TOKEN_USER="@"
TOKEN_USERPASS=":"
URL_ESCAPE="%"
Inherited Contants from Core.Object
MaxInt, Pi, RF_NotForClient, RF_NotForEdit, RF_NotForServer, RF_Public, RF_Standalone, RF_Transactional, RF_Transient

Variables Summary
stringDayNamesLong[7]
stringDayNamesShort[7]
intLOGDATA
intLOGERR
intLOGINFO
intLOGWARN
stringMonthNames[13]
intMonthOffsetLeap[13]
intMonthOffset[13]
Inherited Variables from Core.Object
Class, Name, ObjectFlags, ObjectInternal[7], Outer

Enumerations Summary
Inherited Enumerations from Core.Object
EAxis, ECamOrientation, EDetailMode, EDrawPivot, ESheerAxis

Structures Summary
DateTime
year, month, day, weekday, hour, minute, second
MD5_CTX
state, count, buffer
xURL
protocol, username, password, hostname, port, location, query, hash
Inherited Structures from Core.Object
BoundingVolume, Box, Color, CompressedPosition, Coords, FloatBox, Guid, IntBox, InterpCurve, InterpCurvePoint, Matrix, Plane, Quat, Range, RangeVector, Rotator, Scale, TMultiMap, Vector

Functions Summary
operatorint % (int x, int y ))
functionint AdvSplit (string input, string delim, out array<string> elm, optional string quoteChar))
functionarray<string> Base64Decode (array<string> indata))
functionarray<string> Base64Encode (array<string> indata, out array<string> B64Lookup))
function Base64EncodeLookupTable (out array<string> LookupTable))
functionstring basename (string filename))
functionint daysInYear (int year))
functionstring DecToHex (int dec, int size))
functionstring dirname (string filename))
functionint F (int x, int y, int z))
function FF (out int a, int b, int c, int d, int x, int s, int ac))
functionint G (int x, int y, int z))
functionint getPortByProtocol (string protocol))
function GG (out int a, int b, int c, int d, int x, int s, int ac))
functionint H (int x, int y, int z))
functionint HexToDec (string hexcode))
function HH (out int a, int b, int c, int d, int x, int s, int ac))
functionstring HTTPResponseCode (int code))
functionint I (int x, int y, int z))
function II (out int a, int b, int c, int d, int x, int s, int ac))
functionbool isLeapYear (int year))
functionint leapsThruEndOf (int y))
function Logf (name Comp, coerce string message, optional int level, optional coerce string Param1, optional coerce string Param2))
function MD5Decode (out array<int> output, array<byte> input, int len))
function MD5Encode (out array<byte> output, array<int> input, int len))
function MD5Final (out array<byte> digest, out MD5_CTX context))
function MD5Init (out MD5_CTX context))
function MD5Move (string src, int srcindex, out array<byte> buffer, int bufindex, int len))
functionstring MD5String (string str))
functionstring MD5StringArray (array<string> stra, optional string Concat))
function MD5Transform (out array<int> Buf, array<byte> block))
function MD5Update (out MD5_CTX Context, string Data, int inputLen))
functionbool parseUrl (string inURL, out xURL outURL))
functionstring RawUrlDecode (string instring, optional bool bIgnorePlus))
functionstring RawUrlEncode (string instring))
function ReplaceChar (out string instring, string from, string to))
functionint ROTATE_LEFT (int x, int n))
functionint stringToTimestamp (string datestring, optional int TZoffset))
functionint timestamp (int year, int mon, int day, int hour, int min, int sec))
functionDateTime timestampToDatetime (int timestamp))
functionstring timestampToString (int timestamp, optional string Timezone, optional string format))
functionstring Trim (coerce string S))
functionfloat TZtoOffset (string TZ))
functionstring xURLtoLocation (xURL inURL, optional bool bIncludePassword))
functionstring xURLtoString (xURL inURL, optional bool bIncludePassword))
Inherited Functions from Core.Object
!, !=, $, $=, %, &, &&, *, **, *=, +, ++, +=, -, --, -=, / , /=, <, <<, <=, ==, >, >=, >>, >>>, @, @=, Abs, Acos, AllObjects, Asc, Asin, Atan, BeginState, Caps, Ceil, Chr, Clamp, ClassIsChildOf, ClearConfig, ClockwiseFrom, Cos, Created, Cross, Disable, Divide, Dot, DynamicLoadObject, EatStr, Enable, EndState, Eval, Exp, FClamp, FindObject, FMax, FMin, FRand, GetAxes, GetEnum, GetItemName, GetPerObjectNames, GetPropertyText, GetReferencers, GetStateName, GetUnAxes, GotoState, InStr, InterpCurveEval, InterpCurveGetInputDomain, InterpCurveGetOutputRange, Invert, IsA, IsInState, IsOnConsole, IsSoaking, Left, Len, Lerp, Localize, Locs, Log, Loge, Max, Mid, Min, MirrorVectorByNormal, Normal, Normalize, OrthoRotation, PlatformIs64Bit, PlatformIsMacOS, PlatformIsUnix, PlatformIsWindows, QuatFindBetween, QuatFromAxisAndAngle, QuatFromRotator, QuatInvert, QuatProduct, QuatRotateVector, QuatSlerp, QuatToRotator, Rand, RandRange, Repl, ReplaceText, ResetConfig, Right, RotRand, Round, SaveConfig, SetPropertyText, Sin, Smerp, Split, Sqrt, Square, StaticClearConfig, StaticSaveConfig, StopWatch, StrCmp, Tan, VRand, VSize, Warn, ^, ^^, |, ||, ~, ~=


Constants Detail

TOKEN_HASH Source code

const TOKEN_HASH = "#";
URL delimiter

TOKEN_PATH Source code

const TOKEN_PATH = "/";
URL delimiter

TOKEN_PORT Source code

const TOKEN_PORT = ":";
URL delimiter

TOKEN_PROTOCOL Source code

const TOKEN_PROTOCOL = "://";
URL delimiter; to seperate protocol from the rest

TOKEN_QUERY Source code

const TOKEN_QUERY = "?";
URL delimiter

TOKEN_USER Source code

const TOKEN_USER = "@";
URL delimiter

TOKEN_USERPASS Source code

const TOKEN_USERPASS = ":";
URL delimiter; to seperate the user and pass from the url

URL_ESCAPE Source code

const URL_ESCAPE = "%";
URL escape token


Variables Detail

DayNamesLong[7] Source code

var const string DayNamesLong[7];
names of the days, 0 = sunday

DayNamesShort[7] Source code

var const string DayNamesShort[7];
names of the days, 0 = sunday

LOGDATA Source code

var const int LOGDATA;

LOGERR Source code

var const int LOGERR;

LOGINFO Source code

var const int LOGINFO;

LOGWARN Source code

var const int LOGWARN;

MonthNames[13] Source code

var const string MonthNames[13];
month names to use for date string generation

MonthOffsetLeap[13] Source code

var const int MonthOffsetLeap[13];
days offsets for each month

MonthOffset[13] Source code

var const int MonthOffset[13];
days offsets for each month


Structures Detail

DateTime Source code

struct DateTime
{
var int day;
var int hour;
var int minute;
var int month;
var int second;
var int weekday;
var int year;
};


MD5_CTX Source code

struct MD5_CTX
{
var array<byte> buffer;
var array<int> count;
var array<int> state;
};
MD5 context
buffer:
input buffer
count:
number of bits, modulo 2^64 (lsb first)
state:
state (ABCD)

xURL Source code

struct xURL
{
var string hash;
var string hostname;
var string location;
var string password;
var int port;
var string protocol;
var string query;
var string username;
};
a better URL structure that contains all elements
hash:
the part after the #, without the leading #
hostname:
the hostname
location:
the location field, all from the hostname up to the query or hash string, includes leading /
password:
possible password that was in the url
port:
the port number specified in the URL
protocol:
protocol used, like http:/ /, https:/ /, ftp:/ /. But without the ':/ /' part. (ignore the space between the two slashes, it's required because of a bug in UE2)
query:
the part after the ?, without the leading ?
username:
username that was provided in the URL


Functions Detail

% Source code

static final operator int % ( int x, int y ) )
the float % operator is broken for our needs (numbers >2^24)

AdvSplit Source code

static function int AdvSplit ( string input, string delim, out array<string> elm, optional string quoteChar) )
Split a string with quotes, quotes may appear anywhere in the string, escape the quote char with a \ to use a literal.
Qoutes are removed from the result, and escaped quotes are used as normal quotes.

Base64Decode Source code

static final function array<string> Base64Decode ( array<string> indata) )
Decode a base64 encoded string

Base64Encode Source code

static final function array<string> Base64Encode ( array<string> indata, out array<string> B64Lookup) )
base64 encode an input array

Base64EncodeLookupTable Source code

static final function Base64EncodeLookupTable ( out array<string> LookupTable) )
Generate the base 64 encode lookup table

basename Source code

static final function string basename ( string filename) )
get the base filename

daysInYear Source code

static final function int daysInYear ( int year) )
returns the number of days in a year

DecToHex Source code

static final function string DecToHex ( int dec, int size) )
convert a decimal to hexadecimal notation

dirname Source code

static final function string dirname ( string filename) )
get the dirname of a filename, with traling slash

F Source code

static final function int F ( int x, int y, int z) )

FF Source code

static final function FF ( out int a, int b, int c, int d, int x, int s, int ac) )

G Source code

static final function int G ( int x, int y, int z) )

getPortByProtocol Source code

static final function int getPortByProtocol ( string protocol) )
return the default port based on the protocol

GG Source code

static final function GG ( out int a, int b, int c, int d, int x, int s, int ac) )

H Source code

static final function int H ( int x, int y, int z) )

HexToDec Source code

static final function int HexToDec ( string hexcode) )
convert a hexadecimal number to the integer counterpart

HH Source code

static final function HH ( out int a, int b, int c, int d, int x, int s, int ac) )

HTTPResponseCode Source code

static final function string HTTPResponseCode ( int code) )
return the description of a HTTP response code

I Source code

static final function int I ( int x, int y, int z) )

II Source code

static final function II ( out int a, int b, int c, int d, int x, int s, int ac) )

isLeapYear Source code

static final function bool isLeapYear ( int year) )
returns if year is a leap year

leapsThruEndOf Source code

static final function int leapsThruEndOf ( int y) )

Logf Source code

static final function Logf ( name Comp, coerce string message, optional int level, optional coerce string Param1, optional coerce string Param2) )
Write a log entry

MD5Decode Source code

static final function MD5Decode ( out array<int> output, array<byte> input, int len) )

MD5Encode Source code

static final function MD5Encode ( out array<byte> output, array<int> input, int len) )

MD5Final Source code

static final function MD5Final ( out array<byte> digest, out MD5_CTX context) )
finalize the MD5 context

MD5Init Source code

static final function MD5Init ( out MD5_CTX context) )
initialize the MD5 context

MD5Move Source code

static final function MD5Move ( string src, int srcindex, out array<byte> buffer, int bufindex, int len) )

MD5String Source code

static final function string MD5String ( string str) )
return the MD5 of the input string

MD5StringArray Source code

static final function string MD5StringArray ( array<string> stra, optional string Concat) )
Return the MD5 of the input string array. Concat is added after each line.

MD5Transform Source code

static final function MD5Transform ( out array<int> Buf, array<byte> block) )

MD5Update Source code

static final function MD5Update ( out MD5_CTX Context, string Data, int inputLen) )
update MD5 context

parseUrl Source code

static final function bool parseUrl ( string inURL, out xURL outURL) )
parses the inURL to an xURL structure, return true when succesful

RawUrlDecode Source code

static final function string RawUrlDecode ( string instring, optional bool bIgnorePlus) )
This will decode URL encoded elements. If bIgnorePlus is set to true '+' will not be changed to a space

RawUrlEncode Source code

static final function string RawUrlEncode ( string instring) )
Encode special characters, you should not use this function, it's slow and not secure, so try to avoid it. ";", "/", "?", ":", "@", "&", "=", "+", ",", "$" and " "

ReplaceChar Source code

static final function ReplaceChar ( out string instring, string from, string to) )
replace part of a string

ROTATE_LEFT Source code

static final function int ROTATE_LEFT ( int x, int n) )

stringToTimestamp Source code

static final function int stringToTimestamp ( string datestring, optional int TZoffset) )
Parse a string to a timestamp The date string is formatted as: Wdy, DD-Mon-YYYY HH:MM:SS GMT TZoffset is the local offset to GMT

timestamp Source code

static final function int timestamp ( int year, int mon, int day, int hour, int min, int sec) )
Create a UNIX timestamp.
Warning: Assumes info is passed in GMT. So make sure you correct the timezone if you are going to send a timestamp generated with this function to an other server.

timestampToDatetime Source code

static final function DateTime timestampToDatetime ( int timestamp) )
converts a timestamp to a DateTime record

timestampToString Source code

static final function string timestampToString ( int timestamp, optional string Timezone, optional string format) )
convert a timestamp into a string.
Format can be one of the following strings:
"822", "1123" : RFC 822, updated by RFC 1123 (default), timezone is the TZ CODE
"850", "1036" : RFC 850, obsoleted by RFC 1036, timezone is the TZ CODE
"2822" : RFC 2822, timezone is a +0000 like string
"asctime": ANSI C's asctime() format, timezone is an integer that will increment the hour

Trim Source code

static final function string Trim ( coerce string S) )
Trim leading and trailing spaces

TZtoOffset Source code

static final function float TZtoOffset ( string TZ) )
Converts a timezone code to an offset.

xURLtoLocation Source code

static final function string xURLtoLocation ( xURL inURL, optional bool bIncludePassword) )
convert a xURL to a location string, just the location+query+hash

xURLtoString Source code

static final function string xURLtoString ( xURL inURL, optional bool bIncludePassword) )
converts a xURL to a string. bIncludePassword defaults to false


Defaultproperties

defaultproperties
{
    LOGERR=0
    LOGWARN=1
    LOGINFO=2
    LOGDATA=3


    MonthNames[1]="Jan"
    MonthNames[2]="Feb"
    MonthNames[3]="Mar"
    MonthNames[4]="Apr"
    MonthNames[5]="May"
    MonthNames[6]="Jun"
    MonthNames[7]="Jul"
    MonthNames[8]="Aug"
    MonthNames[9]="Sep"
    MonthNames[10]="Oct"
    MonthNames[11]="Nov"
    MonthNames[12]="Dec"


    DayNamesShort[0]="Sun"
    DayNamesShort[1]="Mon"
    DayNamesShort[2]="Tue"
    DayNamesShort[3]="Wed"
    DayNamesShort[4]="Thu"
    DayNamesShort[5]="Fri"
    DayNamesShort[6]="Sat"


    DayNamesLong[0]="Sunday"
    DayNamesLong[1]="Monday"
    DayNamesLong[2]="Tuesday"
    DayNamesLong[3]="Wednesday"
    DayNamesLong[4]="Thursday"
    DayNamesLong[5]="Friday"
    DayNamesLong[6]="Saturday"


    MonthOffset[0]=0
    MonthOffset[1]=31
    MonthOffset[2]=59
    MonthOffset[3]=90
    MonthOffset[4]=120
    MonthOffset[5]=151
    MonthOffset[6]=181
    MonthOffset[7]=212
    MonthOffset[8]=243
    MonthOffset[9]=273
    MonthOffset[10]=304
    MonthOffset[11]=334
    MonthOffset[12]=365


    MonthOffsetLeap[0]=0
    MonthOffsetLeap[1]=31
    MonthOffsetLeap[2]=60
    MonthOffsetLeap[3]=91
    MonthOffsetLeap[4]=121
    MonthOffsetLeap[5]=152
    MonthOffsetLeap[6]=182
    MonthOffsetLeap[7]=213
    MonthOffsetLeap[8]=244
    MonthOffsetLeap[9]=274
    MonthOffsetLeap[10]=305
    MonthOffsetLeap[11]=335
    MonthOffsetLeap[12]=366
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Creation time: Do 14.8.2014 09:58:08.698 - Created with UnCodeX